- 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.

SVN r198 (trunk)
This commit is contained in:
Christoph Oelckers 2006-06-18 15:49:00 +00:00
parent c87e2252ed
commit a42f98af15
10 changed files with 113 additions and 29 deletions

View file

@ -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 June 17, 2006
- Finally implemented code to keep some or all of your inventory intact when - 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. :-) respawning in coop. Now the new inventory code should finally be complete. :-)

View file

@ -3811,11 +3811,22 @@ int DLevelScript::RunScript ()
ClearInventory (activator); ClearInventory (activator);
break; break;
case PCD_CLEARACTORINVENTORY:
ClearInventory (SingleActorFromTID(STACK(3), NULL));
sp--;
break;
case PCD_GIVEINVENTORY: case PCD_GIVEINVENTORY:
GiveInventory (activator, FBehavior::StaticLookupString (STACK(2)), STACK(1)); GiveInventory (activator, FBehavior::StaticLookupString (STACK(2)), STACK(1));
sp -= 2; sp -= 2;
break; break;
case PCD_GIVEACTORINVENTORY:
GiveInventory (SingleActorFromTID(STACK(3), NULL),
FBehavior::StaticLookupString (STACK(2)), STACK(1));
sp -= 3;
break;
case PCD_GIVEINVENTORYDIRECT: case PCD_GIVEINVENTORYDIRECT:
GiveInventory (activator, FBehavior::StaticLookupString (pc[0]), pc[1]); GiveInventory (activator, FBehavior::StaticLookupString (pc[0]), pc[1]);
pc += 2; pc += 2;
@ -3826,6 +3837,12 @@ int DLevelScript::RunScript ()
sp -= 2; sp -= 2;
break; break;
case PCD_TAKEACTORINVENTORY:
TakeInventory (SingleActorFromTID(STACK(3), NULL),
FBehavior::StaticLookupString (STACK(2)), STACK(1));
sp -= 3;
break;
case PCD_TAKEINVENTORYDIRECT: case PCD_TAKEINVENTORYDIRECT:
TakeInventory (activator, FBehavior::StaticLookupString (pc[0]), pc[1]); TakeInventory (activator, FBehavior::StaticLookupString (pc[0]), pc[1]);
pc += 2; pc += 2;
@ -3835,6 +3852,12 @@ int DLevelScript::RunScript ()
STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1))); STACK(1) = CheckInventory (activator, FBehavior::StaticLookupString (STACK(1)));
break; break;
case PCD_CHECKACTORINVENTORY:
STACK(1) = CheckInventory (SingleActorFromTID(STACK(2), NULL),
FBehavior::StaticLookupString (STACK(1)));
sp--;
break;
case PCD_CHECKINVENTORYDIRECT: case PCD_CHECKINVENTORYDIRECT:
PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (pc[0]))); PushToStack (CheckInventory (activator, FBehavior::StaticLookupString (pc[0])));
pc += 1; pc += 1;
@ -3964,6 +3987,17 @@ int DLevelScript::RunScript ()
STACK(1) = I_PlayMovie (FBehavior::StaticLookupString (STACK(1))); STACK(1) = I_PlayMovie (FBehavior::StaticLookupString (STACK(1)));
break; 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_GETACTORX:
case PCD_GETACTORY: case PCD_GETACTORY:
case PCD_GETACTORZ: case PCD_GETACTORZ:
@ -3982,6 +4016,7 @@ int DLevelScript::RunScript ()
break; break;
case PCD_GETACTORFLOORZ: case PCD_GETACTORFLOORZ:
case PCD_GETACTORCEILINGZ:
{ {
AActor *actor = SingleActorFromTID (STACK(1), activator); AActor *actor = SingleActorFromTID (STACK(1), activator);
@ -3989,10 +4024,15 @@ int DLevelScript::RunScript ()
{ {
STACK(1) = 0; STACK(1) = 0;
} }
else else if (pcd == PCD_GETACTORFLOORZ)
{ {
STACK(1) = actor->floorz; STACK(1) = actor->floorz;
} }
else
{
STACK(1) = actor->ceilingz;
}
} }
break; break;
@ -4048,6 +4088,19 @@ int DLevelScript::RunScript ()
} }
break; 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: case PCD_SETFLOORTRIGGER:
new DPlaneWatcher (activator, activationline, backSide, false, STACK(8), new DPlaneWatcher (activator, activationline, backSide, false, STACK(8),
STACK(7), STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1)); STACK(7), STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1));

View file

@ -483,6 +483,13 @@ public:
PCD_SETMOUSEPOINTER, // " PCD_SETMOUSEPOINTER, // "
PCD_MOVEMOUSEPOINTER, // " PCD_MOVEMOUSEPOINTER, // "
PCD_SPAWNPROJECTILE, PCD_SPAWNPROJECTILE,
PCD_GETSECTORLIGHTLEVEL,
PCD_GETACTORCEILINGZ,
PCD_SETACTORPOSITION,
PCD_CLEARACTORINVENTORY,
PCD_GIVEACTORINVENTORY,
PCD_TAKEACTORINVENTORY,
PCD_CHECKACTORINVENTORY,
PCODE_COMMAND_COUNT PCODE_COMMAND_COUNT
}; };

View file

@ -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, 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, fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid,
bool leadTarget); 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); bool P_Thing_Move (int tid, int mapspot, bool fog);
// //

View file

@ -114,6 +114,31 @@ bool P_Thing_Spawn (int tid, int type, angle_t angle, bool fog, int newtid)
// [BC] Added // [BC] Added
// [RH] Fixed // [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<ATeleportFog> (x, y, z + TELEFOGHEIGHT);
Spawn<ATeleportFog> (oldx, oldy, oldz + TELEFOGHEIGHT);
}
return true;
}
else
{
source->SetOrigin (oldx, oldy, oldz);
return false;
}
}
bool P_Thing_Move (int tid, int mapspot, bool fog) bool P_Thing_Move (int tid, int mapspot, bool fog)
{ {
FActorIterator iterator1 (tid); FActorIterator iterator1 (tid);
@ -125,27 +150,7 @@ bool P_Thing_Move (int tid, int mapspot, bool fog)
if (source != NULL && target != NULL) if (source != NULL && target != NULL)
{ {
fixed_t oldx, oldy, oldz; return P_MoveThing(source, target->x, target->y, target->z, fog);
oldx = source->x;
oldy = source->y;
oldz = source->z;
source->SetOrigin (target->x, target->y, target->z);
if (P_TestMobjLocation (source))
{
if (fog)
{
Spawn<ATeleportFog> (target->x, target->y, target->z + TELEFOGHEIGHT);
Spawn<ATeleportFog> (oldx, oldy, oldz + TELEFOGHEIGHT);
}
return true;
}
else
{
source->SetOrigin (oldx, oldy, oldz);
return false;
}
} }
return false; return false;
} }

View file

@ -2589,6 +2589,7 @@ FCanvasTexture::FCanvasTexture (const char *name, int width, int height)
bNeedsUpdate = true; bNeedsUpdate = true;
bDidUpdate = false; bDidUpdate = false;
bHasCanvas = true; bHasCanvas = true;
bFirstUpdate = true;
} }
FCanvasTexture::~FCanvasTexture () FCanvasTexture::~FCanvasTexture ()
@ -2680,7 +2681,7 @@ void FCanvasTexture::RenderView (AActor *viewpoint, int fov)
} }
float savedfov = LastFOV; float savedfov = LastFOV;
R_SetFOV (fov); R_SetFOV (fov);
R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, Width, Height); R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, Width, Height, bFirstUpdate);
R_SetFOV (savedfov); R_SetFOV (savedfov);
if (Pixels == Canvas->GetBuffer()) if (Pixels == Canvas->GetBuffer())
{ {
@ -2692,6 +2693,7 @@ void FCanvasTexture::RenderView (AActor *viewpoint, int fov)
} }
bNeedsUpdate = false; bNeedsUpdate = false;
bDidUpdate = true; bDidUpdate = true;
bFirstUpdate = false;
} }
// //

View file

@ -263,6 +263,7 @@ protected:
Span DummySpans[2]; Span DummySpans[2];
BYTE bNeedsUpdate:1; BYTE bNeedsUpdate:1;
BYTE bDidUpdate:1; BYTE bDidUpdate:1;
BYTE bFirstUpdate:1;
void MakeTexture (); void MakeTexture ();

View file

@ -98,6 +98,7 @@ static TArray<InterpolationViewer> PastViewers;
static int centerxwide; static int centerxwide;
static bool polyclipped; static bool polyclipped;
static bool r_showviewer; static bool r_showviewer;
bool r_dontmaplines;
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // 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; WallCycles = PlaneCycles = MaskedCycles = WallScanCycles = 0;
@ -1441,6 +1442,8 @@ void R_RenderActorView (AActor *actor)
MirrorFlags = 0; MirrorFlags = 0;
ActiveWallMirror = NULL; ActiveWallMirror = NULL;
r_dontmaplines = dontmaplines;
// [RH] Hack to make windows into underwater areas possible // [RH] Hack to make windows into underwater areas possible
r_fakingunderwater = false; r_fakingunderwater = false;
@ -1518,7 +1521,7 @@ void R_RenderActorView (AActor *actor)
//========================================================================== //==========================================================================
void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, 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 int saveddetail = detailxshift | (detailyshift << 1);
const bool savedviewactive = viewactive; const bool savedviewactive = viewactive;
@ -1535,7 +1538,7 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
viewwindowy = y; viewwindowy = y;
viewactive = true; viewactive = true;
R_RenderActorView (actor); R_RenderActorView (actor, dontmaplines);
RenderTarget = screen; RenderTarget = screen;
bRenderingToCanvas = false; bRenderingToCanvas = false;
@ -1579,6 +1582,7 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, int picnum, int fov)
// Yes, change its assignment to this new camera // Yes, change its assignment to this new camera
probe->Viewpoint = viewpoint; probe->Viewpoint = viewpoint;
probe->FOV = fov; probe->FOV = fov;
texture->bFirstUpdate = true;
return; return;
} }
} }
@ -1589,6 +1593,7 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, int picnum, int fov)
probe->PicNum = picnum; probe->PicNum = picnum;
probe->FOV = fov; probe->FOV = fov;
probe->Next = List; probe->Next = List;
texture->bFirstUpdate = true;
List = probe; List = probe;
} }

View file

@ -79,6 +79,8 @@ extern int loopcount;
extern int r_Yaspect; extern int r_Yaspect;
extern bool r_dontmaplines;
// //
// Lighting. // Lighting.
// //
@ -184,11 +186,11 @@ void R_SetViewAngle ();
// //
// Called by G_Drawer. // Called by G_Drawer.
void R_RenderActorView (AActor *actor); void R_RenderActorView (AActor *actor, bool dontmaplines = false);
void R_RefreshViewBorder (); void R_RefreshViewBorder ();
void R_SetupBuffer (bool inview); 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 (); void R_ResetViewInterpolation ();

View file

@ -1184,7 +1184,7 @@ void R_NewWall (bool needlights)
linedef = curline->linedef; linedef = curline->linedef;
// mark the segment as visible for auto map // mark the segment as visible for auto map
linedef->flags |= ML_MAPPED; if (!r_dontmaplines) linedef->flags |= ML_MAPPED;
midtexture = toptexture = bottomtexture = 0; midtexture = toptexture = bottomtexture = 0;