Compare commits

...

3 Commits

Author SHA1 Message Date
Shadow15510 b4d7f1fcdf Fix airport's box 2022-07-05 16:46:29 +02:00
Shadow15510 0a648cea10 Fix bug on game's structure declaration 2022-07-05 16:02:37 +02:00
Shadow15510 e495ee83e7 Update README.md 2022-06-24 13:13:38 +02:00
5 changed files with 34 additions and 22 deletions

View File

@ -10,15 +10,15 @@ Tout droits réservés.
## Contrôles
[REPLAY] : se déplacer
[F1] et [F2] : menus de construction des bâtiments
[F4] : taxes et subventions
[F5] : statistiques
[F6] : options diverse
[+] et [-] : zoomer / dézoomer sur la carte
[SHIFT] : valider
[ALPHA] : revenir en arrière
[OPTN] : affiche le nom du bâtiment sous le curseur
- [REPLAY] : se déplacer
- [F1] et [F2] : menus de construction des bâtiments
- [F4] : taxes et subventions
- [F5] : statistiques
- [F6] : options diverses
- [+] et [-] : zoomer / dézoomer sur la carte
- [SHIFT] : valider
- [ALPHA] : revenir en arrière
- [OPTN] : affiche le nom du bâtiment sous le curseur
### Construction

View File

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "core.h"
@ -20,7 +21,7 @@ int callback_tick(volatile int *tick)
void default_values(struct calccity *calccity, struct camera *camera, struct map *map)
{
srand(20211104);
srand(clock());
// Initialisation of struct calccity
memset(calccity, 0, sizeof *calccity);

View File

@ -139,7 +139,7 @@ void display_around(struct calccity *calccity, struct camera *camera, struct map
if (camera->cursor_size[0] > 8 && camera->cursor_size[1] > 8)
{
unsigned short x = camera->cursor_size[0] * floor(camera->cursor_x / (floor(camera->cursor_size[0] / 8) + 1)) + 3;
unsigned short y = camera->cursor_size[0] * floor(camera->cursor_y / (floor(camera->cursor_size[1] / 8) + 1));
unsigned short y = camera->cursor_size[1] * floor(camera->cursor_y / (floor(camera->cursor_size[1] / 8) + 1));
drect_border(x, y, x + camera->cursor_size[0], y + camera->cursor_size[1], C_NONE, 1, C_BLACK);
}

View File

@ -8,20 +8,31 @@ int main(void)
{
extern font_t font_calccity;
dfont(&font_calccity);
title_screen();
// Game initialisation
struct calccity calccity;
struct camera camera;
struct map map;
gint_world_switch(GINT_CALL(read_save, (void *)&calccity, (void *)&camera, (void *)&map));
struct calccity *calccity;
calccity = (struct calccity*) malloc(sizeof *calccity);
// Game
main_loop(&calccity, &camera, &map);
struct camera *camera;
camera = (struct camera*) malloc(sizeof *camera);
struct map *map;
map = (struct map*) malloc(sizeof *map);
// Loading save
gint_world_switch(GINT_CALL(read_save, (void *)calccity, (void *)camera, (void *)map));
// Launch the game
main_loop(calccity, camera, map);
// Backup data
gint_world_switch(GINT_CALL(write_save, (void *)&calccity, (void *)&camera, (void *)&map));
gint_world_switch(GINT_CALL(write_save, (void *)calccity, (void *)camera, (void *)map));
// Free memory
free(calccity);
free(camera);
free(map);
return 1;
}

View File

@ -9,7 +9,7 @@ uint16_t const *filename_u16 = u"\\\\fls0\\CalcCity.sav";
void read_save(struct calccity *calccity, struct camera *camera, struct map *map)
{
if(gint[HWCALC] == HWCALC_G35PE2)
if (gint[HWCALC] == HWCALC_G35PE2)
{
FILE *fp;
fp = fopen(filename_u8, "rb");
@ -29,7 +29,7 @@ void read_save(struct calccity *calccity, struct camera *camera, struct map *map
else
{
int fd = BFile_Open(filename_u16, BFile_ReadOnly);
if(fd < 0)
if (fd < 0)
default_values(calccity, camera, map);
else
{
@ -44,7 +44,7 @@ void read_save(struct calccity *calccity, struct camera *camera, struct map *map
void write_save(const struct calccity *calccity, const struct camera *camera, const struct map *map)
{
if(gint[HWCALC] == HWCALC_G35PE2)
if (gint[HWCALC] == HWCALC_G35PE2)
{
FILE *fp;
fp = fopen(filename_u8, "wb");