From e257d84daee9d474a944588214fbdafed9d9e983 Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Fri, 6 Nov 2015 08:48:46 -0500 Subject: Fixed some handAngle bugs, and raised the world height --- assets/names_en-us | 1 + include/common.h | 2 ++ main.cpp | 7 +++---- src/gameplay.cpp | 6 +++--- src/ui.cpp | 9 +++++++-- src/world.cpp | 7 +++---- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/assets/names_en-us b/assets/names_en-us index 0f6195f..2d1f8d9 100644 --- a/assets/names_en-us +++ b/assets/names_en-us @@ -54,6 +54,7 @@ mClyne mPingu mShrek mLogan +mJohn Cena fShani fIsidra fAja diff --git a/include/common.h b/include/common.h index 846dfb9..93735fa 100644 --- a/include/common.h +++ b/include/common.h @@ -113,6 +113,8 @@ extern unsigned int deltaTime; */ extern vec2 offset; +extern float handAngle; + /* * Loads an image from the given file path and attempts to make a texture out of it. The * resulting GLuint is returned (used to recall the texture in glBindTexture). diff --git a/main.cpp b/main.cpp index 90b673d..b3e94c4 100644 --- a/main.cpp +++ b/main.cpp @@ -65,6 +65,8 @@ static GLuint bgDay, bgNight, bgMtn, bgTreesFront, bgTreesMid, bgTreesFar; bool gameRunning; +float handAngle; + /* * currentWorld - This is a pointer to the current world that the player * is in. Most drawing/entity handling is done through this @@ -489,8 +491,6 @@ int main(int argc, char *argv[]){ char *worldBuf; unsigned int worldSize; worldBuf=currentWorld->save(&worldSize); - std::cout<light){ handAngle = atan((ui::mouse.y - (player->loc.y + player->height/2)) / (ui::mouse.x - player->loc.x + player->width/2))*180/PI; if(ui::mouse.x < player->loc.x){ @@ -1082,7 +1081,7 @@ void logic(){ if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)){ NPCp(entity[i])->interact(); - //Mix_PlayChannel( -1, horn, 0); // Audio feedback + Mix_PlayChannel( -1, horn, 0); // Audio feedback } } diff --git a/src/gameplay.cpp b/src/gameplay.cpp index b32d9ee..39d0675 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -40,7 +40,7 @@ void initEverything(void){ * Load the saved world if it exists, otherwise generate a new one. */ - FILE *worldLoad; + /*FILE *worldLoad; if((worldLoad=fopen("world.dat","r"))){ std::cout<<"Yes"<load(buf); - }else{ + }else{*/ test->generate(SCREEN_WIDTH * 2); test->addHole(100,150); - } + //} test->addLayer(400); diff --git a/src/ui.cpp b/src/ui.cpp index 7329f6a..237d09a 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -150,9 +150,9 @@ namespace ui { memset(ret,0,512); size=strlen(str); linc=0; - sinc=2; + sinc=1; } - if(++sinc==3){ + if(++sinc==2){ sinc=0; strncpy(ret+linc,str+linc,1); if(lincspeed = 1; if(SDL_KEY==SDLK_h)player->health-=5; if(SDL_KEY==SDLK_f)player->light ^= true; + if(SDL_KEY==SDLK_UP)handAngle+=0; + if(SDL_KEY==SDLK_DOWN)handAngle-=0; + break; default: break; diff --git a/src/world.cpp b/src/world.cpp index 01c06c4..b0f419d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -7,11 +7,11 @@ // or not calculated at all, so GEN_INC is also used to decrease 'lineCount' in functions like draw() // and detect(). -#define GEN_MIN 40 -#define GEN_MAX 70 +#define GEN_MIN 80 +#define GEN_MAX 110 #define GEN_INIT 60 -#define GRASS_HEIGHT 4 // Defines how long the grass layer of a line should be in multiples of HLINE. +#define GRASS_HEIGHT 4 // Defines how long the grass layer of a line should be in multiples of HLINE. #define DRAW_Y_OFFSET 50 // Defines how many pixels each layer should be offset from each other on the y axis when drawn. @@ -56,7 +56,6 @@ char *World::save(unsigned int *ssize){ void World::load(char *buf){ struct wSavePack *sp; sp=(struct wSavePack *)buf; - std::cout<lineCount<x_start; lineCount=sp->lineCount; line=(struct line_t *)calloc(lineCount,sizeof(struct line_t)); -- cgit v1.2.3