From d9d66652af66fc824588176e5ce1136ea9965925 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <tullivan99@gmail.com> Date: Thu, 17 Dec 2015 09:25:22 -0500 Subject: indoors, fixed npcs --- src/gameplay.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gameplay.cpp') diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 35abca4..2361029 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -93,6 +93,8 @@ static World *worldSpawnHill1; static World *worldSpawnHill2; static World *worldSpawnHill3; +static IndoorWorld *worldSpawnHill2_Building1; + /* * initEverything() start */ @@ -119,7 +121,7 @@ void initEverything(void){ worldSpawnHill3->addMob(MS_TRIGGER,-500,0,worldSpawnHill3_itemGet); worldSpawnHill3->addMob(MS_TRIGGER,0,0,worldSpawnHill3_itemSee); worldSpawnHill3->addObject(TEST_ITEM,false,"",-200,300); - worldSpawnHill3->addMob(MS_TRIGGER,400,0,worldSpawnHill3_leave); + worldSpawnHill3->addMob(MS_TRIGGER,650,0,worldSpawnHill3_leave); worldSpawnHill3->addHole(800,1000); worldSpawnHill1->toRight = worldSpawnHill2; @@ -140,14 +142,18 @@ void initEverything(void){ //playerSpawnHill->addMob(MS_TRIGGER,-1300,0,CUTSCENEEE);*/ - currentWorld = worldSpawnHill1; - worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill1,worldSpawnHill2); + worldSpawnHill2_Building1 = new IndoorWorld(); + worldSpawnHill2_Building1->generate(300); + worldSpawnHill2_Building1->setBackground(BG_WOODHOUSE); + worldSpawnHill2_Building1->setBGM("assets/music/theme_jazz.wav"); + + worldSpawnHill2->addStructure(STRUCTURET,HOUSE,(rand()%120*HLINE),100,worldSpawnHill2_Building1); player = new Player(); player->spawn(200,100); - + + currentWorld = worldSpawnHill1; currentWorld->bgmPlay(NULL); - atexit(destroyEverything); } -- cgit v1.2.3 From 1b2510a427cea42e6381d60f434b5fdec2b181b0 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <tullivan99@gmail.com> Date: Thu, 17 Dec 2015 20:33:50 -0500 Subject: fork tests, revised song --- Makefile | 2 +- assets/music/theme_jazz.wav | Bin 13193260 -> 13193260 bytes main.cpp | 5 +++++ src/entities.cpp | 8 +++++++- src/gameplay.cpp | 1 + src/ui.cpp | 2 +- 6 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src/gameplay.cpp') diff --git a/Makefile b/Makefile index e48afa6..6eeca1a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ all: @rm -f out64/*.o @cd src; $(MAKE) $(MFLAGS64) @echo " CXX main.cpp" - @g++ $(FLAGS) -m64 -o main main.cpp out64/*.o $(LIBS) + @g++ $(FLAGS) -m64 -o main main.cpp out64/*.o $(LIBS) -lX11 win32: @g++ $(FLAGS) -o main main.cpp src/*.cpp $(WIN_LIBS) diff --git a/assets/music/theme_jazz.wav b/assets/music/theme_jazz.wav index 1c62bbc..94f888e 100644 Binary files a/assets/music/theme_jazz.wav and b/assets/music/theme_jazz.wav differ diff --git a/main.cpp b/main.cpp index 0651077..7eaaa84 100644 --- a/main.cpp +++ b/main.cpp @@ -199,9 +199,14 @@ extern int fadeIntensity; * MAIN ************************************************************************ *******************************************************************************/ +#include <X11/Xlib.h> + 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. diff --git a/src/entities.cpp b/src/entities.cpp index 7cd413c..c307a31 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -1,6 +1,8 @@ #include <entities.h> #include <ui.h> +#include <unistd.h> + extern FILE* names; extern unsigned int loops; @@ -462,7 +464,11 @@ void Mob::wander(int timeRun){ case MS_TRIGGER: if(player->loc.x + player->width / 2 > loc.x && player->loc.x + player->width / 2 < loc.x + width ){ - hey(this); + //if(!vfork()){ + hey(this); + /*_exit(0); + }*/ + } break; case MS_DOOR: diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 2361029..ba2c8d9 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -42,6 +42,7 @@ float gen_worldSpawnHill3(float x){ */ void worldSpawnHill1_hillBlock(Mob *callee){ + std::cout<<"oi"; player->vel.x = 0; player->loc.x = callee->loc.x + callee->width; ui::dialogBox(player->name,NULL,false,"This hill seems to steep to climb up..."); diff --git a/src/ui.cpp b/src/ui.cpp index 08f503f..6069ef9 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -512,7 +512,7 @@ namespace ui { glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y+1); glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y-1-SCREEN_HEIGHT/4); glVertex2f(x-1 ,y-1-SCREEN_HEIGHT/4); - glVertex2f(x-1 ,y+2); + glVertex2f(x ,y+1); glEnd(); glColor3ub(0,0,0); -- cgit v1.2.3