mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 13:40:45 +00:00
Merge branch 'dye' into 'next'
Expose colorization to mappers and SOC See merge request STJr/SRB2!679
This commit is contained in:
commit
b8d40a5783
9 changed files with 114 additions and 12 deletions
|
@ -1252,7 +1252,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)
|
||||
|
@ -1364,8 +1364,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;
|
||||
}
|
||||
|
@ -1378,7 +1379,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
|
||||
|
|
|
@ -279,6 +279,9 @@ typedef enum
|
|||
pw_nights_linkfreeze,
|
||||
|
||||
pw_nocontrol, //for linedef exec 427
|
||||
|
||||
pw_dye, // for dyes
|
||||
|
||||
pw_justlaunched, // Launched off a slope this tic (0=none, 1=standard launch, 2=half-pipe launch)
|
||||
|
||||
NUMPOWERS
|
||||
|
|
|
@ -2909,6 +2909,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"},
|
||||
|
@ -9132,7 +9133,11 @@ static const char *const POWERS_LIST[] = {
|
|||
|
||||
//for linedef exec 427
|
||||
"NOCONTROL",
|
||||
"JUSTLAUNCHED",
|
||||
|
||||
//for dyes
|
||||
"DYE",
|
||||
|
||||
"JUSTLAUNCHED"
|
||||
};
|
||||
|
||||
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();
|
||||
|
|
|
@ -189,6 +189,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);
|
||||
|
@ -8773,6 +8774,42 @@ 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 = color value to dye
|
||||
//
|
||||
void A_Dye(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
|
||||
mobj_t *target = ((locvar1 && actor->target) ? actor->target : actor);
|
||||
UINT8 color = (UINT8)locvar2;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_Dye", actor))
|
||||
return;
|
||||
#endif
|
||||
if (color >= MAXTRANSLATIONS)
|
||||
return;
|
||||
|
||||
if (!color)
|
||||
target->colorized = false;
|
||||
else
|
||||
target->colorized = true;
|
||||
|
||||
// What if it's a player?
|
||||
if (target->player)
|
||||
{
|
||||
target->player->powers[pw_dye] = color;
|
||||
return;
|
||||
}
|
||||
|
||||
target->color = color;
|
||||
}
|
||||
|
||||
// Function: A_MoveRelative
|
||||
//
|
||||
// Description: Moves an object (wrapper for P_Thrust)
|
||||
|
|
|
@ -1181,10 +1181,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
|
||||
|
@ -4037,7 +4050,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 >= MAXTRANSLATIONS)
|
||||
return;
|
||||
|
||||
var1 = 0;
|
||||
var2 = color;
|
||||
A_Dye(mo);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
case 480: // Polyobj_DoorSlide
|
||||
case 481: // Polyobj_DoorSwing
|
||||
|
@ -7205,6 +7234,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;
|
||||
|
@ -7257,6 +7287,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.
|
||||
|
|
|
@ -12213,7 +12213,7 @@ void P_PlayerThink(player_t *player)
|
|||
player->powers[pw_nocontrol]--;
|
||||
else
|
||||
player->powers[pw_nocontrol] = 0;
|
||||
|
||||
|
||||
//pw_super acts as a timer now
|
||||
if (player->powers[pw_super]
|
||||
&& (player->mo->state < &states[S_PLAY_SUPER_TRANS1]
|
||||
|
@ -12858,6 +12858,12 @@ void P_PlayerAfterThink(player_t *player)
|
|||
player->mo->flags |= MF_NOGRAVITY;
|
||||
}
|
||||
|
||||
if (player->powers[pw_dye])
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
player->mo->color = player->powers[pw_dye];
|
||||
}
|
||||
|
||||
if (player->followmobj && (player->spectator || player->mo->health <= 0 || player->followmobj->type != player->followitem))
|
||||
{
|
||||
P_RemoveMobj(player->followmobj);
|
||||
|
|
|
@ -1331,6 +1331,16 @@ void ST_drawTitleCard(void)
|
|||
INT32 ttlscroll = FixedInt(lt_scroll);
|
||||
INT32 zzticker;
|
||||
patch_t *actpat, *zigzag, *zztext;
|
||||
UINT8 colornum;
|
||||
const UINT8 *colormap;
|
||||
stplyr = &players[consoleplayer];
|
||||
|
||||
if (stplyr->skincolor)
|
||||
colornum = stplyr->skincolor;
|
||||
else
|
||||
colornum = cv_playercolor.value;
|
||||
|
||||
colormap = R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE);
|
||||
|
||||
if (!G_IsTitleCardAvailable())
|
||||
return;
|
||||
|
@ -1364,16 +1374,16 @@ void ST_drawTitleCard(void)
|
|||
if (!splitscreen || (splitscreen && stplyr == &players[displayplayer]))
|
||||
{
|
||||
zzticker = lt_ticker;
|
||||
V_DrawScaledPatch(FixedInt(lt_zigzag), (-zzticker) % zigzag->height, V_SNAPTOTOP|V_SNAPTOLEFT, zigzag);
|
||||
V_DrawScaledPatch(FixedInt(lt_zigzag), (zigzag->height-zzticker) % zigzag->height, V_SNAPTOTOP|V_SNAPTOLEFT, zigzag);
|
||||
V_DrawScaledPatch(FixedInt(lt_zigzag), (-zigzag->height+zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext);
|
||||
V_DrawScaledPatch(FixedInt(lt_zigzag), (zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext);
|
||||
V_DrawMappedPatch(FixedInt(lt_zigzag), (-zzticker) % zigzag->height, V_SNAPTOTOP|V_SNAPTOLEFT, zigzag, colormap);
|
||||
V_DrawMappedPatch(FixedInt(lt_zigzag), (zigzag->height-zzticker) % zigzag->height, V_SNAPTOTOP|V_SNAPTOLEFT, zigzag, colormap);
|
||||
V_DrawMappedPatch(FixedInt(lt_zigzag), (-zigzag->height+zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext, colormap);
|
||||
V_DrawMappedPatch(FixedInt(lt_zigzag), (zzticker) % zztext->height, V_SNAPTOTOP|V_SNAPTOLEFT, zztext, colormap);
|
||||
}
|
||||
|
||||
if (actnum)
|
||||
{
|
||||
if (!splitscreen)
|
||||
V_DrawScaledPatch(ttlnumxpos + ttlscroll, 104 - ttlscroll, 0, actpat);
|
||||
V_DrawMappedPatch(ttlnumxpos + ttlscroll, 104 - ttlscroll, 0, actpat, colormap);
|
||||
V_DrawLevelActNum(ttlnumxpos + ttlscroll, 104, V_PERPLAYER, actnum);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue