diff --git a/docs/rh-log.txt b/docs/rh-log.txt index ba4085269a..97d2438e13 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,11 @@ +June 18, 2006 (Changes by Graf Zahl) +- Added another set of ACS inventory functions which take a tid for the actor + and aren't limited to the script's activator. +- Added GetSectorLightLevel(tag), GetActorCeilingZ(tid) and + SetActorPosition(tid, x, y, z, fog) ACS functions. +- Fixed: First initialization of camera textures should not mark the rendered + lines as mapped. + June 17, 2006 - Finally implemented code to keep some or all of your inventory intact when respawning in coop. Now the new inventory code should finally be complete. :-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 57aee2a3a1..ad5e2145bc 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3811,11 +3811,22 @@ int DLevelScript::RunScript () ClearInventory (activator); break; + case PCD_CLEARACTORINVENTORY: + ClearInventory (SingleActorFromTID(STACK(3), NULL)); + sp--; + break; + case PCD_GIVEINVENTORY: GiveInventory (activator, FBehavior::StaticLookupString (STACK(2)), STACK(1)); sp -= 2; break; + case PCD_GIVEACTORINVENTORY: + GiveInventory (SingleActorFromTID(STACK(3), NULL), + FBehavior::StaticLookupString (STACK(2)), STACK(1)); + sp -= 3; + break; + case PCD_GIVEINVENTORYDIRECT: GiveInventory (activator, FBehavior::StaticLookupString (pc[0]), pc[1]); pc += 2; @@ -3826,6 +3837,12 @@ int DLevelScript::RunScript () sp -= 2; break; + case PCD_TAKEACTORINVENTORY: + TakeInventory (SingleActorFromTID(STACK(3), NULL), + FBehavior::StaticLookupString (STACK(2)), STACK(1)); + sp -= 3; + break; + case PCD_TAKEINVENTORYDIRECT: TakeInventory (activator, FBehavior::StaticLookupString (pc[0]), pc[1]); pc += 2; @@ -3835,6 +3852,12 @@ int DLevelScript::RunScript () STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1))); break; + case PCD_CHECKACTORINVENTORY: + STACK(1) = CheckInventory (SingleActorFromTID(STACK(2), NULL), + FBehavior::StaticLookupString (STACK(1))); + sp--; + break; + case PCD_CHECKINVENTORYDIRECT: PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (pc[0]))); pc += 1; @@ -3964,6 +3987,17 @@ int DLevelScript::RunScript () STACK(1) = I_PlayMovie (FBehavior::StaticLookupString (STACK(1))); break; + case PCD_SETACTORPOSITION: + { + BOOL result = false; + AActor *actor = SingleActorFromTID (STACK(5), activator); + if (actor != NULL) + result = P_MoveThing(actor, STACK(4), STACK(3), STACK(2), !!STACK(1)); + sp -= 4; + STACK(1) = result; + } + break; + case PCD_GETACTORX: case PCD_GETACTORY: case PCD_GETACTORZ: @@ -3982,6 +4016,7 @@ int DLevelScript::RunScript () break; case PCD_GETACTORFLOORZ: + case PCD_GETACTORCEILINGZ: { AActor *actor = SingleActorFromTID (STACK(1), activator); @@ -3989,10 +4024,15 @@ int DLevelScript::RunScript () { STACK(1) = 0; } - else + else if (pcd == PCD_GETACTORFLOORZ) { STACK(1) = actor->floorz; } + else + { + STACK(1) = actor->ceilingz; + } + } break; @@ -4048,6 +4088,19 @@ int DLevelScript::RunScript () } break; + case PCD_GETSECTORLIGHTLEVEL: + { + int secnum = P_FindSectorFromTag (STACK(1), -1); + int z = -1; + + if (secnum >= 0) + { + z = sectors[secnum].lightlevel; + } + STACK(1) = z; + } + break; + case PCD_SETFLOORTRIGGER: new DPlaneWatcher (activator, activationline, backSide, false, STACK(8), STACK(7), STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1)); diff --git a/src/p_acs.h b/src/p_acs.h index 3895444c03..fcdca7712d 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -483,6 +483,13 @@ public: PCD_SETMOUSEPOINTER, // " PCD_MOVEMOUSEPOINTER, // " PCD_SPAWNPROJECTILE, + PCD_GETSECTORLIGHTLEVEL, + PCD_GETACTORCEILINGZ, + PCD_SETACTORPOSITION, + PCD_CLEARACTORINVENTORY, + PCD_GIVEACTORINVENTORY, + PCD_TAKEACTORINVENTORY, + PCD_CHECKACTORINVENTORY, PCODE_COMMAND_COUNT }; diff --git a/src/p_local.h b/src/p_local.h index a40a72840f..48dc8465f3 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -129,6 +129,7 @@ bool P_Thing_Spawn (int tid, int type, angle_t angle, bool fog, int newtid); bool P_Thing_Projectile (int tid, int type, const char * type_name, angle_t angle, fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid, bool leadTarget); +bool P_MoveThing(AActor * source, fixed_t x, fixed_t y, fixed_t z, bool fog); bool P_Thing_Move (int tid, int mapspot, bool fog); // diff --git a/src/p_things.cpp b/src/p_things.cpp index a49fc55305..d3732764aa 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -114,6 +114,31 @@ bool P_Thing_Spawn (int tid, int type, angle_t angle, bool fog, int newtid) // [BC] Added // [RH] Fixed +bool P_MoveThing(AActor * source, fixed_t x, fixed_t y, fixed_t z, bool fog) +{ + fixed_t oldx, oldy, oldz; + + oldx = source->x; + oldy = source->y; + oldz = source->z; + + source->SetOrigin (x, y, z); + if (P_TestMobjLocation (source)) + { + if (fog) + { + Spawn (x, y, z + TELEFOGHEIGHT); + Spawn (oldx, oldy, oldz + TELEFOGHEIGHT); + } + return true; + } + else + { + source->SetOrigin (oldx, oldy, oldz); + return false; + } +} + bool P_Thing_Move (int tid, int mapspot, bool fog) { FActorIterator iterator1 (tid); @@ -125,27 +150,7 @@ bool P_Thing_Move (int tid, int mapspot, bool fog) if (source != NULL && target != NULL) { - fixed_t oldx, oldy, oldz; - - oldx = source->x; - oldy = source->y; - oldz = source->z; - - source->SetOrigin (target->x, target->y, target->z); - if (P_TestMobjLocation (source)) - { - if (fog) - { - Spawn (target->x, target->y, target->z + TELEFOGHEIGHT); - Spawn (oldx, oldy, oldz + TELEFOGHEIGHT); - } - return true; - } - else - { - source->SetOrigin (oldx, oldy, oldz); - return false; - } + return P_MoveThing(source, target->x, target->y, target->z, fog); } return false; } diff --git a/src/r_data.cpp b/src/r_data.cpp index 3b447558be..71c30ea39d 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -2589,6 +2589,7 @@ FCanvasTexture::FCanvasTexture (const char *name, int width, int height) bNeedsUpdate = true; bDidUpdate = false; bHasCanvas = true; + bFirstUpdate = true; } FCanvasTexture::~FCanvasTexture () @@ -2680,7 +2681,7 @@ void FCanvasTexture::RenderView (AActor *viewpoint, int fov) } float savedfov = LastFOV; R_SetFOV (fov); - R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, Width, Height); + R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, Width, Height, bFirstUpdate); R_SetFOV (savedfov); if (Pixels == Canvas->GetBuffer()) { @@ -2692,6 +2693,7 @@ void FCanvasTexture::RenderView (AActor *viewpoint, int fov) } bNeedsUpdate = false; bDidUpdate = true; + bFirstUpdate = false; } // diff --git a/src/r_data.h b/src/r_data.h index 8a3b094f7c..3ed4f5e219 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -263,6 +263,7 @@ protected: Span DummySpans[2]; BYTE bNeedsUpdate:1; BYTE bDidUpdate:1; + BYTE bFirstUpdate:1; void MakeTexture (); diff --git a/src/r_main.cpp b/src/r_main.cpp index f21e2cd47a..36212e50f6 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -98,6 +98,7 @@ static TArray PastViewers; static int centerxwide; static bool polyclipped; static bool r_showviewer; +bool r_dontmaplines; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -1403,7 +1404,7 @@ void R_SetupBuffer (bool inview) // //========================================================================== -void R_RenderActorView (AActor *actor) +void R_RenderActorView (AActor *actor, bool dontmaplines) { WallCycles = PlaneCycles = MaskedCycles = WallScanCycles = 0; @@ -1441,6 +1442,8 @@ void R_RenderActorView (AActor *actor) MirrorFlags = 0; ActiveWallMirror = NULL; + r_dontmaplines = dontmaplines; + // [RH] Hack to make windows into underwater areas possible r_fakingunderwater = false; @@ -1518,7 +1521,7 @@ void R_RenderActorView (AActor *actor) //========================================================================== void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, - int x, int y, int width, int height) + int x, int y, int width, int height, bool dontmaplines) { const int saveddetail = detailxshift | (detailyshift << 1); const bool savedviewactive = viewactive; @@ -1535,7 +1538,7 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, viewwindowy = y; viewactive = true; - R_RenderActorView (actor); + R_RenderActorView (actor, dontmaplines); RenderTarget = screen; bRenderingToCanvas = false; @@ -1579,6 +1582,7 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, int picnum, int fov) // Yes, change its assignment to this new camera probe->Viewpoint = viewpoint; probe->FOV = fov; + texture->bFirstUpdate = true; return; } } @@ -1589,6 +1593,7 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, int picnum, int fov) probe->PicNum = picnum; probe->FOV = fov; probe->Next = List; + texture->bFirstUpdate = true; List = probe; } diff --git a/src/r_main.h b/src/r_main.h index 24a0cdba7a..99f483cb27 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -79,6 +79,8 @@ extern int loopcount; extern int r_Yaspect; +extern bool r_dontmaplines; + // // Lighting. // @@ -184,11 +186,11 @@ void R_SetViewAngle (); // // Called by G_Drawer. -void R_RenderActorView (AActor *actor); +void R_RenderActorView (AActor *actor, bool dontmaplines = false); void R_RefreshViewBorder (); void R_SetupBuffer (bool inview); -void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height); +void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false); void R_ResetViewInterpolation (); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 1475ea5a58..c7e74c1f79 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1184,7 +1184,7 @@ void R_NewWall (bool needlights) linedef = curline->linedef; // mark the segment as visible for auto map - linedef->flags |= ML_MAPPED; + if (!r_dontmaplines) linedef->flags |= ML_MAPPED; midtexture = toptexture = bottomtexture = 0;