Add A_SetBlendMode action

This commit is contained in:
Jaime Ita Passos 2021-04-27 00:09:53 -03:00
parent 1355a82aa5
commit cea36c6da0
5 changed files with 35 additions and 2 deletions

View file

@ -219,6 +219,7 @@ actionpointer_t actionpointers[] =
{{A_SetTargetsTarget}, "A_SETTARGETSTARGET"}, {{A_SetTargetsTarget}, "A_SETTARGETSTARGET"},
{{A_SetObjectFlags}, "A_SETOBJECTFLAGS"}, {{A_SetObjectFlags}, "A_SETOBJECTFLAGS"},
{{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"}, {{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"},
{{A_SetBlendMode}, "A_SETBLENDMODE"},
{{A_RandomState}, "A_RANDOMSTATE"}, {{A_RandomState}, "A_RANDOMSTATE"},
{{A_RandomStateRange}, "A_RANDOMSTATERANGE"}, {{A_RandomStateRange}, "A_RANDOMSTATERANGE"},
{{A_DualAction}, "A_DUALACTION"}, {{A_DualAction}, "A_DUALACTION"},

View file

@ -175,6 +175,7 @@ enum actionnum
A_SETTARGETSTARGET, A_SETTARGETSTARGET,
A_SETOBJECTFLAGS, A_SETOBJECTFLAGS,
A_SETOBJECTFLAGS2, A_SETOBJECTFLAGS2,
A_SETBLENDMODE,
A_RANDOMSTATE, A_RANDOMSTATE,
A_RANDOMSTATERANGE, A_RANDOMSTATERANGE,
A_DUALACTION, A_DUALACTION,
@ -441,6 +442,7 @@ void A_ZThrust();
void A_SetTargetsTarget(); void A_SetTargetsTarget();
void A_SetObjectFlags(); void A_SetObjectFlags();
void A_SetObjectFlags2(); void A_SetObjectFlags2();
void A_SetBlendMode();
void A_RandomState(); void A_RandomState();
void A_RandomStateRange(); void A_RandomStateRange();
void A_DualAction(); void A_DualAction();

View file

@ -12,6 +12,7 @@
#include "doomdef.h" #include "doomdef.h"
#include "fastcmp.h" #include "fastcmp.h"
#include "r_data.h"
#include "r_skins.h" #include "r_skins.h"
#include "p_local.h" #include "p_local.h"
#include "g_game.h" #include "g_game.h"
@ -654,8 +655,13 @@ static int mobj_set(lua_State *L)
break; break;
} }
case mobj_blendmode: case mobj_blendmode:
mo->blendmode = (INT32)luaL_checkinteger(L, 3); {
INT32 blendmode = (INT32)luaL_checkinteger(L, 3);
if (blendmode < 0 || blendmode > AST_OVERLAY)
return luaL_error(L, "mobj.blendmode %d out of range (0 - %d).", blendmode, AST_OVERLAY);
mo->blendmode = blendmode;
break; break;
}
case mobj_bnext: case mobj_bnext:
return NOSETPOS; return NOSETPOS;
case mobj_bprev: case mobj_bprev:

View file

@ -197,6 +197,7 @@ void A_ZThrust(mobj_t *actor);
void A_SetTargetsTarget(mobj_t *actor); void A_SetTargetsTarget(mobj_t *actor);
void A_SetObjectFlags(mobj_t *actor); void A_SetObjectFlags(mobj_t *actor);
void A_SetObjectFlags2(mobj_t *actor); void A_SetObjectFlags2(mobj_t *actor);
void A_SetBlendMode(mobj_t *actor);
void A_RandomState(mobj_t *actor); void A_RandomState(mobj_t *actor);
void A_RandomStateRange(mobj_t *actor); void A_RandomStateRange(mobj_t *actor);
void A_DualAction(mobj_t *actor); void A_DualAction(mobj_t *actor);
@ -9085,6 +9086,29 @@ void A_SetObjectFlags2(mobj_t *actor)
actor->flags2 = locvar1; actor->flags2 = locvar1;
} }
// Function: A_SetBlendMode
//
// Description: Sets the blend mode of an object
//
// var1 = blend mode to set
// var2 = unused
//
void A_SetBlendMode(mobj_t *actor)
{
INT32 locvar1 = var1;
if (LUA_CallAction(A_SETBLENDMODE, actor))
return;
if (locvar1 < 0 || locvar1 > AST_OVERLAY)
{
CONS_Debug(DBG_GAMELOGIC, "Blend mode %d out of range!\n", locvar1);
return;
}
actor->blendmode = locvar1;
}
// Function: A_BossJetFume // Function: A_BossJetFume
// //
// Description: Spawns jet fumes/other attachment miscellany for the boss. To only be used when he is spawned. // Description: Spawns jet fumes/other attachment miscellany for the boss. To only be used when he is spawned.

View file

@ -341,7 +341,7 @@ UINT8 *R_GetBlendTable(int style, INT32 alphalevel)
{ {
size_t offs; size_t offs;
if (style == AST_COPY || style == AST_OVERLAY) if (style <= AST_COPY || style >= AST_OVERLAY)
return NULL; return NULL;
offs = (ClipBlendLevel(style, alphalevel) << FF_TRANSSHIFT); offs = (ClipBlendLevel(style, alphalevel) << FF_TRANSSHIFT);