]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Fixed some handAngle bugs, and raised the world height
authordrumsetmonkey <abelleisle@roadrunner.com>
Fri, 6 Nov 2015 13:48:46 +0000 (08:48 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Fri, 6 Nov 2015 13:48:46 +0000 (08:48 -0500)
assets/names_en-us
include/common.h
main.cpp
src/gameplay.cpp
src/ui.cpp
src/world.cpp

index 0f6195fd76e73db56eefd22708d5abdcca425baa..2d1f8d9eaca223147972b2e9b5afc9fa6debac36 100644 (file)
@@ -54,6 +54,7 @@ mClyne
 mPingu
 mShrek
 mLogan
+mJohn Cena
 fShani
 fIsidra
 fAja
index 846dfb9e3772c7928edb2a1f9f933a47f33eca1f..93735fae523a9457785f3e69b686e5fbbe0d2810 100644 (file)
@@ -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).
index 90b673d7b3b4fa8841c680d20b76a3dac2090ba8..b3e94c4f898aaee2175098e5723475e9d701efd9 100644 (file)
--- 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<<worldSize<<" "<<(int)worldBuf<<std::endl;
-    std::cout<<fwrite(worldBuf,1,worldSize,worldSave)<<std::endl;
     if(ferror(worldSave))perror("HEY: ");
     fclose(worldSave);
     
@@ -795,7 +795,6 @@ void render(){
                glUseProgramObjectARB(0);
        #endif //SHADERS
 
-       float handAngle;
        if(player->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
 
                                                }
                                        }
index b32d9ee777db3b50eb786e59310b313f964d8ae5..39d0675a0e7e3fc950f0c915add954b27871123c 100644 (file)
@@ -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"<<std::endl;
                char *buf;
@@ -51,10 +51,10 @@ void initEverything(void){
                buf=(char *)malloc(size);
                fread(buf,1,size,worldLoad);
                test->load(buf);
-       }else{
+       }else{*/
                test->generate(SCREEN_WIDTH * 2);
                test->addHole(100,150);
-       }
+       //}
        
        test->addLayer(400);
        
index 7329f6afcafab434addcdb6c6dc4b06ef6fcb7e3..237d09aeb840612e5aa5a09c1f7ebacd9824fa6e 100644 (file)
@@ -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(linc<size)linc++;
@@ -315,6 +315,8 @@ namespace ui {
                                if(SDL_KEY==SDLK_p)toggleBlack();
                                if(SDL_KEY==SDLK_F3)debug^=true;
                                if(SDL_KEY==SDLK_b & SDL_KEY==SDLK_F3)posFlag^=true;
+                               if(SDL_KEY==SDLK_UP)handAngle++;
+                               if(SDL_KEY==SDLK_DOWN)handAngle--;
                                break;
                        /*
                                KEYUP
@@ -327,6 +329,9 @@ namespace ui {
                                if(SDL_KEY==SDLK_LCTRL)player->speed = 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;
index 01c06c47d8bba1ec4edabcad795c3c99bf4790a6..b0f419d386100f76709c4b943644e3516a75eacd 100644 (file)
@@ -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<<sp->lineCount<<std::endl;
        x_start=sp->x_start;
        lineCount=sp->lineCount;
        line=(struct line_t *)calloc(lineCount,sizeof(struct line_t));