thrive/01_text_adventure/main.c
2025-01-18 19:34:45 -05:00

58 lines
1.4 KiB
C

#include "game.h"
#include "../raylib.h"
#include "log.h"
#include "input.h"
#include "parse.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#define TARGET_FPS 60
int main(void) {
InitWindow(800, 450, "Text Adventure");
SetTargetFPS(TARGET_FPS);
Game *g = game_create();
game_load_rooms(g);
g->current_room = &g->rooms->rooms[0];
game_load_transitions(g);
game_load_words(g);
game_load_flags(g);
game_load_actions(g);
for (int i = 0; i < g->actions->count; i++) {
for (int j = 0; j < g->actions->actions[i].words_count; j++) {
printf("%s ", g->actions->actions[i].words[j]->word);
}
printf("|");
for (int j = 0; j < g->actions->actions[i].predicates_count; j++) {
if (j > 0) printf(" & ");
print_predicate(g->actions->actions[i].predicates[j]);
}
printf("|%d|%s|", g->actions->actions[i].priority, g->actions->actions[i].description);
for (int j = 0; j < g->actions->actions[i].effects_count; j++) {
if (j > 0) printf(" & ");
print_effect(g->actions->actions[i].effects[j]);
}
printf("\n");
}
printf("before action\n");
printf("lever_pulled: %d\n", flag_value(g->flags, "LEVER_PULLED"));
cause_effect(g, g->actions->actions[2].effects[0]);
printf("after action\n");
printf("lever_pulled: %d\n", flag_value(g->flags, "LEVER_PULLED"));
game_run_until_close(g);
CloseWindow();
free_game(g);
return 0;
}