From 1c9d7c28bb3eaa2a34d1337d3cbaaf10a16c0c8a Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 26 Jan 2008 03:59:34 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@600 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 13 +++++++++ polymer/eduke32/source/gameexec.c | 46 +++++++++++++++++-------------- polymer/eduke32/source/sounds.c | 8 ++++++ 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index d94550930..d7b0b6cb4 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -3736,6 +3736,19 @@ static int parsecommand(void) casecount=0; if (tempscrptr) { + int t,n; + for (i=3;i<3+tempscrptr[1]*2-2;i+=2) // sort them + { + t=tempscrptr[i];n=i; + for (j=i+2;j<3+tempscrptr[1]*2;j+=2) + if (tempscrptr[j] lValue) right=lCheckCase-1; else + if (lpCases[lCheckCase*2] < lValue) left =lCheckCase+1; else + if (lpCases[lCheckCase*2] == lValue) + { + //AddLog("Found Case Match"); + //Bsprintf(g_szBuf,"insptr=%d. lCheckCase=%d, offset=%d, &script[0]=%d", + // (int)insptr,(int)lCheckCase,lpCases[lCheckCase*2+1],(int)&script[0]); + //AddLog(g_szBuf); + // fake a 2-d Array + insptr=(int*)(lpCases[lCheckCase*2+1] + &script[0]); + //Bsprintf(g_szBuf,"insptr=%d. ", (int)insptr); + //AddLog(g_szBuf); + while (1) + { + if (parse()) + break; + } + //AddLog("Done Executing Case"); + bMatched=1; + } + if (right-left<0)break; } if (!bMatched) { diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 04d59e2f5..1f135cd8b 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -233,6 +233,14 @@ int loadsound(unsigned int num) if (num >= MAXSOUNDS || ud.config.SoundToggle == 0) return 0; if (ud.config.FXDevice < 0) return 0; + if (g_sounds[num].filename == NULL) + { +// Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num); +// FTA(113,g_player[myconnectindex].ps); + OSD_Printf("Sound (#%d) not defined!\n",num); + return 0; + } + fp = kopen4load(g_sounds[num].filename,loadfromgrouponly); if (fp == -1) {