mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Expose colorization to mappers and SOC
This commit is contained in:
parent
fef72c6009
commit
5d33ca42cf
8 changed files with 99 additions and 7 deletions
|
@ -1251,7 +1251,7 @@ static void SendNameAndColor(void)
|
|||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
if (players[consoleplayer].mo && !players[consoleplayer].powers[pw_dye])
|
||||
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
|
||||
|
||||
if (metalrecording)
|
||||
|
@ -1363,8 +1363,9 @@ static void SendNameAndColor2(void)
|
|||
if (botingame)
|
||||
{
|
||||
players[secondplaya].skincolor = botcolor;
|
||||
if (players[secondplaya].mo)
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
SetPlayerSkinByNum(secondplaya, botskin-1);
|
||||
return;
|
||||
}
|
||||
|
@ -1377,7 +1378,7 @@ static void SendNameAndColor2(void)
|
|||
|
||||
// don't use secondarydisplayplayer: the second player must be 1
|
||||
players[secondplaya].skincolor = cv_playercolor2.value;
|
||||
if (players[secondplaya].mo)
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
if (cv_forceskin.value >= 0 && (netgame || multiplayer)) // Server wants everyone to use the same player
|
||||
|
|
|
@ -278,6 +278,8 @@ typedef enum
|
|||
pw_nights_linkfreeze,
|
||||
|
||||
pw_nocontrol, //for linedef exec 427
|
||||
|
||||
pw_dye, // for dyes
|
||||
|
||||
NUMPOWERS
|
||||
} powertype_t;
|
||||
|
|
|
@ -2918,6 +2918,7 @@ static actionpointer_t actionpointers[] =
|
|||
{{A_SetRandomTics}, "A_SETRANDOMTICS"},
|
||||
{{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"},
|
||||
{{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"},
|
||||
{{A_Dye}, "A_DYE"},
|
||||
{{A_MoveRelative}, "A_MOVERELATIVE"},
|
||||
{{A_MoveAbsolute}, "A_MOVEABSOLUTE"},
|
||||
{{A_Thrust}, "A_THRUST"},
|
||||
|
@ -9129,7 +9130,10 @@ static const char *const POWERS_LIST[] = {
|
|||
"NIGHTS_LINKFREEZE",
|
||||
|
||||
//for linedef exec 427
|
||||
"NOCONTROL"
|
||||
"NOCONTROL",
|
||||
|
||||
//for dyes
|
||||
"DYE"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
|
|
|
@ -165,6 +165,7 @@ void A_SetTics();
|
|||
void A_SetRandomTics();
|
||||
void A_ChangeColorRelative();
|
||||
void A_ChangeColorAbsolute();
|
||||
void A_Dye();
|
||||
void A_MoveRelative();
|
||||
void A_MoveAbsolute();
|
||||
void A_Thrust();
|
||||
|
|
|
@ -191,6 +191,7 @@ void A_SetTics(mobj_t *actor);
|
|||
void A_SetRandomTics(mobj_t *actor);
|
||||
void A_ChangeColorRelative(mobj_t *actor);
|
||||
void A_ChangeColorAbsolute(mobj_t *actor);
|
||||
void A_Dye(mobj_t *actor);
|
||||
void A_MoveRelative(mobj_t *actor);
|
||||
void A_MoveAbsolute(mobj_t *actor);
|
||||
void A_Thrust(mobj_t *actor);
|
||||
|
@ -8949,6 +8950,39 @@ void A_ChangeColorAbsolute(mobj_t *actor)
|
|||
actor->color = (UINT8)locvar2;
|
||||
}
|
||||
|
||||
// Function: A_Dye
|
||||
//
|
||||
// Description: Colorizes an object.
|
||||
//
|
||||
// var1 = if (var1 > 0), dye your target instead of yourself
|
||||
// var2 = if (var1 = 0), color value to dye
|
||||
//
|
||||
void A_Dye(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_Dye", actor))
|
||||
return;
|
||||
#endif
|
||||
mobj_t *target = ((locvar1 && actor->target) ? actor->target : actor);
|
||||
UINT8 color = (UINT8)locvar2;
|
||||
|
||||
// What if it's a player?
|
||||
if (target->player)
|
||||
{
|
||||
target->player->powers[pw_dye] = color;
|
||||
return;
|
||||
}
|
||||
|
||||
target->color = color;
|
||||
|
||||
if (!color)
|
||||
target->colorized = false;
|
||||
else
|
||||
target->colorized = true;
|
||||
}
|
||||
|
||||
// Function: A_MoveRelative
|
||||
//
|
||||
// Description: Moves an object (wrapper for P_Thrust)
|
||||
|
|
|
@ -1185,10 +1185,14 @@ static void P_LoadSidedefs(UINT8 *data)
|
|||
case 9: // Mace parameters
|
||||
case 14: // Bustable block parameters
|
||||
case 15: // Fan particle spawner parameters
|
||||
case 334: // Trigger linedef executor: Object dye - Continuous
|
||||
case 335: // Trigger linedef executor: Object dye - Each time
|
||||
case 336: // Trigger linedef executor: Object dye - Once
|
||||
case 425: // Calls P_SetMobjState on calling mobj
|
||||
case 434: // Custom Power
|
||||
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
|
||||
case 461: // Spawns an object on the map based on texture offsets
|
||||
case 463: // Colorizes an object
|
||||
{
|
||||
char process[8*3+1];
|
||||
memset(process,0,8*3+1);
|
||||
|
|
39
src/p_spec.c
39
src/p_spec.c
|
@ -2034,6 +2034,17 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
if (!(actor && actor->player && ((stricmp(triggerline->text, skins[actor->player->skin].name) == 0) ^ ((triggerline->flags & ML_NOCLIMB) == ML_NOCLIMB))))
|
||||
return false;
|
||||
break;
|
||||
case 334: // object dye - continuous
|
||||
case 335: // object dye - each time
|
||||
case 336: // object dye - once
|
||||
{
|
||||
INT32 triggercolor = (INT32)sides[triggerline->sidenum[0]].toptexture;
|
||||
UINT8 color = (actor->player ? actor->player->powers[pw_dye] : actor->color);
|
||||
boolean invert = (triggerline->flags & ML_NOCLIMB ? true : false);
|
||||
|
||||
if (invert ^ (triggercolor != color))
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2167,6 +2178,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
|| specialtype == 328 // Nights lap - Once
|
||||
|| specialtype == 330 // Nights Bonus Time - Once
|
||||
|| specialtype == 333 // Skin - Once
|
||||
|| specialtype == 336 // Dye - Once
|
||||
|| specialtype == 399) // Level Load
|
||||
triggerline->special = 0; // Clear it out
|
||||
|
||||
|
@ -2208,7 +2220,8 @@ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller)
|
|||
|| lines[masterline].special == 310 // CTF Red team - Each time
|
||||
|| lines[masterline].special == 312 // CTF Blue team - Each time
|
||||
|| lines[masterline].special == 322 // Trigger on X calls - Each Time
|
||||
|| lines[masterline].special == 332)// Skin - Each time
|
||||
|| lines[masterline].special == 332 // Skin - Each time
|
||||
|| lines[masterline].special == 335)// Dye - Each time
|
||||
continue;
|
||||
|
||||
if (lines[masterline].special < 300
|
||||
|
@ -4041,7 +4054,23 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 463: // Dye object
|
||||
{
|
||||
INT32 color = sides[line->sidenum[0]].toptexture;
|
||||
|
||||
if (mo)
|
||||
{
|
||||
if (color < 0 || color > MAXSKINCOLORS)
|
||||
return;
|
||||
|
||||
var1 = 0;
|
||||
var2 = color;
|
||||
A_Dye(mo);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
case 480: // Polyobj_DoorSlide
|
||||
case 481: // Polyobj_DoorSwing
|
||||
|
@ -7208,6 +7237,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
case 310:
|
||||
case 312:
|
||||
case 332:
|
||||
case 335:
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
P_AddEachTimeThinker(§ors[sec], &lines[i]);
|
||||
break;
|
||||
|
@ -7260,6 +7290,11 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
case 331:
|
||||
case 333:
|
||||
break;
|
||||
|
||||
// Object dye executors
|
||||
case 334:
|
||||
case 336:
|
||||
break;
|
||||
|
||||
case 399: // Linedef execute on map load
|
||||
// This is handled in P_RunLevelLoadExecutors.
|
||||
|
|
13
src/p_user.c
13
src/p_user.c
|
@ -12270,7 +12270,18 @@ void P_PlayerThink(player_t *player)
|
|||
player->powers[pw_nocontrol]--;
|
||||
else
|
||||
player->powers[pw_nocontrol] = 0;
|
||||
|
||||
|
||||
if (player->powers[pw_dye])
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
player->mo->color = player->powers[pw_dye];
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->colorized = false;
|
||||
player->mo->color = player->skincolor;
|
||||
}
|
||||
|
||||
//pw_super acts as a timer now
|
||||
if (player->powers[pw_super]
|
||||
&& (player->mo->state < &states[S_PLAY_SUPER_TRANS1]
|
||||
|
|
Loading…
Reference in a new issue