diff --git a/src/menu.c b/src/menu.c
index ff6932df60e4741b38dab3450fb49940762fe20c..7f44950493624f25d6ab8ccd6b67e21009d718e6 100644 (file)
--- a/src/menu.c
+++ b/src/menu.c
#include <stdlib.h>
#include "files.h"
#include "memory.h"
#include <stdlib.h>
#include "files.h"
#include "memory.h"
-#include "vga.h"
#include "error.h"
#include "error.h"
-#include "keyb.h"
#include "sound.h"
#include "view.h"
#include "player.h"
#include "switch.h"
#include "menu.h"
#include "misc.h"
#include "sound.h"
#include "view.h"
#include "player.h"
#include "switch.h"
#include "menu.h"
#include "misc.h"
+#include "render.h"
+#include "config.h"
+#include "game.h"
+#include "player.h"
+#include "sound.h"
+#include "music.h"
+#include "input.h"
-#include <SDL.h>
#include <sys/stat.h>
#include <sys/stat.h>
-extern SDL_Surface *screen;
#define QSND_NUM 14
enum{HIT100,ARMOR,JUMP,WPNS,IMMORTAL,SPEED,OPEN,EXIT};
#define QSND_NUM 14
enum{HIT100,ARMOR,JUMP,WPNS,IMMORTAL,SPEED,OPEN,EXIT};
-extern int PL_JUMP,PL_RUN;
-extern byte _warp,cheat,p_fly;
-
-extern byte g_music[8];
-
-extern byte savname[7][24],savok[7];
-void load_game(int);
+static byte panim[] = "BBDDAACCDDAABBDDAACCDDAABBDDAACCDDAAEEEEEFEFEFEFEFEFEFEFEFEFEEEEE";
+byte *panimp = panim;
+byte _warp;
-static byte panim[]=
- "BBDDAACCDDAABBDDAACCDDAABBDDAACCDDAAEEEEEFEFEFEFEFEFEFEFEFEFEEEEE";
-static byte *panimp=panim;
-
-#define PCOLORN 10
-byte pcolortab[PCOLORN]={
- 0x18,0x20,0x40,0x58,0x60,0x70,0x80,0xB0,0xC0,0xD0
+byte pcolortab[PCOLORN] = {
+ 0x18, 0x20, 0x40, 0x58, 0x60, 0x70, 0x80, 0xB0, 0xC0, 0xD0
};
};
-int p1color=5,p2color=4;
+int p1color = 5;
+int p2color = 4;
-static byte ibuf[24],input=0;
+char ibuf[24];
+byte input=0;
static int icur;
enum{MENU,MSG};
static int icur;
enum{MENU,MSG};
SAVE,SAVE,SAVE,SAVE,SAVE,SAVE,SAVE
};
SAVE,SAVE,SAVE,SAVE,SAVE,SAVE,SAVE
};
-static menu_t main_mnu={
+menu_t main_mnu={
MENU,5,0,80,"MENU",main_txt,main_typ
},opt_mnu={
MENU,5,0,75,"OPTIONS",opt_txt,opt_typ
MENU,5,0,80,"MENU",main_txt,main_typ
},opt_mnu={
MENU,5,0,75,"OPTIONS",opt_txt,opt_typ
static menu_t *qmsg[3]={&quit1_msg,&quit2_msg,&quit3_msg};
static menu_t *qmsg[3]={&quit1_msg,&quit2_msg,&quit3_msg};
-static menu_t *mnu=NULL;
+menu_t *mnu=NULL;
+byte gm_redraw=0;
-static byte gm_redraw=0;
-static int gm_tm=0;
short lastkey=0;
static void *csnd1,*csnd2,*msnd1,*msnd2,*msnd3,*msnd4,*msnd5,*msnd6;
static int movsndt=0;
short lastkey=0;
static void *csnd1,*csnd2,*msnd1,*msnd2,*msnd3,*msnd4,*msnd5,*msnd6;
static int movsndt=0;
-static vgaimg *msklh[2],*mbarl,*mbarm,*mbarr,*mbaro,*mslotl,*mslotm,*mslotr;
static byte cbuf[32];
static byte cbuf[32];
-static snd_t *voc=NULL;
-static int voc_ch=0;
+static snd_t *voc;
+static int voc_ch;
-void GMV_stop(void) {
- if(voc) {
- if(voc_ch) {S_stop(voc_ch);voc_ch=0;}
- free(voc);voc=NULL;
+static void GMV_stop (void) {
+ if (voc != NULL) {
+ if (voc_ch) {
+ S_stop(voc_ch);
+ voc_ch = 0;
+ }
+ S_free(voc);
+ voc = NULL;
}
}
}
}
-void GMV_say(char *nm) {
- int r,len;
- snd_t *p;
- byte *d;
-
- if((r=F_findres(nm))==-1) return;
- if(!(p=malloc((len=F_getreslen(r))+16))) return;
- p->len=len;p->rate=11000;
- p->lstart=p->llen=0;
- GMV_stop();
- F_loadres(r,p+1,0,len);
- for(d=(byte*)(p+1);len;--len,++d) *d^=128;
- voc=p;
- voc_ch=S_play(voc,-1,1024,255);
+void GMV_say (const char nm[8]) {
+ snd_t *snd = S_load(nm);
+ if (snd) {
+ GMV_stop();
+ voc = S_load(nm);
+ voc_ch = S_play(voc, 0, 255);
+ }
+}
+
+static void GM_set (menu_t *m) {
+ mnu=m;gm_redraw=1;
+ if(g_st==GS_GAME) {
+ //V_setrect(0,SCRW,0,SCRH);V_clr(0,SCRW,0,SCRH,0);//V_setrect(0,320,0,200);V_clr(0,320,0,200,0);
+ //if(_2pl) {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();w_o=SCRH/2;Z_clrst();}//if(_2pl) {V_setrect(200,120,0,200);w_o=0;Z_clrst();w_o=100;Z_clrst();}
+ //else {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();}//else {V_setrect(200,120,50,100);w_o=50;Z_clrst();}
+ //pl1.drawst=pl2.drawst=0xFF;V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200);
+ }
}
}
-void G_code(void) {
+void G_code (void) {
void *s;
s=csnd2;
if(memcmp(cbuf+32-5,"IDDQD",5)==0) {
void *s;
s=csnd2;
if(memcmp(cbuf+32-5,"IDDQD",5)==0) {
Z_sound(s,128);
}
Z_sound(s,128);
}
-void GM_set(menu_t *m) {
- mnu=m;gm_redraw=1;
- if(g_st==GS_GAME) {
- //V_setrect(0,SCRW,0,SCRH);V_clr(0,SCRW,0,SCRH,0);//V_setrect(0,320,0,200);V_clr(0,320,0,200,0);
- //if(_2pl) {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();w_o=SCRH/2;Z_clrst();}//if(_2pl) {V_setrect(200,120,0,200);w_o=0;Z_clrst();w_o=100;Z_clrst();}
- //else {V_setrect(SCRW-120,120,0,SCRH);w_o=0;Z_clrst();}//else {V_setrect(200,120,50,100);w_o=50;Z_clrst();}
- //pl1.drawst=pl2.drawst=0xFF;V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200);
- }
-}
-
-void setgamma(int);
-
-void GM_command(int c) {
+static void GM_command (int c) {
switch(c) {
case CANCEL:
GM_set(NULL);break;
case INTERP:
switch(c) {
case CANCEL:
GM_set(NULL);break;
case INTERP:
- fullscreen=!fullscreen;
- V_toggle();
+ R_toggle_fullscreen();
GM_set(mnu);
break;
case MUSIC:
GM_set(mnu);
break;
case MUSIC:
F_freemus();
GMV_stop();
#ifndef DEMO
F_freemus();
GMV_stop();
#ifndef DEMO
- c=Z_sound(M_lock(qsnd[myrand(QSND_NUM)]),256);//for(c=(Z_sound(M_lock(qsnd[random2(QSND_NUM)]),256)+9)<<16,timer=0;timer<c;);
- S_wait();
+ c = Z_sound(S_get(qsnd[myrand(QSND_NUM)]), 255);
+ S_wait();
#endif
ERR_quit();break;
case ENDGM:
#endif
ERR_quit();break;
case ENDGM:
S_volumemusic(mus_vol-8);break;
case MVOLP:
S_volumemusic(mus_vol+8);break;
S_volumemusic(mus_vol-8);break;
case MVOLP:
S_volumemusic(mus_vol+8);break;
- case GAMMAM: setgamma(gammaa-1);break;
- case GAMMAP: setgamma(gammaa+1);break;
+ case GAMMAM:
+ R_setgamma(R_getgamma() - 1);
+ break;
+ case GAMMAP:
+ R_setgamma(R_getgamma() + 1);
+ break;
}
}
}
}
-/*
-byte keychar[2][128]={{
- 0,0,'1','2','3','4','5','6','7','8','9','0','-','=',0,0,
- 'Q','W','E','R','T','Y','U','I','O','P','[',']','\r',0,'A','S',
- 'D','F','G','H','J','K','L',';','\'',0,0,'\\','Z','X','C','V',
- 'B','N','M',',','.','/',0,'*',0,' ',0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-},{
- 0,0,'!','\"','#','$','%',':','&','*','(',')','_','+',0,0,
- 'x','x','x','x','x','x','x','x','x','x','x','x','\r',0,'x','x',
- 'x','x','x','x','x','x','x','x','x',0,0,0,'x','x','x','x',
- 'x','x','x','x','x','?',0,'*',0,' ',0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,'-',0,0,0,'+',0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-}};
-*/
-
struct {
int keysym;
byte ch;
} keychar[] = {
struct {
int keysym;
byte ch;
} keychar[] = {
- {SDLK_SPACE, ' '},
- {SDLK_0, '0'},
- {SDLK_1, '1'},
- {SDLK_2, '2'},
- {SDLK_3, '3'},
- {SDLK_4, '4'},
- {SDLK_5, '5'},
- {SDLK_6, '6'},
- {SDLK_7, '7'},
- {SDLK_8, '8'},
- {SDLK_9, '9'},
- {SDLK_UNDERSCORE, '_'},
- {SDLK_a, 'A'},
- {SDLK_b, 'B'},
- {SDLK_c, 'C'},
- {SDLK_d, 'D'},
- {SDLK_e, 'E'},
- {SDLK_f, 'F'},
- {SDLK_g, 'G'},
- {SDLK_h, 'H'},
- {SDLK_i, 'I'},
- {SDLK_j, 'J'},
- {SDLK_k, 'K'},
- {SDLK_l, 'L'},
- {SDLK_m, 'M'},
- {SDLK_n, 'N'},
- {SDLK_o, 'O'},
- {SDLK_p, 'P'},
- {SDLK_q, 'Q'},
- {SDLK_r, 'R'},
- {SDLK_s, 'S'},
- {SDLK_t, 'T'},
- {SDLK_u, 'U'},
- {SDLK_v, 'V'},
- {SDLK_w, 'W'},
- {SDLK_x, 'X'},
- {SDLK_y, 'Y'},
- {SDLK_z, 'Z'},
- {SDLK_COMMA,','},
+ {KEY_SPACE, ' '},
+ {KEY_0, '0'},
+ {KEY_1, '1'},
+ {KEY_2, '2'},
+ {KEY_3, '3'},
+ {KEY_4, '4'},
+ {KEY_5, '5'},
+ {KEY_6, '6'},
+ {KEY_7, '7'},
+ {KEY_8, '8'},
+ {KEY_9, '9'},
+ //{KEY_UNDERSCORE, '_'},
+ {KEY_A, 'A'},
+ {KEY_B, 'B'},
+ {KEY_C, 'C'},
+ {KEY_D, 'D'},
+ {KEY_E, 'E'},
+ {KEY_F, 'F'},
+ {KEY_G, 'G'},
+ {KEY_H, 'H'},
+ {KEY_I, 'I'},
+ {KEY_J, 'J'},
+ {KEY_K, 'K'},
+ {KEY_L, 'L'},
+ {KEY_M, 'M'},
+ {KEY_N, 'N'},
+ {KEY_O, 'O'},
+ {KEY_P, 'P'},
+ {KEY_Q, 'Q'},
+ {KEY_R, 'R'},
+ {KEY_S, 'S'},
+ {KEY_T, 'T'},
+ {KEY_U, 'U'},
+ {KEY_V, 'V'},
+ {KEY_W, 'W'},
+ {KEY_X, 'X'},
+ {KEY_Y, 'Y'},
+ {KEY_Z, 'Z'},
+ {KEY_COMMA,','},
{0}
};
{0}
};
-byte get_keychar(int keysym)
-{
+static byte get_keychar (int keysym) {
int i = 0;
while (keychar[i].keysym) {
if (keychar[i].keysym == keysym) return keychar[i].ch;
int i = 0;
while (keychar[i].keysym) {
if (keychar[i].keysym == keysym) return keychar[i].ch;
return 0;
}
return 0;
}
-extern vgapal main_pal,std_pal;
-extern byte shot_vga;
-
-static void shot(void) {
+static void shot (void) {
+/*
static int num=1;
char fn[100];//...
#ifndef WIN32
static int num=1;
char fn[100];//...
#ifndef WIN32
#endif
SDL_SaveBMP(screen, fn);
++num;
#endif
SDL_SaveBMP(screen, fn);
++num;
+*/
}
}
-int GM_act(void) {
+int GM_act (void) {
byte c;
if(mnu==&plcolor_mnu) {
byte c;
if(mnu==&plcolor_mnu) {
lastkey=0;
return 1;
}
lastkey=0;
return 1;
}
- if(input) switch(lastkey) {
- case SDLK_RETURN: case SDLK_KP_ENTER://case 0x1C: case 0x9C:
- F_savegame(save_mnu.cur,ibuf);
- input=0;GM_set(NULL);break;
- case 1: input=0;GM_set(mnu);break;
- case SDLK_BACKSPACE://case 0x0E:
- if(icur) {ibuf[--icur]=0;GM_set(mnu);} break;
- default:
- if(icur>=23) break;
- c=get_keychar(lastkey);//c=keychar[(keys[0x2A] || keys[0x36])?1:0][lastkey];
- if(!c) break;
- ibuf[icur]=c;ibuf[++icur]=0;GM_set(mnu);
- }else {
- switch(lastkey) {
- case SDLK_ESCAPE://case 1:
- if(!mnu) {GM_set(&main_mnu);Z_sound(msnd3,128);}
- else {GM_set(NULL);Z_sound(msnd4,128);}
- break;
- case SDLK_F5:
- if(mnu) break;
- Z_sound(msnd3,128);
- GMV_say("_GAMMA");
- GM_set(&gamma_mnu);break;
- case SDLK_F4://case 0x3E:
- if(mnu) break;
- Z_sound(msnd3,128);
- GMV_say("_VOLUME");
- GM_set(&vol_mnu);break;
- case SDLK_F2://case 0x3C:
- if(mnu) break;
- if(g_st!=GS_GAME) break;
- Z_sound(msnd3,128);
- F_getsavnames();GM_set(&save_mnu);break;
- case SDLK_F3://case 0x3D:
- if(mnu) break;
- Z_sound(msnd3,128);
- F_getsavnames();GM_set(&load_mnu);break;
- case SDLK_F10://case 0x44:
- if(mnu) break;
- Z_sound(msnd3,128);
- GM_command(QUITGAME);break;
- case SDLK_UP: case SDLK_KP8://case 0x48: case 0xC8:
- if(!mnu) break;
- if(mnu->type!=MENU) break;
- if(--mnu->cur<0) mnu->cur=mnu->n-1;
- GM_set(mnu);
- Z_sound(msnd1,128);break;
- case SDLK_DOWN: case SDLK_KP5: case SDLK_KP2://case 0x50: case 0xD0: case 0x4C:
- if(!mnu) break;
- if(mnu->type!=MENU) break;
- if(++mnu->cur>=mnu->n) mnu->cur=0;
- GM_set(mnu);
- Z_sound(msnd1,128);break;
- case SDLK_LEFT: case SDLK_RIGHT: case SDLK_KP4: case SDLK_KP6://case 0x4B: case 0x4D: case 0xCB: case 0xCD:
- if(!mnu) break;
- if(mnu->type!=MENU) break;
- if(mnu->t[mnu->cur]<SVOLM) break;
- GM_command(mnu->t[mnu->cur]+((lastkey==SDLK_LEFT || lastkey==SDLK_KP4)?0:1));//GM_command(mnu->t[mnu->cur]+((lastkey==0x4B || lastkey==0xCB)?0:1));
- GM_set(mnu);
- if(!movsndt) movsndt=Z_sound((lastkey==SDLK_LEFT || lastkey==SDLK_KP4)?msnd5:msnd6,255);//if(!movsndt) movsndt=Z_sound((lastkey==0x4B || lastkey==0xCB)?msnd5:msnd6,255);
- break;
- case SDLK_RETURN: case SDLK_SPACE: case SDLK_KP_ENTER://case 0x1C: case 0x39: case 0x9C:
- if(!mnu) break;
- if(mnu->type!=MENU) break;
- if(mnu->t[mnu->cur]>=PL1CM) {
- Z_sound(msnd2,128);
- GM_command(PLCEND);
- break;
- }
- if(mnu->t[mnu->cur]>=SVOLM) break;
- Z_sound(msnd2,128);
- GM_command(mnu->t[mnu->cur]);
- break;
- case SDLK_y://case 0x15:
- if(!mnu) break;
- if(mnu->type!=MSG) break;
- Z_sound(msnd3,128);
- GM_command(mnu->t[0]);
- break;
- case SDLK_n://case 0x31:
- if(!mnu) break;
- if(mnu->type!=MSG) break;
- Z_sound(msnd4,128);
- GM_command(mnu->t[1]);
- break;
- case SDLK_F1://case 0x3B:
- if(shot_vga) {shot();Z_sound(msnd4,128);}
- break;
- }
+ if (input) {
+ switch (lastkey) {
+ case KEY_RETURN:
+ case KEY_KP_ENTER:
+ F_savegame(save_mnu.cur, ibuf);
+ input = 0;
+ GM_set(NULL);
+ break;
+ case KEY_ESCAPE:
+ input = 0;
+ GM_set(mnu);
+ break;
+ case KEY_BACKSPACE:
+ if (icur) {
+ icur -= 1;
+ ibuf[icur] = 0;
+ GM_set(mnu);
+ }
+ break;
+ default:
+ if (icur < 23) {
+ c = get_keychar(lastkey);
+ if (c != 0) {
+ ibuf[icur] = c;
+ icur += 1;
+ ibuf[icur] = 0;
+ GM_set(mnu);
+ }
+ }
+ break;
+ }
+ } else {
+ switch (lastkey) {
+ case KEY_ESCAPE:
+ if (mnu == NULL) {
+ GM_set(&main_mnu);
+ Z_sound(msnd3, 128);
+ } else {
+ GM_set(NULL);
+ Z_sound(msnd4, 128);
+ }
+ break;
+ case KEY_F5:
+ if (mnu == NULL) {
+ Z_sound(msnd3, 128);
+ GMV_say("_GAMMA");
+ GM_set(&gamma_mnu);
+ }
+ break;
+ case KEY_F4:
+ if (mnu == NULL) {
+ Z_sound(msnd3, 128);
+ GMV_say("_VOLUME");
+ GM_set(&vol_mnu);
+ }
+ break;
+ case KEY_F2:
+ if (mnu == NULL && g_st == GS_GAME) {
+ Z_sound(msnd3, 128);
+ F_getsavnames();
+ GM_set(&save_mnu);
+ }
+ break;
+ case KEY_F3:
+ if (mnu == NULL) {
+ Z_sound(msnd3, 128);
+ F_getsavnames();
+ GM_set(&load_mnu);
+ }
+ break;
+ case KEY_F10:
+ if (mnu == NULL) {
+ Z_sound(msnd3, 128);
+ GM_command(QUITGAME);
+ }
+ break;
+ case KEY_UP:
+ case KEY_KP_8:
+ if (mnu != NULL && mnu->type == MENU) {
+ mnu->cur -= 1;
+ if (mnu->cur < 0) {
+ mnu->cur = mnu->n - 1;
+ }
+ GM_set(mnu);
+ Z_sound(msnd1, 128);
+ }
+ break;
+ case KEY_DOWN:
+ case KEY_KP_5:
+ case KEY_KP_2:
+ if (mnu != NULL && mnu->type == MENU) {
+ mnu->cur += 1;
+ if (mnu->cur >= mnu->n) {
+ mnu->cur = 0;
+ }
+ GM_set(mnu);
+ Z_sound(msnd1, 128);
+ }
+ break;
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_KP_4:
+ case KEY_KP_6:
+ if (mnu != NULL && mnu->type == MENU && mnu->t[mnu->cur] >= SVOLM) {
+ GM_command(mnu->t[mnu->cur] + (lastkey == KEY_LEFT || lastkey == KEY_KP_4));
+ GM_set(mnu);
+ if (!movsndt) {
+ movsndt = Z_sound(lastkey == KEY_LEFT || lastkey == KEY_KP_4 ? msnd5 : msnd6, 255);
+ }
+ }
+ break;
+ case KEY_RETURN:
+ case KEY_SPACE:
+ case KEY_KP_ENTER:
+ if (mnu != NULL && mnu->type == MENU) {
+ if (mnu->t[mnu->cur] >= PL1CM) {
+ Z_sound(msnd2, 128);
+ GM_command(PLCEND);
+ break;
+ } else if (mnu->t[mnu->cur] < SVOLM) {
+ Z_sound(msnd2,128);
+ GM_command(mnu->t[mnu->cur]);
+ }
+ }
+ break;
+ case KEY_Y:
+ if (mnu != NULL && mnu->type == MSG) {
+ Z_sound(msnd3, 128);
+ GM_command(mnu->t[0]);
+ }
+ break;
+ case KEY_N:
+ if (mnu != NULL && mnu->type == MSG) {
+ Z_sound(msnd4, 128);
+ GM_command(mnu->t[1]);
+ }
+ break;
+ case KEY_F1:
+ if (shot_vga) {
+ shot();
+ Z_sound(msnd4, 128);
+ }
+ break;
+ }
}
}
- lastkey=0;
- return((mnu)?1:0);
+ lastkey = KEY_UNKNOWN;
+ return mnu ? 1 : 0;
}
}
-void G_keyf(int k, int press) {
+void G_keyf (int key, int down) {
int i;
int i;
-
- lastkey=k;
- if(!_2pl || cheat) {
- for(i=0;i<31;++i) cbuf[i]=cbuf[i+1];
- cbuf[31]=get_keychar(k);
+ if (down) {
+ lastkey = key;
+ if (!_2pl || cheat) {
+ for (i = 0; i < 31; ++i) {
+ cbuf[i] = cbuf[i + 1];
+ }
+ cbuf[31] = get_keychar(key);
+ }
}
}
}
}
-void GM_init(void) {
+void GM_init (void) {
#ifndef DEMO
int i;
static char nm[QSND_NUM][6]={
#ifndef DEMO
int i;
static char nm[QSND_NUM][6]={
msnd4=Z_getsnd("SWTCHX");
msnd5=Z_getsnd("SUDI");
msnd6=Z_getsnd("TUDI");
msnd4=Z_getsnd("SWTCHX");
msnd5=Z_getsnd("SUDI");
msnd6=Z_getsnd("TUDI");
- msklh[0]=M_lock(F_getresid("M_SKULL1"));
-// msklh[0]=load_vga("vga\\spr.vga","M_SKULL1");
- msklh[1]=M_lock(F_getresid("M_SKULL2"));
- mbarl=M_lock(F_getresid("M_THERML"));
- mbarm=M_lock(F_getresid("M_THERMM"));
- mbarr=M_lock(F_getresid("M_THERMR"));
- mbaro=M_lock(F_getresid("M_THERMO"));
- mslotl=M_lock(F_getresid("M_LSLEFT"));
- mslotm=M_lock(F_getresid("M_LSCNTR"));
- mslotr=M_lock(F_getresid("M_LSRGHT"));
- K_setkeyproc(G_keyf);
-}
-
-int GM_draw(void) {
- int i,j,k,y;
-
- ++gm_tm;
- V_setrect(0,SCRW,0,SCRH);//V_setrect(0,320,0,200);
- if(!mnu && !gm_redraw) return 0;
- gm_redraw=0;
- if(!mnu) return 1;
- if(mnu->type==MENU) {
- y=(200-mnu->n*16-20)/2;
- Z_gotoxy(mnu->x,y-10);Z_printbf(mnu->ttl);
- for(i=0;i<mnu->n;++i) {
- if(mnu->t[i]==LOAD || mnu->t[i]==SAVE) {
- V_spr(mnu->x,j=y+i*16+29,mslotl);
- for(k=8;k<184;k+=8)
- V_spr(mnu->x+k,j,mslotm);
- V_spr(mnu->x+184,j,mslotr);
- Z_gotoxy(mnu->x+4,j-8);
- if(input && i==save_mnu.cur) Z_printsf("%s_",ibuf);
- else Z_printsf("%s",savname[i]);
- }else{
- Z_gotoxy(mnu->x+((mnu->t[i]>=SVOLM)?((mnu->t[i]>=PL1CM)?50:152):0),y+i*16+20);
- Z_printbf(mnu->m[i]);
- }
- if(mnu->t[i]==MUSIC) {
- Z_printbf(" '%.8s'",g_music);
- }else if(mnu->t[i]==INTERP) {
- Z_printbf("%s",fullscreen?"ON":"OFF");
- }else if(mnu->t[i]>=PL1CM) {
- V_manspr(mnu->x+((mnu->t[i]==PL1CM)?15:35),y+i*16+20+14,
- PL_getspr(*panimp,0),
- pcolortab[(mnu->t[i]==PL1CM)?p1color:p2color]
- );
- }else if(mnu->t[i]>=SVOLM) {
- V_spr(mnu->x,j=y+i*16+20,mbarl);
- for(k=8;k<144;k+=8)
- V_spr(mnu->x+k,j,mbarm);
- V_spr(mnu->x+144,j,mbarr);
- switch(mnu->t[i]) {
- case SVOLM: k=snd_vol;break;
- case MVOLM: k=mus_vol;break;
- case GAMMAM: k=gammaa<<5;break;
- }
- V_spr(mnu->x+8+k,j,mbaro);
- }
- }
- V_spr(mnu->x-25,y+mnu->cur*16+20-8,msklh[(gm_tm/6)&1]);
- }else{
- Z_gotoxy((320-strlen(mnu->ttl)*7)/2,90);Z_printsf(mnu->ttl);
- Z_gotoxy(136,100);Z_printsf("(Y/N)");
- }
- return 1;
+ F_loadmus("MENU");
+ S_startmusic(0);
}
}