From 0b9561febb7677de8792ba0feb056139ba7c94ea Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 18 Dec 2015 08:45:29 -0500 Subject: [PATCH] pages --- Changelog | 8 ++++++++ Makefile | 5 +++-- assets/items/ITEM_PAGE.png | Bin 0 -> 331 bytes include/entities.h | 3 ++- main.cpp | 7 ++----- src/entities.cpp | 22 ++++++++++++++++++++-- src/gameplay.cpp | 31 ++++++++++++++++++++++--------- xcf/page.xcf | Bin 0 -> 1059 bytes 8 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 assets/items/ITEM_PAGE.png create mode 100644 xcf/page.xcf diff --git a/Changelog b/Changelog index 6d5fa3b..44ff8a4 100644 --- a/Changelog +++ b/Changelog @@ -444,3 +444,11 @@ - fixed NPC spawning world location stuff - messed with threads/forks - re-fixed/added indoor environment; fixed indoor background + +12/18/2015: +=========== + + - upgraded development utilities + - began working on pages, made sprite and handler + - GLSL shaders are better + - redid theme_jazz diff --git a/Makefile b/Makefile index 6eeca1a..81862c0 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ WIN_LIBS = -lopengl32 -lglew32 -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_m FLAGS = -std=c++11 -Iinclude -Iinclude/freetype2 -Wall -Wextra -Werror MFLAGS64 = 64 + all: @echo "Building for 32-bit target" @rm -f out/*.o @@ -17,11 +18,11 @@ all: @rm -f out64/*.o @cd src; $(MAKE) $(MFLAGS64) @echo " CXX main.cpp" - @g++ $(FLAGS) -m64 -o main main.cpp out64/*.o $(LIBS) -lX11 + @g++ $(FLAGS) -m64 -o main main.cpp out64/*.o $(LIBS) win32: @g++ $(FLAGS) -o main main.cpp src/*.cpp $(WIN_LIBS) - + clean: @echo " RM main" @-rm -f main diff --git a/assets/items/ITEM_PAGE.png b/assets/items/ITEM_PAGE.png new file mode 100644 index 0000000000000000000000000000000000000000..ac132c63bdf361b3704ca7b6887e0d20a2f63373 GIT binary patch literal 331 zcmeAS@N?(olHy`uVBq!ia0vp^azHG?!3HE}t?oSnq&N#aB8wRqxP?KOkzv*x37{Z* ziKnkC`+XiEUP18_ea@$WLXst}5hc#~xw)x%B@E6*sfi`2DGKG8B^e6tp1uL$jeO!j zMMphd978;gznv1u*Q~(P_P_okTW!oE!D$u$ohMZE&s$i1Qy_x1M@6l>*2#6>`T#HE z!=fJ#xE40&fB4_H{37?Hp2t!B4_2^EVq%Qwp14 - + int main(/*int argc, char *argv[]*/){ //*argv = (char *)argc; gameRunning=false; - XInitThreads(); - /*! * (Attempt to) Initialize SDL libraries so that we can use SDL facilities and eventually * make openGL calls. Exit if there was an error. @@ -905,6 +901,7 @@ void logic(){ m->wander((rand()%240 + 15)); // Make the mob wander :) break; case MS_TRIGGER: + case MS_PAGE: m->wander(0); break; case MS_DOOR: diff --git a/src/entities.cpp b/src/entities.cpp index c307a31..23a4ae6 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -1,7 +1,7 @@ #include #include -#include +//#include extern FILE* names; extern unsigned int loops; @@ -153,15 +153,22 @@ Mob::Mob(int sub){ width = HLINE * 8; height = HLINE * 8; tex = new Texturec(1, "assets/robin.png"); + break; case MS_TRIGGER: width = HLINE * 20; height = 2000; tex = new Texturec(0); + break; case MS_DOOR: width = HLINE * 12; height = HLINE * 19; tex = new Texturec(1,"assets/door.png"); break; + case MS_PAGE: + width = HLINE * 6; + height = HLINE * 4; + tex = new Texturec(1,"assets/items/ITEM_PAGE.png"); + break; } inv = new Inventory(NPC_INV_SIZE); @@ -248,6 +255,7 @@ void Entity::draw(void){ //draws the entities break; case MS_BIRD: case MS_DOOR: + case MS_PAGE: default: tex->bind(0); break; @@ -471,7 +479,17 @@ void Mob::wander(int timeRun){ } break; - case MS_DOOR: + case MS_PAGE: + if(ui::mouse.x > loc.x && + ui::mouse.x < loc.x + width && + SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)){ + if(speed != 666){ + speed = 666; + hey(this); + speed = 0; + } + } + break; default: break; } diff --git a/src/gameplay.cpp b/src/gameplay.cpp index ba2c8d9..1670929 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -51,14 +51,27 @@ void worldSpawnHill1_hillBlock(Mob *callee){ static Arena *a; void worldSpawnHill2_infoSprint(Mob *callee){ - callee->alive = false; - a = new Arena(currentWorld,player); - a->setBackground(BG_FOREST); - a->setBGM("assets/music/embark.wav"); - ui::toggleWhiteFast(); - ui::waitForCover(); - currentWorld = a; - ui::toggleWhiteFast(); + + ui::dialogBox(player->name,":Nah:Sure",false,"This page would like to take you somewhere."); + ui::waitForDialog(); + switch(ui::dialogOptChosen){ + case 1: + ui::dialogBox(player->name,NULL,true,"Cool."); + callee->alive = false; + a = new Arena(currentWorld,player); + a->setBackground(BG_FOREST); + a->setBGM("assets/music/embark.wav"); + ui::toggleWhiteFast(); + ui::waitForCover(); + currentWorld = a; + ui::toggleWhiteFast(); + break; + case 2: + default: + ui::dialogBox(player->name,NULL,false,"Okay then."); + break; + } + //ui::dialogBox("B-) ",NULL,true,"Press \'Shift\' to run!"); } @@ -113,7 +126,7 @@ void initEverything(void){ worldSpawnHill2->generate(700); worldSpawnHill2->setBackground(BG_FOREST); worldSpawnHill2->setBGM("assets/music/ozone.wav"); - worldSpawnHill2->addMob(MS_TRIGGER,-400,0,worldSpawnHill2_infoSprint); + worldSpawnHill2->addMob(MS_PAGE,-400,0,worldSpawnHill2_infoSprint); worldSpawnHill3 = new World(); worldSpawnHill3->generateFunc(1000,gen_worldSpawnHill3); diff --git a/xcf/page.xcf b/xcf/page.xcf new file mode 100644 index 0000000000000000000000000000000000000000..bf39c184b629e57eff4a95ca9b37e8c76c68dadc GIT binary patch literal 1059 zcmc&y!EVz)5S?8+iJhdBP(VdRXeBP`Ays?kRt{AUNc@89*zStNu54Gd2gDat>X+~< zmi!<70#KJX?z*@TxH8gY-oAOWZ#7P$*B9z4j8&{x5h30npEE$rkV4>R2k9N(5^*9} z;M#m?E9+iBe}cM|;Mzr)t=Can;!NCp_CAk-GFqz7x;$4Wryo9Y=V>d|>mZ31Nv@a7 zK`m%rl-H|B71>HJ_s8=%3A0s}t9e@%d2$x0!-K;%Hh?4B+Q;bGhS9FC{tkHbs<;S3 zohIt2^8$IjiL~6}GS#KhX?PwLJfFpJ5tR=Q