From 7118cf8ed3c6c734ae0aede64f64bde4802db064 Mon Sep 17 00:00:00 2001 From: attilavs2 Date: Sat, 5 Apr 2025 12:25:04 +0200 Subject: [PATCH] =?UTF-8?q?WIP=20-=20le=20cours=20d'histoire=20=C3=A9tait?= =?UTF-8?q?=20long?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 18 ++++++++++-------- map/converter | Bin 21344 -> 21344 bytes map/converter.c | 2 +- src/config.h | 2 +- src/game.c | 8 +++++--- src/ui.c | 4 ++-- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 75505d8..9f24b03 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ BUILD_DIR = build SRC_DIR = src OBJS = $(patsubst $(SRC_DIR)/%.c,build-tmp/%.o,$(wildcard $(SRC_DIR)/*.c)) +OBJS += build-tmp/maps_out.o all: | builddir map build builddir2 @@ -28,24 +29,25 @@ windef: $(eval BUILD_DIR = build-win) $(eval LDFLAGS = $(LDFLAGS_WIN)) -converter: map/converter.c +map/converter: map/converter.c $(CC) map/converter.c -o map/converter $(CFLAGS) -map: converter +map/maps_out.c: map/converter $(wildcard map/*.tmx) ./map/converter $(CC) -c map/maps_out.c -o build-tmp/maps_out.o $(CFLAGS) - $(eval OBJS += build-tmp/maps_out.o) + +map: map/maps_out.c builddir: - mkdir $(BUILD_DIR) mkdir build-tmp - - mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/ + - mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/ build-tmp/%.o : $(SRC_DIR)/%.c - ${CC} -c $< -o $@ ${CFLAGS} + $(CC) -c $< -o $@ $(CFLAGS) build: $(OBJS) - ${CC} ${CFLAGS} -o ${OUTPUT} $(OBJS) ${LDFLAGS} + $(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(LDFLAGS) builddir2: mv $(wildcard build-tmp/*.o) $(BUILD_DIR) @@ -66,5 +68,5 @@ clean: - rm "$(OUTNAME).amd64" "$(OUTNAME).exe" - rm map/maps_out.c map/converter map/converter.exe -.NOTPARALLEL: builddir builddir2 converter map -.PHONY: all test clean win windef builddir builddir2 testwin converter map +.NOTPARALLEL: builddir builddir2 map +.PHONY: all test clean win windef builddir builddir2 testwin map diff --git a/map/converter b/map/converter index 125e1cefa7d9abd7c51c9b7054856f7159468b6a..1dc804242807aecad0a0c2ca2c77d0194dda3c61 100755 GIT binary patch delta 99 zcmaE`jPb!T#tj+FBJs^a&-{CARsQKFaVoHe*j})=sN7t`yiS0-hKGT{qw|>`u|OY)i{tZ4OZ1XA?^jr81OSWbB$xmI diff --git a/map/converter.c b/map/converter.c index e8306b2..9459655 100644 --- a/map/converter.c +++ b/map/converter.c @@ -54,7 +54,7 @@ int import_map(FILE *mapfile, FILE *outfile){ fprintf(outfile, "\n};\n"); fprintf(outfile, "Map %s = {{%s_lyr0, %s_lyr1}, 256, 256," - "{0, 0, {NULL}}, {0, {NULL}}};\n", + "{0, 0, NULL}, {0, NULL}};\n", tmpname, tmpname, tmpname); return 0; diff --git a/src/config.h b/src/config.h index efff0b9..267cb80 100644 --- a/src/config.h +++ b/src/config.h @@ -2,7 +2,7 @@ #define VERSION_MAJ 0 #define VERSION_MIN 1 -#define VERSION_PATCH 2 +#define VERSION_PATCH 3 // Set in ui.c extern char *VERSION_STR; diff --git a/src/game.c b/src/game.c index 2a198e5..08e437f 100644 --- a/src/game.c +++ b/src/game.c @@ -9,6 +9,7 @@ #include #include "types.h" +#include "map.h" #include "game.h" MachineDef machine_dict[] = { @@ -197,14 +198,14 @@ void update_worker(Game *game, Worker *worker){ AiInternal *ai = &worker->ai; Machine *mach[2] = {0}; - MachineDef *defs[2]; + //MachineDef *defs[2]; if(ai->assigned_machine != MACH_NULL){ mach[0] = get_machine_from_id(&game->machines, ai->assigned_machine); if(!mach[0]) ai->assigned_machine = MACH_NULL; else{ - defs[0] = &machine_dict[mach[0]->type]; + //defs[0] = &machine_dict[mach[0]->type]; ai->mtype = mach[0]->type; } } @@ -212,8 +213,9 @@ void update_worker(Game *game, Worker *worker){ mach[1] = get_machine_from_id(&game->machines, ai->assigned_machine1); if(!mach[1]) ai->assigned_machine1 = MACH_NULL; - else + /*else defs[1] = &machine_dict[mach[1]->type]; + */ } if(ai->assigned_machine == MACH_NULL && ai->assigned_machine1 == MACH_NULL) diff --git a/src/ui.c b/src/ui.c index 302506f..dbbbf66 100644 --- a/src/ui.c +++ b/src/ui.c @@ -347,9 +347,9 @@ void get_keys(Game *game){ if(keydown(KEY_D)) game->camera.target.x += 3; if(keydown(KEY_UP)) - game->camera.zoom *= 1.1; + game->camera.zoom *= 1.025; if(keydown(KEY_DOWN)) - game->camera.zoom *= 1/1.1; + game->camera.zoom *= 1/1.025; if(IsKeyPressed(KEY_P)) game->paused = !game->paused; if(IsKeyPressed(KEY_ESCAPE))