- transitioned Shadow Warrior to the global mapinfo

This commit is contained in:
Christoph Oelckers 2019-12-11 02:01:11 +01:00
parent 250dd36289
commit 875678f20b
12 changed files with 43 additions and 143 deletions

View file

@ -5177,8 +5177,8 @@ repeatcase:
C_SkipComments();
mapList[j *MAXLEVELS+k].parTime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0')));
textptr += 5;
scriptSkipSpaces();
@ -5187,8 +5187,8 @@ repeatcase:
if (*(textptr+2) == ':')
{
mapList[j *MAXLEVELS+k].designerTime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0')));
textptr += 5;
scriptSkipSpaces();

View file

@ -1943,11 +1943,11 @@ static int32_t G_PrintTime_ClockPad(void)
clockpad = max(clockpad, ij);
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
for (ii=currentLevel->parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
for (ii=currentLevel->parTime/(60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij);
if (!NAM_WW2GI && currentLevel->designerTime)
{
for (ii= currentLevel->designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
for (ii= currentLevel->designerTime/(60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij);
}
}
@ -1976,13 +1976,13 @@ const char* G_PrintParTime(void)
{
if (ud.last_level < 1)
return "<invalid>";
return G_PrintTime2(currentLevel->parTime);
return G_PrintTime2(currentLevel->parTime*REALGAMETICSPERSEC);
}
const char* G_PrintDesignerTime(void)
{
if (ud.last_level < 1)
return "<invalid>";
return G_PrintTime2(currentLevel->designerTime);
return G_PrintTime2(currentLevel->designerTime*REALGAMETICSPERSEC);
}
const char* G_PrintBestTime(void)
{

View file

@ -1876,8 +1876,8 @@ static int32_t C_ParseCommand(int32_t loop)
C_SkipComments();
mapList[j *MAXLEVELS+k].parTime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0')));
textptr += 5;
C_SkipSpace();
@ -1886,8 +1886,8 @@ static int32_t C_ParseCommand(int32_t loop)
if (*(textptr+2) == ':')
{
mapList[j *MAXLEVELS+k].designerTime =
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*REALGAMETICSPERSEC*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*REALGAMETICSPERSEC);
(((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*60)+
(((*(textptr+3)-'0')*10+(*(textptr+4)-'0')));
textptr += 5;
C_SkipSpace();

View file

@ -1967,11 +1967,11 @@ static int32_t G_PrintTime_ClockPad(void)
clockpad = max(clockpad, ij);
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
{
for (ii=currentLevel->parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
for (ii=currentLevel->parTime/(60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij);
if (currentLevel->designerTime)
{
for (ii=currentLevel->designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
for (ii=currentLevel->designerTime/(60), ij=1; ii>9; ii/=10, ij++) { }
clockpad = max(clockpad, ij);
}
}
@ -2000,13 +2000,13 @@ const char* G_PrintParTime(void)
{
if (ud.last_level < 1)
return "<invalid>";
return G_PrintTime2(currentLevel->parTime);
return G_PrintTime2(currentLevel->parTime * REALGAMETICSPERSEC);
}
const char* G_PrintDesignerTime(void)
{
if (ud.last_level < 1)
return "<invalid>";
return G_PrintTime2(currentLevel->designerTime);
return G_PrintTime2(currentLevel->designerTime*REALGAMETICSPERSEC);
}
const char* G_PrintBestTime(void)
{

View file

@ -99,6 +99,7 @@ Things required to make savegames work:
#include "z_music.h"
#include "statistics.h"
#include "gstrings.h"
#include "mapinfo.h"
//#include "crc32.h"
@ -177,7 +178,6 @@ extern SWBOOL GamePaused;
short screenpeek = 0;
SWBOOL NoDemoStartup = FALSE;
SWBOOL FirstTimeIntoGame;
extern uint8_t RedBookSong[40];
SWBOOL BorderAdjust = FALSE;
SWBOOL LocationInfo = 0;
@ -982,51 +982,6 @@ YOKOHA03 MID
*/
short SongLevelNum;
//#ifndef SW_SHAREWARE
LEVEL_INFO LevelInfo[MAX_LEVELS_REG+2] =
{
{"title.map", "theme.mid", " ", " ", " " },
{"$bullet.map", "e1l01.mid", "Seppuku Station", "0 : 55", "5 : 00" },
{"$dozer.map", "e1l03.mid", "Zilla Construction", "4 : 59", "8 : 00" },
{"$shrine.map", "e1l02.mid", "Master Leep's Temple", "3 : 16", "10 : 00" },
{"$woods.map", "e1l04.mid", "Dark Woods of the Serpent", "7 : 06", "16 : 00" },
{"$whirl.map", "yokoha03.mid", "Rising Son", "5 : 30", "10 : 00" },
{"$tank.map", "nippon34.mid", "Killing Fields", "1 : 46", "4 : 00" },
{"$boat.map", "execut11.mid", "Hara-Kiri Harbor", "1 : 56", "4 : 00" },
{"$garden.map", "execut11.mid", "Zilla's Villa", "1 : 06", "2 : 00" },
{"$outpost.map", "sanai.mid", "Monastery", "1 : 23", "3 : 00" },
{"$hidtemp.map", "kotec2.mid", "Raider of the Lost Wang", "2 : 05", "4 : 10" },
{"$plax1.map", "kotec2.mid", "Sumo Sky Palace", "6 : 32", "12 : 00" },
{"$bath.map", "yokoha03.mid", "Bath House", "10 : 00", "10 : 00" },
{"$airport.map", "nippon34.mid", "Unfriendly Skies", "2 : 59", "6 : 00" },
{"$refiner.map", "kotoki12.mid", "Crude Oil", "2 : 40", "5 : 00" },
{"$newmine.map", "hoshia02.mid", "Coolie Mines", "2 : 48", "6 : 00" },
{"$subbase.map", "hoshia02.mid", "Subpen 7", "2 : 02", "4 : 00" },
{"$rock.map", "kotoki12.mid", "The Great Escape", "3 : 18", "6 : 00" },
{"$yamato.map", "sanai.mid", "Floating Fortress", "11 : 38", "20 : 00" },
{"$seabase.map", "kotec2.mid", "Water Torture", "5 : 07", "10 : 00" },
{"$volcano.map", "kotec2.mid", "Stone Rain", "9 : 15", "20 : 00" },
{"$shore.map", "kotec2.mid", "Shanghai Shipwreck", "3 : 58", "8 : 00" },
{"$auto.map", "kotec2.mid", "Auto Maul", "4 : 07", "8 : 00" },
{"tank.map", "kotec2.mid", "Heavy Metal (DM only)", "10 : 00", "10 : 00" },
{"$dmwoods.map", "kotec2.mid", "Ripper Valley (DM only)", "10 : 00", "10 : 00" },
{"$dmshrin.map", "kotec2.mid", "House of Wang (DM only)", "10 : 00", "10 : 00" },
{"$rush.map", "kotec2.mid", "Lo Wang Rally (DM only)", "10 : 00", "10 : 00" },
{"shotgun.map", "kotec2.mid", "Ruins of the Ronin (CTF)", "10 : 00", "10 : 00" },
{"$dmdrop.map", "kotec2.mid", "Killing Fields (CTF)", "10 : 00", "10 : 00" },
{NULL, NULL, NULL, NULL, NULL}
};
/*#else
LEVEL_INFO LevelInfo[MAX_LEVELS+2] = // Shareware
{
{"title.map", "theme.mid", " ", " ", " " },
{"$bullet.map", "e1l01.mid", "Seppuku Station", "0 : 55", "5 : 00" },
{"$dozer.map", "e1l03.mid", "Zilla Construction", "4 : 59", "8 : 00" },
{"$shrine.map", "e1l02.mid", "Master Leep's Temple", "3 : 16", "10 : 00" },
{"$woods.map", "e1l04.mid", "Dark Woods of the Serpent", "7 : 06", "16 : 00" },
{NULL, NULL, NULL, NULL, NULL}
};
#endif*/
FString ThemeSongs[6];
int ThemeTrack[6];
@ -1060,15 +1015,12 @@ void FindLevelInfo(char *map_name, short *level)
for (j = 1; j <= MAX_LEVELS; j++)
{
if (LevelInfo[j].LevelName)
{
if (Bstrcasecmp(map_name, LevelInfo[j].LevelName) == 0)
if (Bstrcasecmp(map_name, mapList[j].fileName.GetChars()) == 0)
{
*level = j;
return;
}
}
}
*level = 0;
return;
@ -1156,7 +1108,7 @@ InitLevel(void)
FindLevelInfo(LevelName, &Level);
if (Level > 0)
{
strcpy(LevelName, LevelInfo[Level].LevelName);
strcpy(LevelName, mapList[Level].fileName);
UserMapName[0] = '\0';
}
else
@ -1194,13 +1146,13 @@ InitLevel(void)
if (Level > 0)
{
// user map is part of game - treat it as such
strcpy(LevelName, LevelInfo[Level].LevelName);
strcpy(LevelName, mapList[Level].fileName);
UserMapName[0] = '\0';
}
}
else
{
strcpy(LevelName, LevelInfo[Level].LevelName);
strcpy(LevelName, mapList[Level].fileName);
}
}
@ -2021,11 +1973,7 @@ void LoadingLevelScreen(char *level_name)
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 170, ds,1,16);
if (UserMapName[0])
sprintf(ds,"%s",UserMapName);
else
sprintf(ds,"%s",LevelInfo[Level].Description);
auto ds = currentLevel->DisplayName();
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 180, ds,1,16);
@ -2259,7 +2207,7 @@ void BonusScreen(PLAYERp pp)
{
if (PlayingLevel <= 1)
PlayingLevel = 1;
sprintf(ds,"%s",LevelInfo[PlayingLevel].Description);
auto ds = currentLevel->DisplayName();
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(TEXT_TEST_COL(w), 20, ds,1,19);
}
@ -2283,12 +2231,12 @@ void BonusScreen(PLAYERp pp)
if (!UserMapName[0])
{
line++;
sprintf(ds,"3D Realms Best Time: %s", LevelInfo[PlayingLevel].BestTime);
sprintf(ds,"3D Realms Best Time: %d:%02d", currentLevel->designerTime/60, currentLevel->designerTime%60);
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(40, BONUS_LINE(line), ds,1,16);
line++;
sprintf(ds,"Par Time: %s", LevelInfo[PlayingLevel].ParTime);
sprintf(ds,"Par Time: %d:%02d", currentLevel->parTime/ 60, currentLevel->parTime%60);
MNU_MeasureString(ds, &w, &h);
MNU_DrawString(40, BONUS_LINE(line), ds,1,16);
}
@ -2774,16 +2722,14 @@ void InitRunLevel(void)
InitNetVars();
{
int track;
if (Level == 0)
{
track = RedBookSong[4+RANDOM_RANGE(10)];
PlaySong(nullptr, currentLevel->music, 1 + RANDOM_RANGE(10));
}
else
{
track = RedBookSong[Level];
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
}
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, track);
}
InitPrediction(&Player[myconnectindex]);
@ -2980,13 +2926,6 @@ int32_t GameInterface::app_main()
else buildputs("Detected registered GRP\n");
}
if (SW_SHAREWARE)
{
// Zero out the maps that aren't in shareware version
memset(&LevelInfo[MAX_LEVELS_SW+1], 0, sizeof(LEVEL_INFO)*(MAX_LEVELS_REG-MAX_LEVELS_SW));
GameVersion++;
}
for (i = 0; i < MAX_SW_PLAYERS; i++)
INITLIST(&Player[i].PanelSpriteList);
@ -3894,10 +3833,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
minigametext(txt_x,txt_y-7,"Follow Mode",0,2+8);
}
if (UserMapName[0])
sprintf(ds,"%s",UserMapName);
else
sprintf(ds,"%s",LevelInfo[Level].Description);
sprintf(ds,"%s",currentLevel->DisplayName());
minigametext(txt_x,txt_y,ds,0,2+8);

View file

@ -942,16 +942,6 @@ typedef struct
#define MAX_LEVELS_SW 4
#define MAX_LEVELS (isShareware ? MAX_LEVELS_SW : MAX_LEVELS_REG)
typedef struct
{
const char *LevelName;
const char *SongName;
const char *Description;
const char *BestTime;
const char *ParTime;
} LEVEL_INFO, *LEVEL_INFOp, * *LEVEL_INFOpp;
extern LEVEL_INFO LevelInfo[MAX_LEVELS_REG+2];
extern int ThemeTrack[6]; // w
extern FString ThemeSongs[6]; //

View file

@ -75,7 +75,6 @@ TO DO
*/
extern int lastUpdate;
extern uint8_t RedBookSong[40];
extern char UserMapName[80];
extern char SaveGameDescr[10][80];
extern int PlayClock;
@ -252,10 +251,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
auto game_name = G_BuildSaveName(sv->Filename);
OpenSaveGameForWrite(game_name);
// workaround until the level info here has been transitioned.
MapRecord mr;
mr.SetFileName(LevelInfo[Level].Description);
mr.labelName = LevelInfo[Level].Description;
currentLevel = &mr;
G_WriteSaveHeader(sv->SaveTitle);
fil = WriteSavegameChunk("snapshot.sw");

View file

@ -41,6 +41,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "scriptfile.h"
#include "menu/menu.h"
#include "quotemgr.h"
#include "mapinfo.h"
BEGIN_SW_NS
@ -506,7 +507,6 @@ static int cm_transtok(const char *tok, const struct _tokset *set, const unsigne
return -1;
}
static LEVEL_INFO custommaps[MAX_LEVELS_REG];
#define WM_DAMAGE 1
#define WM_WEAP 2
@ -575,7 +575,7 @@ void LoadCustomInfoFromScript(const char *filename)
mapnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
// first map file in LevelInfo[] is bogus, last map file is NULL
// first map entry may not be used, max. amount needs investigation
if (curmap < 1 || curmap > MAX_LEVELS_REG)
{
initprintf("Error: map number %d not in range 1-%d on line %s:%d\n",
@ -596,9 +596,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
//Bfree(custommaps[curmap].LevelName);
custommaps[curmap].LevelName = strdup(t);
LevelInfo[curmap].LevelName = custommaps[curmap].LevelName;
mapList[curmap].SetFileName(t);
break;
}
case CM_SONG:
@ -606,9 +604,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
//Bfree(custommaps[curmap].SongName);
custommaps[curmap].SongName = strdup(t);
LevelInfo[curmap].SongName = custommaps[curmap].SongName;
mapList[curmap].music = t;
break;
}
case CM_TITLE:
@ -616,9 +612,7 @@ void LoadCustomInfoFromScript(const char *filename)
char *t;
if (scriptfile_getstring(script, &t)) break;
//Bfree(custommaps[curmap].Description);
custommaps[curmap].Description = strdup(t);
LevelInfo[curmap].Description = custommaps[curmap].Description;
mapList[curmap].SetName(t);
break;
}
case CM_BESTTIME:
@ -627,10 +621,7 @@ void LoadCustomInfoFromScript(const char *filename)
char s[10];
if (scriptfile_getnumber(script, &n)) break;
Bsnprintf(s, 10, "%d : %02d", n/60, n%60);
//Bfree(custommaps[curmap].BestTime);
custommaps[curmap].BestTime = strdup(s);
LevelInfo[curmap].BestTime = custommaps[curmap].BestTime;
mapList[curmap].designerTime = (int)strtoll(s, nullptr, 0);
break;
}
case CM_PARTIME:
@ -639,10 +630,7 @@ void LoadCustomInfoFromScript(const char *filename)
char s[10];
if (scriptfile_getnumber(script, &n)) break;
Bsnprintf(s, 10, "%d : %02d", n/60, n%60);
//Bfree(custommaps[curmap].ParTime);
custommaps[curmap].ParTime = strdup(s);
LevelInfo[curmap].ParTime = custommaps[curmap].ParTime;
mapList[curmap].parTime = (int)strtoll(s, nullptr, 0);
break;
}
case CM_CDATRACK:
@ -668,7 +656,6 @@ void LoadCustomInfoFromScript(const char *filename)
epnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
// first map file in LevelInfo[] is bogus, last map file is NULL
if ((unsigned)--curmap >= 2u)
{
initprintf("Error: episode number %d not in range 1-2 on line %s:%d\n",
@ -715,7 +702,6 @@ void LoadCustomInfoFromScript(const char *filename)
epnumptr = script->ltextptr;
if (scriptfile_getbraces(script, &braceend)) break;
// first map file in LevelInfo[] is bogus, last map file is NULL
if ((unsigned)--curmap >= 4u)
{
initprintf("Error: skill number %d not in range 1-4 on line %s:%d\n",

View file

@ -35,10 +35,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "track.h"
#include "sector.h"
#include "gamecontrol.h"
#include "mapinfo.h"
BEGIN_SW_NS
extern uint8_t RedBookSong[40];
extern short BossSpriteNum[3];
DECISION SerpBattle[] =
@ -821,7 +821,7 @@ int DoDeathSpecial(short SpriteNum)
if (!SW_SHAREWARE)
{
// Resume the regular music - in a hack-free fashion.
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, RedBookSong[Level]);
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
}
BossSpriteNum[0] = -2;

View file

@ -72,13 +72,6 @@ int PLocked_Sounds[] =
558,557
};
uint8_t RedBookSong[40] =
{
2,4,9,12,10, // Title and ShareWare levels
5,6,8,11,12,5,10,4,6,9,7,10,8,7,9,10,11,5, // Registered levels
11,8,7,13,5,6, // Deathmatch levels
13 // Fight boss
};
// Global vars used by ambient sounds to set spritenum of ambient sounds for later lookups in
// the sprite array so FAFcansee can know the sound sprite's current sector location

View file

@ -38,10 +38,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "weapon.h"
#include "sector.h"
#include "gamecontrol.h"
#include "mapinfo.h"
BEGIN_SW_NS
extern uint8_t RedBookSong[40];
extern uint8_t playTrack;
SWBOOL serpwasseen = FALSE;
SWBOOL sumowasseen = FALSE;
@ -805,7 +805,7 @@ int DoSumoDeathMelt(short SpriteNum)
if (!SW_SHAREWARE)
{
// Resume the regular music - in a hack-free fashion.
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, RedBookSong[Level]);
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
}
BossSpriteNum[1] = -2; // Sprite is gone, set it back to keep it valid!

View file

@ -37,10 +37,10 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "track.h"
#include "fx_man.h"
#include "gamecontrol.h"
#include "mapinfo.h"
BEGIN_SW_NS
extern uint8_t RedBookSong[40];
extern short BossSpriteNum[3];
ANIMATOR InitZillaCharge;
@ -780,7 +780,7 @@ int DoZillaDeathMelt(short SpriteNum)
if (!SW_SHAREWARE)
{
// Resume the regular music - in a hack-free fashion.
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, RedBookSong[Level]);
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
}
//KeepActorOnFloor(SpriteNum);