- moved the GetBlend script call to the one single place where it is needed to get rid of one native AInventory method.

This commit is contained in:
Christoph Oelckers 2018-11-29 23:48:55 +01:00
parent a14b0c58bf
commit 7b63e088e1
5 changed files with 12 additions and 28 deletions

View File

@ -789,7 +789,7 @@ public:
void ObtainInventory (AActor *other); void ObtainInventory (AActor *other);
// Die. Now. // Die. Now.
virtual bool Massacre (); bool Massacre ();
// Transforms the actor into a finely-ground paste // Transforms the actor into a finely-ground paste
bool Grind(bool items); bool Grind(bool items);

View File

@ -183,28 +183,6 @@ void AInventory::DepleteOrDestroy ()
} }
} }
//===========================================================================
//
// AInventory :: GetBlend
//
// Returns a color to blend to the player's view as long as they possess this
// item.
//
//===========================================================================
PalEntry AInventory::CallGetBlend()
{
IFVIRTUAL(AInventory, GetBlend)
{
VMValue params[1] = { (DObject*)this };
int retval;
VMReturn ret(&retval);
VMCall(func, params, 1, &ret, 1);
return retval;
}
else return 0;
}
//=========================================================================== //===========================================================================
// //
// AInventory :: PrevInv // AInventory :: PrevInv

View File

@ -76,8 +76,6 @@ public:
bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function. bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function.
void DepleteOrDestroy (); // virtual on the script side. void DepleteOrDestroy (); // virtual on the script side.
PalEntry CallGetBlend(); // virtual on the script side.
bool GetNoTeleportFreeze(); // virtual on the script side.
bool DoRespawn(); bool DoRespawn();

View File

@ -282,8 +282,6 @@ int HWDrawInfo::SetFullbrightFlags(player_t *player)
auto litetype = PClass::FindActor(NAME_PowerLightAmp); auto litetype = PClass::FindActor(NAME_PowerLightAmp);
for (AInventory * in = cplayer->mo->Inventory; in; in = in->Inventory) for (AInventory * in = cplayer->mo->Inventory; in; in = in->Inventory)
{ {
//PalEntry color = in->CallGetBlend();
// Need special handling for light amplifiers // Need special handling for light amplifiers
if (in->IsKindOf(torchtype)) if (in->IsKindOf(torchtype))
{ {

View File

@ -43,6 +43,7 @@
#include "gi.h" #include "gi.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h" #include "g_levellocals.h"
#include "vm.h"
CVAR( Float, blood_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Pulled from Skulltag - changed default from 0.5 to 1.0 CVAR( Float, blood_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Pulled from Skulltag - changed default from 0.5 to 1.0
CVAR( Float, pickup_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Uses same logic as blood_fade_scalar except for pickups CVAR( Float, pickup_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Uses same logic as blood_fade_scalar except for pickups
@ -96,7 +97,16 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int
// [RH] All powerups can affect the screen blending now // [RH] All powerups can affect the screen blending now
for (AInventory *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) for (AInventory *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
{ {
PalEntry color = item->CallGetBlend (); PalEntry color = 0;
IFVIRTUALPTR(item, AInventory, GetBlend)
{
VMValue params[1] = { item };
VMReturn ret((int*)&color.d);
VMCall(func, params, 1, &ret, 1);
}
if (color.a != 0) if (color.a != 0)
{ {
V_AddBlend (color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f, blend); V_AddBlend (color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f, blend);