X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fmenu.c;h=7f44950493624f25d6ab8ccd6b67e21009d718e6;hb=0102df00b3e2485b084f11a8270a2365d1aa7cbc;hp=3d797fc944cbf019c0df7addc2153ce89118fbf9;hpb=de05b18ef2a99168b0a1a8a921a4b18ec7023833;p=flatwaifu.git diff --git a/src/menu.c b/src/menu.c index 3d797fc..7f44950 100644 --- a/src/menu.c +++ b/src/menu.c @@ -148,30 +148,27 @@ static void *csnd1,*csnd2,*msnd1,*msnd2,*msnd3,*msnd4,*msnd5,*msnd6; static int movsndt=0; static byte cbuf[32]; -static snd_t *voc=NULL; -static int voc_ch=0; +static snd_t *voc; +static int voc_ch; static void GMV_stop (void) { - if(voc) { - if(voc_ch) {S_stop(voc_ch);voc_ch=0;} - free(voc);voc=NULL; + 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) { @@ -299,8 +296,8 @@ static void GM_command (int c) { 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