From 7cd91e3fc2b1d1debcd0b004e9e59ab5893e2d07 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 22 Jul 2006 00:53:20 +0000 Subject: [PATCH] NAM support git-svn-id: https://svn.eduke32.com/eduke32@234 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/duke3d.h | 4 +- polymer/eduke32/source/game.c | 70 +++++++++++++++++--------- polymer/eduke32/source/gamedef.c | 20 ++++---- polymer/eduke32/source/misc/gameres.rc | 2 +- polymer/eduke32/source/startdlg.c | 13 ++--- polymer/eduke32/source/startdlg.h | 6 ++- polymer/eduke32/source/startwin.game.c | 10 +++- 7 files changed, 79 insertions(+), 46 deletions(-) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 775e873c5..3d496f79b 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -38,12 +38,12 @@ extern "C" { #include "function.h" -extern int conversion; -extern int shareware; +extern int conversion, shareware, namversion; #define VOLUMEALL (shareware==0) #define PLUTOPAK (conversion==14) #define VOLUMEONE (shareware==1) +#define NAM (namversion==1) #define MAXSLEEPDIST 16384 #define SLEEPTIME 24*64 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 599152641..8ad8df078 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -127,7 +127,8 @@ void pitch_test( void ); char restorepalette,screencapt,nomorelogohack; int sendmessagecommand = -1; -char *duke3dgrp = "duke3d.grp"; // JBF 20030925 +char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; +char *duke3dgrp = defaultduke3dgrp; static char *duke3ddef = "duke3d.def"; extern long lastvisinc; @@ -4498,7 +4499,7 @@ short spawn( short j, short pn ) sp->shade = -8; - if (sp->yvel == 1) + if (sp->yvel == 1 || NAM) { sp->ang = a+512; sp->xvel = 30; @@ -7755,6 +7756,10 @@ void checkcommandline(int argc,char **argv) c = argv[i]; if (((*c == '/') || (*c == '-')) && (!firstnet)) { + if (!Bstrcasecmp(c+1,"nam")) { + i++; + continue; + } if (!Bstrcasecmp(c+1,"setup")) { i++; continue; @@ -8234,23 +8239,25 @@ void Logo(void) if (logoflags & LOGO_FLAG_PLAYMUSIC) playmusic(&env_music_fn[0][0]); - fadepal(0,0,0, 0,64,7); - //ps[myconnectindex].palette = drealms; - //palto(0,0,0,63); - if (logoflags & LOGO_FLAG_3DRSCREEN) - { - setgamepalette(&ps[myconnectindex], drealms, 3); // JBF 20040308 - rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); - nextpage(); - fadepal(0,0,0, 63,0,-7); - totalclock = 0; - while( totalclock < (120*7) && !KB_KeyWaiting() ) { - handleevents(); - getpackets(); + if (!NAM) { + fadepal(0,0,0, 0,64,7); + //ps[myconnectindex].palette = drealms; + //palto(0,0,0,63); + if (logoflags & LOGO_FLAG_3DRSCREEN) + { + setgamepalette(&ps[myconnectindex], drealms, 3); // JBF 20040308 + rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); + nextpage(); + fadepal(0,0,0, 63,0,-7); + totalclock = 0; + while( totalclock < (120*7) && !KB_KeyWaiting() ) { + handleevents(); + getpackets(); + } } + KB_ClearKeysDown(); // JBF } - KB_ClearKeysDown(); // JBF - + fadepal(0,0,0, 0,64,7); clearview(0L); nextpage(); @@ -8789,6 +8796,7 @@ void backtomenu(void) } int shareware = 0; +int namversion = 0; int load_script(char *szScript) { @@ -8863,21 +8871,24 @@ void app_main(int argc,char **argv) } } - // JBF 20030925: Because it's annoying renaming GRP files whenever I want to test different game data - if (getenv("DUKE3DGRP")) { - duke3dgrp = getenv("DUKE3DGRP"); - initprintf("Using `%s' as main GRP file\n", duke3dgrp); - } - for (i=1;i>2)+71,69+9,tempbuf,0,2+8+16); + if (!NAM) { Bsprintf(tempbuf,"%0*ld:%02ld",clockpad, (designertime[ud.volume_number*11+ud.last_level-1]/(26*60)), (designertime[ud.volume_number*11+ud.last_level-1]/26)%60); gametext((320>>2)+71,78+9,tempbuf,0,2+8+16); - + } } } if( totalclock > (60*6) ) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 3b6f87559..02ca1de1c 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -5000,9 +5000,9 @@ void AddSystemVars() Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",PISTOL_WEAPON); AddGameVar(aszBuf, PISTOL_WEAPON, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_CLIP",PISTOL_WEAPON); - AddGameVar(aszBuf, 12, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?20:12, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_RELOAD",PISTOL_WEAPON); - AddGameVar(aszBuf, 27, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?50:27, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",PISTOL_WEAPON); AddGameVar(aszBuf, 2, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",PISTOL_WEAPON); @@ -5010,7 +5010,7 @@ void AddSystemVars() Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",PISTOL_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FLAGS",PISTOL_WEAPON); - AddGameVar(aszBuf, WEAPON_FLAG_RELOAD_TIMING, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?WEAPON_FLAG_HOLSTER_CLEARS_CLIP:0 | WEAPON_FLAG_RELOAD_TIMING, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SHOOTS",PISTOL_WEAPON); AddGameVar(aszBuf, SHOTSPARK1, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",PISTOL_WEAPON); @@ -5186,7 +5186,7 @@ void AddSystemVars() Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",SHRINKER_WEAPON); AddGameVar(aszBuf, 10, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",SHRINKER_WEAPON); - AddGameVar(aszBuf, 12, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?30:12, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",SHRINKER_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FLAGS",SHRINKER_WEAPON); @@ -5364,9 +5364,9 @@ void AddSystemVars() Bsprintf(aszBuf,"WEAPON%d_RELOAD",GROW_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",GROW_WEAPON); - AddGameVar(aszBuf, 4, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, 3, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",GROW_WEAPON); - AddGameVar(aszBuf, 5, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?30:5, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",GROW_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FLAGS",GROW_WEAPON); @@ -5374,15 +5374,15 @@ void AddSystemVars() Bsprintf(aszBuf,"WEAPON%d_SHOOTS",GROW_WEAPON); AddGameVar(aszBuf, GROWSPARK, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",GROW_WEAPON); - AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?2:0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SPAWN",GROW_WEAPON); - AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?SHELL:0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",GROW_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",GROW_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",GROW_WEAPON); - AddGameVar(aszBuf, EXPANDERSHOOT, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, NAM?0:EXPANDERSHOOT, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",GROW_WEAPON); AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",GROW_WEAPON); @@ -5399,7 +5399,7 @@ void AddSystemVars() AddGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); AddGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); - AddGameVar("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar("PIPEBOMB_CONTROL", NAM?PIPEBOMB_TIMER:PIPEBOMB_REMOTE, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); AddGameVar("RESPAWN_MONSTERS", (long)&ud.respawn_monsters,GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG); AddGameVar("RESPAWN_ITEMS",(long)&ud.respawn_items, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG); diff --git a/polymer/eduke32/source/misc/gameres.rc b/polymer/eduke32/source/misc/gameres.rc index ae69b2f1d..3ab066136 100644 --- a/polymer/eduke32/source/misc/gameres.rc +++ b/polymer/eduke32/source/misc/gameres.rc @@ -48,7 +48,7 @@ CAPTION "Dialog" FONT 8, "MS Shell Dlg" BEGIN CONTROL "&Game or addon:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 5, 100, 8 - CONTROL "", IDGDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_SORT | WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP, 10, 15, 226, 50 + CONTROL "", IDGDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 15, 226, 70 END 1 24 "rsrc/manifest.game.xml" diff --git a/polymer/eduke32/source/startdlg.c b/polymer/eduke32/source/startdlg.c index 61942c063..ca929b21d 100755 --- a/polymer/eduke32/source/startdlg.c +++ b/polymer/eduke32/source/startdlg.c @@ -8,12 +8,13 @@ #include "startdlg.h" struct grpfile grpfiles[numgrpfiles] = { - { "Registered Version 1.3d", 0xBBC9CE44, 26524524, NULL }, - { "Registered Version 1.4", 0x00000000, 0, NULL }, - { "Registered Version 1.5", 0xFD3DCFF1, 44356548, NULL }, - { "Shareware Version", 0x983AD923, 11035779, NULL }, - { "Mac Shareware Version", 0xC5F71561, 10444391, NULL }, - { "Mac Registered Version", 0x00000000, 0, NULL }, + { "Registered Version 1.3d", 0xBBC9CE44, 26524524, GAMEDUKE, NULL }, + { "Registered Version 1.4", 0xF514A6AC, 44348015, GAMEDUKE, NULL }, + { "Registered Version 1.5", 0xFD3DCFF1, 44356548, GAMEDUKE, NULL }, + { "Shareware Version", 0x983AD923, 11035779, GAMEDUKE, NULL }, + { "Mac Shareware Version", 0xC5F71561, 10444391, GAMEDUKE, NULL }, + { "Mac Registered Version", 0x00000000, 0, GAMEDUKE, NULL }, + { "NAM", 0x75C1F07B, 43448927, GAMENAM, NULL }, }; struct grpfile *foundgrps = NULL; diff --git a/polymer/eduke32/source/startdlg.h b/polymer/eduke32/source/startdlg.h index f15da2f08..78238fec3 100755 --- a/polymer/eduke32/source/startdlg.h +++ b/polymer/eduke32/source/startdlg.h @@ -1,12 +1,16 @@ // List of internally-known GRP files -#define numgrpfiles 6 +#define numgrpfiles 7 struct grpfile { const char *name; int crcval; int size; + int game; struct grpfile *next; } grpfiles[numgrpfiles], *foundgrps; +#define GAMEDUKE 0 +#define GAMENAM 1 + int ScanGroups(void); void FreeGroups(void); diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 77bd3e48c..f18cec4c1 100755 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -32,6 +32,7 @@ static struct { int forcesetup; int usemouse, usejoy; char selectedgrp[BMAX_PATH+1]; + int game; } settings; static HWND startupdlg = NULL; @@ -121,6 +122,7 @@ static void PopulateForm(int pgs) if (i == numgrpfiles) continue; // unrecognised grp file Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name); + fg->game = grpfiles[i].game; j = ListBox_AddString(hwnd, buf); ListBox_SetItemData(hwnd, j, (LPARAM)fg); if (!Bstrcasecmp(fg->name, settings.selectedgrp)) ListBox_SetCurSel(hwnd, j); @@ -173,9 +175,13 @@ static INT_PTR CALLBACK GamePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA switch (LOWORD(wParam)) { case IDGDATA: { int i; + if (HIWORD(wParam) != LBN_SELCHANGE) break; i = ListBox_GetCurSel((HWND)lParam); if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i); - if (i != CB_ERR) strcpy(settings.selectedgrp, ((struct grpfile*)i)->name); + if (i != CB_ERR) { + strcpy(settings.selectedgrp, ((struct grpfile*)i)->name); + settings.game = ((struct grpfile*)i)->game; + } return TRUE; } default: break; @@ -511,6 +517,7 @@ int startwin_run(void) settings.forcesetup = ForceSetup; settings.usemouse = UseMouse; settings.usejoy = UseJoystick; + settings.game = namversion; strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); PopulateForm(-1); @@ -537,6 +544,7 @@ int startwin_run(void) UseMouse = settings.usemouse; UseJoystick = settings.usejoy; duke3dgrp = settings.selectedgrp; + namversion = settings.game; } if (wavedevs) {