Merge remote-tracking branch 'remotes/origin/battle' into multi-admin

This commit is contained in:
wolfy852 2017-11-20 21:49:42 -06:00
commit 37448a3e92
33 changed files with 2457 additions and 592 deletions

View File

@ -1447,8 +1447,8 @@ void CV_AddValue(consvar_t *var, INT32 increment)
INT32 newvalue, max;
// count pointlimit better
if (var == &cv_pointlimit && (gametype == GT_MATCH))
increment *= 50;
/*if (var == &cv_pointlimit && (gametype == GT_MATCH))
increment *= 50;*/
newvalue = var->value + increment;
if (var->PossibleValue)

View File

@ -43,6 +43,7 @@
#include "lzf.h"
#include "lua_script.h"
#include "lua_hook.h"
#include "k_kart.h"
#ifdef CLIENT_LOADINGSCREEN
// cl loading screen
@ -519,8 +520,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]);
for (j = 0; j < NUMKARTSTUFF; ++j)
rsp->kartstuff[j] = LONG(players[i].kartstuff[j]); // SRB2kart
for (j = 0; j < MAXPLAYERS; ++j)
rsp->collide[j] = (UINT8)players[i].collide[j]; // SRB2kart
// Score is resynched in the rspfirm resync packet
rsp->health = 0; // resynched with mo health
@ -576,6 +575,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->starposty = SHORT(players[i].starposty);
rsp->starpostz = SHORT(players[i].starpostz);
rsp->starpostnum = LONG(players[i].starpostnum);
rsp->starpostcount = LONG(players[i].starpostcount);
rsp->starposttime = (tic_t)LONG(players[i].starposttime);
rsp->starpostangle = (angle_t)LONG(players[i].starpostangle);
@ -653,8 +653,6 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]);
for (j = 0; j < NUMKARTSTUFF; ++j)
players[i].kartstuff[j] = LONG(rsp->kartstuff[j]); // SRB2kart
for (j = 0; j < MAXPLAYERS; ++j)
players[i].collide[j] = (UINT8)rsp->collide[j]; // SRB2kart
// Score is resynched in the rspfirm resync packet
players[i].health = rsp->health;
@ -709,6 +707,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].starposty = SHORT(rsp->starposty);
players[i].starpostz = SHORT(rsp->starpostz);
players[i].starpostnum = LONG(rsp->starpostnum);
players[i].starpostcount = LONG(rsp->starpostcount);
players[i].starposttime = (tic_t)LONG(rsp->starposttime);
players[i].starpostangle = (angle_t)LONG(rsp->starpostangle);
@ -2427,6 +2426,8 @@ static void CL_RemovePlayer(INT32 playernum)
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
P_CheckSurvivors();
else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)
K_CheckBalloons(); // SRB2Kart
else if (gametype == GT_RACE || gametype == GT_COMPETITION)
P_CheckRacers();
}

View File

@ -163,7 +163,7 @@ typedef struct
UINT16 powers[NUMPOWERS];
INT32 kartstuff[NUMKARTSTUFF]; // SRB2kart
UINT8 collide[MAXPLAYERS]; // SRB2kart
angle_t frameangle; // SRB2kart
// Score is resynched in the confirm resync packet
INT32 health;
@ -219,6 +219,7 @@ typedef struct
INT16 starposty;
INT16 starpostz;
INT32 starpostnum;
INT32 starpostcount;
tic_t starposttime;
angle_t starpostangle;

View File

@ -313,9 +313,17 @@ consvar_t cv_jaws = {"jaws", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0,
consvar_t cv_fireflower = {"fireflowers", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_tripleredshell = {"tripleredshells", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_lightning = {"lightning", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_feather = {"feathers", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_karthud = {"karthud", "Default", CV_SAVE|CV_CALL, karthud_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartcheck = {"kartcheck", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartstarsfx_cons_t[] = {{0, "Music"}, {1, "SMK"}, {0, NULL}};
consvar_t cv_kartstarsfx = {"kartstarsfx", "SMK", CV_SAVE, kartstarsfx_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // change default to "SMK"?
consvar_t cv_kartcc = {"kartcc", "100cc", CV_NETVAR, kartcc_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t kartballoons_cons_t[] = {{1, "MIN"}, {12, "MAX"}, {0, NULL}};
consvar_t cv_kartballoons = {"kartballoons", "3", CV_NETVAR, kartballoons_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartfrantic = {"kartfrantic", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_kartcomeback = {"kartcomeback", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t speedometer_cons_t[] = {{0, "Off"}, {1, "Kilometers"}, {2, "Miles"}, {3, "Fracunits"}, {0, NULL}};
consvar_t cv_speedometer = {"speedometer", "Kilometers", CV_SAVE, speedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
@ -1063,7 +1071,7 @@ UINT8 CanChangeSkin(INT32 playernum)
return true;
// Can change skin during initial countdown.
if ((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE)
if (leveltime < 4*TICRATE)
return true;
if (G_TagGametype())
@ -1868,8 +1876,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
// a copy of color
if (players[0].mo)
players[0].mo->color = players[0].skincolor;
CV_StealthSetValue(&cv_kartcc, 150); // srb2kart
}
if (metalrecording)
G_BeginMetal();
@ -1970,11 +1976,11 @@ static void Command_Suicide(void)
return;
}
if (!G_PlatformGametype())
/*if (!G_PlatformGametype()) // srb2kart: not necessary, suiciding makes you lose a balloon in battle, so it's not desirable to use as a way to escape a hit
{
CONS_Printf(M_GetText("You may only use this in co-op, race, and competition!\n"));
return;
}
}*/
// Retry is quicker. Probably should force people to use it.
if (!(netgame || multiplayer))
@ -1991,7 +1997,7 @@ static void Got_Suicide(UINT8 **cp, INT32 playernum)
INT32 suicideplayer = READINT32(*cp);
// You can't suicide someone else. Nice try, there.
if (suicideplayer != playernum || (!G_PlatformGametype()))
if (suicideplayer != playernum) // srb2kart: "|| (!G_PlatformGametype())"
{
CONS_Alert(CONS_WARNING, M_GetText("Illegal suicide command received from %s\n"), player_names[playernum]);
if (server)
@ -2661,6 +2667,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
// In tag, check to see if you still have a game.
if (G_TagGametype())
P_CheckSurvivors();
else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)
K_CheckBalloons(); // SRB2Kart
}
//
@ -3544,9 +3552,9 @@ void D_GameTypeChanged(INT32 lastgametype)
case GT_TEAMMATCH:
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
{
// default settings for match: timelimit 10 mins, no pointlimit
// default settings for match: no timelimit, no pointlimit
CV_SetValue(&cv_pointlimit, 0);
CV_SetValue(&cv_timelimit, 10);
CV_SetValue(&cv_timelimit, 0);
}
if (!cv_itemrespawntime.changed)
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
@ -3604,7 +3612,7 @@ void D_GameTypeChanged(INT32 lastgametype)
// When swapping to a gametype that supports spectators,
// make everyone a spectator initially.
if (!splitscreen && (G_GametypeHasSpectators()))
/*if (!splitscreen && (G_GametypeHasSpectators()))
{
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
@ -3613,7 +3621,7 @@ void D_GameTypeChanged(INT32 lastgametype)
players[i].ctfteam = 0;
players[i].spectator = true;
}
}
}*/
// don't retain teams in other modes or between changes from ctf to team match.
// also, stop any and all forms of team scrambling that might otherwise take place.

View File

@ -103,9 +103,15 @@ extern consvar_t cv_magnet, cv_boo, cv_mushroom, cv_triplemushroom, cv_megashroo
extern consvar_t cv_goldshroom, cv_star, cv_triplebanana, cv_fakeitem, cv_banana;
extern consvar_t cv_greenshell, cv_redshell, cv_laserwisp, cv_triplegreenshell, cv_bobomb;
extern consvar_t cv_blueshell, cv_jaws, cv_fireflower, cv_tripleredshell, cv_lightning;
extern consvar_t cv_feather;
extern consvar_t cv_karthud;
extern consvar_t cv_kartcheck;
extern consvar_t cv_kartstarsfx;
extern consvar_t cv_kartcc;
extern consvar_t cv_kartballoons;
extern consvar_t cv_kartfrantic;
extern consvar_t cv_kartcomeback;
extern consvar_t cv_speedometer;
extern consvar_t cv_collideminimum;

View File

@ -266,6 +266,7 @@ typedef enum
// Some items use timers for their duration or effects
k_magnettimer, // Duration of Magnet's item-break and item box pull
k_bootimer, // Duration of the boo offroad effect itself
k_bootaketimer, // You are stealing an item, this is your timer
k_boostolentimer, // You are being stolen from, this is your timer
k_mushroomtimer, // Duration of the Mushroom Boost itself
@ -275,6 +276,9 @@ typedef enum
k_startimer, // Invincibility timer
k_spinouttimer, // Wipe-out from a banana peel or oil slick (was "pw_bananacam")
k_laserwisptimer, // The duration and relative angle of the laser
k_justbumped, // Prevent players from endlessly bumping into each other
k_poweritemtimer, // Battle mode, how long before you're allowed another power item (Star, Megashroom)
k_comebacktimer, // Battle mode, how long before you become a bomb after death
// Each item needs its own power slot, for the HUD and held use
k_magnet, // 0x1 = Magnet in inventory
@ -301,8 +305,15 @@ typedef enum
k_tripleredshell, // 0x1 = 1 Red Shell orbiting, 0x2 = 2 Red Shells orbiting
// 0x4 = 3 Red Shells orbiting, 0x8 = Triple Red Shell in inventory
k_lightning, // 0x1 = Lightning in inventory
k_feather, // 0x1 = Feather in inventory, 0x2 = Player is feather jumping
k_kitchensink, // 0x1 = Sink in inventory
// Battle Mode vars
k_balloon, // Number of balloons left
k_comebackpoints, // Number of times you've bombed or gave an item to someone; once it's 3 it gets set back to 0 and you're given a balloon
k_comebackmode, // 0 = bomb, 1 = item
k_comebackshowninfo,// Have you already seen the info screen before?
NUMKARTSTUFF
} kartstufftype_t;
//}
@ -365,7 +376,6 @@ typedef struct player_s
// SRB2kart stuff
INT32 kartstuff[NUMKARTSTUFF];
boolean collide[MAXPLAYERS];
angle_t frameangle; // for the player add the ability to have the sprite only face other angles
// Bit flags.
@ -467,6 +477,7 @@ typedef struct player_s
INT16 starposty;
INT16 starpostz;
INT32 starpostnum; // The number of the last starpost you hit
INT32 starpostcount; // SRB2kart: how many did you hit?
tic_t starposttime; // Your time when you hit the starpost
angle_t starpostangle; // Angle that the starpost is facing - you respawn facing this way

View File

@ -6367,6 +6367,11 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_SINKTRAIL2",
"S_SINKTRAIL3",
// Battle Mode balloon
"S_BATTLEBALLOON1",
"S_BATTLEBALLOON2",
"S_BATTLEBALLOON3",
// Pokey
"S_POKEY1",
"S_POKEY2",
@ -6401,6 +6406,27 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_FIREDITEM3",
"S_FIREDITEM4",
"S_PLAYERARROW", // Above player arrow
"S_PLAYERARROW_MUSHROOM",
"S_PLAYERARROW_GREENSHELL",
"S_PLAYERARROW_BANANA",
"S_PLAYERARROW_FAKEITEM",
"S_PLAYERARROW_BOO",
"S_PLAYERARROW_FEATHER",
"S_PLAYERARROW_REDSHELL",
"S_PLAYERARROW_BOBOMB",
"S_PLAYERARROW_FIREFLOWER",
"S_PLAYERARROW_TRIPLEGREENSHELL",
"S_PLAYERARROW_TRIPLEBANANA",
"S_PLAYERARROW_TRIPLEREDSHELL",
"S_PLAYERARROW_STAR",
"S_PLAYERARROW_MEGASHROOM",
"S_PLAYERARROW_KITCHENSINK",
"S_PLAYERARROW_EMPTY",
"S_PLAYERARROW_ROULETTE",
"S_PLAYERBOMB", // Player bomb overlay
#ifdef SEENAMES
"S_NAMECHECK",
#endif
@ -6958,6 +6984,10 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_SINK", // Kitchen Sink Stuff
"MT_SINKTRAIL",
"MT_BATTLEBALLOON", // Battle Mode balloon
"MT_LAKITU",
"MT_POKEY", // Huh, thought this was a default asset for some reason, guess not.
"MT_ENEMYFLIP",
"MT_WAYPOINT",
@ -6969,6 +6999,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_FIREDITEM",
"MT_PLAYERARROW",
#ifdef SEENAMES
"MT_NAMECHECK",
#endif
@ -7281,6 +7313,80 @@ static const char *const POWERS_LIST[] = {
"INGOOP" // In goop
};
static const char *const KARTSTUFF_LIST[] = {
"POSITION",
"OLDPOSITION",
"POSITIONDELAY",
"PREVCHECK",
"NEXTCHECK",
"WAYPOINT",
"STARPOSTWP",
"LAKITU",
"THROWDIR",
"CAMSPIN",
"LAPANIMATION",
"SOUNDS",
"BOOSTING",
"FLOORBOOST",
"SPINOUT",
"SPINOUTTYPE",
"DRIFT",
"DRIFTEND",
"DRIFTCHARGE",
"DRIFTBOOST",
"BOOSTCHARGE",
"JMP",
"OFFROAD",
"ITEMROULETTE",
"ITEMCLOSE",
"MAGNETTIMER",
"BOOTIMER",
"BOOTAKETIMER",
"BOOSTOLENTIMER",
"MUSHROOMTIMER",
"GROWSHRINKTIMER",
"SQUISHEDTIMER",
"GOLDSHROOMTIMER",
"STARTIMER",
"SPINOUTTIMER",
"LASERWISPTIMER",
"JUSTBUMPED",
"POWERITEMTIMER",
"COMEBACKTIMER",
"MAGNET",
"BOO",
"MUSHROOM",
"MEGASHROOM",
"GOLDSHROOM",
"STAR",
"TRIPLEBANANA",
"FAKEITEM",
"BANANA",
"GREENSHELL",
"REDSHELL",
"LASERWISP",
"TRIPLEGREENSHELL",
"BOBOMB",
"BLUESHELL",
"JAWS",
"FIREFLOWER",
"TRIPLEREDSHELL",
"LIGHTNING",
"FEATHER",
"KITCHENSINK",
"BALLOON",
"COMEBACKPOINTS",
"COMEBACKMODE",
"COMEBACKSHOWNINFO"
};
static const char *const HUDITEMS_LIST[] = {
"LIVESNAME",
"LIVESPIC",
@ -7915,6 +8021,20 @@ static powertype_t get_power(const char *word)
return pw_invulnerability;
}
static kartstufftype_t get_kartstuff(const char *word)
{ // Returns the vlaue of k_ enumerations
kartstufftype_t i;
if (*word >= '0' && *word <= '9')
return atoi(word);
if (fastncmp("K_",word,2))
word += 2; // take off the k_
for (i = 0; i < NUMKARTSTUFF; i++)
if (fastcmp(word, KARTSTUFF_LIST[i]))
return i;
deh_warning("Couldn't find power named 'k_%s'",word);
return k_position;
}
/// \todo Make ANY of this completely over-the-top math craziness obey the order of operations.
static fixed_t op_mul(fixed_t a, fixed_t b) { return a*b; }
static fixed_t op_div(fixed_t a, fixed_t b) { return a/b; }
@ -8151,6 +8271,7 @@ void FUNCMATH DEH_Check(void)
const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*);
const size_t dehmobjs = sizeof(MOBJTYPE_LIST)/sizeof(const char*);
const size_t dehpowers = sizeof(POWERS_LIST)/sizeof(const char*);
const size_t dehkartstuff = sizeof(KARTSTUFF_LIST)/sizeof(const char*);
const size_t dehcolors = sizeof(COLOR_ENUMS)/sizeof(const char*);
if (dehstates != S_FIRSTFREESLOT)
@ -8162,6 +8283,9 @@ void FUNCMATH DEH_Check(void)
if (dehpowers != NUMPOWERS)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
if (dehkartstuff != NUMKARTSTUFF)
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d kartstuff defined, versus %s in the Dehacked list)\n", NUMKARTSTUFF, sizeu1(dehkartstuff));
if (dehcolors != MAXTRANSLATIONS)
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", MAXTRANSLATIONS, sizeu1(dehcolors));
#endif
@ -8501,6 +8625,24 @@ static inline int lib_getenum(lua_State *L)
}
return luaL_error(L, "power '%s' could not be found.\n", word);
}
else if (!mathlib && fastncmp("k_",word,2)) {
p = word+2;
for (i = 0; i < NUMKARTSTUFF; i++)
if (fasticmp(p, KARTSTUFF_LIST[i])) {
lua_pushinteger(L, i);
return 1;
}
return 0;
}
else if (mathlib && fastncmp("K_",word,2)) { // SOCs are ALL CAPS!
p = word+2;
for (i = 0; i < NUMKARTSTUFF; i++)
if (fastcmp(p, KARTSTUFF_LIST[i])) {
lua_pushinteger(L, i);
return 1;
}
return luaL_error(L, "kartstuff '%s' could not be found.\n", word);
}
else if (fastncmp("HUD_",word,4)) {
p = word+4;
for (i = 0; i < NUMHUDITEMS; i++)

View File

@ -329,7 +329,7 @@ extern UINT16 emeralds;
#define EMERALD7 64
#define ALL7EMERALDS(v) ((v & (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) == (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7))
extern INT32 nummaprings; //keep track of spawned rings/coins
extern INT32 nummaprings, nummapboxes, numgotboxes; //keep track of spawned rings/coins/battle mode items
/** Time attack information, currently a very small structure.
*/
@ -401,8 +401,10 @@ extern UINT16 extralifetics;
// SRB2kart
extern INT32 bootime;
extern INT32 boostealtime;
extern INT32 mushroomtime;
extern INT32 itemtime;
extern INT32 comebacktime;
extern UINT8 introtoplay;
extern UINT8 creditscutscene;

View File

@ -179,6 +179,10 @@ UINT32 bluescore, redscore; // CTF and Team Match team scores
// ring count... for PERFECT!
INT32 nummaprings = 0;
// box respawning in battle mode
INT32 nummapboxes = 0;
INT32 numgotboxes = 0;
// Elminates unnecessary searching.
boolean CheckForBustableBlocks;
boolean CheckForBouncySector;
@ -198,8 +202,10 @@ UINT16 extralifetics = 4*TICRATE;
// SRB2kart
INT32 bootime = 7*TICRATE;
INT32 boostealtime = TICRATE/2;
INT32 mushroomtime = TICRATE + (TICRATE/3);
INT32 itemtime = 8*TICRATE;
INT32 comebacktime = 10*TICRATE;
INT32 gameovertics = 15*TICRATE;
@ -1784,7 +1790,7 @@ boolean G_Responder(event_t *ev)
if (players[displayplayer].spectator)
continue;
if (G_GametypeHasTeams())
/*if (G_GametypeHasTeams())
{
if (players[consoleplayer].ctfteam
&& players[displayplayer].ctfteam != players[consoleplayer].ctfteam)
@ -1806,6 +1812,12 @@ boolean G_Responder(event_t *ev)
{
if (!players[consoleplayer].spectator)
continue;
}*/
if (gametype != GT_RACE) // srb2kart
{
if (players[consoleplayer].kartstuff[k_balloon] > 0)
continue;
}
break;
@ -2120,7 +2132,6 @@ static inline void G_PlayerFinishLevel(INT32 player)
memset(p->powers, 0, sizeof (p->powers));
memset(p->kartstuff, 0, sizeof (p->kartstuff)); // SRB2kart
memset(p->collide, 0, sizeof (p->collide)); // SRB2kart
p->ringweapons = 0;
p->mo->flags2 &= ~MF2_SHADOW; // cancel invisibility
@ -2131,6 +2142,7 @@ static inline void G_PlayerFinishLevel(INT32 player)
p->starposty = 0;
p->starpostz = 0;
p->starpostnum = 0;
p->starpostcount = 0;
if (rendermode == render_soft)
V_SetPaletteLump(GetPalette()); // Reset the palette
@ -2171,6 +2183,7 @@ void G_PlayerReborn(INT32 player)
INT16 starposty;
INT16 starpostz;
INT32 starpostnum;
INT32 starpostcount;
INT32 starpostangle;
fixed_t jumpfactor;
INT32 exiting;
@ -2188,6 +2201,8 @@ void G_PlayerReborn(INT32 player)
// SRB2kart
INT32 starpostwp;
INT32 offroad;
INT32 balloon;
INT32 comebackpoints;
score = players[player].score;
lives = players[player].lives;
@ -2226,6 +2241,7 @@ void G_PlayerReborn(INT32 player)
starposty = players[player].starposty;
starpostz = players[player].starpostz;
starpostnum = players[player].starpostnum;
starpostcount = players[player].starpostcount;
starpostangle = players[player].starpostangle;
jumpfactor = players[player].jumpfactor;
thokitem = players[player].thokitem;
@ -2242,6 +2258,8 @@ void G_PlayerReborn(INT32 player)
// SRB2kart
starpostwp = players[player].kartstuff[k_starpostwp];
offroad = players[player].kartstuff[k_offroad];
balloon = players[player].kartstuff[k_balloon];
comebackpoints = players[player].kartstuff[k_comebackpoints];
p = &players[player];
memset(p, 0, sizeof (*p));
@ -2281,6 +2299,7 @@ void G_PlayerReborn(INT32 player)
p->starposty = starposty;
p->starpostz = starpostz;
p->starpostnum = starpostnum;
p->starpostcount = starpostcount;
p->starpostangle = starpostangle;
p->jumpfactor = jumpfactor;
p->exiting = exiting;
@ -2297,6 +2316,9 @@ void G_PlayerReborn(INT32 player)
// SRB2kart
p->kartstuff[k_starpostwp] = starpostwp; // TODO: get these out of kartstuff, it causes desync
p->kartstuff[k_offroad] = offroad;
p->kartstuff[k_balloon] = balloon;
p->kartstuff[k_comebackpoints] = comebackpoints;
p->kartstuff[k_comebacktimer] = comebacktime;
// Don't do anything immediately
p->pflags |= PF_USEDOWN;
@ -2308,7 +2330,7 @@ void G_PlayerReborn(INT32 player)
p->panim = PA_IDLE; // standing animation
if ((netgame || multiplayer) && !p->spectator)
p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
p->powers[pw_flashing] = K_GetKartFlashing(p)-1; // Babysitting deterrent
if (p-players == consoleplayer)
{
@ -2399,6 +2421,9 @@ static boolean G_CheckSpot(INT32 playernum, mapthing_t *mthing)
if (!P_CheckPosition(players[playernum].mo, x, y))
return false;
if (!K_CheckPlayersRespawnColliding(playernum, x, y))
return false;
return true;
}
@ -2644,6 +2669,7 @@ void G_DoReborn(INT32 playernum)
player->starposty = 0;
player->starpostz = 0;
player->starpostnum = 0;
player->starpostcount = 0;
}
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
{
@ -2801,7 +2827,8 @@ boolean G_GametypeHasTeams(void)
//
boolean G_GametypeHasSpectators(void)
{
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE);
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE
&& gametype != GT_MATCH); // srb2kart: temporary?
}
//
@ -3066,7 +3093,7 @@ static void G_DoWorldDone(void)
// don't reset player between maps
D_MapChange(nextmap+1, gametype, ultimatemode, false, 0, false, false);
else
// resetplayer in match/chaos/tag/CTF/race for more equality
// resetplayer in match/tag/CTF for more equality
D_MapChange(nextmap+1, gametype, ultimatemode, true, 0, false, false);
}
@ -3692,6 +3719,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
players[i].playerstate = PST_REBORN;
players[i].starpostangle = players[i].starpostnum = players[i].starposttime = 0;
players[i].starpostx = players[i].starposty = players[i].starpostz = 0;
players[i].starpostcount = 0; // srb2kart
if (netgame || multiplayer)
{

View File

@ -57,8 +57,8 @@ char sprnames[NUMSPRITES + 1][5] =
//SRB2kart Sprites
"SPRG","BSPR","RNDM","RPOP","KFRE","DRIF","DSMO","FITM","DFAK","BANA",
"DBAN","GSHE","DGSH","RSHE","DRSH","BOMB","BLIG","LIGH","SINK","SITR",
"LAKI","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM",
"SACO","CRAB","SHAD","BUMP","FLEN","CLAS","PSHW"
"KBLN","LAKI","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB",
"CHOM","SACO","CRAB","SHAD","BUMP","FLEN","CLAS","PSHW","ARRO","PBOM"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@ -2704,6 +2704,10 @@ state_t states[NUMSTATES] =
{SPR_SITR, 1, 5, {NULL}, 0, 0, S_SINKTRAIL3}, // S_SINKTRAIL2
{SPR_SITR, 2, 3, {NULL}, 0, 0, S_NULL}, // S_SINKTRAIL3
{SPR_KBLN, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_BATTLEBALLOON1}, // S_BATTLEBALLOON1
{SPR_KBLN, FF_FULLBRIGHT|1, -1, {NULL}, 0, 0, S_BATTLEBALLOON2}, // S_BATTLEBALLOON2
{SPR_KBLN, FF_FULLBRIGHT|2, -1, {NULL}, 0, 0, S_BATTLEBALLOON3}, // S_BATTLEBALLOON3
{SPR_LAKI, 0, 64, {NULL}, 1, 0, S_LAKITU2}, // S_LAKITU1
{SPR_LAKI, 1, 35, {NULL}, 0, 0, S_NULL}, // S_LAKITU2
@ -2857,6 +2861,28 @@ state_t states[NUMSTATES] =
{SPR_PSHW, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_FIREDITEM4}, // S_FIREDITEM3
{SPR_PSHW, FF_FULLBRIGHT|3, 3, {NULL}, 0, 0, S_NULL}, // S_FIREDITEM4
// Above player arrow
{SPR_ARRO, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW
{SPR_ARRO, FF_FULLBRIGHT|1, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_MUSHROOM
{SPR_ARRO, FF_FULLBRIGHT|2, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_GREENSHELL
{SPR_ARRO, FF_FULLBRIGHT|3, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_BANANA
{SPR_ARRO, FF_FULLBRIGHT|4, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_FAKEITEM
{SPR_ARRO, FF_FULLBRIGHT|5, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_BOO
{SPR_ARRO, FF_FULLBRIGHT|6, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_FEATHER
{SPR_ARRO, FF_FULLBRIGHT|7, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_REDSHELL
{SPR_ARRO, FF_FULLBRIGHT|8, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_BOBOMB
{SPR_ARRO, FF_FULLBRIGHT|9, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_FIREFLOWER
{SPR_ARRO, FF_FULLBRIGHT|10, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_TRIPLEGREENSHELL
{SPR_ARRO, FF_FULLBRIGHT|11, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_TRIPLEBANANA
{SPR_ARRO, FF_FULLBRIGHT|12, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_TRIPLEREDSHELL
{SPR_ARRO, FF_FULLBRIGHT|13, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_STAR
{SPR_ARRO, FF_FULLBRIGHT|14, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_MEGASHROOM
{SPR_ARRO, FF_FULLBRIGHT|15, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_KITCHENSINK
{SPR_ARRO, FF_FULLBRIGHT|16, -1, {NULL}, 0, 0, S_NULL}, // S_PLAYERARROW_EMPTY
{SPR_ARRO, FF_FULLBRIGHT|FF_ANIMATE|1, -1, {NULL}, 5, 3, S_NULL}, // S_PLAYERARROW_ROULETTE
{SPR_PBOM, 0, -1, {NULL}, 1, 0, S_NULL}, // S_PLAYERBOMB
#ifdef SEENAMES
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
#endif
@ -15112,6 +15138,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_BATTLEBALLOON
-1, // doomednum
S_BATTLEBALLOON1,// spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
4*FRACUNIT, // speed
8*FRACUNIT, // radius
16*FRACUNIT, // height
0, // display offset
100, // mass
1, // damage
sfx_None, // activesound
MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_LAKITU
-1, // doomednum
S_LAKITU1, // spawnstate
@ -16596,6 +16649,34 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_PLAYERARROW
-1, // doomednum
S_PLAYERARROW, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
8, // speed
36*FRACUNIT, // radius
37*FRACUNIT, // height
0, // display offset
16, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
// ============================================================================================================================//
#ifdef SEENAMES

View File

@ -598,6 +598,7 @@ typedef enum sprite
SPR_LIGH, // Lightning
SPR_SINK, // Kitchen Sink
SPR_SITR, // Kitchen Sink Trail
SPR_KBLN, // Battle Mode Balloon
SPR_LAKI, // Lakitu
@ -620,6 +621,10 @@ typedef enum sprite
SPR_CLAS, // items clash
SPR_PSHW, // thrown indicator
SPR_ARRO, // player arrows
SPR_PBOM, // player bomb
SPR_FIRSTFREESLOT,
SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1,
NUMSPRITES
@ -3212,6 +3217,11 @@ typedef enum state
S_SINKTRAIL2,
S_SINKTRAIL3,
// Battle Mode balloons
S_BATTLEBALLOON1,
S_BATTLEBALLOON2,
S_BATTLEBALLOON3,
// Lakitu
S_LAKITU1,
S_LAKITU2,
@ -3373,6 +3383,27 @@ typedef enum state
S_FIREDITEM3,
S_FIREDITEM4,
S_PLAYERARROW, // Above player arrow
S_PLAYERARROW_MUSHROOM,
S_PLAYERARROW_GREENSHELL,
S_PLAYERARROW_BANANA,
S_PLAYERARROW_FAKEITEM,
S_PLAYERARROW_BOO,
S_PLAYERARROW_FEATHER,
S_PLAYERARROW_REDSHELL,
S_PLAYERARROW_BOBOMB,
S_PLAYERARROW_FIREFLOWER,
S_PLAYERARROW_TRIPLEGREENSHELL,
S_PLAYERARROW_TRIPLEBANANA,
S_PLAYERARROW_TRIPLEREDSHELL,
S_PLAYERARROW_STAR,
S_PLAYERARROW_MEGASHROOM,
S_PLAYERARROW_KITCHENSINK,
S_PLAYERARROW_EMPTY,
S_PLAYERARROW_ROULETTE,
S_PLAYERBOMB,
#ifdef SEENAMES
S_NAMECHECK,
#endif
@ -3947,6 +3978,8 @@ typedef enum mobj_type
MT_SINK, // Kitchen Sink Stuff
MT_SINKTRAIL,
MT_BATTLEBALLOON, // Battle Mode balloons
MT_LAKITU,
MT_POKEY, // Huh, thought this was a default asset for some reason, guess not.
@ -4017,6 +4050,8 @@ typedef enum mobj_type
MT_FIREDITEM,
MT_PLAYERARROW,
#ifdef SEENAMES
MT_NAMECHECK,
#endif

File diff suppressed because it is too large Load Diff

View File

@ -15,20 +15,27 @@ UINT8 K_GetKartColorByName(const char *name);
void K_RegisterKartStuff(void);
void K_KartBouncer(void);
UINT8 K_GetKartCC(void);
void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce);
void K_KartMoveAnimation(player_t *player);
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
void K_SpinPlayer(player_t *player, mobj_t *source);
void K_SquishPlayer(player_t *player, mobj_t *source);
void K_ExplodePlayer(player_t *player, mobj_t *source);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit);
void K_StealBalloon(player_t *player, player_t *victim, boolean force);
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
void K_SpawnDriftTrail(player_t *player);
void K_DoMushroom(player_t *player, boolean doPFlag, boolean startboost);
void K_DoBouncePad(mobj_t *mo, fixed_t vertispeed);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
void K_MomentumToFacing(player_t *player);
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower);
fixed_t K_GetKartAccel(player_t *player);
UINT16 K_GetKartFlashing(player_t *player);
fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove);
void K_MoveKartPlayer(player_t *player, boolean onground);
void K_CheckBalloons(void);
void K_LoadKartHUDGraphics(void);
void K_drawKartHUD(void);

View File

@ -20,6 +20,7 @@
#include "m_random.h"
#include "s_sound.h"
#include "g_game.h"
#include "k_kart.h"
#include "lua_script.h"
#include "lua_libs.h"
@ -1009,10 +1010,11 @@ static int lib_pTeleportMove(lua_State *L)
static int lib_pSlideMove(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
boolean forceslide = luaL_checkboolean(L, 2);
NOHUD
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
P_SlideMove(mo);
P_SlideMove(mo, forceslide);
return 0;
}
@ -1980,6 +1982,184 @@ static int lib_gTicsToMilliseconds(lua_State *L)
return 1;
}
// K_KART
////////////
static int lib_kGetKartColorByName(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
//HUDSAFE
lua_pushinteger(L, K_GetKartColorByName(name));
return 1;
}
static int lib_kGetKartCC(lua_State *L)
{
//HUDSAFE
lua_pushinteger(L, K_GetKartCC());
return 1;
}
static int lib_kKartBouncing(lua_State *L)
{
mobj_t *mobj1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *mobj2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
boolean bounce = luaL_checkboolean(L, 3);
NOHUD
if (!mobj1)
return LUA_ErrInvalid(L, "mobj_t");
if (!mobj2)
return LUA_ErrInvalid(L, "mobj_t");
K_KartBouncing(mobj1, mobj2, bounce);
return 0;
}
static int lib_kSpinPlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
K_SpinPlayer(player, source);
return 0;
}
static int lib_kSquishPlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
K_SquishPlayer(player, source);
return 0;
}
static int lib_kExplodePlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
K_ExplodePlayer(player, source);
return 0;
}
static int lib_kStealBalloon(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
player_t *victim = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
boolean force = luaL_checkboolean(L, 3);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (!victim)
return LUA_ErrInvalid(L, "player_t");
K_StealBalloon(player, victim, force);
return 0;
}
static int lib_kSpawnKartExplosion(lua_State *L)
{
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = luaL_checkfixed(L, 3);
fixed_t radius = luaL_checkfixed(L, 4);
INT32 number = (INT32)luaL_checkinteger(L, 5);
mobjtype_t type = luaL_checkinteger(L, 6);
angle_t rotangle = luaL_checkangle(L, 7);
boolean spawncenter = luaL_checkboolean(L, 8);
boolean ghostit = luaL_checkboolean(L, 9);
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 10, META_MOBJ));
NOHUD
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
K_SpawnKartExplosion(x, y, z, radius, number, type, rotangle, spawncenter, ghostit, source);
return 0;
}
static int lib_kSpawnDriftTrail(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_SpawnDriftTrail(player);
return 0;
}
static int lib_kDoMushroom(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
boolean doPFlag = luaL_checkboolean(L, 2);
boolean startboost = luaL_checkboolean(L, 3);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_DoMushroom(player, doPFlag, startboost);
return 0;
}
static int lib_kDoBouncePad(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t vertispeed = luaL_checkfixed(L, 2);
NOHUD
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
K_DoBouncePad(mo, vertispeed);
return 0;
}
static int lib_kMomentumToFacing(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_MomentumToFacing(player);
return 0;
}
static int lib_kGetKartSpeed(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
boolean doboostpower = luaL_checkboolean(L, 2);
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, K_GetKartSpeed(player, doboostpower));
return 0;
}
static int lib_kGetKartAccel(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, K_GetKartAccel(player));
return 0;
}
static int lib_kGetKartFlashing(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, K_GetKartFlashing(player));
return 0;
}
static luaL_Reg lib[] = {
{"print", lib_print},
{"EvalMath", lib_evalMath},
@ -2153,6 +2333,23 @@ static luaL_Reg lib[] = {
{"G_TicsToCentiseconds",lib_gTicsToCentiseconds},
{"G_TicsToMilliseconds",lib_gTicsToMilliseconds},
// k_kart
{"K_GetKartColorByName",lib_kGetKartColorByName},
{"K_GetKartCC",lib_kGetKartCC},
{"K_KartBouncing",lib_kKartBouncing},
{"K_SpinPlayer",lib_kSpinPlayer},
{"K_SquishPlayer",lib_kSquishPlayer},
{"K_ExplodePlayer",lib_kExplodePlayer},
{"K_StealBalloon",lib_kStealBalloon},
{"K_SpawnKartExplosion",lib_kSpawnKartExplosion},
{"K_SpawnDriftTrail",lib_kSpawnDriftTrail},
{"K_DoMushroom",lib_kDoMushroom},
{"K_DoBouncePad",lib_kDoBouncePad},
{"K_MomentumToFacing",lib_kMomentumToFacing},
{"K_GetKartSpeed",lib_kGetKartSpeed},
{"K_GetKartAccel",lib_kGetKartAccel},
{"K_GetKartFlashing",lib_kGetKartFlashing},
{NULL, NULL}
};

View File

@ -130,8 +130,6 @@ static int player_get(lua_State *L)
LUA_PushUserdata(L, plr->powers, META_POWERS);
else if (fastcmp(field,"kartstuff"))
LUA_PushUserdata(L, plr->kartstuff, META_KARTSTUFF);
else if (fastcmp(field,"collide"))
LUA_PushUserdata(L, plr->collide, META_COLLIDE);
else if (fastcmp(field,"frameangle"))
lua_pushangle(L, plr->frameangle);
else if (fastcmp(field,"pflags"))
@ -248,6 +246,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->starpostz);
else if (fastcmp(field,"starpostnum"))
lua_pushinteger(L, plr->starpostnum);
else if (fastcmp(field,"starpostcount"))
lua_pushinteger(L, plr->starpostcount);
else if (fastcmp(field,"starposttime"))
lua_pushinteger(L, plr->starposttime);
else if (fastcmp(field,"starpostangle"))
@ -414,10 +414,14 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"dashtime"))
plr->dashtime = (INT32)luaL_checkinteger(L, 3);
// SRB2kart
else if (fastcmp(field,"kartstuff"))
return NOSET;
else if (fastcmp(field,"frameangle"))
plr->frameangle = luaL_checkangle(L, 3);
else if (fastcmp(field,"kartspeed"))
plr->kartspeed = (UINT8)luaL_checkfixed(L, 3);
plr->kartspeed = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"kartweight"))
plr->kartweight = (UINT8)luaL_checkfixed(L, 3);
plr->kartweight = (UINT8)luaL_checkinteger(L, 3);
//
else if (fastcmp(field,"normalspeed"))
plr->normalspeed = luaL_checkfixed(L, 3);
@ -511,6 +515,8 @@ static int player_set(lua_State *L)
plr->starpostz = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostnum"))
plr->starpostnum = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostcount"))
plr->starpostcount = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starposttime"))
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostangle"))
@ -672,6 +678,38 @@ static int power_len(lua_State *L)
return 1;
}
// kartstuff, ks -> kartstuff[ks]
static int kartstuff_get(lua_State *L)
{
INT32 *kartstuff = *((INT32 **)luaL_checkudata(L, 1, META_KARTSTUFF));
kartstufftype_t ks = luaL_checkinteger(L, 2);
if (ks >= NUMKARTSTUFF)
return luaL_error(L, LUA_QL("kartstufftype_t") " cannot be %u", ks);
lua_pushinteger(L, kartstuff[ks]);
return 1;
}
// kartstuff, ks, value -> kartstuff[ks] = value
static int kartstuff_set(lua_State *L)
{
INT32 *kartstuff = *((INT32 **)luaL_checkudata(L, 1, META_KARTSTUFF));
kartstufftype_t ks = luaL_checkinteger(L, 2);
INT32 i = (INT32)luaL_checkinteger(L, 3);
if (ks >= NUMKARTSTUFF)
return luaL_error(L, LUA_QL("kartstufftype_t") " cannot be %u", ks);
if (hud_running)
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
kartstuff[ks] = i;
return 0;
}
// #kartstuff -> NUMKARTSTUFF
static int kartstuff_len(lua_State *L)
{
lua_pushinteger(L, NUMKARTSTUFF);
return 1;
}
#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, field)
static int ticcmd_get(lua_State *L)
@ -749,6 +787,17 @@ int LUA_PlayerLib(lua_State *L)
lua_setfield(L, -2, "__len");
lua_pop(L,1);
luaL_newmetatable(L, META_KARTSTUFF);
lua_pushcfunction(L, kartstuff_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, kartstuff_set);
lua_setfield(L, -2, "__newindex");
lua_pushcfunction(L, kartstuff_len);
lua_setfield(L, -2, "__len");
lua_pop(L,1);
luaL_newmetatable(L, META_TICCMD);
lua_pushcfunction(L, ticcmd_get);
lua_setfield(L, -2, "__index");

View File

@ -435,7 +435,6 @@ void LUA_InvalidatePlayer(player_t *player)
LUA_InvalidateUserdata(player);
LUA_InvalidateUserdata(player->powers);
LUA_InvalidateUserdata(player->kartstuff);
LUA_InvalidateUserdata(player->collide);
LUA_InvalidateUserdata(&player->cmd);
}

View File

@ -165,10 +165,10 @@ static int skin_get(lua_State *L)
break;
// SRB2kart
case skin_kartspeed:
lua_pushfixed(L, skin->kartspeed);
lua_pushinteger(L, skin->kartspeed);
break;
case skin_kartweight:
lua_pushfixed(L, skin->kartweight);
lua_pushinteger(L, skin->kartweight);
break;
//
case skin_normalspeed:

View File

@ -33,6 +33,8 @@
#include "z_zone.h"
#include "p_slopes.h"
#include "k_kart.h" // srb2kart
#include "lua_script.h"
#include "lua_hook.h"
@ -1348,7 +1350,7 @@ void Command_ObjectPlace_f(void)
players[0].mo->color = op_oldcolor;
// This is necessary for recovery of dying players.
if (players[0].powers[pw_flashing] >= flashingtics)
players[0].powers[pw_flashing] = flashingtics - 1;
if (players[0].powers[pw_flashing] >= K_GetKartFlashing(&players[0]))
players[0].powers[pw_flashing] = K_GetKartFlashing(&players[0]) - 1;
}
}

View File

@ -850,7 +850,7 @@ void A_Look(mobj_t *actor)
if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale)))
return;
if (leveltime < 4*TICRATE && gametype == GT_RACE) // SRB2kart - no looking before race starts
if (leveltime < 4*TICRATE) // SRB2kart - no looking before race starts
return;
// go into chase state
@ -3627,12 +3627,16 @@ void A_AttractChase(mobj_t *actor)
P_LookForShield(actor); // Go find 'em, boy!
if (!actor->tracer
if (actor->tracer && actor->tracer->player && actor->tracer->player->kartstuff[k_comebackmode] == 1)
;
else if (!actor->tracer
|| !actor->tracer->player
|| !actor->tracer->health
|| !P_CheckSight(actor, actor->tracer)) // You have to be able to SEE it...sorta
{
// Lost attracted rings don't through walls anymore.
if (actor->tracer && actor->tracer->player)
actor->tracer->player->kartstuff[k_comebackmode] = 0;
actor->flags &= ~MF_NOCLIP;
P_SetTarget(&actor->tracer, NULL);
return;
@ -3921,10 +3925,11 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing)
if (thing == grenade->target && !(grenade->threshold == 0)) // Don't blow up at your owner.
return true;
if (thing->player && thing->player->kartstuff[k_bootaketimer])
if (thing->player && (thing->player->kartstuff[k_bootimer]
|| (thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebacktimer])))
return true;
if ((gametype == GT_CTF || gametype == GT_MATCH)
if ((gametype == GT_CTF || gametype == GT_TEAMMATCH)
&& !cv_friendlyfire.value && grenade->target->player && thing->player
&& grenade->target->player->ctfteam == thing->player->ctfteam) // Don't blow up at your teammates, unless friendlyfire is on
return true;
@ -8090,6 +8095,13 @@ void A_ItemPop(mobj_t *actor)
{
mobj_t *remains;
if (!(actor->target && actor->target->player))
{
if (cv_debug && !(actor->target && actor->target->player))
CONS_Printf("ERROR: Powerup has no target!\n");
return;
}
// de-solidify
//P_UnsetThingPosition(actor);
//actor->flags &= ~MF_SOLID;
@ -8123,26 +8135,13 @@ void A_ItemPop(mobj_t *actor)
return;
}
if (actor->target && actor->target->player // These used to be &2's and &8's for box only, but are now universal.
&& !(actor->target->player->kartstuff[k_greenshell] || actor->target->player->kartstuff[k_triplegreenshell]
|| actor->target->player->kartstuff[k_redshell] || actor->target->player->kartstuff[k_tripleredshell]
|| actor->target->player->kartstuff[k_banana] || actor->target->player->kartstuff[k_triplebanana]
|| actor->target->player->kartstuff[k_fakeitem] & 2 || actor->target->player->kartstuff[k_magnet]
|| actor->target->player->kartstuff[k_bobomb] || actor->target->player->kartstuff[k_blueshell]
|| actor->target->player->kartstuff[k_mushroom] || actor->target->player->kartstuff[k_fireflower]
|| actor->target->player->kartstuff[k_star] || actor->target->player->kartstuff[k_goldshroom]
|| actor->target->player->kartstuff[k_lightning] || actor->target->player->kartstuff[k_megashroom]
|| actor->target->player->kartstuff[k_itemroulette]
|| actor->target->player->kartstuff[k_boo] || actor->target->player->kartstuff[k_bootaketimer]
|| actor->target->player->kartstuff[k_boostolentimer]
|| actor->target->player->kartstuff[k_growshrinktimer] > 1
|| actor->target->player->kartstuff[k_goldshroomtimer]))
actor->target->player->kartstuff[k_itemroulette] = 1;
else if (cv_debug && !(actor->target && actor->target->player))
CONS_Printf("ERROR: Powerup has no target!\n");
actor->target->player->kartstuff[k_itemroulette] = 1;
remains->flags2 &= ~MF2_AMBUSH;
if (gametype != GT_RACE)
numgotboxes++;
P_RemoveMobj(actor);
}
@ -8213,8 +8212,11 @@ void A_RedShellChase(mobj_t *actor)
continue;
}
if (!(gametype == GT_RACE))
if (gametype != GT_RACE)
{
if (player->kartstuff[k_balloon] <= 0)
continue;
if (P_AproxDistance(P_AproxDistance(player->mo->x-actor->x,
player->mo->y-actor->y), player->mo->z-actor->z) > RING_DIST)
continue;
@ -8223,7 +8225,8 @@ void A_RedShellChase(mobj_t *actor)
if ((gametype == GT_RACE) || (gametype != GT_RACE // If in match etc. only home in when you get close enough, in race etc. home in all the time
&& P_AproxDistance(P_AproxDistance(player->mo->x-actor->x,
player->mo->y-actor->y), player->mo->z-actor->z) < RING_DIST))
player->mo->y-actor->y), player->mo->z-actor->z) < RING_DIST
&& player->kartstuff[k_balloon] > 0))
P_SetTarget(&actor->tracer, player->mo);
return;
@ -8253,7 +8256,7 @@ void A_BobombExplode(mobj_t *actor)
type = (mobjtype_t)locvar1;
for (d = 0; d < 16; d++)
K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), false, false); // 32 <-> 64
K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), false, false, actor->target); // 32 <-> 64
P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOMBEXPLOSIONSOUND);
@ -8269,6 +8272,9 @@ void A_BobombExplode(mobj_t *actor)
if (mo2 == actor || mo2->type == MT_BOMBEXPLOSIONSOUND) // Don't explode yourself! Endless loop!
continue;
if (actor->target && actor->target->player && actor->target->player->kartstuff[k_balloon] <= 0 && mo2 == actor->target)
continue;
if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > actor->info->painchance)
continue;

View File

@ -150,6 +150,28 @@ boolean P_CanPickupItem(player_t *player, boolean weapon)
//if (player->powers[pw_flashing] > (flashingtics/4)*3 && player->powers[pw_flashing] <= flashingtics)
// return false;
if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) // No balloons in Match
return false;
if (player->kartstuff[k_magnettimer]) // You should probably collect stuff when you're attracting it :V
return true;
if (player->kartstuff[k_bootaketimer] || player->kartstuff[k_boostolentimer]
|| player->kartstuff[k_growshrinktimer] > 1 || player->kartstuff[k_goldshroomtimer]) // Item-specific timer going off
return false;
if (player->kartstuff[k_itemroulette]
|| player->kartstuff[k_greenshell] || player->kartstuff[k_triplegreenshell]
|| player->kartstuff[k_redshell] || player->kartstuff[k_tripleredshell]
|| player->kartstuff[k_banana] || player->kartstuff[k_triplebanana]
|| player->kartstuff[k_fakeitem] & 2 || player->kartstuff[k_magnet]
|| player->kartstuff[k_bobomb] || player->kartstuff[k_blueshell]
|| player->kartstuff[k_mushroom] || player->kartstuff[k_fireflower]
|| player->kartstuff[k_star] || player->kartstuff[k_goldshroom]
|| player->kartstuff[k_lightning] || player->kartstuff[k_megashroom]
|| player->kartstuff[k_boo] || player->kartstuff[k_feather] & 1) // Item slot already taken up
return false;
return true;
}
@ -388,8 +410,34 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{
case MT_RANDOMITEM: // SRB2kart
case MT_FLINGRANDOMITEM:
if (!(P_CanPickupItem(player, false)))
if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0)
{
if (player->kartstuff[k_comebackmode] == 0 && !player->kartstuff[k_comebacktimer])
{
if (special->tracer && special->tracer->player)
special->tracer->player->kartstuff[k_comebackmode] = 0;
P_SetTarget(&special->tracer, toucher);
player->kartstuff[k_comebackmode] = 1;
}
return;
}
if (!P_CanPickupItem(player, false) && special->tracer != toucher)
return;
if (gametype != GT_RACE && special->tracer && special->tracer->player)
{
special->tracer->player->kartstuff[k_comebackmode] = 0;
special->tracer->player->kartstuff[k_comebackpoints]++;
CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[special->tracer->player-players], player_names[player-players]);
if (special->tracer->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(special->tracer->player, player, true);
special->tracer->player->kartstuff[k_comebacktimer] = comebacktime;
}
special->momx = special->momy = special->momz = 0;
P_SetTarget(&special->target, toucher);
P_SetMobjState(special, special->info->deathstate);
@ -1165,9 +1213,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return;
}
//
// In circuit, player must have touched all previous starposts
// SRB2kart: make sure the player will have enough checkpoints to touch
if (circuitmap
&& special->health - player->starpostnum > 1)
&& special->health >= (numstarposts/2 + player->starpostnum))
{
// blatant reuse of a variable that's normally unused in circuit
if (!player->tossdelay)
@ -1194,6 +1242,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->starpostz = special->z>>FRACBITS;
player->starpostangle = special->angle;
player->starpostnum = special->health;
player->starpostcount++;
P_ClearStarPost(special->health);
// Find all starposts in the level with this value.
@ -2004,6 +2053,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
target->target->player->kartstuff[k_triplebanana] &= ~2;
else if (target->type == MT_TRIPLEBANANASHIELD3 && target->target->player->kartstuff[k_triplebanana] & 4)
target->target->player->kartstuff[k_triplebanana] &= ~4;
/*else if (target->type == MT_BATTLEBALLOON && target->target->player->kartstuff[k_balloon] > target->threshold-1)
target->target->player->kartstuff[k_balloon] = target->threshold-1;*/
}
//
@ -2066,7 +2117,9 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
P_SetTarget(&target->target, source);
source->player->numboxes++;
if ((cv_itemrespawn.value && gametype != GT_COOP && (modifiedgame || netgame || multiplayer)))
{
target->fuse = cv_itemrespawntime.value*TICRATE + 2; // Random box generation
}
}
// Award Score Tails
@ -2214,7 +2267,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
for (w=0; w < MAXPLAYERS; w++)
{
if (players[w].pflags & PF_TAGIT)
P_AddPlayerScore(&players[w], 100);
P_AddPlayerScore(&players[w], 1);
}
target->player->pflags |= PF_TAGGED;
@ -2224,6 +2277,10 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
}
}
}
else if (gametype == GT_MATCH)
{
K_CheckBalloons();
}
}
if (source && target && target->player && source->player)
@ -2535,7 +2592,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
target->momy = FixedMul(FINESINE(fa),target->target->radius);
}
player->powers[pw_flashing] = flashingtics;
player->powers[pw_flashing] = K_GetKartFlashing(player);
P_SetMobjState(target->tracer, S_NIGHTSHURT1);
S_StartSound(target, sfx_nghurt);
@ -2580,7 +2637,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
// The tag occurs so long as you aren't shooting another tagger with friendlyfire on.
if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT))
{
P_AddPlayerScore(source->player, 100); //award points to tagger.
P_AddPlayerScore(source->player, 1); //award points to tagger.
P_HitDeathMessages(player, inflictor, source);
if (gametype == GT_TAG) //survivor
@ -2694,21 +2751,21 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
/*if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
{
P_PlayerFlagBurst(player, false);
if (source && source->player)
{
// Award no points when players shoot each other when cv_friendlyfire is on.
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
P_AddPlayerScore(source->player, 25);
P_AddPlayerScore(source->player, 1);
}
}
if (source && source->player && !player->powers[pw_super]) //don't score points against super players
{
// Award no points when players shoot each other when cv_friendlyfire is on.
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
P_AddPlayerScore(source->player, 100);
P_AddPlayerScore(source->player, 1);
}
// If the player was super, tell them he/she ain't so super nomore.
@ -2718,6 +2775,18 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
HU_SetCEchoFlags(0);
HU_SetCEchoDuration(5);
HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players]));
}*/
if (gametype != GT_RACE)
{
if (player->kartstuff[k_balloon] > 0)
{
if (player->kartstuff[k_balloon] == 1)
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
player->kartstuff[k_balloon]--;
}
K_CheckBalloons();
}
}
@ -2854,11 +2923,11 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
S_StartSound(player->mo, sfx_spkdth);
}
if (source && source->player && !player->powers[pw_super]) //don't score points against super players
/*if (source && source->player && !player->powers[pw_super]) //don't score points against super players
{
// Award no points when players shoot each other when cv_friendlyfire is on.
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
P_AddPlayerScore(source->player, 50);
P_AddPlayerScore(source->player, 1);
}
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
@ -2868,9 +2937,9 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
{
// Award no points when players shoot each other when cv_friendlyfire is on.
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
P_AddPlayerScore(source->player, 25);
P_AddPlayerScore(source->player, 1);
}
}
}*/
// Ring loss sound plays despite hitting spikes
P_PlayRinglossSound(player->mo); // Ringledingle!
@ -3092,7 +3161,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
{
// Just need to do this now! Being thrown upwards is done by the explosion.
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUELIGHTNING);
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
mobj_t *blueexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
P_SetTarget(&blueexplode->target, source);
return true;
}
else if (damage == 65 && player->kartstuff[k_position] > 1)
@ -3124,17 +3194,29 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false;
else
{
player->kartstuff[k_spinouttype] = 1;
K_SpinPlayer(player, source);
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
if (inflictor && (inflictor->type == MT_GREENITEM || inflictor->type == MT_REDITEM || inflictor->type == MT_REDITEMDUD))
P_PlayerRingBurst(player, 5);
player->mo->momx = player->mo->momy = 0;
if (P_IsLocalPlayer(player))
if (inflictor && (inflictor->type == MT_GREENITEM || inflictor->type == MT_GREENSHIELD
|| inflictor->type == MT_REDITEM || inflictor->type == MT_REDSHIELD || inflictor->type == MT_REDITEMDUD
|| inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD
|| inflictor->type == MT_TRIPLEGREENSHIELD1 || inflictor->type == MT_TRIPLEGREENSHIELD2 || inflictor->type == MT_TRIPLEGREENSHIELD3
|| inflictor->type == MT_TRIPLEREDSHIELD1 || inflictor->type == MT_TRIPLEREDSHIELD2 || inflictor->type == MT_TRIPLEREDSHIELD3
|| inflictor->player))
{
quake.intensity = 32*FRACUNIT;
quake.time = 5;
player->kartstuff[k_spinouttype] = 1;
K_SpinPlayer(player, source);
damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5);
player->mo->momx = player->mo->momy = 0;
if (P_IsLocalPlayer(player))
{
quake.intensity = 32*FRACUNIT;
quake.time = 5;
}
}
else
{
player->kartstuff[k_spinouttype] = -1;
K_SpinPlayer(player, source);
}
return true;
}
@ -3227,7 +3309,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
player->health -= damage; // mirror mobj health here
if (damage < 10000)
{
target->player->powers[pw_flashing] = flashingtics;
target->player->powers[pw_flashing] = K_GetKartFlashing(target->player);
if (damage > 0) // don't spill emeralds/ammo/panels for shield damage
P_PlayerRingBurst(player, damage);
}

View File

@ -153,7 +153,7 @@ void P_DoJumpShield(player_t *player);
void P_BlackOw(player_t *player);
void P_ElementalFireTrail(player_t *player);
void P_DoPityCheck(player_t *player);
//void P_DoPityCheck(player_t *player);
void P_PlayerThink(player_t *player);
void P_PlayerAfterThink(player_t *player);
void P_DoPlayerExit(player_t *player);
@ -201,6 +201,7 @@ extern size_t iquehead, iquetail;
extern consvar_t cv_gravity, cv_viewheight;
void P_RespawnSpecials(void);
void P_RespawnBattleSpecials(void);
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
@ -326,7 +327,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
boolean P_Move(mobj_t *actor, fixed_t speed);
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
void P_SlideMove(mobj_t *mo);
void P_SlideMove(mobj_t *mo, boolean forceslide);
void P_BounceMove(mobj_t *mo);
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);

View File

@ -320,6 +320,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
}
}
#if 0
static void P_DoTailsCarry(player_t *sonic, player_t *tails)
{
INT32 p;
@ -400,6 +401,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
sonic->pflags &= ~PF_CARRIED;
}
}
#endif
//
// PIT_CheckThing
@ -673,6 +675,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
&& (tmthing->target == thing->target)) // Don't hit each other if you have the same target
return true;
if (thing->player && thing->player->powers[pw_flashing]
&& !(tmthing->type == MT_GREENITEM || tmthing->type == MT_REDITEM || tmthing->type == MT_REDITEMDUD))
return true;
if (thing->type == MT_PLAYER)
{
// Player Damage
@ -808,6 +814,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (((tmthing->target == thing) || (tmthing->target == thing->target)) && (tmthing->threshold > 0 || (thing->type != MT_PLAYER && thing->threshold > 0)))
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
S_StartSound(NULL, sfx_cgot); //let all players hear it.
@ -832,6 +841,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (!(thing->type == MT_PLAYER))
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
K_SpinPlayer(thing->player, tmthing->target);
@ -863,6 +875,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->type == MT_FIREBALL && thing->type == MT_FIREBALL)
return true; // Fireballs don't collide with eachother
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
// Player Damage
@ -960,6 +975,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->health <= 0 || thing->health <= 0)
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_GREENITEM // When these items collide with the fake item, just the fake item is destroyed
|| thing->type == MT_REDITEM || thing->type == MT_REDITEMDUD
|| thing->type == MT_BOMBITEM
@ -1043,6 +1061,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->health <= 0 || thing->health <= 0)
return true;
if (thing->player && thing->player->powers[pw_flashing])
return true;
if (thing->type == MT_PLAYER)
{
P_KillMobj(tmthing, thing, thing);
@ -1087,6 +1108,10 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (tmthing->player && tmthing->player->powers[pw_flashing]
&& !(thing->type == MT_GREENITEM || thing->type == MT_REDITEM || thing->type == MT_REDITEMDUD))
return true;
if (thing->type == MT_GREENSHIELD || thing->type == MT_TRIPLEGREENSHIELD1 || thing->type == MT_TRIPLEGREENSHIELD2 || thing->type == MT_TRIPLEGREENSHIELD3
|| thing->type == MT_REDSHIELD || thing->type == MT_TRIPLEREDSHIELD1 || thing->type == MT_TRIPLEREDSHIELD2 || thing->type == MT_TRIPLEREDSHIELD3
|| thing->type == MT_GREENITEM || thing->type == MT_REDITEM || thing->type == MT_REDITEMDUD
@ -1534,7 +1559,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
}
// Force solid players in hide and seek to avoid corner stacking.
if (cv_tailspickup.value && gametype != GT_HIDEANDSEEK)
// Kart: No Tailspickup ever, players are always solid
/*if (cv_tailspickup.value && gametype != GT_HIDEANDSEEK)
{
if (tmthing->player && thing->player)
{
@ -1546,7 +1572,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, true);
thing->player->pflags &= ~PF_CARRIED;
}
}*/
if (thing->player)
{
@ -1592,6 +1618,101 @@ static boolean PIT_CheckThing(mobj_t *thing)
&& tmthing->z <= thing->z + thing->height)
iwassprung = P_DoSpring(thing, tmthing);
}
else if (thing->player) // bounce when players collide
{
// see if it went over / under
if (tmthing->z > thing->z + thing->height)
return true; // overhead
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
if (thing->player->kartstuff[k_growshrinktimer] || thing->player->kartstuff[k_squishedtimer]
|| thing->player->kartstuff[k_bootimer] || thing->player->kartstuff[k_spinouttimer]
|| thing->player->kartstuff[k_startimer] || thing->player->kartstuff[k_justbumped]
|| (gametype != GT_RACE && (thing->player->kartstuff[k_balloon] <= 0
&& (thing->player->kartstuff[k_comebacktimer] || thing->player->kartstuff[k_comebackmode] == 1)))
|| tmthing->player->kartstuff[k_growshrinktimer] || tmthing->player->kartstuff[k_squishedtimer]
|| tmthing->player->kartstuff[k_bootimer] || tmthing->player->kartstuff[k_spinouttimer]
|| tmthing->player->kartstuff[k_startimer] || tmthing->player->kartstuff[k_justbumped]
|| (gametype != GT_RACE && (tmthing->player->kartstuff[k_balloon] <= 0
&& (tmthing->player->kartstuff[k_comebacktimer] || tmthing->player->kartstuff[k_comebackmode] == 1))))
{
return true;
}
if (gametype != GT_RACE)
{
if ((thing->player->kartstuff[k_balloon] <= 0 || tmthing->player->kartstuff[k_balloon] <= 0)
&& (thing->player->kartstuff[k_comebackmode] == 0 && tmthing->player->kartstuff[k_comebackmode] == 0))
{
if (tmthing->player->kartstuff[k_balloon] > 0)
{
thing->player->kartstuff[k_comebackpoints] += 2;
CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[thing->player-players], player_names[tmthing->player-players]);
if (thing->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(thing->player, tmthing->player, true);
K_ExplodePlayer(tmthing->player, thing);
thing->player->kartstuff[k_comebacktimer] = comebacktime;
return true;
}
else if (thing->player->kartstuff[k_balloon] > 0)
{
tmthing->player->kartstuff[k_comebackpoints] += 2;
CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[tmthing->player-players], player_names[thing->player-players]);
if (tmthing->player->kartstuff[k_comebackpoints] >= 3)
K_StealBalloon(tmthing->player, thing->player, true);
K_ExplodePlayer(thing->player, tmthing);
tmthing->player->kartstuff[k_comebacktimer] = comebacktime;
return true;
}
}
}
if (P_IsObjectOnGround(thing) && tmthing->momz < 0)
{
K_KartBouncing(tmthing, thing, true);
if (gametype != GT_RACE && tmthing->player->kartstuff[k_feather] & 2)
{
K_StealBalloon(tmthing->player, thing->player, false);
K_SpinPlayer(thing->player, tmthing);
}
}
else if (P_IsObjectOnGround(tmthing) && thing->momz < 0)
{
K_KartBouncing(thing, tmthing, true);
if (gametype != GT_RACE && thing->player->kartstuff[k_feather] & 2)
{
K_StealBalloon(thing->player, tmthing->player, false);
K_SpinPlayer(tmthing->player, thing);
}
}
else
K_KartBouncing(tmthing, thing, false);
if (gametype != GT_RACE)
{
if (thing->player->kartstuff[k_mushroomtimer] && !(tmthing->player->kartstuff[k_mushroomtimer]))
{
K_StealBalloon(thing->player, tmthing->player, false);
K_SpinPlayer(tmthing->player, thing);
}
else if (tmthing->player->kartstuff[k_mushroomtimer] && !(thing->player->kartstuff[k_mushroomtimer]))
{
K_StealBalloon(tmthing->player, thing->player, false);
K_SpinPlayer(thing->player, tmthing);
}
}
thing->player->kartstuff[k_justbumped] = 6;
tmthing->player->kartstuff[k_justbumped] = 6;
return true;
}
// Are you touching the side of the object you're interacting with?
else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height
&& thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z)
@ -2613,7 +2734,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (!(thing->flags & MF_NOCLIP))
{
//All things are affected by their scale.
fixed_t maxstep = FixedMul(MAXSTEPMOVE, thing->scale);
fixed_t maxstep = MAXSTEPMOVE; //FixedMul(MAXSTEPMOVE, thing->scale);
if (thing->player)
{
@ -3522,7 +3643,7 @@ stairstep:
//
// This is a kludgy mess.
//
void P_SlideMove(mobj_t *mo)
void P_SlideMove(mobj_t *mo, boolean forceslide)
{
fixed_t leadx, leady, trailx, traily, newx, newy;
INT16 hitcount = 0;
@ -3600,7 +3721,7 @@ retry:
PT_ADDLINES, PTR_SlideTraverse);
// Some walls are bouncy even if you're not
if (bestslideline && !(bestslideline->flags & ML_BOUNCY)) // SRB2kart - All walls are bouncy unless specified otherwise
if (!forceslide && bestslideline && !(bestslideline->flags & ML_BOUNCY)) // SRB2kart - All walls are bouncy unless specified otherwise
{
P_BounceMove(mo);
return;

View File

@ -216,11 +216,11 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
}
}
// You were in pain state after taking a hit, and you're moving out of pain state now?
else */if (mobj->state == &states[mobj->info->painstate] && player->powers[pw_flashing] == flashingtics && state != mobj->info->painstate)
else */if (mobj->state == &states[mobj->info->painstate] && player->powers[pw_flashing] == K_GetKartFlashing(player) && state != mobj->info->painstate)
{
// Start flashing, since you've landed.
player->powers[pw_flashing] = flashingtics-1;
P_DoPityCheck(player);
player->powers[pw_flashing] = K_GetKartFlashing(player)-1;
//P_DoPityCheck(player);
}
// Set animation state
@ -1331,6 +1331,8 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
}
if (wasflip == !(mo->eflags & MFE_VERTICALFLIP)) // note!! == ! is not equivalent to != here - turns numeric into bool this way
P_PlayerFlip(mo);
if (mo->player->kartstuff[k_feather] & 2)
gravityadd = FixedMul(gravityadd, 5*FRACUNIT/2);
}
else
{
@ -1378,6 +1380,10 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
break;
case MT_WATERDROP:
gravityadd >>= 1;
case MT_BANANAITEM:
case MT_FAKEITEM:
case MT_BOMBITEM:
gravityadd = FixedMul(gravityadd, 5*FRACUNIT/2);
default:
break;
}
@ -1809,7 +1815,7 @@ void P_XYMovement(mobj_t *mo)
}
else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE))
{ // try to slide along it
P_SlideMove(mo);
P_SlideMove(mo, false);
xmove = ymove = 0;
}
else if (mo->type == MT_SPINFIRE)
@ -1990,7 +1996,7 @@ static void P_RingXYMovement(mobj_t *mo)
I_Assert(!P_MobjWasRemoved(mo));
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_SlideMove(mo);
P_SlideMove(mo, false);
}
static void P_SceneryXYMovement(mobj_t *mo)
@ -2004,7 +2010,7 @@ static void P_SceneryXYMovement(mobj_t *mo)
oldy = mo->y;
if (!P_SceneryTryMove(mo, mo->x + mo->momx, mo->y + mo->momy))
P_SlideMove(mo);
P_SlideMove(mo, false);
if ((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
return; // no friction when airborne
@ -2299,6 +2305,14 @@ static boolean P_ZMovement(mobj_t *mo)
case MT_BIGTUMBLEWEED:
case MT_LITTLETUMBLEWEED:
case MT_SHELL:
// SRB2kart stuff that should die in pits
// Shouldn't stop moving along the Z if there's no speed though!
case MT_FAKEITEM:
case MT_BANANAITEM:
case MT_GREENITEM:
case MT_REDITEM:
case MT_REDITEMDUD:
case MT_FIREBALL:
// Remove stuff from death pits.
if (P_CheckDeathPitCollide(mo))
{
@ -2325,13 +2339,6 @@ static boolean P_ZMovement(mobj_t *mo)
case MT_FLINGCOIN:
case MT_FLINGRANDOMITEM:
case MT_FLINGEMERALD:
// SRB2kart stuff that should die in pits
case MT_RANDOMITEM:
case MT_BANANAITEM:
case MT_GREENITEM:
case MT_REDITEM:
case MT_REDITEMDUD:
case MT_FIREBALL:
// Remove flinged stuff from death pits.
if (P_CheckDeathPitCollide(mo))
{
@ -6452,19 +6459,30 @@ void P_MobjThinker(mobj_t *mobj)
//{ SRB2kart mobs
case MT_DRIFT:
{
fixed_t dsone = 26*4 + mobj->target->player->kartspeed*2 + (9 - mobj->target->player->kartweight);
fixed_t dstwo = dsone*2;
if ((mobj->target && mobj->target->player && mobj->target->player->mo && mobj->target->player->health > 0 && !mobj->target->player->spectator)
&& (mobj->type == MT_DRIFT && mobj->target->player->kartstuff[k_driftcharge] >= dsone))
if (mobj->target && mobj->target->player && mobj->target->player->mo && mobj->target->player->health > 0 && !mobj->target->player->spectator)
{
UINT8 kartspeed = mobj->target->player->kartspeed;
fixed_t dsone, dstwo;
INT32 HEIGHT;
fixed_t radius;
if (mobj->target->player->kartstuff[k_bootaketimer] > 0)
if (gametype != GT_RACE && mobj->target->player->kartstuff[k_balloon] <= 0)
kartspeed = 1;
dsone = 26*4 + kartspeed*2 + (9 - mobj->target->player->kartweight);
dstwo = dsone*2;
if (mobj->target->player->kartstuff[k_driftcharge] < dsone)
{
P_RemoveMobj(mobj);
return;
}
if (mobj->target->player->kartstuff[k_bootimer] > 0)
{
if ((mobj->target->player == &players[displayplayer] || (splitscreen && mobj->target->player == &players[secondarydisplayplayer]))
|| (!(mobj->target->player == &players[displayplayer] || (splitscreen && mobj->target->player == &players[secondarydisplayplayer]))
&& (mobj->target->player->kartstuff[k_bootaketimer] < 1*TICRATE/2 || mobj->target->player->kartstuff[k_bootaketimer] > bootime-(1*TICRATE/2))))
&& (mobj->target->player->kartstuff[k_bootimer] < 1*TICRATE/2 || mobj->target->player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
{
if (leveltime & 1)
mobj->flags2 |= MF2_DONTDRAW;
@ -6474,7 +6492,7 @@ void P_MobjThinker(mobj_t *mobj)
else
mobj->flags2 |= MF2_DONTDRAW;
}
else if (mobj->target->player->kartstuff[k_bootaketimer] == 0)
else if (mobj->target->player->kartstuff[k_bootimer] == 0)
{
mobj->flags2 &= ~MF2_DONTDRAW;
}
@ -6540,15 +6558,8 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->health > 0 && mobj->target && mobj->target->player && mobj->target->player->mo
&& mobj->target->player->health > 0 && !mobj->target->player->spectator)
{
INT32 zfixds = 56;
INT32 DIST = FixedMul(zfixds, mobj->target->scale);
INT32 HEIGHT;
const fixed_t radius = DIST*FRACUNIT; // mobj's distance from its Target, or Radius.
if (mobj->type == MT_BANANASHIELD || mobj->type == MT_TRIPLEBANANASHIELD1 || mobj->type == MT_TRIPLEBANANASHIELD2 || mobj->type == MT_TRIPLEBANANASHIELD3)
zfixds = 64;
else
zfixds = 56;
fixed_t z;
const fixed_t radius = FixedHypot(mobj->target->radius, mobj->target->radius) + FixedHypot(mobj->radius, mobj->radius); // mobj's distance from its Target, or Radius.
//mobj->angle += FixedAngle(12*FRACUNIT); // mobj's actual speed.
if (mobj->type == MT_TRIPLEGREENSHIELD1 || mobj->type == MT_TRIPLEGREENSHIELD2 || mobj->type == MT_TRIPLEGREENSHIELD3
@ -6565,26 +6576,51 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->target->player && mobj->target->eflags & MFE_VERTICALFLIP)
{
mobj->eflags |= MFE_VERTICALFLIP;
HEIGHT = mobj->target->height / 2;
}
else
{
mobj->eflags &= ~MFE_VERTICALFLIP;
HEIGHT = mobj->target->height / 5;
}
// Shrink your items if the player shrunk too.
if (mobj->target->player)
mobj->scale = mobj->target->scale;
P_UnsetThingPosition(mobj);
if (P_MobjFlip(mobj) > 0)
{
const angle_t fa = mobj->angle>>ANGLETOFINESHIFT;
mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius);
mobj->y = mobj->target->y + FixedMul(FINESINE(fa), radius);
mobj->z = mobj->target->z + HEIGHT;
P_SetThingPosition(mobj);
z = mobj->target->z;
}
else
{
z = mobj->target->z + mobj->target->height - mobj->height;
}
mobj->flags |= MF_NOCLIPTHING; // temporarily make them noclip other objects so they can't hit anyone while in the player
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, z);
mobj->momx = FixedMul(FINECOSINE(mobj->angle>>ANGLETOFINESHIFT),radius);
mobj->momy = FixedMul(FINESINE(mobj->angle>>ANGLETOFINESHIFT), radius);
mobj->flags &= ~MF_NOCLIPTHING;
if (!P_TryMove(mobj, mobj->target->x + mobj->momx, mobj->target->y + mobj->momy, true))
P_SlideMove(mobj, true);
if (P_IsObjectOnGround(mobj->target))
{
if (P_MobjFlip(mobj) > 0)
{
if (mobj->floorz > mobj->target->z - mobj->height)
{
z = mobj->floorz;
}
}
else
{
if (mobj->ceilingz < mobj->target->z + mobj->target->height + mobj->height)
{
z = mobj->ceilingz - mobj->height;
}
}
}
mobj->z = z;
mobj->momx = mobj->momy = 0;
// Was this so hard?
if ((mobj->type == MT_GREENSHIELD && !(mobj->target->player->kartstuff[k_greenshell] & 1))
@ -6615,6 +6651,163 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
break;
case MT_BATTLEBALLOON:
if (mobj->health > 0 && mobj->target && mobj->target->player && mobj->target->player->mo
&& mobj->target->player->health > 0 && !mobj->target->player->spectator)
{
fixed_t rad = 32*mobj->target->scale;
fixed_t offz;
angle_t ang, diff;
if (!((mobj->target->player-players) & 1))
ang = (FixedAngle(mobj->info->speed) * -1);
else
ang = FixedAngle(mobj->info->speed);
if (mobj->target->player->kartstuff[k_balloon] <= 1)
diff = 0;
else
diff = FixedAngle(360*FRACUNIT/mobj->target->player->kartstuff[k_balloon]);
ang = (ang*leveltime) + (diff * (mobj->threshold-1));
// If the player is on the ceiling, then flip your items as well.
if (mobj->target->eflags & MFE_VERTICALFLIP)
{
mobj->eflags |= MFE_VERTICALFLIP;
offz = mobj->target->height / 2;
}
else
{
mobj->eflags &= ~MFE_VERTICALFLIP;
offz = mobj->target->height / 5;
}
if (mobj->target->flags2 & MF2_DONTDRAW)
mobj->flags2 |= MF2_DONTDRAW;
else
mobj->flags2 &= ~MF2_DONTDRAW;
if (mobj->target->eflags & MFE_VERTICALFLIP)
offz += 4*FRACUNIT;
else
offz -= 4*FRACUNIT;
if (mobj->tracer && mobj->tracer->player && mobj->tracer->player->mo
&& mobj->tracer->player->health > 0 && !mobj->tracer->player->spectator) // STOLEN
mobj->color = mobj->tracer->player->skincolor; // don't do star flashing for stolen balloons
else
mobj->color = mobj->target->color; // but do so if it belongs to you :B
if (mobj->target->player->kartstuff[k_balloon] < 2)
P_SetMobjState(mobj, S_BATTLEBALLOON3);
else if (mobj->target->player->kartstuff[k_balloon] < 3)
P_SetMobjState(mobj, S_BATTLEBALLOON2);
else
P_SetMobjState(mobj, S_BATTLEBALLOON1);
// Shrink your items if the player shrunk too.
mobj->scale = mobj->target->scale;
P_UnsetThingPosition(mobj);
{
const angle_t fa = ang>>ANGLETOFINESHIFT;
mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa), rad);
mobj->y = mobj->target->y + FixedMul(FINESINE(fa), rad);
mobj->z = mobj->target->z + offz;
P_SetThingPosition(mobj);
}
// Was this so hard?
if (mobj->target->player->kartstuff[k_balloon] <= mobj->threshold)
{
P_RemoveMobj(mobj);
return;
}
}
else if ((mobj->health > 0
&& (!mobj->target || !mobj->target->player || !mobj->target->player->mo || mobj->target->player->health <= 0 || mobj->target->player->spectator))
|| (mobj->health <= 0 && mobj->z <= mobj->floorz)
|| P_CheckDeathPitCollide(mobj)) // When in death state
{
P_RemoveMobj(mobj);
return;
}
break;
case MT_PLAYERARROW:
if (mobj->target && mobj->target->health
&& mobj->target->player && mobj->target->player->mo
&& mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD)
{
fixed_t scale = mobj->target->scale;
mobj->color = mobj->target->color;
if ((splitscreen || !netgame)
|| gametype == GT_RACE
|| mobj->target->player == &players[displayplayer]
|| mobj->target->player->kartstuff[k_balloon] <= 0
|| (mobj->target->player->mo->flags2 & MF2_DONTDRAW))
mobj->flags2 |= MF2_DONTDRAW;
else
mobj->flags2 &= ~MF2_DONTDRAW;
P_UnsetThingPosition(mobj);
mobj->x = mobj->target->x;
mobj->y = mobj->target->y;
if (!(mobj->target->eflags & MFE_VERTICALFLIP))
{
mobj->z = mobj->target->z + P_GetPlayerHeight(mobj->target->player)+16*FRACUNIT;
mobj->eflags &= ~MFE_VERTICALFLIP;
}
else
{
mobj->z = mobj->target->z - P_GetPlayerHeight(mobj->target->player)+16*FRACUNIT;
mobj->eflags |= MFE_VERTICALFLIP;
}
P_SetThingPosition(mobj);
// Set it to use the correct states for its condition
if (mobj->target->player->kartstuff[k_itemroulette])
{
if (mobj->state != &states[S_PLAYERARROW_ROULETTE]) // don't reset FF_ANIMATE
P_SetMobjState(mobj, S_PLAYERARROW_ROULETTE);
}
else if (mobj->target->player->kartstuff[k_kitchensink]) P_SetMobjState(mobj, S_PLAYERARROW_KITCHENSINK);
else if (mobj->target->player->kartstuff[k_megashroom] == 1
|| (mobj->target->player->kartstuff[k_growshrinktimer] > 1
&& (leveltime & 1))) P_SetMobjState(mobj, S_PLAYERARROW_MEGASHROOM);
else if (mobj->target->player->kartstuff[k_growshrinktimer] > 1
&& !(leveltime & 1)) P_SetMobjState(mobj, S_PLAYERARROW_EMPTY); // S_INVISIBLE
else if (mobj->target->player->kartstuff[k_star] == 1) P_SetMobjState(mobj, S_PLAYERARROW_STAR);
else if (mobj->target->player->kartstuff[k_tripleredshell]) P_SetMobjState(mobj, S_PLAYERARROW_TRIPLEREDSHELL);
else if (mobj->target->player->kartstuff[k_triplebanana]) P_SetMobjState(mobj, S_PLAYERARROW_TRIPLEBANANA);
else if (mobj->target->player->kartstuff[k_triplegreenshell]) P_SetMobjState(mobj, S_PLAYERARROW_TRIPLEGREENSHELL);
else if (mobj->target->player->kartstuff[k_fireflower]) P_SetMobjState(mobj, S_PLAYERARROW_FIREFLOWER);
else if (mobj->target->player->kartstuff[k_bobomb]) P_SetMobjState(mobj, S_PLAYERARROW_BOBOMB);
else if (mobj->target->player->kartstuff[k_redshell]) P_SetMobjState(mobj, S_PLAYERARROW_REDSHELL);
else if (mobj->target->player->kartstuff[k_feather] & 1) P_SetMobjState(mobj, S_PLAYERARROW_FEATHER);
else if (mobj->target->player->kartstuff[k_boo] == 1) P_SetMobjState(mobj, S_PLAYERARROW_BOO);
else if (mobj->target->player->kartstuff[k_fakeitem] & 2) P_SetMobjState(mobj, S_PLAYERARROW_FAKEITEM);
else if (mobj->target->player->kartstuff[k_banana]) P_SetMobjState(mobj, S_PLAYERARROW_BANANA);
else if (mobj->target->player->kartstuff[k_greenshell]) P_SetMobjState(mobj, S_PLAYERARROW_GREENSHELL);
else if (mobj->target->player->kartstuff[k_mushroom]) P_SetMobjState(mobj, S_PLAYERARROW_MUSHROOM);
else P_SetMobjState(mobj, S_PLAYERARROW); // S_INVISIBLE
scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x,
players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale);
if (scale > 16*FRACUNIT)
{
scale = 16*FRACUNIT;
}
mobj->destscale = scale;
}
else if (mobj->health > 0)
{
P_KillMobj(mobj, NULL, NULL);
return;
}
break;
//}
case MT_WATERDROP:
P_SceneryCheckWater(mobj);
@ -7486,15 +7679,16 @@ void P_MobjThinker(mobj_t *mobj)
break;
case MT_GREENITEM:
{
sector_t *sec2;
fixed_t finalspeed = mobj->info->speed;
P_SpawnGhostMobj(mobj);
if (cv_kartcc.value == 50)
if (K_GetKartCC() == 50)
{
finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4);
}
else if (cv_kartcc.value == 150)
else if (K_GetKartCC() == 150)
{
finalspeed = FixedMul(finalspeed, FRACUNIT+FRACUNIT/4);
}
@ -7513,14 +7707,21 @@ void P_MobjThinker(mobj_t *mobj)
{
P_InstaThrust(mobj, mobj->angle, finalspeed);
}
sec2 = P_ThingOnSpecial3DFloor(mobj);
if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnGround(mobj) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1))
K_DoBouncePad(mobj, 0);
if (mobj->threshold > 0)
mobj->threshold--;
if (leveltime % 6 == 0)
S_StartSound(mobj, mobj->info->activesound);
break;
}
case MT_REDITEM:
{
sector_t *sec2;
fixed_t topspeed = 64*FRACUNIT;
fixed_t distbarrier = 512*FRACUNIT;
fixed_t distaway;
@ -7532,18 +7733,18 @@ void P_MobjThinker(mobj_t *mobj)
if (leveltime % 7 == 0)
S_StartSound(mobj, mobj->info->activesound);
if (cv_kartcc.value == 50)
if (K_GetKartCC() == 50)
{
topspeed = FixedMul(topspeed, FRACUNIT-FRACUNIT/4);
distbarrier = FixedMul(distbarrier, FRACUNIT-FRACUNIT/4);
}
else if (cv_kartcc.value == 150)
else if (K_GetKartCC() == 150)
{
topspeed = FixedMul(topspeed, FRACUNIT+FRACUNIT/4);
distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4);
}
if (mobj->tracer)
if (gametype == GT_RACE && mobj->tracer)
{
distaway = P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y);
if (distaway < distbarrier)
@ -7557,17 +7758,33 @@ void P_MobjThinker(mobj_t *mobj)
}
P_InstaThrust(mobj, R_PointToAngle2(0, 0, mobj->momx, mobj->momy), topspeed);
sec2 = P_ThingOnSpecial3DFloor(mobj);
if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnGround(mobj) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1))
K_DoBouncePad(mobj, 0);
break;
}
case MT_REDITEMDUD:
{
sector_t *sec2;
P_SpawnGhostMobj(mobj);
mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->x+mobj->momx, mobj->y+mobj->momy);
P_InstaThrust(mobj, mobj->angle, mobj->info->speed);
sec2 = P_ThingOnSpecial3DFloor(mobj);
if ((sec2 && GETSECSPECIAL(sec2->special, 3) == 1) || (P_IsObjectOnGround(mobj) && GETSECSPECIAL(mobj->subsector->sector->special, 3) == 1))
K_DoBouncePad(mobj, 0);
if (mobj->threshold > 0)
mobj->threshold--;
if (leveltime % 7 == 0)
S_StartSound(mobj, mobj->info->activesound);
break;
}
case MT_BANANAITEM:
case MT_FAKEITEM:
if (mobj->momx || mobj->momy)
@ -8387,6 +8604,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
case MT_COIN:
case MT_BLUEBALL:
nummaprings++;
break;
default:
break;
}
@ -8401,10 +8619,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
case MT_GREENITEM: case MT_GREENSHIELD:
case MT_TRIPLEGREENSHIELD1: case MT_TRIPLEGREENSHIELD2: case MT_TRIPLEGREENSHIELD3:
case MT_REDITEM: case MT_REDSHIELD: case MT_REDITEMDUD:
case MT_TRIPLEREDSHIELD1: case MT_TRIPLEREDSHIELD2: case MT_TRIPLEREDSHIELD3:
case MT_TRIPLEREDSHIELD1: case MT_TRIPLEREDSHIELD2: case MT_TRIPLEREDSHIELD3:
case MT_BATTLEBALLOON: case MT_FIREBALL:
case MT_FAKEITEM: case MT_FAKESHIELD:
case MT_BOMBITEM: case MT_BOMBSHIELD:
case MT_FIREBALL:
P_SpawnShadowMobj(mobj);
default:
break;
@ -8978,6 +9196,12 @@ void P_RespawnSpecials(void)
mobj_t *mo = NULL;
mapthing_t *mthing = NULL;
if (gametype != GT_RACE) // Battle Mode vers
{
P_RespawnBattleSpecials();
return;
}
// only respawn items when cv_itemrespawn is on
if (!cv_itemrespawn.value)
return;
@ -9059,6 +9283,97 @@ void P_RespawnSpecials(void)
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
}
//
// P_RespawnBattleSpecials
//
void P_RespawnBattleSpecials(void)
{
fixed_t x, y, z;
subsector_t *ss;
mobj_t *mo = NULL;
mapthing_t *mthing = NULL;
// only respawn items when cv_itemrespawn is on
if (!cv_itemrespawn.value)
return;
// Didn't collect enough boxes
if (numgotboxes < (4*nummapboxes/5))
return;
// wait a teeeensy bit after collecting everything
if (leveltime - itemrespawntime[iquehead-1] < (tic_t)cv_itemrespawntime.value*(5*TICRATE))
return;
while (iquehead != iquetail) // respawn EVERYTHING in que!
{
mthing = itemrespawnque[iquetail];
#ifdef PARANOIA
if (!mthing)
I_Error("itemrespawnque[iquetail] is NULL!");
#endif
if (mthing)
{
mobjtype_t i;
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
ss = R_PointInSubsector(x, y);
// find which type to spawn
for (i = 0; i < NUMMOBJTYPES; i++)
if (mthing->type == mobjinfo[i].doomednum)
break;
//CTF rings should continue to respawn as normal rings outside of CTF.
if (gametype != GT_CTF)
{
if (i == MT_REDTEAMRING || i == MT_BLUETEAMRING)
i = MT_RING;
}
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
#ifdef ESLOPE
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
#endif
ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT;
if (mthing->options & MTF_AMBUSH
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i)))
z -= 24*FRACUNIT;
z -= mobjinfo[i].height; // Don't forget the height!
}
else
{
z = (
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT;
if (mthing->options & MTF_AMBUSH
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i)))
z += 24*FRACUNIT;
}
mo = P_SpawnMobj(x, y, z, i);
mo->spawnpoint = mthing;
mo->angle = ANGLE_45 * (mthing->angle/45);
if (mthing->options & MTF_OBJECTFLIP)
{
mo->eflags |= MFE_VERTICALFLIP;
mo->flags2 |= MF2_OBJECTFLIP;
}
}
// pull it from the que
iquetail = (iquetail+1)&(ITEMQUESIZE-1);
}
numgotboxes = 0;
}
//
// P_SpawnPlayer
// Called when a player is spawned on the level.
@ -9068,6 +9383,7 @@ void P_SpawnPlayer(INT32 playernum)
{
player_t *p = &players[playernum];
mobj_t *mobj;
mobj_t *overheadarrow;
if (p->playerstate == PST_REBORN)
G_PlayerReborn(playernum);
@ -9077,13 +9393,13 @@ void P_SpawnPlayer(INT32 playernum)
{
// Special case for (NiGHTS) special stages!
// if stage has already started, force players to become spectators until the next stage
if (multiplayer && netgame && G_IsSpecialStage(gamemap) && useNightsSS && leveltime > 0)
/*if (multiplayer && netgame && G_IsSpecialStage(gamemap) && useNightsSS && leveltime > 0)
p->spectator = true;
else
else*/
p->spectator = false;
}
else if (netgame && p->jointime < 1)
p->spectator = true;
/*p->spectator = true*/;
else if (multiplayer && !netgame)
{
// If you're in a team game and you don't have a team assigned yet...
@ -9153,7 +9469,62 @@ void P_SpawnPlayer(INT32 playernum)
P_FlashPal(p, 0, 0); // Resets
// Spawn with a pity shield if necessary.
P_DoPityCheck(p);
//P_DoPityCheck(p);
overheadarrow = P_SpawnMobj(mobj->x, mobj->y, mobj->z + P_GetPlayerHeight(p)+16*FRACUNIT, MT_PLAYERARROW);
P_SetTarget(&overheadarrow->target, mobj);
overheadarrow->flags2 |= MF2_DONTDRAW;
P_SetScale(overheadarrow, mobj->destscale);
if (gametype != GT_RACE)
{
/*INT32 i;
INT32 pcount = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator || &players[i] == p)
continue;
if (players[i].jointime > 0)
continue;
pcount++;
}*/
if (p->kartstuff[k_balloon] > 0 || leveltime < 1/* || pcount <= 1*/) // srb2kart
{
INT32 i;
angle_t newangle;
angle_t diff;
fixed_t newx;
fixed_t newy;
mobj_t *mo;
if (leveltime < 1 /*|| pcount <= 1*/) // Start of the map?
p->kartstuff[k_balloon] = cv_kartballoons.value; // Reset those balloons!
if (p->kartstuff[k_balloon] <= 1)
diff = 0;
else
diff = FixedAngle(360*FRACUNIT/p->kartstuff[k_balloon]);
newangle = mobj->angle;
newx = mobj->x + P_ReturnThrustX(mobj, newangle + ANGLE_180, 64*FRACUNIT);
newy = mobj->y + P_ReturnThrustY(mobj, newangle + ANGLE_180, 64*FRACUNIT);
for (i = 0; i < p->kartstuff[k_balloon]; i++)
{
mo = P_SpawnMobj(newx, newy, mobj->z, MT_BATTLEBALLOON);
mo->threshold = i;
P_SetTarget(&mo->target, mobj);
mo->angle = (diff * (i-1));
mo->color = mobj->color;
if (mobj->flags2 & MF2_DONTDRAW)
mo->flags2 |= MF2_DONTDRAW;
else
mo->flags2 &= ~MF2_DONTDRAW;
}
}
}
}
void P_AfterPlayerSpawn(INT32 playernum)

View File

@ -138,8 +138,6 @@ static void P_NetArchivePlayers(void)
WRITEUINT16(save_p, players[i].powers[j]);
for (j = 0; j < NUMKARTSTUFF; j++)
WRITEINT32(save_p, players[i].kartstuff[j]);
for (j = 0; j < MAXPLAYERS; j++)
WRITEUINT8(save_p, players[i].collide[j]);
WRITEANGLE(save_p, players[i].frameangle);
@ -323,8 +321,6 @@ static void P_NetUnArchivePlayers(void)
players[i].powers[j] = READUINT16(save_p);
for (j = 0; j < NUMKARTSTUFF; j++)
players[i].kartstuff[j] = READINT32(save_p);
for (j = 0; j < MAXPLAYERS; j++)
players[i].collide[j] = (boolean)READUINT8(save_p);
players[i].frameangle = READANGLE(save_p);

View File

@ -983,6 +983,9 @@ static void P_LoadThings(void)
|| mt->type == 1702) // MT_AXISTRANSFERLINE
continue; // These were already spawned
if (mt->type == 2000) // MT_RANDOMITEM
nummapboxes++;
mt->mobj = NULL;
P_SpawnMapThing(mt);
}
@ -2154,6 +2157,8 @@ static void P_LevelInitStuff(void)
tokenbits = 0;
runemeraldmanager = false;
nummaprings = 0;
nummapboxes = 0;
numgotboxes = 0;
// emerald hunt
hunt1 = hunt2 = hunt3 = NULL;
@ -2566,8 +2571,7 @@ boolean P_SetupLevel(boolean skipprecip)
// chasecam on in chaos, race, coop
// chasecam off in match, tag, capture the flag
chase = (gametype == GT_RACE || gametype == GT_COMPETITION || gametype == GT_COOP)
|| (maptol & TOL_2D);
chase = true; // srb2kart: always on
if (!dedicated)
{

View File

@ -3728,7 +3728,18 @@ DoneSection2:
// Process Section 3
switch (special)
{
case 1: // Unused (was "Ice/Sludge")
case 1: // SRB2kart: bounce pad
if (!P_IsObjectOnGround(player->mo))
break;
if (player->speed < K_GetKartSpeed(player, true)/16 && !(player->mo->eflags & MFE_SPRUNG)) // Push forward to prevent getting stuck
P_InstaThrust(player->mo, player->mo->angle, FixedMul(K_GetKartSpeed(player, true)/16, player->mo->scale));
player->kartstuff[k_feather] |= 2;
K_DoBouncePad(player->mo, 0);
break;
case 2: // Wind/Current
case 3: // Unused (was "Ice/Sludge and Wind/Current")
case 4: // Conveyor Belt
@ -3878,7 +3889,7 @@ DoneSection2:
mo->spawnpoint = bflagpoint;
mo->flags2 |= MF2_JUSTATTACKED;
redscore += 1;
P_AddPlayerScore(player, 250);
P_AddPlayerScore(player, 5);
}
}
break;
@ -3911,7 +3922,7 @@ DoneSection2:
mo->spawnpoint = rflagpoint;
mo->flags2 |= MF2_JUSTATTACKED;
bluescore += 1;
P_AddPlayerScore(player, 250);
P_AddPlayerScore(player, 5);
}
}
break;
@ -4099,12 +4110,12 @@ DoneSection2:
case 10: // Finish Line
// SRB2kart - 150117
if (gametype == GT_RACE && (player->starpostnum == numstarposts || player->exiting))
if (gametype == GT_RACE && (player->starpostcount >= numstarposts/2 || player->exiting))
player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0;
//
if (gametype == GT_RACE && !player->exiting)
{
if (player->starpostnum == numstarposts) // Must have touched all the starposts
if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)")
{
player->laps++;
player->kartstuff[k_lapanimation] = 80;
@ -4123,6 +4134,7 @@ DoneSection2:
// SRB2kart 200117
player->starpostangle = player->starpostnum = 0;
player->starpostx = player->starposty = player->starpostz = 0;
player->starpostcount = 0;
//except the time!
player->starposttime = player->realtime;
@ -7140,7 +7152,7 @@ void T_Friction(friction_t *f)
// friction works for all mobj's
// (or at least MF_PUSHABLEs, which is all I care about anyway)
if ((!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) && thing->z == thing->floorz) && (thing->player
&& (thing->player->kartstuff[k_startimer] == 0 && thing->player->kartstuff[k_bootaketimer] == 0
&& (thing->player->kartstuff[k_startimer] == 0 && thing->player->kartstuff[k_bootimer] == 0
&& thing->player->kartstuff[k_mushroomtimer] == 0 && thing->player->kartstuff[k_growshrinktimer] <= 0)))
{
if (f->roverfriction)
@ -7537,7 +7549,7 @@ void T_Pusher(pusher_t *p)
if (thing->player && thing->player->pflags & PF_ROPEHANG)
continue;
if (thing->player && (thing->state == &states[thing->info->painstate]) && (thing->player->powers[pw_flashing] > (flashingtics/4)*3 && thing->player->powers[pw_flashing] <= flashingtics))
if (thing->player && (thing->state == &states[thing->info->painstate]) && (thing->player->powers[pw_flashing] > (K_GetKartFlashing(thing->player)/4)*3 && thing->player->powers[pw_flashing] <= K_GetKartFlashing(thing->player)))
continue;
inFOF = touching = moved = false;

View File

@ -625,9 +625,6 @@ void P_Ticker(boolean run)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
// SRB2kart - runs bounce collision for players
K_KartBouncer();
#ifdef HAVE_BLUA
LUAh_ThinkFrame();
#endif
@ -743,9 +740,6 @@ void P_PreTicker(INT32 frames)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
// SRB2kart - runs bounce collision for players
K_KartBouncer();
#ifdef HAVE_BLUA
LUAh_ThinkFrame();
#endif

View File

@ -853,17 +853,17 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
// Point penalty for hitting a hazard during tag.
// Discourages players from intentionally hurting themselves to avoid being tagged.
if (gametype == GT_TAG && (!(player->pflags & PF_TAGGED) && !(player->pflags & PF_TAGIT)))
/*if (gametype == GT_TAG && (!(player->pflags & PF_TAGGED) && !(player->pflags & PF_TAGIT)))
{
//if (player->score >= 50)
// player->score -= 50;
//else
// player->score = 0;
}
if (player->score >= 50)
player->score -= 50;
else
player->score = 0;
}*/
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
player->powers[pw_flashing] = flashingtics;
player->powers[pw_flashing] = K_GetKartFlashing(player);
if (player->timeshit != UINT8_MAX)
++player->timeshit;
@ -1007,12 +1007,12 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
{
UINT32 oldscore;
return; // SRB2kart - no score.
// This will probably be temporary until we do battle modes?
if (player->bot)
player = &players[consoleplayer];
if (player->exiting) // srb2kart
return;
// NiGHTS does it different!
if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->typeoflevel & TOL_NIGHTS)
{
@ -1607,9 +1607,7 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting)
return;
if (cv_allowexitlevel.value == 0 && !G_PlatformGametype())
return;
else if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow
if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow
{
// SRB2kart 120217
if (!countdown && !(netgame || multiplayer))
@ -1652,6 +1650,8 @@ void P_DoPlayerExit(player_t *player)
if (P_CheckRacers())
player->exiting = (14*TICRATE)/5 + 1;
}
else if (gametype != GT_RACE)
player->exiting = 10*TICRATE + 2; // Accidental death safeguard???
else
player->exiting = (14*TICRATE)/5 + 2; // Accidental death safeguard???
@ -1668,8 +1668,8 @@ void P_DoPlayerExit(player_t *player)
player->powers[pw_spacetime] = 0;
P_RestoreMusic(player);
if (playeringame[player-players] && netgame && !circuitmap)
CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]);
/*if (playeringame[player-players] && netgame && !circuitmap)
CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]);*/
}
#define SPACESPECIAL 12
@ -3557,7 +3557,7 @@ static void P_DoSuperStuff(player_t *player)
}
if (gametype != GT_COOP)
player->powers[pw_flashing] = flashingtics-1;
player->powers[pw_flashing] = K_GetKartFlashing(player)-1;
/*
if (player->mo->health > 0)
@ -5842,7 +5842,7 @@ static void P_NiGHTSMovement(player_t *player)
}
// Currently reeling from being hit.
if (player->powers[pw_flashing] > (2*flashingtics)/3)
if (player->powers[pw_flashing] > (2*K_GetKartFlashing(player))/3)
{
{
const angle_t fa = (FixedAngle(player->flyangle*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
@ -6499,7 +6499,7 @@ static void P_MovePlayer(player_t *player)
*/
cmd = &player->cmd;
runspd = FixedMul(player->runspeed, player->mo->scale);
runspd = 14*player->mo->scale; //srb2kart
// Let's have some movement speed fun on low-friction surfaces, JUST for players...
// (high friction surfaces shouldn't have any adjustment, since the acceleration in
@ -6700,10 +6700,12 @@ static void P_MovePlayer(player_t *player)
{
K_KartMoveAnimation(player);
player->frameangle = player->mo->angle;
if (player->kartstuff[k_feather] & 2)
player->frameangle += ANGLE_22h;
else
player->frameangle = player->mo->angle;
}
player->mo->movefactor = FRACUNIT; // We're not going to do any more with this, so let's change it back for the next frame.
// If you are stopped and are still walking, stand still!
@ -7935,13 +7937,8 @@ static void P_DeathThink(player_t *player)
}
//player->kartstuff[k_lakitu] = 48; // See G_PlayerReborn in g_game.c
// SRB2kart - spawn automatically after 1.5 seconds
if (player->deadtimer > (TICRATE + TICRATE/2) && (gametype == GT_RACE || player->spectator))
player->playerstate = PST_REBORN;
// SRB2kart - spawn after 1.5 seconds & Button press
if ((cmd->buttons & BT_JUMP || cmd->buttons & BT_ACCELERATE) && player->deadtimer > (TICRATE + TICRATE/2)
&& (gametype == GT_RACE || player->spectator))
// SRB2kart - spawn automatically after 1 second
if (player->deadtimer > TICRATE)
player->playerstate = PST_REBORN;
// Single player auto respawn
@ -8000,41 +7997,33 @@ static void P_DeathThink(player_t *player)
}
}
if (gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame)))
// Keep time rolling
if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_TIMEOVER))
{
if (leveltime >= 4*TICRATE)
player->realtime = leveltime - 4*TICRATE;
else
player->realtime = 0;
}
if ((gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0))
{
// Keep time rolling in race mode
if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_TIMEOVER))
{
if (gametype == GT_RACE || gametype == GT_COMPETITION)
{
if (leveltime >= 4*TICRATE)
player->realtime = leveltime - 4*TICRATE;
else
player->realtime = 0;
}
else
player->realtime = leveltime;
}
// Return to level music
if (player->lives <= 0)
if (netgame)
{
if (netgame)
{
if (player->deadtimer == gameovertics && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusname, mapmusflags, true);
}
else if (multiplayer) // local multiplayer only
{
if (player->deadtimer != gameovertics)
;
// Restore the other player's music once we're dead for long enough
// -- that is, as long as they aren't dead too
else if (player == &players[displayplayer] && players[secondarydisplayplayer].lives > 0)
P_RestoreMusic(&players[secondarydisplayplayer]);
else if (player == &players[secondarydisplayplayer] && players[displayplayer].lives > 0)
P_RestoreMusic(&players[displayplayer]);
}
if (player->deadtimer == gameovertics && P_IsLocalPlayer(player))
S_ChangeMusic(mapmusname, mapmusflags, true);
}
else if (multiplayer) // local multiplayer only
{
if (player->deadtimer != gameovertics)
;
// Restore the other player's music once we're dead for long enough
// -- that is, as long as they aren't dead too
else if (player == &players[displayplayer] && players[secondarydisplayplayer].lives > 0)
P_RestoreMusic(&players[secondarydisplayplayer]);
else if (player == &players[secondarydisplayplayer] && players[displayplayer].lives > 0)
P_RestoreMusic(&players[displayplayer]);
}
}
@ -8707,7 +8696,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
// Make player translucent if camera is too close (only in single player).
if (!(multiplayer || netgame) && !splitscreen)
/*if (!(multiplayer || netgame) && !splitscreen)
{
fixed_t vx = 0, vy = 0;
if (player->awayviewtics) {
@ -8726,7 +8715,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
player->mo->flags2 &= ~MF2_SHADOW;
}
else
player->mo->flags2 &= ~MF2_SHADOW;
player->mo->flags2 &= ~MF2_SHADOW;*/
/* if (!resetcalled && (player->pflags & PF_NIGHTSMODE && player->exiting))
{
@ -8969,7 +8958,7 @@ static void P_CalcPostImg(player_t *player)
#endif
}
void P_DoPityCheck(player_t *player)
/*void P_DoPityCheck(player_t *player)
{
// No pity outside of match or CTF.
if (player->spectator
@ -8986,7 +8975,7 @@ void P_DoPityCheck(player_t *player)
player->powers[pw_shield] = SH_PITY;
P_SpawnShieldOrb(player);
}
}
}*/
//
// P_PlayerThink
@ -9131,7 +9120,7 @@ void P_PlayerThink(player_t *player)
// If it is set, start subtracting
// Don't allow it to go back to 0
if (player->exiting > 1 && player->exiting < 3*TICRATE && player->exiting > 1) // SRB2kart - " && player->exiting > 1"
if (player->exiting > 1 && (player->exiting < 3*TICRATE || gametype != GT_RACE)) // SRB2kart - "&& player->exiting > 1"
player->exiting--;
if (player->exiting && countdown2)
@ -9214,7 +9203,7 @@ void P_PlayerThink(player_t *player)
playerdeadview = false;
// SRB2kart 010217
if (gametype == GT_RACE && leveltime < 4*TICRATE)
if (leveltime < 4*TICRATE)
player->powers[pw_nocontrol] = 2;
/*
if ((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE)
@ -9228,15 +9217,10 @@ void P_PlayerThink(player_t *player)
// Synchronizes the "real" amount of time spent in the level.
if (!player->exiting)
{
if (gametype == GT_RACE || gametype == GT_COMPETITION)
{
if (leveltime >= 4*TICRATE)
player->realtime = leveltime - 4*TICRATE;
else
player->realtime = 0;
}
if (leveltime >= 4*TICRATE)
player->realtime = leveltime - 4*TICRATE;
else
player->realtime = leveltime;
player->realtime = 0;
}
if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing])
@ -9391,7 +9375,7 @@ void P_PlayerThink(player_t *player)
if (player->powers[pw_invulnerability] && player->powers[pw_invulnerability] < UINT16_MAX)
player->powers[pw_invulnerability]--;
if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE) || player->powers[pw_flashing] < flashingtics))
if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE) || player->powers[pw_flashing] < K_GetKartFlashing(player)))
player->powers[pw_flashing]--;
if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX && player->charability != CA_SWIM && !(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) // tails fly counter
@ -9480,9 +9464,10 @@ void P_PlayerThink(player_t *player)
{
// SRB2kart - fixes boo not flashing when it should. Mega doesn't flash either. Flashing is local.
if ((player == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer]))
&& player->kartstuff[k_bootaketimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0)
&& player->kartstuff[k_bootimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0
&& (player->kartstuff[k_comebacktimer] == 0 || (gametype == GT_RACE || player->kartstuff[k_balloon] > 0)))
{
if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1))
if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < K_GetKartFlashing(player) && (leveltime & 1))
player->mo->flags2 |= MF2_DONTDRAW;
else
player->mo->flags2 &= ~MF2_DONTDRAW;

View File

@ -1262,7 +1262,7 @@ static void R_ProjectSprite(mobj_t *thing)
offset2 = FixedMul(spritecachedinfo[lump].width, this_scale);
tx += FixedMul(offset2, ang_scale);
x2 = ((centerxfrac + FixedMul (tx,xscale)) >>FRACBITS) - 1;
x2 = ((centerxfrac + FixedMul (tx,xscale)) >> FRACBITS) - (papersprite ? 2 : 1);
// off the left side
if (x2 < 0)

View File

@ -91,8 +91,8 @@ typedef struct
fixed_t maxdash;
// SRB2kart
UINT8 kartspeed; // Normal ground
UINT8 kartweight; // Normal ground
UINT8 kartspeed;
UINT8 kartweight;
//
fixed_t normalspeed; // Normal ground

View File

@ -498,10 +498,12 @@ sfxinfo_t S_sfx[NUMSFX] =
{"mkitm7", true, 72, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"mkitm8", true, 72, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"mkitmF", true, 72, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"clash", false, 64, 8, -1, NULL, 0, -1, -1, LUMPERROR},
{"tossed", false,150, 8, -1, NULL, 0, -1, -1, LUMPERROR},
{"shelit", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR},
{"vroom", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"clash", false, 64, 8, -1, NULL, 0, -1, -1, LUMPERROR},
{"tossed", false, 150, 8, -1, NULL, 0, -1, -1, LUMPERROR},
{"shelit", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR},
{"vroom", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"boing", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"smkinv", false, 140, 16, -1, NULL, 0, -1, -1, LUMPERROR},
// SRB2kart - Skin sounds
{"kwin", false, 64, 0, -1, NULL, 0, SKSWIN, -1, LUMPERROR},

View File

@ -574,6 +574,8 @@ typedef enum
sfx_tossed,
sfx_shelit,
sfx_vroom,
sfx_boing,
sfx_smkinv,
sfx_kwin,
sfx_klose,

View File

@ -1922,14 +1922,14 @@ static void ST_overlayDrawer(void)
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(116), 0, M_GetText("You cannot move while hiding."));
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player."));
}
else if (!G_PlatformGametype() && stplyr->playerstate == PST_DEAD && stplyr->lives) //Death overrides spectator text.
/*else if (!G_PlatformGametype() && stplyr->playerstate == PST_DEAD && stplyr->lives) //Death overrides spectator text.
{
INT32 respawntime = cv_respawntime.value - stplyr->deadtimer/TICRATE;
if (respawntime > 0 && !stplyr->spectator)
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, va(M_GetText("Respawn in: %d second%s."), respawntime, respawntime == 1 ? "" : "s"));
else
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Jump to respawn."));
}
}*/
else if (stplyr->spectator
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_textspectator)