- added code submission for printing secret information.

- added missing TRXTCOLOR_CYAN #define.
- changed bridge things to be completely immobile towards sector plane movement. This problem again reared its ugly head in 007LTSD where the oversized bridges got messed up by some opening doors and lowering lifts. Now any plane trying to move such a thing will get blocked. Moving these things by other means still works normally, of course

SVN r3013 (trunk)
This commit is contained in:
Christoph Oelckers 2010-11-30 08:18:11 +00:00
parent 14f4a9e835
commit 5ad9e0c3b8
3 changed files with 144 additions and 6 deletions

View File

@ -68,6 +68,8 @@
#include "p_setup.h"
#include "cmdlib.h"
#include "d_net.h"
#include "v_text.h"
#include "p_lnspec.h"
extern FILE *Logfile;
extern bool insave;
@ -929,6 +931,7 @@ CCMD(nextsecret)
//
//
//-----------------------------------------------------------------------------
CCMD(currentpos)
{
AActor *mo = players[consoleplayer].mo;
@ -936,4 +939,121 @@ CCMD(currentpos)
FIXED2FLOAT(mo->x), FIXED2FLOAT(mo->y), FIXED2FLOAT(mo->z), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
}
//-----------------------------------------------------------------------------
//
// Print secret info (submitted by Karl Murks)
//
//-----------------------------------------------------------------------------
static void PrintSecretString(const char *string, bool thislevel)
{
const char *colstr = thislevel? TEXTCOLOR_YELLOW : TEXTCOLOR_CYAN;
if (string != NULL)
{
if (*string == '$')
{
if (string[1] == 'S' || string[1] == 's')
{
long secnum = strtol(string+2, (char**)&string, 10);
if (*string == ';') string++;
if (thislevel && secnum >= 0 && secnum < numsectors)
{
if (sectors[secnum].secretsector)
{
if ((sectors[secnum].special & SECRET_MASK)) colstr = TEXTCOLOR_RED;
else colstr = TEXTCOLOR_GREEN;
}
else colstr = TEXTCOLOR_ORANGE;
}
}
else if (string[1] == 'T' || string[1] == 't')
{
long tid = strtol(string+2, (char**)&string, 10);
if (*string == ';') string++;
FActorIterator it(tid);
AActor *actor;
bool foundone = false;
if (thislevel)
{
while ((actor = it.Next()))
{
if (!actor->IsKindOf(PClass::FindClass("SecretTrigger"))) continue;
foundone = true;
break;
}
}
if (foundone) colstr = TEXTCOLOR_YELLOW;
else colstr = TEXTCOLOR_RED;
}
}
FBrokenLines *brok = V_BreakLines(ConFont, screen->GetWidth()*95/100, string);
for (int k = 0; brok[k].Width >= 0; k++)
{
Printf("%s%s\n", colstr, brok[k].Text.GetChars());
}
V_FreeBrokenLines(brok);
}
}
//============================================================================
//
// Print secret hints
//
//============================================================================
CCMD(secret)
{
const char *mapname = argv.argc() < 2? level.mapname : argv[1];
bool thislevel = !stricmp(mapname, level.mapname);
bool foundsome = false;
int lumpno=Wads.CheckNumForName("SECRETS");
if (lumpno < 0) return;
FWadLump lump = Wads.OpenLumpNum(lumpno);
FString maphdr;
maphdr.Format("[%s]", mapname);
FString linebuild;
char readbuffer[1024];
bool inlevel = false;
while (lump.Gets(readbuffer, 1024))
{
if (!inlevel)
{
if (readbuffer[0] == '[')
{
inlevel = !strnicmp(readbuffer, maphdr, maphdr.Len());
if (!foundsome)
{
FString levelname;
level_info_t *info = FindLevelInfo(mapname);
levelname.Format("%s - %s\n", mapname, info->LevelName);
size_t llen = levelname.Len() - 1;
for(size_t ii=0; ii<llen; ii++) levelname += '-';
Printf(TEXTCOLOR_YELLOW"%s\n", levelname);
foundsome = true;
}
}
continue;
}
else
{
if (readbuffer[0] != '[')
{
linebuild += readbuffer;
if (linebuild.Len() < 1023 || linebuild[1022] == '\n')
{
// line complete so print it.
linebuild.Substitute("\r", "");
linebuild.StripRight(" \t\n");
PrintSecretString(linebuild, thislevel);
linebuild = "";
}
}
else inlevel = false;
}
}
}

View File

@ -4737,9 +4737,11 @@ int P_PushUp (AActor *thing, FChangePosition *cpos)
{
AActor *intersect = intersectors[firstintersect];
if (!(intersect->flags2 & MF2_PASSMOBJ) ||
(!(intersect->flags3 & MF3_ISMONSTER) &&
intersect->Mass > mymass))
{ // Can't push things more massive than ourself
(!(intersect->flags3 & MF3_ISMONSTER) && intersect->Mass > mymass) ||
(intersect->flags4 & MF4_ACTLIKEBRIDGE)
)
{
// Can't push bridges or things more massive than ourself
return 2;
}
fixed_t oldz = intersect->z;
@ -4779,9 +4781,11 @@ int P_PushDown (AActor *thing, FChangePosition *cpos)
{
AActor *intersect = intersectors[firstintersect];
if (!(intersect->flags2 & MF2_PASSMOBJ) ||
(!(intersect->flags3 & MF3_ISMONSTER) &&
intersect->Mass > mymass))
{ // Can't push things more massive than ourself
(!(intersect->flags3 & MF3_ISMONSTER) && intersect->Mass > mymass) ||
(intersect->flags4 & MF4_ACTLIKEBRIDGE)
)
{
// Can't push bridges or things more massive than ourself
return 2;
}
fixed_t oldz = intersect->z;
@ -4813,6 +4817,7 @@ void PIT_FloorDrop (AActor *thing, FChangePosition *cpos)
P_AdjustFloorCeil (thing, cpos);
if (oldfloorz == thing->floorz) return;
if (thing->flags4 & MF4_ACTLIKEBRIDGE) return; // do not move bridge things
if (thing->velz == 0 &&
(!(thing->flags & MF_NOGRAVITY) ||
@ -4856,6 +4861,11 @@ void PIT_FloorRaise (AActor *thing, FChangePosition *cpos)
if (thing->z <= thing->floorz ||
(!(thing->flags & MF_NOGRAVITY) && (thing->flags2 & MF2_FLOATBOB)))
{
if (thing->flags4 & MF4_ACTLIKEBRIDGE)
{
cpos->nofit = true;
return; // do not move bridge things
}
intersectors.Clear ();
fixed_t oldz = thing->z;
if (!(thing->flags2 & MF2_FLOATBOB))
@ -4898,6 +4908,11 @@ void PIT_CeilingLower (AActor *thing, FChangePosition *cpos)
if (thing->z + thing->height > thing->ceilingz)
{
if (thing->flags4 & MF4_ACTLIKEBRIDGE)
{
cpos->nofit = true;
return; // do not move bridge things
}
intersectors.Clear ();
fixed_t oldz = thing->z;
if (thing->ceilingz - thing->height >= thing->floorz)
@ -4935,6 +4950,8 @@ void PIT_CeilingRaise (AActor *thing, FChangePosition *cpos)
{
bool isgood = P_AdjustFloorCeil (thing, cpos);
if (thing->flags4 & MF4_ACTLIKEBRIDGE) return; // do not move bridge things
// For DOOM compatibility, only move things that are inside the floor.
// (or something else?) Things marked as hanging from the ceiling will
// stay where they are.

View File

@ -67,6 +67,7 @@ struct FBrokenLines
#define TEXTCOLOR_DARKBROWN "\034S"
#define TEXTCOLOR_PURPLE "\034T"
#define TEXTCOLOR_DARKGRAY "\034U"
#define TEXTCOLOR_CYAN "\034V"
#define TEXTCOLOR_NORMAL "\034-"
#define TEXTCOLOR_BOLD "\034+"