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"
@ -7757,10 +7758,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,"nam")) {
i++;
continue;
}
if (!Bstrcasecmp(c+1,"setup")) {
i++;
continue;
@ -8258,7 +8259,7 @@ void Logo(void)
}
KB_ClearKeysDown(); // JBF
}
fadepal(0,0,0, 0,64,7);
clearview(0L);
nextpage();
@ -8797,7 +8798,7 @@ void backtomenu(void)
}
int shareware = 0;
int namversion = 0;
int gametype = 0;
int load_script(char *szScript)
{
@ -8876,10 +8877,9 @@ void app_main(int argc,char **argv)
if (argv[i][0] != '-' && argv[i][0] != '/') continue;
if (!Bstrcasecmp(argv[i]+1, "setup")) CommandSetup = TRUE;
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, "nam")) {
strcpy(defaultduke3dgrp, "nam.grp");
}
else if (!Bstrcasecmp(argv[i]+1, "?")) {
comlinehelp(argv);
exit(0);
@ -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) {
// 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");
}
FreeGroups();
if (getenv("DUKE3DGRP")) {
duke3dgrp = getenv("DUKE3DGRP");
initprintf("Using `%s' as main GRP file\n", duke3dgrp);
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("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);
}
@ -10845,7 +10866,7 @@ FRAGBONUS:
{
gametext(10,59+9,"Your Time:",0,2+8+16);
gametext(10,69+9,"Par time:",0,2+8+16);
if (!NAM)
if (!NAM)
gametext(10,78+9,"3D Realms' Time:",0,2+8+16);
if(bonuscnt == 0)
bonuscnt++;
@ -10868,11 +10889,11 @@ FRAGBONUS:
(partime[ud.volume_number*11+ud.last_level-1]/26)%60);
gametext((320>>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 (!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);
}
}
}

View file

@ -5,16 +5,17 @@
#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 },
{ "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 },
{ "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;

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>
@ -32,7 +32,7 @@ static struct {
int forcesetup;
int usemouse, usejoy;
char selectedgrp[BMAX_PATH+1];
int game;
int game;
} settings;
static HWND startupdlg = NULL;
@ -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);
@ -175,13 +172,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;
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);
settings.game = ((struct grpfile*)i)->game;
}
if (i != CB_ERR) {
strcpy(settings.selectedgrp, ((struct grpfile*)i)->name);
settings.game = ((struct grpfile*)i)->game;
}
return TRUE;
}
default: break;
@ -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) {