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"
extern int conversion, shareware, namversion;
extern int conversion, shareware, gametype;
#define GAMEDUKE 0
#define GAMENAM 1
#define VOLUMEALL (shareware==0)
#define PLUTOPAK (conversion==14)
#define VOLUMEONE (shareware==1)
#define NAM (namversion==1)
#define NAM (gametype==1)
#define MAXSLEEPDIST 16384
#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 "osdcmds.h"
#include "scriptfile.h"
#include "grpscan.h"
//#include "crc32.h"
@ -8797,7 +8798,7 @@ void backtomenu(void)
}
int shareware = 0;
int namversion = 0;
int gametype = 0;
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, "nam")) {
strcpy(defaultduke3dgrp, "nam.grp");
namversion = 1;
}
else if (!Bstrcasecmp(argv[i]+1, "?")) {
comlinehelp(argv);
@ -8894,6 +8894,28 @@ void app_main(int argc,char **argv)
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 (i < 0 || (!NoSetup && ForceSetup) || CommandSetup) {
if (quitevent || !startwin_run()) {
@ -8903,22 +8925,21 @@ void app_main(int argc,char **argv)
}
#endif
if (namversion) {
FreeGroups();
if (NAM) {
// overwrite the default GRP and CON so that if the user chooses
// something different, they get what they asked for
Bsprintf(defaultduke3dgrp,"nam.grp");
Bsprintf(confilename, "nam.con");
}
if (getenv("DUKE3DGRP")) {
duke3dgrp = getenv("DUKE3DGRP");
initprintf("Using `%s' as main GRP file\n", duke3dgrp);
}
if (getenv("DUKE3DGRP")) duke3dgrp = getenv("DUKE3DGRP");
initprintf("GRP file: %s\n", duke3dgrp);
initgroupfile(duke3dgrp);
i = kopen4load("DUKESW.BIN",1); // JBF 20030810
if (i!=-1) {
initprintf("Using Shareware GRP file.\n");
shareware = 1;
kclose(i);
}

View file

@ -5,7 +5,8 @@
#include "cache1d.h"
#include "crc32.h"
#include "startdlg.h"
#include "duke3d.h"
#include "grpscan.h"
struct grpfile grpfiles[numgrpfiles] = {
{ "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
#define numgrpfiles 7
struct grpfile {
@ -8,9 +11,7 @@ struct grpfile {
struct grpfile *next;
} grpfiles[numgrpfiles], *foundgrps;
#define GAMEDUKE 0
#define GAMENAM 1
int ScanGroups(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 SHX(X) 0
@ -2334,8 +2334,7 @@ cheat_for_port_credits:
"Send MP messages to all",
"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;
modval(0,1,(int *)&ud.idplayers,1,probey==io);
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;
}
gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2);

View file

@ -9,7 +9,7 @@
#include "winlayer.h"
#include "compat.h"
#include "startdlg.h"
#include "grpscan.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -117,12 +117,9 @@ static void PopulateForm(int pgs)
hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA);
for (fg = foundgrps; fg; fg=fg->next) {
for (i = 0; i<numgrpfiles; i++)
if (fg->crcval == grpfiles[i].crcval) break;
for (i = 0; i<numgrpfiles; i++) if (fg->crcval == grpfiles[i].crcval) break;
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);
@ -503,7 +500,6 @@ int startwin_run(void)
done = -1;
ScanGroups();
#ifdef JFAUD
EnumAudioDevs(&wavedevs, NULL, NULL);
#endif
@ -517,7 +513,7 @@ int startwin_run(void)
settings.forcesetup = ForceSetup;
settings.usemouse = UseMouse;
settings.usejoy = UseJoystick;
settings.game = namversion;
settings.game = gametype;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1);
@ -544,7 +540,7 @@ int startwin_run(void)
UseMouse = settings.usemouse;
UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp;
namversion = settings.game;
gametype = settings.game;
}
if (wavedevs) {