Fixes from JonoF

git-svn-id: https://svn.eduke32.com/eduke32@241 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-22 05:20:25 +00:00
parent 07562f737e
commit d404dd8ead
6 changed files with 81 additions and 57 deletions

View file

@ -38,12 +38,15 @@ extern "C" {
#include "function.h" #include "function.h"
extern int conversion, shareware, namversion; extern int conversion, shareware, gametype;
#define GAMEDUKE 0
#define GAMENAM 1
#define VOLUMEALL (shareware==0) #define VOLUMEALL (shareware==0)
#define PLUTOPAK (conversion==14) #define PLUTOPAK (conversion==14)
#define VOLUMEONE (shareware==1) #define VOLUMEONE (shareware==1)
#define NAM (namversion==1) #define NAM (gametype==1)
#define MAXSLEEPDIST 16384 #define MAXSLEEPDIST 16384
#define SLEEPTIME 24*64 #define SLEEPTIME 24*64

View file

@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osdfuncs.h" #include "osdfuncs.h"
#include "osdcmds.h" #include "osdcmds.h"
#include "scriptfile.h" #include "scriptfile.h"
#include "grpscan.h"
//#include "crc32.h" //#include "crc32.h"
@ -8797,7 +8798,7 @@ void backtomenu(void)
} }
int shareware = 0; int shareware = 0;
int namversion = 0; int gametype = 0;
int load_script(char *szScript) int load_script(char *szScript)
{ {
@ -8878,7 +8879,6 @@ void app_main(int argc,char **argv)
else if (!Bstrcasecmp(argv[i]+1, "net")) NoSetup = TRUE; else if (!Bstrcasecmp(argv[i]+1, "net")) NoSetup = TRUE;
else if (!Bstrcasecmp(argv[i]+1, "nam")) { else if (!Bstrcasecmp(argv[i]+1, "nam")) {
strcpy(defaultduke3dgrp, "nam.grp"); strcpy(defaultduke3dgrp, "nam.grp");
namversion = 1;
} }
else if (!Bstrcasecmp(argv[i]+1, "?")) { else if (!Bstrcasecmp(argv[i]+1, "?")) {
comlinehelp(argv); comlinehelp(argv);
@ -8894,6 +8894,28 @@ void app_main(int argc,char **argv)
exit(1); exit(1);
} }
ScanGroups();
{ // try and identify the 'defaultduke3dgrp' in the set of GRPs.
// if it is found, set up the environment accordingly for the game it represents.
// if it is not found, choose the first GRP from the list of
struct grpfile *fg, *first = NULL;
int i;
for (fg = foundgrps; fg; fg=fg->next) {
for (i = 0; i<numgrpfiles; i++) if (fg->crcval == grpfiles[i].crcval) break;
if (i == numgrpfiles) continue; // unrecognised grp file
fg->game = grpfiles[i].game;
if (!first) first = fg;
if (!Bstrcasecmp(fg->name, defaultduke3dgrp)) {
gametype = grpfiles[i].game;
break;
}
}
if (!fg && first) {
Bstrcpy(defaultduke3dgrp, first->name);
gametype = first->game;
}
}
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) #if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i < 0 || (!NoSetup && ForceSetup) || CommandSetup) { if (i < 0 || (!NoSetup && ForceSetup) || CommandSetup) {
if (quitevent || !startwin_run()) { if (quitevent || !startwin_run()) {
@ -8903,22 +8925,21 @@ void app_main(int argc,char **argv)
} }
#endif #endif
if (namversion) { FreeGroups();
if (NAM) {
// overwrite the default GRP and CON so that if the user chooses // overwrite the default GRP and CON so that if the user chooses
// something different, they get what they asked for // something different, they get what they asked for
Bsprintf(defaultduke3dgrp,"nam.grp"); Bsprintf(defaultduke3dgrp,"nam.grp");
Bsprintf(confilename, "nam.con"); Bsprintf(confilename, "nam.con");
} }
if (getenv("DUKE3DGRP")) { if (getenv("DUKE3DGRP")) duke3dgrp = getenv("DUKE3DGRP");
duke3dgrp = getenv("DUKE3DGRP"); initprintf("GRP file: %s\n", duke3dgrp);
initprintf("Using `%s' as main GRP file\n", duke3dgrp);
}
initgroupfile(duke3dgrp); initgroupfile(duke3dgrp);
i = kopen4load("DUKESW.BIN",1); // JBF 20030810 i = kopen4load("DUKESW.BIN",1); // JBF 20030810
if (i!=-1) { if (i!=-1) {
initprintf("Using Shareware GRP file.\n");
shareware = 1; shareware = 1;
kclose(i); kclose(i);
} }

View file

@ -5,7 +5,8 @@
#include "cache1d.h" #include "cache1d.h"
#include "crc32.h" #include "crc32.h"
#include "startdlg.h" #include "duke3d.h"
#include "grpscan.h"
struct grpfile grpfiles[numgrpfiles] = { struct grpfile grpfiles[numgrpfiles] = {
{ "Registered Version 1.3d", 0xBBC9CE44, 26524524, GAMEDUKE, NULL }, { "Registered Version 1.3d", 0xBBC9CE44, 26524524, GAMEDUKE, NULL },

View file

@ -1,3 +1,6 @@
#ifndef __grpscan_h__
#define __grpscan_h__
// List of internally-known GRP files // List of internally-known GRP files
#define numgrpfiles 7 #define numgrpfiles 7
struct grpfile { struct grpfile {
@ -8,9 +11,7 @@ struct grpfile {
struct grpfile *next; struct grpfile *next;
} grpfiles[numgrpfiles], *foundgrps; } grpfiles[numgrpfiles], *foundgrps;
#define GAMEDUKE 0
#define GAMENAM 1
int ScanGroups(void); int ScanGroups(void);
void FreeGroups(void); void FreeGroups(void);
#endif

View file

@ -442,7 +442,7 @@ static void modval(int min, int max,int *p,short dainc,char damodify)
} }
} }
#define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<5)&2047]>>12):8 #define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):8
// #define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):probey-x>=0?(probey-x)<<2:-((probey-x)<<2) // #define MENUHIGHLIGHT(x) probey==x?-(sintable[(totalclock<<4)&2047]>>12):probey-x>=0?(probey-x)<<2:-((probey-x)<<2)
#define SHX(X) 0 #define SHX(X) 0
@ -2334,8 +2334,7 @@ cheat_for_port_credits:
"Send MP messages to all", "Send MP messages to all",
"Display other player IDs", "Display other player IDs",
"-", "-",
"-", "Show startup window",
"-",
"-", "-",
"-", "-",
"-", "-",
@ -2392,7 +2391,10 @@ cheat_for_port_credits:
case 5: if (x==io) ud.idplayers = 1-ud.idplayers; case 5: if (x==io) ud.idplayers = 1-ud.idplayers;
modval(0,1,(int *)&ud.idplayers,1,probey==io); modval(0,1,(int *)&ud.idplayers,1,probey==io);
gametextpal(d,yy, ud.idplayers ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; gametextpal(d,yy, ud.idplayers ? "On" : "Off", MENUHIGHLIGHT(io), 0); break;
case 6: if (x==io) cmenu(200); break; case 6: if (x==io) ForceSetup = 1-ForceSetup;
modval(0,1,(int *)&ForceSetup,1,probey==io);
gametextpal(d,yy, ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0); break;
case 7: if (x==io) cmenu(200); break;
default: break; default: break;
} }
gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2);

View file

@ -9,7 +9,7 @@
#include "winlayer.h" #include "winlayer.h"
#include "compat.h" #include "compat.h"
#include "startdlg.h" #include "grpscan.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
@ -117,12 +117,9 @@ static void PopulateForm(int pgs)
hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA); hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA);
for (fg = foundgrps; fg; fg=fg->next) { for (fg = foundgrps; fg; fg=fg->next) {
for (i = 0; i<numgrpfiles; i++) for (i = 0; i<numgrpfiles; i++) if (fg->crcval == grpfiles[i].crcval) break;
if (fg->crcval == grpfiles[i].crcval) break;
if (i == numgrpfiles) continue; // unrecognised grp file if (i == numgrpfiles) continue; // unrecognised grp file
Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name); Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name);
fg->game = grpfiles[i].game;
j = ListBox_AddString(hwnd, buf); j = ListBox_AddString(hwnd, buf);
ListBox_SetItemData(hwnd, j, (LPARAM)fg); ListBox_SetItemData(hwnd, j, (LPARAM)fg);
if (!Bstrcasecmp(fg->name, settings.selectedgrp)) ListBox_SetCurSel(hwnd, j); if (!Bstrcasecmp(fg->name, settings.selectedgrp)) ListBox_SetCurSel(hwnd, j);
@ -503,7 +500,6 @@ int startwin_run(void)
done = -1; done = -1;
ScanGroups();
#ifdef JFAUD #ifdef JFAUD
EnumAudioDevs(&wavedevs, NULL, NULL); EnumAudioDevs(&wavedevs, NULL, NULL);
#endif #endif
@ -517,7 +513,7 @@ int startwin_run(void)
settings.forcesetup = ForceSetup; settings.forcesetup = ForceSetup;
settings.usemouse = UseMouse; settings.usemouse = UseMouse;
settings.usejoy = UseJoystick; settings.usejoy = UseJoystick;
settings.game = namversion; settings.game = gametype;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1); PopulateForm(-1);
@ -544,7 +540,7 @@ int startwin_run(void)
UseMouse = settings.usemouse; UseMouse = settings.usemouse;
UseJoystick = settings.usejoy; UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp; duke3dgrp = settings.selectedgrp;
namversion = settings.game; gametype = settings.game;
} }
if (wavedevs) { if (wavedevs) {