WIP - le cours d'histoire était long

This commit is contained in:
attilavs2 2025-04-05 12:25:04 +02:00
parent f75f6b9962
commit 7118cf8ed3
6 changed files with 19 additions and 15 deletions

View file

@ -20,6 +20,7 @@ BUILD_DIR = build
SRC_DIR = src SRC_DIR = src
OBJS = $(patsubst $(SRC_DIR)/%.c,build-tmp/%.o,$(wildcard $(SRC_DIR)/*.c)) OBJS = $(patsubst $(SRC_DIR)/%.c,build-tmp/%.o,$(wildcard $(SRC_DIR)/*.c))
OBJS += build-tmp/maps_out.o
all: | builddir map build builddir2 all: | builddir map build builddir2
@ -28,13 +29,14 @@ windef:
$(eval BUILD_DIR = build-win) $(eval BUILD_DIR = build-win)
$(eval LDFLAGS = $(LDFLAGS_WIN)) $(eval LDFLAGS = $(LDFLAGS_WIN))
converter: map/converter.c map/converter: map/converter.c
$(CC) map/converter.c -o map/converter $(CFLAGS) $(CC) map/converter.c -o map/converter $(CFLAGS)
map: converter map/maps_out.c: map/converter $(wildcard map/*.tmx)
./map/converter ./map/converter
$(CC) -c map/maps_out.c -o build-tmp/maps_out.o $(CFLAGS) $(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: builddir:
- mkdir $(BUILD_DIR) - mkdir $(BUILD_DIR)
@ -42,10 +44,10 @@ builddir:
- mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/ - mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/
build-tmp/%.o : $(SRC_DIR)/%.c build-tmp/%.o : $(SRC_DIR)/%.c
${CC} -c $< -o $@ ${CFLAGS} $(CC) -c $< -o $@ $(CFLAGS)
build: $(OBJS) build: $(OBJS)
${CC} ${CFLAGS} -o ${OUTPUT} $(OBJS) ${LDFLAGS} $(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(LDFLAGS)
builddir2: builddir2:
mv $(wildcard build-tmp/*.o) $(BUILD_DIR) mv $(wildcard build-tmp/*.o) $(BUILD_DIR)
@ -66,5 +68,5 @@ clean:
- rm "$(OUTNAME).amd64" "$(OUTNAME).exe" - rm "$(OUTNAME).amd64" "$(OUTNAME).exe"
- rm map/maps_out.c map/converter map/converter.exe - rm map/maps_out.c map/converter map/converter.exe
.NOTPARALLEL: builddir builddir2 converter map .NOTPARALLEL: builddir builddir2 map
.PHONY: all test clean win windef builddir builddir2 testwin converter map .PHONY: all test clean win windef builddir builddir2 testwin map

Binary file not shown.

View file

@ -54,7 +54,7 @@ int import_map(FILE *mapfile, FILE *outfile){
fprintf(outfile, "\n};\n"); fprintf(outfile, "\n};\n");
fprintf(outfile, "Map %s = {{%s_lyr0, %s_lyr1}, 256, 256," 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); tmpname, tmpname, tmpname);
return 0; return 0;

View file

@ -2,7 +2,7 @@
#define VERSION_MAJ 0 #define VERSION_MAJ 0
#define VERSION_MIN 1 #define VERSION_MIN 1
#define VERSION_PATCH 2 #define VERSION_PATCH 3
// Set in ui.c // Set in ui.c
extern char *VERSION_STR; extern char *VERSION_STR;

View file

@ -9,6 +9,7 @@
#include <raymath.h> #include <raymath.h>
#include "types.h" #include "types.h"
#include "map.h"
#include "game.h" #include "game.h"
MachineDef machine_dict[] = { MachineDef machine_dict[] = {
@ -197,14 +198,14 @@ void update_worker(Game *game, Worker *worker){
AiInternal *ai = &worker->ai; AiInternal *ai = &worker->ai;
Machine *mach[2] = {0}; Machine *mach[2] = {0};
MachineDef *defs[2]; //MachineDef *defs[2];
if(ai->assigned_machine != MACH_NULL){ if(ai->assigned_machine != MACH_NULL){
mach[0] = get_machine_from_id(&game->machines, ai->assigned_machine); mach[0] = get_machine_from_id(&game->machines, ai->assigned_machine);
if(!mach[0]) if(!mach[0])
ai->assigned_machine = MACH_NULL; ai->assigned_machine = MACH_NULL;
else{ else{
defs[0] = &machine_dict[mach[0]->type]; //defs[0] = &machine_dict[mach[0]->type];
ai->mtype = 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); mach[1] = get_machine_from_id(&game->machines, ai->assigned_machine1);
if(!mach[1]) if(!mach[1])
ai->assigned_machine1 = MACH_NULL; ai->assigned_machine1 = MACH_NULL;
else /*else
defs[1] = &machine_dict[mach[1]->type]; defs[1] = &machine_dict[mach[1]->type];
*/
} }
if(ai->assigned_machine == MACH_NULL && ai->assigned_machine1 == MACH_NULL) if(ai->assigned_machine == MACH_NULL && ai->assigned_machine1 == MACH_NULL)

View file

@ -347,9 +347,9 @@ void get_keys(Game *game){
if(keydown(KEY_D)) if(keydown(KEY_D))
game->camera.target.x += 3; game->camera.target.x += 3;
if(keydown(KEY_UP)) if(keydown(KEY_UP))
game->camera.zoom *= 1.1; game->camera.zoom *= 1.025;
if(keydown(KEY_DOWN)) if(keydown(KEY_DOWN))
game->camera.zoom *= 1/1.1; game->camera.zoom *= 1/1.025;
if(IsKeyPressed(KEY_P)) if(IsKeyPressed(KEY_P))
game->paused = !game->paused; game->paused = !game->paused;
if(IsKeyPressed(KEY_ESCAPE)) if(IsKeyPressed(KEY_ESCAPE))