- removed all parental lock garbage from SW.

Better get rid of it as it's a major complication as implemented.
This commit is contained in:
Christoph Oelckers 2020-12-08 17:16:50 +01:00
parent bbb53bc717
commit 32955621f8
12 changed files with 4 additions and 494 deletions

View file

@ -1085,11 +1085,6 @@ DoBunnyQuickJump(short SpriteNum)
NewStateGroup(SpriteNum, sg_BunnyScrew);
NewStateGroup(hit_sprite, sg_BunnyScrew);
if (adult_lockout)
{
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
}
u->WaitTics = tu->WaitTics = SEC(10); // Mate for this long
return true;
}
@ -1476,8 +1471,7 @@ DoBunnyScrew(short SpriteNum)
if (RANDOM_RANGE(1000) > 990) // Bunny sex sounds
{
if (!adult_lockout)
PlaySound(DIGI_BUNNYATTACK, sp, v3df_follow);
PlaySound(DIGI_BUNNYATTACK, sp, v3df_follow);
}
u->WaitTics -= ACTORMOVETICS;

View file

@ -594,21 +594,6 @@ analyzesprites(int viewx, int viewy, int viewz, bool mirror)
continue;
}
// Diss any parentally locked sprites
if (adult_lockout)
{
if (aVoxelArray[tsp->picnum].Parental == 6145)
{
tsp->owner = -1;
tu = NULL;
}
else if (aVoxelArray[tsp->picnum].Parental > 0)
{
ASSERT(aVoxelArray[tsp->picnum].Parental >= 0 && aVoxelArray[tsp->picnum].Parental < 6145);
tsp->picnum=aVoxelArray[tsp->picnum].Parental; // Change the pic
}
}
if (tu)
{
if (tsp->statnum != STAT_DEFAULT)

View file

@ -232,7 +232,6 @@ void GameInterface::app_init()
INITLIST(&Player[i].PanelSpriteList);
LoadKVXFromScript("swvoxfil.txt"); // Load voxels from script file
LoadPLockFromScript("swplock.txt"); // Get Parental Lock setup info
LoadCustomInfoFromScript("engine/swcustom.txt"); // load the internal definitions. These also apply to the shareware version.
if (!SW_SHAREWARE)
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
@ -397,8 +396,6 @@ void InitLevel(MapRecord *maprec)
PlayerPanelSetup();
SectorSetup();
JS_InitMirrors();
JS_InitLockouts(); // Setup the lockout linked lists
JS_ToggleLockouts(); // Init lockouts on/off
PlaceSectorObjectsOnTracks();
PlaceActorsOnTracks();
@ -538,8 +535,6 @@ void TerminateLevel(void)
INITLIST(&pp->PanelSpriteList);
}
JS_UnInitLockouts();
}

View file

@ -2147,7 +2147,6 @@ int GetZadjustment(short sectnum,short hitag); // rooms.c
void InitSetup(void); // setup.c
void LoadKVXFromScript(const char *filename); // scrip2.c
void LoadPLockFromScript(const char *filename); // scrip2.c
void LoadCustomInfoFromScript(const char *filename); // scrip2.c
int PlayerInitChemBomb(PLAYERp pp); // jweapon.c

View file

@ -1080,311 +1080,6 @@ JAnalyzeSprites(tspriteptr_t tspr)
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Parental Lockout Stuff
//////////////////////////////////////////////////////////////////////////////////////////////
OrgTileList orgwalllist; // The list containing orginal wall
// pics
OrgTileList orgwalloverlist; // The list containing orginal wall
// over pics
OrgTileList orgsectorceilinglist; // The list containing orginal sector
// ceiling pics
OrgTileList orgsectorfloorlist; // The list containing orginal sector
// floor pics
void
InsertOrgTile(OrgTileP tp, OrgTileListP thelist)
{
ASSERT(tp);
// if list is empty, insert at front
if (EMPTY(thelist))
{
INSERT(thelist, tp);
return;
}
// Otherwise insert it at end
INSERT_TAIL(thelist, tp);
return;
}
OrgTileP
InitOrgTile(OrgTileListP thelist)
{
OrgTileP tp;
tp = (OrgTileP)CallocMem(sizeof(OrgTile), 1);
ASSERT(tp);
InsertOrgTile(tp, thelist);
return tp;
}
void
KillOrgTile(OrgTileP tp)
{
ASSERT(tp);
REMOVE(tp);
FreeMem(tp);
}
OrgTileP
FindOrgTile(short index, OrgTileListP thelist)
{
OrgTileP tp, next_tp;
if (EMPTY(thelist))
return NULL;
TRAVERSE(thelist, tp, next_tp)
{
if (tp->index == index)
return tp;
}
return NULL;
}
// Call this at terminate game time
void
JS_UnInitLockouts(void)
{
OrgTileP tp=NULL, next_tp=NULL;
if (orgwalllist.Next)
{
TRAVERSE(&orgwalllist, tp, next_tp)
{
KillOrgTile(tp);
}
}
if (orgwalloverlist.Next)
{
TRAVERSE(&orgwalloverlist, tp, next_tp)
{
KillOrgTile(tp);
}
}
if (orgsectorceilinglist.Next)
{
TRAVERSE(&orgsectorceilinglist, tp, next_tp)
{
KillOrgTile(tp);
}
}
if (orgsectorfloorlist.Next)
{
TRAVERSE(&orgsectorfloorlist, tp, next_tp)
{
KillOrgTile(tp);
}
}
}
/////////////////////////////////////////////////////
// Initialize the original tiles list
// Creates a list of all orginal tiles and their
// replacements. Several tiles can use the same
// replacement tilenum, so the list is built
// using the original tilenums as a basis for
// memory allocation
// t == 1 - wall
// t == 2 - overpicnum
// t == 3 - ceiling
// t == 4 - floor
/////////////////////////////////////////////////////
void
JS_PlockError(short wall_num, short t)
{
Printf("ERROR: JS_InitLockouts(), out of range tile number\n");
switch (t)
{
case 1:
Printf("wall %d, x %d, y %d, pic %d\n", wall_num, wall[wall_num].x, wall[wall_num].y, wall[wall_num].picnum);
break;
case 2:
Printf("wall %d, x %d, y %d, OVERpic %d\n", wall_num, wall[wall_num].x, wall[wall_num].y, wall[wall_num].overpicnum);
break;
case 3:
Printf("sector %d, ceiling %d\n", wall_num, sector[wall_num].ceilingpicnum);
break;
case 4:
Printf("sector %d, floor %d\n", wall_num, sector[wall_num].floorpicnum);
break;
}
}
void
JS_InitLockouts(void)
{
short i;
OrgTileP tp;
INITLIST(&orgwalllist); // The list containing orginal wall
// pics
INITLIST(&orgwalloverlist); // The list containing orginal wall
// over pics
INITLIST(&orgsectorceilinglist); // The list containing orginal sector
// ceiling pics
INITLIST(&orgsectorfloorlist); // The list containing orginal sector
// floor pics
// Check all walls
for (i = 0; i < numwalls; i++)
{
short picnum;
picnum = wall[i].picnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 1);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgwalllist)) == NULL)
tp = InitOrgTile(&orgwalllist);
tp->index = i;
tp->orgpicnum = wall[i].picnum;
}
picnum = wall[i].overpicnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 2);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgwalloverlist)) == NULL)
tp = InitOrgTile(&orgwalloverlist);
tp->index = i;
tp->orgpicnum = wall[i].overpicnum;
}
}
// Check all ceilings and floors
for (i = 0; i < numsectors; i++)
{
short picnum;
picnum = sector[i].ceilingpicnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 3);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgsectorceilinglist)) == NULL)
tp = InitOrgTile(&orgsectorceilinglist);
tp->index = i;
tp->orgpicnum = sector[i].ceilingpicnum;
}
picnum = sector[i].floorpicnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 2);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgsectorfloorlist)) == NULL)
tp = InitOrgTile(&orgsectorfloorlist);
tp->index = i;
tp->orgpicnum = sector[i].floorpicnum;
}
}
}
/////////////////////////////////////////////////////
// Switch back and forth between locked out stuff
/////////////////////////////////////////////////////
void
JS_ToggleLockouts(void)
{
short i;
OrgTileP tp;
// Check all walls
for (i = 0; i < numwalls; i++)
{
short picnum;
if (adult_lockout)
{
picnum = wall[i].picnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
wall[i].picnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgwalllist)) != NULL)
wall[i].picnum = tp->orgpicnum; // Restore them
if (adult_lockout)
{
picnum = wall[i].overpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
wall[i].overpicnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgwalloverlist)) != NULL)
wall[i].overpicnum = tp->orgpicnum; // Restore them
}
// Check all sectors
for (i = 0; i < numsectors; i++)
{
short picnum;
if (adult_lockout)
{
picnum = sector[i].ceilingpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
sector[i].ceilingpicnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgsectorceilinglist)) != NULL)
sector[i].ceilingpicnum = tp->orgpicnum; // Restore them
if (adult_lockout)
{
picnum = sector[i].floorpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
sector[i].floorpicnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgsectorfloorlist)) != NULL)
sector[i].floorpicnum = tp->orgpicnum; // Restore them
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
void

View file

@ -73,9 +73,6 @@ void JAnalyzeSprites(tspriteptr_t tspr);
void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz);
void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,fixed_t tpq16ang,fixed_t tpq16horiz);
void JS_InitMirrors(void);
void JS_InitLockouts(void);
void JS_ToggleLockouts(void);
void JS_UnInitLockouts(void);
void JS_ProcessEchoSpot(void);
void JS_SpriteSetup(void);

View file

@ -6956,7 +6956,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
break;
}
if (pp->Bloody && !adult_lockout)
if (pp->Bloody)
{
switch (picnum)
{

View file

@ -34,40 +34,9 @@ BEGIN_SW_NS
typedef struct TILE_INFO_TYPE
{
short Voxel; // Voxel Number to replace sprites with
short Parental; // Tile offset to replace adult tiles with when locked out
// 0 = Invisible
} ParentalStruct;
struct ORG_TILE;
typedef struct ORG_TILE OrgTile, *OrgTileP;
struct ORG_TILE_LIST;
typedef struct ORG_TILE_LIST OrgTileList, *OrgTileListP;
void JS_InitLockouts(void);
void JS_UnitInitLockouts(void);
void JS_ToggleLockouts(void);
struct ORG_TILE
{
OrgTileP Next, Prev;
short index;
short orgpicnum;
};
struct ORG_TILE_LIST
{
OrgTileP Next, Prev;
};
extern OrgTileList orgwalllist; // The list containing orginal wall
// pics
extern OrgTileList orgwalloverlist; // The list containing orginal wall
// over pics
extern OrgTileList orgsectorceilinglist; // The list containing orginal sector
// ceiling pics
extern OrgTileList orgsectorfloorlist; // The list containing orginal sector
// floor pics
END_SW_NS
#endif

View file

@ -88,8 +88,6 @@ extern short BossSpriteNum[3];
extern STATE s_NotRestored[];
OrgTileListP otlist[] = {&orgwalllist, &orgwalloverlist, &orgsectorceilinglist, &orgsectorfloorlist};
int PanelSpriteToNdx(PLAYERp pp, PANEL_SPRITEp psprite)
{
short ndx = 0;
@ -219,7 +217,6 @@ bool GameInterface::SaveGame()
PANEL_SPRITEp psp,cur,next;
SECTOR_OBJECTp sop;
int saveisshot=0;
OrgTileP otp, next_otp;
Saveable_Init();
@ -565,20 +562,6 @@ bool GameInterface::SaveGame()
saveisshot |= so_writeinterpolations(fil);
assert(!saveisshot);
// parental lock
for (i = 0; i < (int)SIZ(otlist); i++)
{
ndx = 0;
TRAVERSE(otlist[i], otp, next_otp)
{
MWRITE(&ndx,sizeof(ndx),1,fil);
MWRITE(&otp,sizeof(*otp),1,fil);
ndx++;
}
ndx = -1;
MWRITE(&ndx, sizeof(ndx),1,fil);
}
// mirror
MWRITE(mirror,sizeof(mirror),1,fil);
MWRITE(&mirrorcnt,sizeof(mirrorcnt),1,fil);
@ -636,7 +619,6 @@ bool GameInterface::LoadGame()
SECT_USERp sectu;
ANIMp a;
PANEL_SPRITEp psp,next;
OrgTileP otp;
Saveable_Init();
@ -756,31 +738,6 @@ bool GameInterface::LoadGame()
MREAD(u,sizeof(USER),1,fil);
memset((void*)&u->rotator, 0, sizeof(u->rotator));
#if 0
if (u->WallShade)
{
u->WallShade = (int8_t*)CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
MREAD(u->WallShade, sizeof(*u->WallShade) * u->WallCount, 1, fil);
}
if (u->rotator)
{
u->rotator.Alloc();
MREAD(u->rotator,sizeof(*u->rotator),1,fil);
if (u->rotator->origx)
{
u->rotator->origx = (int*)CallocMem(u->rotator->num_walls * sizeof(*u->rotator->origx), 1);
MREAD(u->rotator->origx,sizeof(*u->rotator->origx)*u->rotator->num_walls,1,fil);
}
if (u->rotator->origy)
{
u->rotator->origy = (int*)CallocMem(u->rotator->num_walls * sizeof(*u->rotator->origy), 1);
MREAD(u->rotator->origy,sizeof(*u->rotator->origy)*u->rotator->num_walls,1,fil);
}
}
#endif
saveisshot |= LoadSymDataInfo(fil, (void **)&u->WallP);
saveisshot |= LoadSymDataInfo(fil, (void **)&u->State);
saveisshot |= LoadSymDataInfo(fil, (void **)&u->Rot);
@ -911,26 +868,6 @@ bool GameInterface::LoadGame()
saveisshot |= so_readinterpolations(fil);
if (saveisshot) { MCLOSE_READ(fil); return false; }
// parental lock
for (i = 0; i < (int)SIZ(otlist); i++)
{
INITLIST(otlist[i]);
while (true)
{
MREAD(&ndx, sizeof(ndx),1,fil);
if (ndx == -1)
break;
otp = (OrgTileP)CallocMem(sizeof(*otp), 1);
ASSERT(otp);
MREAD(otp, sizeof(*otp),1,fil);
INSERT_TAIL(otlist[i],otp);
}
}
// mirror
MREAD(mirror,sizeof(mirror),1,fil);
MREAD(&mirrorcnt,sizeof(mirrorcnt),1,fil);

View file

@ -199,11 +199,6 @@ void LoadKVXFromScript(const char* filename)
// zero out the array memory with -1's for pics not being voxelized
memset(&aVoxelArray[0], -1, sizeof(struct TILE_INFO_TYPE) * MAXTILES);
for (grabbed = 0; grabbed < MAXTILES; grabbed++)
{
aVoxelArray[grabbed].Voxel = -1;
aVoxelArray[grabbed].Parental = -1;
}
grabbed = 0;
@ -249,53 +244,6 @@ void LoadKVXFromScript(const char* filename)
script_p = NULL;
}
// Load in info for all Parental lock tile targets
// # - Comment
// tilenumber (in artfile), replacement tile offset (if any)
// Ex. 1803 -1 -1 = No tile replacement
// 1804 2000
// etc....
void LoadPLockFromScript(const char *filename)
{
int lNumber=0,lTile=0; // lNumber is the voxel no. and lTile is the editart tile being
// replaced.
int grabbed=0; // Number of lines parsed
// Load the file
auto buffer = LoadScriptFile(filename);
if (!buffer.Size())
{
return;
}
script_p = (char*)buffer.Data();
scriptend_p = (char*)&buffer.Last();
do
{
GetToken(true); // Crossing a line boundary on the end of line to first token
// of a new line is permitted (and expected)
if (endofscript)
break;
lTile = atoi(token);
GetToken(false);
lNumber = atoi(token);
// Store the sprite and voxel numbers for later use
aVoxelArray[lTile].Parental = lNumber; // Replacement to tile, -1 for none
grabbed++;
ASSERT(grabbed < MAXSPRITES);
}
while (script_p < scriptend_p);
script_p = NULL;
}
/*
* Here begins JonoF's modding enhancement stuff
*/

View file

@ -625,15 +625,6 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
return -1;
SPRITEp sps = sp;
// Weed out parental lock sounds if PLock is active
if (adult_lockout)
{
for (unsigned i = 0; i < sizeof(PLocked_Sounds); i++)
{
if (num == PLocked_Sounds[i])
return -1;
}
}
auto vp = &voc[num];
int sourcetype = SOURCE_None;
@ -693,7 +684,7 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
void PlaySoundRTS(int rts_num)
{
if (!adult_lockout && SoundEnabled() && RTS_IsInitialized() && snd_speech)
if (SoundEnabled() && RTS_IsInitialized() && snd_speech)
{
auto sid = RTS_GetSoundID(rts_num - 1);
if (sid != -1)

View file

@ -5713,7 +5713,7 @@ KeyMain:
// Say something witty
if (pp == Player+myconnectindex)
{
int cookie = (adult_lockout)? STD_RANDOM_RANGE(10) : STD_RANDOM_RANGE(MAX_FORTUNES);
int cookie = STD_RANDOM_RANGE(MAX_FORTUNES);
// print to the console, and the user quote display.
FStringf msg("%s %s", GStrings("TXTS_FORTUNE"), quoteMgr.GetQuote(QUOTE_COOKIE + cookie));
Printf(PRINT_NONOTIFY, TEXTCOLOR_SAPPHIRE "%s\n", msg.GetChars());