diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index f3cb40958..12055ebca 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -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; iiflags2 & 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. diff --git a/src/v_text.h b/src/v_text.h index 494ebb315..29dfa627b 100644 --- a/src/v_text.h +++ b/src/v_text.h @@ -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+"