mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-18 17:01:20 +00:00
Add weapon_mobj_type and missile_mobj_type
This commit is contained in:
parent
69944f1521
commit
bdc364f19e
9 changed files with 121 additions and 22 deletions
|
@ -1455,6 +1455,28 @@ void readteam(MYFILE *f, INT32 num)
|
||||||
deh_warning("readteam %d: Thing %d out of range (1 - %d)", num, i, NUMMOBJTYPES-1);
|
deh_warning("readteam %d: Thing %d out of range (1 - %d)", num, i, NUMMOBJTYPES-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (fastcmp(word, "WEAPON"))
|
||||||
|
{
|
||||||
|
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||||
|
i = get_mobjtype(word2); // find a thing by name
|
||||||
|
if (i < NUMMOBJTYPES && i > 0)
|
||||||
|
team->weapon_mobj_type = i;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deh_warning("readteam %d: Thing %d out of range (1 - %d)", num, i, NUMMOBJTYPES-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fastcmp(word, "MISSILE"))
|
||||||
|
{
|
||||||
|
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||||
|
i = get_mobjtype(word2); // find a thing by name
|
||||||
|
if (i < NUMMOBJTYPES && i > 0)
|
||||||
|
team->missile_mobj_type = i;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
deh_warning("readteam %d: Thing %d out of range (1 - %d)", num, i, NUMMOBJTYPES-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (fastcmp(word, "COLOR"))
|
else if (fastcmp(word, "COLOR"))
|
||||||
{
|
{
|
||||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||||
|
|
|
@ -406,12 +406,14 @@ enum {
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
UINT16 color;
|
||||||
|
UINT32 weapon_mobj_type;
|
||||||
|
UINT32 missile_mobj_type;
|
||||||
|
UINT16 weapon_color;
|
||||||
|
UINT16 missile_color;
|
||||||
char *flag_name;
|
char *flag_name;
|
||||||
UINT16 flag;
|
UINT16 flag;
|
||||||
UINT32 flag_mobj_type;
|
UINT32 flag_mobj_type;
|
||||||
UINT16 color;
|
|
||||||
UINT16 weapon_color;
|
|
||||||
UINT16 missile_color;
|
|
||||||
char *icons[TEAM_ICON_MAX];
|
char *icons[TEAM_ICON_MAX];
|
||||||
} team_t;
|
} team_t;
|
||||||
|
|
||||||
|
|
20
src/g_game.c
20
src/g_game.c
|
@ -3518,6 +3518,7 @@ team_t teams[MAXTEAMS] = {
|
||||||
.color = SKINCOLOR_RED,
|
.color = SKINCOLOR_RED,
|
||||||
.weapon_color = SKINCOLOR_RED,
|
.weapon_color = SKINCOLOR_RED,
|
||||||
.missile_color = SKINCOLOR_SALMON,
|
.missile_color = SKINCOLOR_SALMON,
|
||||||
|
.weapon_mobj_type = MT_BLUETEAMRING,
|
||||||
.flag = GF_REDFLAG,
|
.flag = GF_REDFLAG,
|
||||||
.flag_mobj_type = MT_REDFLAG,
|
.flag_mobj_type = MT_REDFLAG,
|
||||||
},
|
},
|
||||||
|
@ -3526,6 +3527,7 @@ team_t teams[MAXTEAMS] = {
|
||||||
.color = SKINCOLOR_BLUE,
|
.color = SKINCOLOR_BLUE,
|
||||||
.weapon_color = SKINCOLOR_BLUE,
|
.weapon_color = SKINCOLOR_BLUE,
|
||||||
.missile_color = SKINCOLOR_CORNFLOWER,
|
.missile_color = SKINCOLOR_CORNFLOWER,
|
||||||
|
.weapon_mobj_type = MT_REDTEAMRING,
|
||||||
.flag = GF_BLUEFLAG,
|
.flag = GF_BLUEFLAG,
|
||||||
.flag_mobj_type = MT_BLUEFLAG,
|
.flag_mobj_type = MT_BLUEFLAG,
|
||||||
}
|
}
|
||||||
|
@ -3942,6 +3944,8 @@ void G_InitTeam(UINT8 team)
|
||||||
|
|
||||||
memset(&teams[team], 0, sizeof(team_t));
|
memset(&teams[team], 0, sizeof(team_t));
|
||||||
|
|
||||||
|
teams[team].weapon_mobj_type = MT_RING;
|
||||||
|
teams[team].missile_mobj_type = MT_REDRING;
|
||||||
teams[team].flag = 1 << (team - 1);
|
teams[team].flag = 1 << (team - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4019,6 +4023,22 @@ const char *G_GetTeamFlagName(UINT8 team)
|
||||||
return teams[team].flag_name;
|
return teams[team].flag_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT32 G_GetTeamWeaponMobjtype(UINT8 team)
|
||||||
|
{
|
||||||
|
if (team >= numteams || !teams[team].weapon_mobj_type)
|
||||||
|
return MT_RING;
|
||||||
|
|
||||||
|
return teams[team].weapon_mobj_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 G_GetTeamMissileMobjtype(UINT8 team)
|
||||||
|
{
|
||||||
|
if (team >= numteams || !teams[team].missile_mobj_type)
|
||||||
|
return MT_REDRING;
|
||||||
|
|
||||||
|
return teams[team].missile_mobj_type;
|
||||||
|
}
|
||||||
|
|
||||||
UINT16 G_GetTeamColor(UINT8 team)
|
UINT16 G_GetTeamColor(UINT8 team)
|
||||||
{
|
{
|
||||||
if (team >= numteams)
|
if (team >= numteams)
|
||||||
|
|
|
@ -230,6 +230,8 @@ UINT8 G_GetTeamFromTeamFlag(UINT32 flag);
|
||||||
UINT8 G_GetTeamListFromTeamFlags(UINT8 *teamlist, UINT32 flags);
|
UINT8 G_GetTeamListFromTeamFlags(UINT8 *teamlist, UINT32 flags);
|
||||||
const char *G_GetTeamName(UINT8 team);
|
const char *G_GetTeamName(UINT8 team);
|
||||||
const char *G_GetTeamFlagName(UINT8 team);
|
const char *G_GetTeamFlagName(UINT8 team);
|
||||||
|
UINT32 G_GetTeamWeaponMobjtype(UINT8 team);
|
||||||
|
UINT32 G_GetTeamMissileMobjtype(UINT8 team);
|
||||||
UINT16 G_GetTeamColor(UINT8 team);
|
UINT16 G_GetTeamColor(UINT8 team);
|
||||||
UINT16 G_GetTeamWeaponColor(UINT8 team);
|
UINT16 G_GetTeamWeaponColor(UINT8 team);
|
||||||
UINT16 G_GetTeamMissileColor(UINT8 team);
|
UINT16 G_GetTeamMissileColor(UINT8 team);
|
||||||
|
|
|
@ -2101,6 +2101,8 @@ enum team_e
|
||||||
team_flag_name,
|
team_flag_name,
|
||||||
team_flag,
|
team_flag,
|
||||||
team_flag_mobj_type,
|
team_flag_mobj_type,
|
||||||
|
team_weapon_mobj_type,
|
||||||
|
team_missile_mobj_type,
|
||||||
team_color,
|
team_color,
|
||||||
team_weapon_color,
|
team_weapon_color,
|
||||||
team_missile_color,
|
team_missile_color,
|
||||||
|
@ -2115,6 +2117,8 @@ const char *const team_opt[] = {
|
||||||
"flag_name",
|
"flag_name",
|
||||||
"flag",
|
"flag",
|
||||||
"flag_mobj_type",
|
"flag_mobj_type",
|
||||||
|
"weapon_mobj_type",
|
||||||
|
"missile_mobj_type",
|
||||||
"color",
|
"color",
|
||||||
"weapon_color",
|
"weapon_color",
|
||||||
"missile_color",
|
"missile_color",
|
||||||
|
@ -2166,6 +2170,28 @@ static int set_team_field(lua_State *L, team_t *team, enum team_e field)
|
||||||
team->flag_mobj_type = type;
|
team->flag_mobj_type = type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case team_weapon_mobj_type:
|
||||||
|
{
|
||||||
|
mobjtype_t type = luaL_checkinteger(L, 3);
|
||||||
|
if (type >= NUMMOBJTYPES)
|
||||||
|
{
|
||||||
|
luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
team->weapon_mobj_type = type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case team_missile_mobj_type:
|
||||||
|
{
|
||||||
|
mobjtype_t type = luaL_checkinteger(L, 3);
|
||||||
|
if (type >= NUMMOBJTYPES)
|
||||||
|
{
|
||||||
|
luaL_error(L, "mobj type %d out of range (0 - %d)", type, NUMMOBJTYPES-1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
team->missile_mobj_type = type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case team_color:
|
case team_color:
|
||||||
{
|
{
|
||||||
UINT16 newcolor = (UINT16)luaL_checkinteger(L, 3);
|
UINT16 newcolor = (UINT16)luaL_checkinteger(L, 3);
|
||||||
|
@ -2295,6 +2321,12 @@ static int team_get(lua_State *L)
|
||||||
case team_flag_mobj_type:
|
case team_flag_mobj_type:
|
||||||
lua_pushinteger(L, team->flag_mobj_type);
|
lua_pushinteger(L, team->flag_mobj_type);
|
||||||
break;
|
break;
|
||||||
|
case team_weapon_mobj_type:
|
||||||
|
lua_pushinteger(L, team->weapon_mobj_type);
|
||||||
|
break;
|
||||||
|
case team_missile_mobj_type:
|
||||||
|
lua_pushinteger(L, team->missile_mobj_type);
|
||||||
|
break;
|
||||||
case team_color:
|
case team_color:
|
||||||
lua_pushinteger(L, team->color);
|
lua_pushinteger(L, team->color);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -824,8 +824,8 @@ static boolean P_LookForShield(mobj_t *actor)
|
||||||
continue; // dead
|
continue; // dead
|
||||||
|
|
||||||
//When in CTF, don't pull rings that you cannot pick up.
|
//When in CTF, don't pull rings that you cannot pick up.
|
||||||
if ((actor->type == MT_REDTEAMRING && player->ctfteam != TEAM_RED) ||
|
if ((actor->type == MT_REDTEAMRING && player->ctfteam != G_GetTeam(TEAM_RED)) ||
|
||||||
(actor->type == MT_BLUETEAMRING && player->ctfteam != TEAM_BLUE))
|
(actor->type == MT_BLUETEAMRING && player->ctfteam != G_GetTeam(TEAM_BLUE)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((player->powers[pw_shield] & SH_PROTECTELECTRIC)
|
if ((player->powers[pw_shield] & SH_PROTECTELECTRIC)
|
||||||
|
|
|
@ -333,6 +333,18 @@ void P_DoMatchSuper(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void P_CollectRing(player_t *player, mobj_t *special)
|
||||||
|
{
|
||||||
|
if (!(P_CanPickupItem(player, false)) && !(special->flags2 & MF2_NIGHTSPULL))
|
||||||
|
return;
|
||||||
|
|
||||||
|
special->momx = special->momy = special->momz = 0;
|
||||||
|
P_GivePlayerRings(player, 1);
|
||||||
|
|
||||||
|
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING && special->type != MT_FLINGCOIN)
|
||||||
|
P_DoNightsScore(player);
|
||||||
|
}
|
||||||
|
|
||||||
/** Takes action based on a ::MF_SPECIAL thing touched by a player.
|
/** Takes action based on a ::MF_SPECIAL thing touched by a player.
|
||||||
* Actually, this just checks a few things (heights, toucher->player, no
|
* Actually, this just checks a few things (heights, toucher->player, no
|
||||||
* objectplace, no dead or disappearing things)
|
* objectplace, no dead or disappearing things)
|
||||||
|
@ -614,26 +626,21 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
// Rings, coins, spheres, weapon panels, etc //
|
// Rings, coins, spheres, weapon panels, etc //
|
||||||
// ***************************************** //
|
// ***************************************** //
|
||||||
case MT_REDTEAMRING:
|
case MT_REDTEAMRING:
|
||||||
if (player->ctfteam != TEAM_RED)
|
if (player->ctfteam != G_GetTeam(TEAM_RED))
|
||||||
return;
|
return;
|
||||||
/* FALLTHRU */
|
P_CollectRing(player, special);
|
||||||
case MT_BLUETEAMRING: // Yes, I'm lazy. Oh well, deal with it.
|
break;
|
||||||
if (special->type == MT_BLUETEAMRING && player->ctfteam != TEAM_BLUE)
|
case MT_BLUETEAMRING:
|
||||||
|
if (player->ctfteam != G_GetTeam(TEAM_BLUE))
|
||||||
return;
|
return;
|
||||||
/* FALLTHRU */
|
P_CollectRing(player, special);
|
||||||
|
break;
|
||||||
case MT_RING:
|
case MT_RING:
|
||||||
case MT_FLINGRING:
|
case MT_FLINGRING:
|
||||||
case MT_COIN:
|
case MT_COIN:
|
||||||
case MT_FLINGCOIN:
|
case MT_FLINGCOIN:
|
||||||
case MT_NIGHTSSTAR:
|
case MT_NIGHTSSTAR:
|
||||||
if (!(P_CanPickupItem(player, false)) && !(special->flags2 & MF2_NIGHTSPULL))
|
P_CollectRing(player, special);
|
||||||
return;
|
|
||||||
|
|
||||||
special->momx = special->momy = special->momz = 0;
|
|
||||||
P_GivePlayerRings(player, 1);
|
|
||||||
|
|
||||||
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING && special->type != MT_FLINGCOIN)
|
|
||||||
P_DoNightsScore(player);
|
|
||||||
break;
|
break;
|
||||||
case MT_BLUESPHERE:
|
case MT_BLUESPHERE:
|
||||||
case MT_FLINGBLUESPHERE:
|
case MT_FLINGBLUESPHERE:
|
||||||
|
|
13
src/p_mobj.c
13
src/p_mobj.c
|
@ -10889,10 +10889,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||||
mobj->lastlook = mobj->extravalue2 = -1;
|
mobj->lastlook = mobj->extravalue2 = -1;
|
||||||
break;
|
break;
|
||||||
case MT_REDTEAMRING:
|
case MT_REDTEAMRING:
|
||||||
mobj->color = G_GetTeamWeaponColor(TEAM_RED);
|
mobj->color = G_GetTeamWeaponColor(G_GetTeam(TEAM_RED));
|
||||||
break;
|
break;
|
||||||
case MT_BLUETEAMRING:
|
case MT_BLUETEAMRING:
|
||||||
mobj->color = G_GetTeamWeaponColor(TEAM_BLUE);
|
mobj->color = G_GetTeamWeaponColor(G_GetTeam(TEAM_BLUE));
|
||||||
break;
|
break;
|
||||||
case MT_RING:
|
case MT_RING:
|
||||||
case MT_COIN:
|
case MT_COIN:
|
||||||
|
@ -12169,7 +12169,14 @@ static mobjtype_t P_GetMobjtypeSubstitute(mapthing_t *mthing, mobjtype_t i)
|
||||||
return teams[team].flag_mobj_type;
|
return teams[team].flag_mobj_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(gametyperules & GTR_TEAMS))
|
if (gametyperules & GTR_TEAMS)
|
||||||
|
{
|
||||||
|
if (i == MT_REDTEAMRING)
|
||||||
|
i = G_GetTeamWeaponMobjtype(G_GetTeam(TEAM_RED));
|
||||||
|
else if (i == MT_BLUETEAMRING)
|
||||||
|
i = G_GetTeamWeaponMobjtype(G_GetTeam(TEAM_BLUE));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING)
|
if (i == MT_BLUETEAMRING || i == MT_REDTEAMRING)
|
||||||
return MT_RING;
|
return MT_RING;
|
||||||
|
|
|
@ -4218,7 +4218,14 @@ firenormal:
|
||||||
return;
|
return;
|
||||||
P_SetWeaponDelay(player, TICRATE/4);
|
P_SetWeaponDelay(player, TICRATE/4);
|
||||||
|
|
||||||
mo = P_SpawnPlayerMissile(player->mo, MT_REDRING, 0);
|
mobjtype_t missile_type;
|
||||||
|
|
||||||
|
if (G_GametypeHasTeams())
|
||||||
|
missile_type = G_GetTeamMissileMobjtype(player->ctfteam);
|
||||||
|
else
|
||||||
|
missile_type = MT_REDRING;
|
||||||
|
|
||||||
|
mo = P_SpawnPlayerMissile(player->mo, missile_type, 0);
|
||||||
|
|
||||||
if (mo)
|
if (mo)
|
||||||
P_ColorTeamMissile(mo, player);
|
P_ColorTeamMissile(mo, player);
|
||||||
|
|
Loading…
Reference in a new issue