From a729b0459bfdf971a296989677f1fb6ad10a6657 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Tue, 5 Mar 2019 16:52:45 -0800 Subject: [PATCH] moar worldbuilding with textfile --- Engine.c | 4 ++-- HyperKaos.h | 2 +- Player.c | 2 ++ main.c | 7 ------- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Engine.c b/Engine.c index a5b3069..c05e281 100644 --- a/Engine.c +++ b/Engine.c @@ -528,6 +528,7 @@ void mainmenu() switch (menucounter) { case 0: + playing = 1; thisChunk = LEVEL1; nextChunk = LEVEL1; @@ -539,7 +540,6 @@ void mainmenu() hero->point.x = 160; hero->point.y = 90; - playing = 1; fclose(saveData); break; @@ -548,6 +548,7 @@ void mainmenu() { fscanf(saveData, "%d %d %d %d %lld", &level, &roomNo, &xPos, &yPos, &eventState); } + playing = 1; thisChunk = (enum dataChunks)(level); nextChunk = (enum dataChunks)(level); @@ -559,7 +560,6 @@ void mainmenu() hero->point.y = yPos; warpto(mapData[roomNo]); - playing = 1; fclose(saveData); printf("Loaded save: level %d, room %d (%d,%d) state: %lld\n", level, roomNo, xPos, yPos, eventState); break; diff --git a/HyperKaos.h b/HyperKaos.h index 7e35b6b..1d18108 100644 --- a/HyperKaos.h +++ b/HyperKaos.h @@ -16,5 +16,5 @@ void cleanHyperKaos(HyperKaos* self); void run(HyperKaos* self); void addKaos(HyperKaos* self, Kaos* target); -int isCompleted(int x); +int hasCompleted(int x); int notCompleted(int x); diff --git a/Player.c b/Player.c index 047c50b..1c20dbf 100644 --- a/Player.c +++ b/Player.c @@ -243,6 +243,8 @@ int playerFaces(Player* self, char dir) return 0; } +// collision helper functions + int playerIsInRect(Player* self, SDL_Rect* rect) { SDL_Rect* pBox = &(self->boundBox); diff --git a/main.c b/main.c index 6931e00..547bbe6 100644 --- a/main.c +++ b/main.c @@ -14,12 +14,6 @@ #include "WorldData.h" #include "Scene.h" -/*const int SCREEN_WIDTH = 320; -const int SCREEN_HEIGHT = 180; -const int SCREEN_BPP = 32; - -const int FRAMES_PER_SECOND = 30;*/ - int fullscreen = 0; int playing = 0; int quit = 0; @@ -79,7 +73,6 @@ int main (int argc, char* args[]) intro(); - // main game loop while (!quit) { mainmenu();