Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <time.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <math.h>
- #include <pspdebug.h>
- #include <psprtc.h>
- #include <pspgu.h>
- #include <pspgum.h>
- #include <pspdisplay.h>
- #include "main.h"
- #include "actor.h"
- enum GameMode { MODE_TITLE, MODE_MAINMENU, MODE_CREDITS, MODE_SETTINGS, MODE_ORDER, MODE_DAY };
- enum GameMode gameMode;
- //enum InventoryType { IT_STRAWBERRY,IT_VANILLA,IT_CHOCOLATE,IT_BRAIN,IT_CONE,IT_WHIPPEDCREAM,IT_SPRINKLES,IT_CHERRIES,IT_SHOTGUN,IT_AMMO,IT_APRON,ITMAX };
- char *inventoryName[]={"Strawberry","Vanilla","Chocolate","Brain","Cone","Whipped Cream","Sprinkles","Cherries","Shotgun","Ammo","Apron" };
- char *inventoryIconName[]={"data/straw16.png","data/van16.png","data/choc16.png","data/brain16.png","data/cone16.png","data/whipped16.png","data/sprinkles16.png","data/cher16.png","data/shotgun16.png","data/ammo16.png", "data/apron16.png" };
- Image *inventoryIcon[ITMAX];
- struct Inventory {
- int count;
- int capacity;
- };
- struct Message {
- char text[256];
- int timer;
- };
- struct Game {
- // persistent stuff
- int level;
- int score;
- int cash;
- struct Inventory inventory[12];
- struct Actor staff[8];
- int staffCount;
- // day specific stuff
- struct Actor *activeStaff;
- struct Actor customer[8];
- int customerCount;
- struct Actor zombie[8];
- int zombieCount;
- struct Dialog *dialog;
- // transient stuff
- struct WavefrontModel *room; // wavefront for drawing
- int selected; // currently selected menu item
- int timer;
- struct Message message[256];
- int messageCount;
- // debug camera
- float theta,phi;
- float dist;
- } game;
- // debug camera
- int ax,ay;
- int dir;
- ScePspFVector3 from={0,100,50},to={0,50,0},up={0,1,0};
- ScePspFMatrix4 view;
- struct DialogTable creditsTable[]={
- {0,NULL,"Game play programming by hardhat"},
- {0,NULL,"Sound effect programming by Zack"},
- {0,NULL,"Parlor model by Meyitzo"},
- {0,NULL,"Actor models: see readmes."},
- {0,NULL,"Additional skins by Incomplete"},
- {0,NULL,"Sound effects by meanrabbit.com"},
- {0,NULL,"Music by Incomplete"},
- {0,NULL,"Title screen by Incomplete"},
- {1,NULL,"Continue"},
- };
- struct DialogTable settingsTable[]={
- {10,NULL,"Sound effect|On"},
- {11,NULL,"Music Volume|10"},
- {12,NULL,"Temperature|Degrees C"},
- {1,NULL,"Return to Main Menu"},
- };
- struct DialogTable orderTable[]={
- {-1,NULL,"Item|Inventory|Supplies Cost|Quantity to Order"},
- {10,NULL,"Strawberry|25|$10|0"},
- {11,NULL,"Chocolate|25|$10|0"},
- {12,NULL,"Vanilla|25|$10|0"},
- // {13,NULL,"Brain|0|$10|0"},
- {14,NULL,"Cones|100|$10|0"},
- // {15,NULL,"Shotgun|0|$1000|0"},
- // {16,NULL,"Ammo|0|$1|0"},
- {17,NULL,"Whipped Cream|0|$30|0"},
- {18,NULL,"Sprinkles|0|$30|0"},
- {19,NULL,"Cherries|0|$30|0"},
- {20,NULL,"Apron|0|$2500|0"},
- {-2,NULL,"Total||$2500|"},
- {1,NULL,"Start Day"},
- };
- void setMode(int mode)
- {
- if(gameMode!=mode) {
- gameMode=mode;
- if(game.dialog) freeDialog(game.dialog);
- game.dialog=0;
- if(mode==MODE_CREDITS) {
- game.dialog=newDialog("Zombie Dessert Credits");
- addDialogItemRows(game.dialog,creditsTable,sizeof(creditsTable)/sizeof(struct DialogTable));
- } else if(mode==MODE_SETTINGS) {
- game.dialog=newDialog("Settings");
- addDialogItemRows(game.dialog,settingsTable,sizeof(settingsTable)/sizeof(struct DialogTable));
- } else if(mode==MODE_ORDER) {
- game.dialog=newDialog("Order Supplies");
- addDialogItemRows(game.dialog,orderTable,sizeof(orderTable)/sizeof(struct DialogTable));
- selectDialogItem(game.dialog,1);
- } else if(mode==MODE_DAY) {
- game.selected=0;
- }
- }
- }
- void newLevel(int level)
- {
- struct Inventory *inventory=game.inventory;
- game.level=level;
- if(level==0) {
- int i;
- for(i=0;i<ITMAX;i++) {
- if(i<3) {
- inventory[i].count=25;
- inventory[i].capacity=75;
- } else if(i==IT_CONE) {
- inventory[i].count=200;
- inventory[i].capacity=600;
- } else if(i==IT_APRON) {
- inventory[i].count=1;
- inventory[i].capacity=1;
- } else {
- inventory[i].count=0;
- inventory[i].capacity=0;
- }
- }
- }
- }
- void newGame()
- {
- game.level=0;
- game.score=0;
- game.staffCount=1;
- game.activeStaff=game.staff+0;
- game.customerCount=0;
- game.zombieCount=0;
- int i;
- for(i=0;i<ITMAX;i++) {
- game.inventory[i].capacity=1;
- game.inventory[i].count=0;
- if(!inventoryIcon[i]) {
- inventoryIcon[i]=loadPng(inventoryIconName[i]);
- swizzleFast(inventoryIcon[i]);
- }
- }
- game.theta=3.14159265f; //2.54f;
- game.phi=0.84f; //0.61f;
- game.dist=238; //301;
- struct Actor *a=game.staff+0;
- newActor(a,"ai","ctf_r");
- a->x=32;
- a->z=-86;
- a->angle=GU_PI/2;
- a->playerControlled=1;
- game.staffCount=1;
- game.zombieCount=0;
- game.customerCount=0;
- game.timer=0;
- if(game.dialog) freeDialog(game.dialog);
- game.dialog=0;
- newLevel(game.level);
- }
- void startTitle()
- {
- game.room=loadWavefront("parlor");
- newGame();
- gameMode=MODE_MAINMENU;
- }
- char *mainMenuText[]={"New Game","Continue Game","Settings","Credits","Quit"};
- int mainMenuCount=5;
- void drawMainMenu()
- {
- int w,h,x;
- int i;
- extentMessage(&w,&h,FONT_HEADLINE,"Zombie Dessert");
- x=480/2-w/2;
- drawMessage(x,14,FONT_HEADLINE,"Zombie Dessert");
- for(i=0;i<mainMenuCount;i++) {
- int font=i!=game.selected?FONT_SMALL:FONT_SMALLHIGHLIGHT;
- extentMessage(&w,&h,font,mainMenuText[i]);
- x=480/2-w/2;
- drawMessage(x,85+i*16,font,mainMenuText[i]);
- }
- if(game.selected<0 || game.selected>=mainMenuCount) game.selected=0;
- }
- void drawDay()
- {
- char msg[256];
- int w,h;
- drawFilledRect(0,0,100,272,GU_RGBA(0,0,0,128));
- drawFilledRect(320,0,160,48,GU_RGBA(255,255,255,128));
- drawFilledRect(320,0,1,48,GU_RGBA(0,0,0,255));
- drawFilledRect(320,0,160,1,GU_RGBA(0,0,0,255));
- drawFilledRect(479,0,1,48,GU_RGBA(0,0,0,255));
- drawFilledRect(320,47,160,1,GU_RGBA(0,0,0,255));
- sprintf(msg,"Day %d",game.level+1);
- extentMessage(&w,&h,FONT_BODYHIGHLIGHT,msg);
- int x=5;
- drawMessage(x,15,FONT_BODYHIGHLIGHT, msg);
- int i;
- int y=0;
- for(i=0;i<ITMAX;i++) {
- if(inventoryIcon[i] /* && inventory[i].capacity>0 */) {
- drawSprite(0,0,16,16,inventoryIcon[i],0,50+y);
- char buf[128];
- sprintf(buf,"%d of %d",game.inventory[i].count,game.inventory[i].capacity);
- drawMessage(18,50+y,FONT_SMALL,buf);
- y+=16;
- }
- }
- x=324;
- drawMessage(x,2,FONT_MESSAGE,"Add ");
- extentMessage(&w,&h,FONT_MESSAGE,"Add ");
- drawMessage(x+w,2,FONT_MESSAGE,inventoryName[game.selected]);
- for(i=0;i<ITMAX;i++) {
- if(game.activeStaff->state&(1<<i)) {
- static Image *defaultIcon=0;
- if(!defaultIcon) {
- defaultIcon=newImage(16,16);
- int i;
- for(i=0;i<16*16;i++) {
- defaultIcon->data[i]=0xffffffc0;
- }
- }
- drawSprite(0,0,16,16,inventoryIcon[i]?inventoryIcon[i]:defaultIcon,x,24);
- x+=18;
- }
- }
- #if 0
- strcpy(msg,"Press START to end day.");
- extentMessage(&w,&h,FONT_MESSAGE,msg);
- x=480/2-w/2;
- drawMessage(x,240,FONT_MESSAGE, msg);
- #endif
- }
- int showFps=0;
- void draw()
- {
- u64 oldTick,newTick;
- pspDebugScreenSetXY(0,1);
- sceGuStart(GU_DIRECT,gulist);
- // clear screen
- sceRtcGetCurrentTick(&oldTick);
- sceGuClearColor(GU_RGBA(0x57,0x73,0x9b,255)); //GU_RGBA(0x80,0xc0,0xc0
- sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
- sceGuTexWrap(GU_REPEAT, GU_REPEAT);
- // move camera.
- sceGumMatrixMode(GU_VIEW);
- sceGumLoadIdentity();
- sceGumLookAt(&from,&to,&up);
- gumLoadIdentity(&view);
- gumLookAt(&view,&from,&to,&up);
- sceGumMatrixMode(GU_MODEL);
- sceGumLoadIdentity();
- sceGuClearColor(GU_RGBA(0x80,0xc0,0xc0,255));
- sceGuClearDepth(0);
- sceGuColor(0xffffffff);
- sceGuEnable(GU_LIGHTING);
- sceGuEnable(GU_TEXTURE_2D);
- drawWavefrontPartial(game.room,0);
- sceGuDisable(GU_LIGHTING);
- int i;
- int used;
- for(i=0;i<game.staffCount;i++) {
- drawActor(game.staff+i);
- }
- used=sceGuFinish();
- //printf("Used %d;",used);
- sceGuSync(0,0);
- sceGuStart(GU_DIRECT,gulist);
- for(i=0;i<game.customerCount;i++) {
- drawActor(game.customer+i);
- }
- used=sceGuFinish();
- //printf("Used %d;",used);
- sceGuSync(0,0);
- sceGuStart(GU_DIRECT,gulist);
- for(i=0;i<game.zombieCount;i++) {
- drawActor(game.zombie+i);
- }
- used=sceGuFinish();
- //printf("Used %d;",used);
- sceGuSync(0,0);
- sceGuStart(GU_DIRECT,gulist);
- sceGuSpecular(1);
- sceGuModelColor(0,0xffffff,0xffffff,0xffffff);
- drawWavefrontPartial(game.room,1);
- sceGuModelColor(0,0xffffff,0xffffff,0xffffff);
- if(gameMode==MODE_MAINMENU) drawMainMenu();
- else if(gameMode==MODE_DAY) drawDay();
- if(game.dialog) drawDialog(game.dialog);
- if(game.messageCount>0) {
- int w=0,h=8;
- const char *msg=game.message[0].text;
- extentMessage(&w,&h,FONT_MESSAGE,msg);
- drawFilledRect(240-w/2-20,136-h/2-20,w+40,h+40,GU_RGBA(0,0,0,64));
- drawMessage(240-w/2,136,FONT_MESSAGE,msg);
- }
- // End the frame
- used=sceGuFinish();
- //printf("Used %d gulist words\n",used);
- sceGuSync(0,0);
- if(showFps) {
- static u64 realOldTick=0;
- sceRtcGetCurrentTick(&newTick);
- pspDebugScreenSetXY(0,32);
- pspDebugScreenPrintf("FPS: %.2f (%.2f)",1000000.0f/(newTick-oldTick),((newTick-oldTick)/1000.0f));
- pspDebugScreenPrintf("real: %.2f (%.2f)",1000000.0f/(newTick-realOldTick),((newTick-realOldTick)/1000.0f));
- realOldTick=newTick;
- pspDebugScreenSetXY(0,1);
- pspDebugScreenPrintf("theta: %.2f, phi: %.2f, dist=%.1f",game.theta,game.phi,game.dist);
- }
- #ifdef DEBUG_TEARING
- pspDebugScreenSetXY(42,40);
- static int flipCount=0;
- pspDebugScreenPrintf("frame %d",flipCount++);
- #endif
- sceDisplayWaitVblankStart();
- //printf("-------------------\n");
- drawBuffer=sceGuSwapBuffers();
- pspDebugScreenSetOffset((int)drawBuffer);
- }
- struct Target {
- float x,z;
- float angle;
- };
- struct Target entranceTarget[]={
- {120,-160,GU_PI},
- {-190,-160,GU_PI*3/2},
- {-190,10,0},
- };
- struct Target waitingTarget[]={
- {-72,-86,-GU_PI/2},
- {-72,-46,-GU_PI/2},
- {-72,46,-GU_PI/2},
- {-72,86,-GU_PI/2},
- // queueing
- {-120,-86,-GU_PI/2},
- {-120,-46,-GU_PI/2},
- {-120,46,-GU_PI/2},
- {-120,86,-GU_PI/2},
- };
- int compareTargets(struct Target *target,struct Actor *a)
- {
- return target->x==a->target[0] && target->z==a->target[2];
- }
- struct Target *nextTarget(struct Actor *a)
- {
- int i;
- if(a==NULL) return entranceTarget+0;
- if(a->wants==PT_NONE) { // time to go.
- for(i=0;i<3;i++) {
- if(compareTargets(entranceTarget+i,a)) {
- if(i==0) return NULL; // disappear
- return entranceTarget+i-1;
- }
- }
- return entranceTarget+2;
- }
- for(i=0;i<3-1;i++) {
- if(compareTargets(entranceTarget+i,a)) {
- return entranceTarget+i+1;
- }
- }
- if(compareTargets(entranceTarget+2,a)) {
- // need to find an empty waiting spot.
- for(i=0;i<8;i++) {
- int used=0;
- int j;
- for(j=0;j<game.customerCount;j++) {
- used+=compareTargets(waitingTarget+i,game.customer+j);
- }
- for(j=0;j<game.zombieCount;j++) {
- used+=compareTargets(waitingTarget+i,game.zombie+j);
- }
- if(used==0) return waitingTarget+i;
- }
- // all of the spots are full it seems.
- printf("All waiting spots are full. Trying again in a minute.\n");
- a->wants=PT_NONE;
- return entranceTarget+2;
- }
- // we are currently in the lineup maybe?
- for(i=0;i<8;i++) {
- if(compareTargets(waitingTarget+i,a)) {
- if(i<4) return waitingTarget+i; // not change.
- // see if we can move up in the line.
- int used=0;
- int j;
- for(j=0;j<game.customerCount;j++) {
- used+=compareTargets(waitingTarget+i-4,game.customer+j);
- }
- for(j=0;j<game.zombieCount;j++) {
- used+=compareTargets(waitingTarget+i-4,game.zombie+j);
- }
- if(used==0) return waitingTarget+i-4; // move up in the line
- return waitingTarget+i; // no change.
- }
- }
- return entranceTarget+1; // I'm not sure what's going on, so let's reset.
- }
- void addMessage(const char *message,int timer)
- {
- if(game.messageCount>9) { // we don't care about the messages, so just overwrite the first one.
- strcpy(game.message[0].text,message);
- game.message[0].timer=timer;
- return;
- }
- strcpy(game.message[game.messageCount].text,message);
- printf(">>>%s\n",message);
- game.message[game.messageCount++].timer=timer;
- }
- void newZombie(struct Actor *a)
- {
- newActor(a,"corpse","gunned");
- a->actorType=AT_ZOMBIE;
- a->wants=PT_BRAIN;
- a->state=(1<<IT_BRAIN)|(1<<IT_CONE);
- a->z=entranceTarget[0].z;
- a->y=0;
- a->x=entranceTarget[0].x;
- struct Target *t=nextTarget(0);
- if(!t) {
- // disable this actor
- } else {
- setActorTarget(a,t->x,t->z,t->angle);
- }
- }
- void newCustomer(struct Actor *a)
- {
- newActor(a,"civi","civi");
- a->actorType=AT_CUSTOMER;
- const ProductType pt[]={PT_CHOCOLATE,PT_STRAWBERRY,PT_VANILLA};
- const InventoryType it[]={IT_AMMO,IT_BRAIN,IT_CHOCOLATE,IT_STRAWBERRY,IT_VANILLA};
- a->wants=pt[(rand()>>16)%3];
- a->state=(1<<it[a->wants])|(1<<IT_CONE);
- a->z=entranceTarget[0].z;
- a->y=0;
- a->x=entranceTarget[0].x;
- struct Target *t=nextTarget(0);
- if(!t) {
- // disable this actor
- } else {
- setActorTarget(a,t->x,t->z,t->angle);
- }
- }
- void update(unsigned long elapsed)
- {
- int i;
- for(i=0;i<game.staffCount;i++) {
- updateActor(game.staff+i,elapsed);
- }
- for(i=0;i<game.customerCount;i++) {
- updateActor(game.customer+i,elapsed);
- struct Actor *a=game.customer+i;
- if(a->x==a->target[0] && a->z==a->target[2]) {
- struct Target *t=nextTarget(a);
- if(!t) {
- // disable this actor
- newCustomer(a);
- } else {
- setActorTarget(a,t->x,t->z,t->angle);
- }
- if(i==2 && (a->x!=a->target[0] || a->z!=a->target[2])) printf("C2: %.2f,%.2f -> %.2f,%.2f\n",a->x,a->z,a->target[0],a->target[2]);
- }
- }
- for(i=0;i<game.zombieCount;i++) {
- updateActor(game.zombie+i,elapsed);
- struct Actor *a=game.zombie+i;
- if(a->x==a->target[0] && a->z==a->target[2]) {
- struct Target *t=nextTarget(a);
- if(!t) {
- // disable this actor
- newZombie(a);
- } else {
- setActorTarget(a,t->x,t->z,t->angle);
- }
- }
- }
- if(game.zombieCount<4 && game.zombieCount<game.customerCount && game.timer==0) {
- game.timer=1000;
- struct Actor *a=game.zombie+game.zombieCount;
- newZombie(a);
- game.zombieCount++;
- } else if(game.customerCount<4 && game.timer==0) {
- game.timer=1000;
- struct Actor *a=game.customer+game.customerCount;
- newCustomer(a);
- game.customerCount++;
- } else {
- game.timer-=elapsed;
- if(game.timer<0) game.timer=0;
- }
- // message update
- if(game.messageCount>0) {
- game.message[0].timer-=elapsed;
- if(game.message[0].timer<0) {
- game.messageCount--;
- if(game.messageCount>0) {
- memcpy(game.message,game.message+1,sizeof(struct Message)*game.messageCount);
- }
- }
- }
- if(game.dialog) updateDialog(game.dialog,elapsed);
- // now update the camera
- if(ax!=0) game.theta+=ax/100.0f*elapsed/1000.0f;
- if(game.theta>GU_PI) game.theta-=2*GU_PI;
- if(game.theta<-GU_PI) game.theta+=2*GU_PI;
- if(ay!=0) game.phi+=ay/100.0f*elapsed/1000.0f;
- if(game.phi>GU_PI/2) game.phi=GU_PI/2;
- if(game.phi<-GU_PI/2) game.phi=-GU_PI/2;
- if(dir!=0) game.dist+=dir;
- from.x=to.x+game.dist*cosf(game.theta)*cosf(game.phi);
- from.y=to.y+game.dist*sinf(game.phi);
- from.z=to.z+game.dist*sinf(game.theta)*cosf(game.phi);
- }
- int handleAnalog(int dx,int dy)
- {
- dx-=100;
- if(dx>0 && dx<56) dx=0; else if(dx>0) dx-=56;
- if(dx>-20 && dx<20) dx=0; // extra deadzone
- dy-=100;
- if(dy>0 && dy<56) dy=0; else if(dy>0) dy-=56;
- if(dy>-20 && dy<20) dy=0; // extra deadzone
- ax=dx;
- ay=dy;
- return 0;
- }
- void handleMainMenu(button)
- {
- switch(button) {
- case BT_UP:
- playSound(SFX_MENUNEXT);
- game.selected--;
- if(game.selected<0) game.selected=mainMenuCount-1;
- break;
- case BT_DOWN:
- playSound(SFX_MENUNEXT);
- game.selected++;
- if(game.selected>=mainMenuCount) game.selected=0;
- break;
- case BT_START:
- case BT_CROSS:
- playSound(SFX_MENUSELECT);
- if(game.selected==2) {
- setMode(MODE_SETTINGS);
- break;
- } else if(game.selected==3) {
- setMode(MODE_CREDITS);
- break;
- } else if(game.selected==4) {
- exitRequest=1;
- }
- newGame();
- setMode(MODE_ORDER);
- break;
- }
- }
- void handleDay(button)
- {
- int i;
- handleActor(game.activeStaff,button);
- switch(button) {
- case BT_LEFT:
- playSound(SFX_MENUNEXT);
- game.selected=getInventorySelection(game.activeStaff);
- break;
- case BT_RIGHT:
- playSound(SFX_MENUNEXT);
- game.selected=getInventorySelection(game.activeStaff);
- break;
- case BT_UP:
- playSound(SFX_MENUNEXT);
- game.selected=getInventorySelection(game.activeStaff);
- break;
- case BT_DOWN:
- playSound(SFX_MENUNEXT);
- game.selected=getInventorySelection(game.activeStaff);
- break;
- case BT_SQUARE:
- playSound(SFX_MENUNEXT);
- game.selected=getInventorySelection(game.activeStaff);
- break;
- case BT_TRIANGLE:
- // grab the shotgun, and arm it
- playSound(SFX_LOADGUN);
- game.activeStaff->state=(1<<IT_SHOTGUN);
- break;
- case BT_CROSS:
- if(game.activeStaff->actorState==AS_WAITING && game.activeStaff->playerSelection!=BIN_NONE) {
- if(getInventorySelection(game.activeStaff)==IT_CONE) {
- playSound(SFX_CONE);
- game.activeStaff->state=(1<<IT_CONE);
- setActorAction(game.activeStaff,MT_POINT);
- }
- // scoop ice cream/etc.
- if(game.activeStaff->state&(1<<IT_CONE)) {
- playSound(SFX_SCOOP);
- game.activeStaff->state|=(1<<game.selected);
- setActorAction(game.activeStaff,MT_POINT);
- } else {
- playSound(SFX_LOSE);
- }
- }
- break;
- case BT_CIRCLE:
- // deliver the ice cream/shoot the zombie
- for(i=0;i<game.customerCount;i++) {
- if(game.activeStaff->state==game.customer[i].state) {
- playSound(SFX_WIN);
- // Make the match go away.
- printf("customer %d going away\n",i);
- game.customer[i].state=0;
- game.customer[i].wants=PT_NONE;
- game.activeStaff->state=0;
- break;
- }
- }
- for(i=0;i<game.zombieCount;i++) {
- if( game.activeStaff->state==game.zombie[i].state) {
- playSound(SFX_WIN);
- // Make the match go away.
- printf("zombie %d going away\n",i);
- game.zombie[i].state=0;
- game.zombie[i].wants=PT_NONE;
- game.activeStaff->state=0;
- }
- }
- if(game.activeStaff->state&(1<<IT_SHOTGUN)) {
- playSound(SFX_BANG);
- i=0;
- printf("zombie %d is shot\n",i);
- } else {
- playSound(SFX_LOSE);
- printf("no match for order");
- }
- game.activeStaff->state=0;
- break;
- case BT_START:
- gameMode=MODE_MAINMENU;
- break;
- }
- }
- void handleDayDown(button)
- {
- }
- int handleJoy( enum Buttons button, int up)
- {
- switch(button) {
- case BT_LTRIGGER:
- if(up==0) dir=1;
- else if(dir==1 && up==1) dir=0;
- break;
- case BT_RTRIGGER:
- if(up==0) dir=-1;
- else if(dir==-1 && up==1) dir=0;
- showFps=1-showFps;
- break;
- default:
- break;
- }
- if(up==1) {
- int rc=0;
- if(gameMode==MODE_MAINMENU) handleMainMenu(button);
- else if(gameMode==MODE_DAY) handleDay(button);
- else if(game.dialog) rc=handleDialog(game.dialog,button);
- if(gameMode==MODE_CREDITS && rc>0) setMode(MODE_MAINMENU);
- else if(gameMode==MODE_SETTINGS && rc>0) {
- if(rc==1) setMode(MODE_MAINMENU);
- else if(rc==10) replaceDialogColumnText(game.dialog,"Deactivated",FONT_SMALL,1,rc);
- else if(rc==11) replaceDialogColumnText(game.dialog,"Yes!",FONT_SMALL,1,10);
- } else if(gameMode==MODE_ORDER && rc>0) {
- if(rc==1) setMode(MODE_DAY);
- else if(rc==10) replaceDialogColumnText(game.dialog,"1",FONT_SMALL,3,rc);
- else if(rc==11) replaceDialogColumnText(game.dialog,"100",FONT_SMALL,3,10);
- }
- } else {
- if(gameMode==MODE_DAY) handleDayDown(button);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment