From 4261e0b61a90f887a4a0548aaf4eab2dcb662a7d Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 30 Jan 2019 00:30:48 +0100 Subject: [PATCH 001/114] Start of a fix for antigrav --- src/k_kart.c | 40 ++++++++++++++++++++++++++++++++-------- src/p_enemy.c | 1 + src/p_mobj.c | 5 ++++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 0410a931..bbca029c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1309,7 +1309,12 @@ static void K_UpdateOffroad(player_t *player) void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master) { // flipping + // handle z shifting from there too; mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP)|(master->eflags & MFE_VERTICALFLIP); + if (mo->eflags & MFE_VERTICALFLIP) + mo->z += master->height - FixedMul(master->scale, mo->height); + + // visibility (usually for hyudoro) mo->flags2 = (mo->flags2 & ~MF2_DONTDRAW)|(master->flags2 & MF2_DONTDRAW); mo->eflags = (mo->eflags & ~MFE_DRAWONLYFORP1)|(master->eflags & MFE_DRAWONLYFORP1); @@ -2400,6 +2405,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) { INT32 i, radius, height; mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING); + K_MatchGenericExtraFlags(smoldering, source); + mobj_t *dust; mobj_t *truc; INT32 speed, speed2; @@ -2423,6 +2430,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, source->y + P_RandomRange(-radius, radius)*FRACUNIT, source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMEXPLODE); + K_MatchGenericExtraFlags(truc, source); P_SetScale(truc, source->scale); truc->destscale = source->scale*6; truc->scalespeed = source->scale/12; @@ -2430,7 +2438,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) truc->momx = P_RandomRange(-speed, speed)*FRACUNIT; truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; speed = FixedMul(20*FRACUNIT, source->scale)>>FRACBITS; - truc->momz = P_RandomRange(-speed, speed)*FRACUNIT; + truc->momz = P_RandomRange(-speed, speed)*FRACUNIT*P_MobjFlip(truc); truc->color = color; } @@ -2448,6 +2456,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) truc = P_SpawnMobj(source->x + P_RandomRange(-radius, radius)*FRACUNIT, source->y + P_RandomRange(-radius, radius)*FRACUNIT, source->z + P_RandomRange(0, height)*FRACUNIT, MT_BOOMPARTICLE); + K_MatchGenericExtraFlags(truc, source); P_SetScale(truc, source->scale); truc->destscale = source->scale*5; truc->scalespeed = source->scale/12; @@ -2456,7 +2465,7 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color) truc->momy = P_RandomRange(-speed, speed)*FRACUNIT; speed = FixedMul(15*FRACUNIT, source->scale)>>FRACBITS; speed2 = FixedMul(45*FRACUNIT, source->scale)>>FRACBITS; - truc->momz = P_RandomRange(speed, speed2)*FRACUNIT; + truc->momz = P_RandomRange(speed, speed2)*FRACUNIT*P_MobjFlip(truc); if (P_RandomChance(FRACUNIT/2)) truc->momz = -truc->momz; truc->tics = TICRATE*2; @@ -2722,6 +2731,9 @@ void K_SpawnBoostTrail(player_t *player) P_SetScale(flame, player->mo->scale); flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags so that a stolen sneaker can be seen + if (flame->eflags & MFE_VERTICALFLIP) + flame->z += player->mo->height - FixedMul(player->mo->scale, flame->height); + flame->momx = 8; P_XYMovement(flame); if (P_MobjWasRemoved(flame)) @@ -2761,6 +2773,8 @@ void K_SpawnSparkleTrail(mobj_t *mo) sparkle->destscale = mo->destscale; P_SetScale(sparkle, mo->scale); sparkle->eflags = (sparkle->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags so that a stolen invincibility can be seen + if (sparkle->eflags & MFE_VERTICALFLIP) + sparkle->z += mo->height - FixedMul(mo->scale, sparkle->height); sparkle->color = mo->color; //sparkle->colorized = mo->colorized; } @@ -2782,6 +2796,8 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent) dust->destscale = mo->scale; P_SetScale(dust, mo->scale); dust->eflags = (dust->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags because hyudoro shouldn't be able to wipeout + if (dust->eflags & MFE_VERTICALFLIP) + dust->z += mo->height - FixedMul(mo->scale, dust->height); if (translucent) // offroad effect { @@ -2847,10 +2863,10 @@ void K_DriftDustHandling(mobj_t *spawner) fixed_t spawny = P_RandomRange(-spawnrange, spawnrange)<x + spawnx, spawner->y + spawny, spawner->z, MT_DRIFTDUST); - if (spawner->eflags & MFE_VERTICALFLIP) + /*if (spawner->eflags & MFE_VERTICALFLIP) And say something actually bothered supporting it! MatchGenericExtraFlags does this for us now :D { dust->z += spawner->height - dust->height; - } + }*/ dust->momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<scale)/4); dust->momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<scale)/4); dust->momz = P_MobjFlip(spawner) * (P_RandomRange(1, 4) * (spawner->scale)); @@ -3355,7 +3371,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) thrust = 32<momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, vscale)); + mo->momz = P_MobjFlip(mo)*FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, vscale)); } else mo->momz = FixedMul(vertispeed, vscale); @@ -3864,11 +3880,15 @@ static void K_MoveHeldObjects(player_t *player) targx = player->mo->x + P_ReturnThrustX(cur, cur->angle + angoffset, cur->extravalue1); targy = player->mo->y + P_ReturnThrustY(cur, cur->angle + angoffset, cur->extravalue1); + K_MatchGenericExtraFlags(cur, player->mo); // Update graviflip in real time thanks. { // bobbing, copy pasted from my kimokawaiii entry const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); targz = (player->mo->z + (player->mo->height/2)) + sine; + if (player->mo->eflags & MFE_VERTICALFLIP) + targz -= player->mo->height/2 - FixedMul(player->mo->scale, cur->height); + } if (cur->tracer) @@ -4424,8 +4444,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_comebacktimer]) player->kartstuff[k_comebackmode] = 0; - if (P_IsObjectOnGround(player->mo) && player->mo->momz <= 0 && player->kartstuff[k_pogospring]) - player->kartstuff[k_pogospring] = 0; + if (P_IsObjectOnGround(player->mo) && player->kartstuff[k_pogospring]) + { + if ((player->mo->eflags & MFE_VERTICALFLIP && player->mo->momz >= 0) || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->momz <= 0)) + player->kartstuff[k_pogospring] = 0; + } if (cmd->buttons & BT_DRIFT) player->kartstuff[k_jmp] = 1; @@ -4670,7 +4693,7 @@ static void K_KartDrift(player_t *player, boolean onground) player->kartstuff[k_driftend] = 0; } - + // Incease/decrease the drift value to continue drifting in that direction if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0) @@ -5043,6 +5066,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) for (moloop = 0; moloop < 2; moloop++) { mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_ROCKETSNEAKER); + K_MatchGenericExtraFlags(mo, player->mo); mo->flags |= MF_NOCLIPTHING; mo->angle = player->mo->angle; mo->threshold = 10; diff --git a/src/p_enemy.c b/src/p_enemy.c index 8a6d7597..c2ec211a 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8640,6 +8640,7 @@ void A_LightningFollowPlayer(mobj_t *actor) else // else just teleport to player directly P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); + K_MatchGenericExtraFlags(actor, actor->target); // copy our target for graviflip actor->momx = actor->target->momx; actor->momy = actor->target->momy; actor->momz = actor->target->momz; // Give momentum since we don't teleport to our player literally every frame. diff --git a/src/p_mobj.c b/src/p_mobj.c index f71ff209..786276d8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6651,6 +6651,7 @@ void P_MobjThinker(mobj_t *mobj) fixed_t y = P_RandomRange(-35, 35)*mobj->scale; fixed_t z = P_RandomRange(0, 70)*mobj->scale; mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE); + K_MatchGenericExtraFlags(smoke, mobj); smoke->scale = mobj->scale * 2; smoke->destscale = mobj->scale * 6; smoke->momz = P_RandomRange(4, 9)*FRACUNIT; @@ -6660,10 +6661,11 @@ void P_MobjThinker(mobj_t *mobj) { fixed_t x = P_RandomRange(-16, 16)*mobj->scale; fixed_t y = P_RandomRange(-16, 16)*mobj->scale; - fixed_t z = P_RandomRange(0, 32)*mobj->scale; + fixed_t z = P_RandomRange(0, 32)*mobj->scale*P_MobjFlip(mobj); if (leveltime % 2 == 0) { mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_BOSSEXPLODE); + K_MatchGenericExtraFlags(smoke, mobj); P_SetMobjState(smoke, S_QUICKBOOM1); smoke->scale = mobj->scale/2; smoke->destscale = mobj->scale; @@ -6672,6 +6674,7 @@ void P_MobjThinker(mobj_t *mobj) else { mobj_t *smoke = P_SpawnMobj(mobj->x + x, mobj->y + y, mobj->z + z, MT_SMOKE); + K_MatchGenericExtraFlags(smoke, mobj); smoke->scale = mobj->scale; smoke->destscale = mobj->scale*2; } From 4c19c36fbb7f8e43caed50a16d50cf4b8d17f8d9 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 30 Jan 2019 15:25:41 +0100 Subject: [PATCH 002/114] Small optimization + item throwing + battle stuff --- src/k_kart.c | 66 +++++++++++++++++++++++++++++----------------------- src/k_kart.h | 1 + src/p_mobj.c | 30 ++++++++++++++++-------- 3 files changed, 58 insertions(+), 39 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index bbca029c..edb1f3c7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1305,15 +1305,22 @@ static void K_UpdateOffroad(player_t *player) player->kartstuff[k_offroad] = 0; } +// Adds gravity flipping to an object relative to its master and shifts the z coordinate accordingly. +void K_FlipFromObject(mobj_t *mo, mobj_t *master) +{ + mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP)|(master->eflags & MFE_VERTICALFLIP); + mo->flags2 = (mo->flags2 & ~MF2_OBJECTFLIP)|(master->flags2 & MF2_OBJECTFLIP); + + if (mo->eflags & MFE_VERTICALFLIP) + mo->z += master->height - FixedMul(master->scale, mo->height); +} + // These have to go earlier than its sisters because of K_RespawnChecker... void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master) { // flipping // handle z shifting from there too; - mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP)|(master->eflags & MFE_VERTICALFLIP); - if (mo->eflags & MFE_VERTICALFLIP) - mo->z += master->height - FixedMul(master->scale, mo->height); - + K_FlipFromObject(mo, master); // visibility (usually for hyudoro) mo->flags2 = (mo->flags2 & ~MF2_DONTDRAW)|(master->flags2 & MF2_DONTDRAW); @@ -2166,7 +2173,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor) // A b if (source && source != player->mo && source->player) K_PlayHitEmSound(source); - player->mo->momz = 18*mapobjectscale; + player->mo->momz = 18*mapobjectscale*P_MobjFlip(player->mo); // please stop forgetting mobjflip checks!!!! player->mo->momx = player->mo->momy = 0; player->kartstuff[k_sneakertimer] = 0; @@ -2729,10 +2736,8 @@ void K_SpawnBoostTrail(player_t *player) flame->fuse = TICRATE*2; flame->destscale = player->mo->scale; P_SetScale(flame, player->mo->scale); - flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags so that a stolen sneaker can be seen - - if (flame->eflags & MFE_VERTICALFLIP) - flame->z += player->mo->height - FixedMul(player->mo->scale, flame->height); + // not K_MatchGenericExtraFlags so that a stolen sneaker can be seen + K_FlipFromObject(flame, player->mo); flame->momx = 8; P_XYMovement(flame); @@ -2765,6 +2770,7 @@ void K_SpawnSparkleTrail(mobj_t *mo) fixed_t newz = mo->z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<target, mo); sparkle->destscale = mo->destscale; P_SetScale(sparkle, mo->scale); - sparkle->eflags = (sparkle->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags so that a stolen invincibility can be seen - if (sparkle->eflags & MFE_VERTICALFLIP) - sparkle->z += mo->height - FixedMul(mo->scale, sparkle->height); sparkle->color = mo->color; //sparkle->colorized = mo->colorized; } @@ -2795,9 +2798,7 @@ void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent) dust->angle = R_PointToAngle2(0,0,mo->momx,mo->momy); dust->destscale = mo->scale; P_SetScale(dust, mo->scale); - dust->eflags = (dust->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); // not K_MatchGenericExtraFlags because hyudoro shouldn't be able to wipeout - if (dust->eflags & MFE_VERTICALFLIP) - dust->z += mo->height - FixedMul(mo->scale, dust->height); + K_FlipFromObject(dust, mo); if (translucent) // offroad effect { @@ -3007,6 +3008,14 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map { // Shoot forward mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, mapthing); + //K_FlipFromObject(mo, player->mo); + // These are really weird so let's make it a very specific case to make SURE it works... + if (player->mo->eflags & MFE_VERTICALFLIP) + { + mo->z -= player->mo->height; + mo->flags2 |= MF2_OBJECTFLIP; + mo->eflags |= MFE_VERTICALFLIP; + } mo->threshold = 10; P_SetTarget(&mo->target, player->mo); @@ -3016,18 +3025,24 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map if (mo) { angle_t fa = player->mo->angle>>ANGLETOFINESHIFT; - INT32 HEIGHT = (20 + (dir*10))*mapobjectscale + player->mo->momz; + INT32 HEIGHT = (20 + (dir*10))*mapobjectscale + (player->mo->momz*P_MobjFlip(player->mo)); + P_SetObjectMomZ(mo, HEIGHT, false); mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED)); mo->momy = player->mo->momy + FixedMul(FINESINE(fa), (altthrow == 2 ? 2*PROJSPEED/3 : PROJSPEED)); - mo->momz = P_MobjFlip(player->mo) * HEIGHT; - - if (player->mo->eflags & MFE_VERTICALFLIP) - mo->eflags |= MFE_VERTICALFLIP; } + // this is the small graphic effect that plops in you when you throw an item: throwmo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FIREDITEM); P_SetTarget(&throwmo->target, player->mo); + // Ditto: + if (player->mo->eflags & MFE_VERTICALFLIP) + { + throwmo->z -= player->mo->height; + throwmo->flags2 |= MF2_OBJECTFLIP; + throwmo->eflags |= MFE_VERTICALFLIP; + } + throwmo->movecount = 0; // above player } else @@ -3053,9 +3068,7 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map } mo = P_SpawnMobj(newx, newy, newz, mapthing); - - if (P_MobjFlip(player->mo) < 0) - mo->z = player->mo->z + player->mo->height - mo->height; + K_FlipFromObject(mo, player->mo); mo->threshold = 10; P_SetTarget(&mo->target, player->mo); @@ -3081,12 +3094,6 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map } } } - - if (mo) - { - if (player->mo->eflags & MFE_VERTICALFLIP) - mo->eflags |= MFE_VERTICALFLIP; - } } } @@ -3793,6 +3800,7 @@ static void K_MoveHeldObjects(player_t *player) targx = targ->x + P_ReturnThrustX(cur, ang + ANGLE_180, dist); targy = targ->y + P_ReturnThrustY(cur, ang + ANGLE_180, dist); targz = targ->z; + speed = FixedMul(R_PointToDist2(cur->x, cur->y, targx, targy), 3*FRACUNIT/4); if (P_IsObjectOnGround(targ)) targz = cur->floorz; diff --git a/src/k_kart.h b/src/k_kart.h index 3f712091..c54fe698 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -23,6 +23,7 @@ void K_RegisterKartStuff(void); boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); +void K_FlipFromObject(mobj_t *mo, mobj_t *master); void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master); void K_RespawnChecker(player_t *player); void K_KartMoveAnimation(player_t *player); diff --git a/src/p_mobj.c b/src/p_mobj.c index 786276d8..769663b7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6637,7 +6637,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_SINK_SHIELD: if ((mobj->health > 0 && (!mobj->target || !mobj->target->player || mobj->target->player->health <= 0 || mobj->target->player->spectator)) - || (mobj->health <= 0 && mobj->z <= mobj->floorz) + || (mobj->health <= 0 && P_IsObjectOnGround(mobj)) || P_CheckDeathPitCollide(mobj)) // When in death state { P_RemoveMobj(mobj); @@ -6654,7 +6654,7 @@ void P_MobjThinker(mobj_t *mobj) K_MatchGenericExtraFlags(smoke, mobj); smoke->scale = mobj->scale * 2; smoke->destscale = mobj->scale * 6; - smoke->momz = P_RandomRange(4, 9)*FRACUNIT; + smoke->momz = P_RandomRange(4, 9)*FRACUNIT*P_MobjFlip(smoke); } break; case MT_BOOMPARTICLE: @@ -6780,7 +6780,7 @@ void P_MobjThinker(mobj_t *mobj) } 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) + || (mobj->health <= 0 && P_IsObjectOnGround(mobj)) || P_CheckDeathPitCollide(mobj)) // When in death state { P_RemoveMobj(mobj); @@ -7228,6 +7228,9 @@ void P_MobjThinker(mobj_t *mobj) y = mobj->target->y; z = mobj->target->z + (80*mapobjectscale); } + if (mobj->target->eflags & MFE_VERTICALFLIP) + z += mobj->target->height - FixedMul(mobj->target->scale, mobj->height); + P_TeleportMove(mobj, x, y, z); } break; @@ -7423,7 +7426,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_BANANA: case MT_EGGMANITEM: case MT_SPB: - if (mobj->z <= mobj->floorz) + if (P_IsObjectOnGround(mobj)) { P_RemoveMobj(mobj); return; @@ -7436,7 +7439,7 @@ void P_MobjThinker(mobj_t *mobj) break; case MT_JAWZ: case MT_JAWZ_DUD: - if (mobj->z <= mobj->floorz) + if (P_IsObjectOnGround(mobj)) P_SetMobjState(mobj, mobj->info->xdeathstate); // fallthru case MT_JAWZ_SHIELD: @@ -7470,7 +7473,7 @@ void P_MobjThinker(mobj_t *mobj) /* FALLTHRU */ case MT_SMK_MOLE: mobj->flags2 ^= MF2_DONTDRAW; - if (mobj->z <= mobj->floorz) + if (P_IsObjectOnGround(mobj)) { P_RemoveMobj(mobj); return; @@ -7491,7 +7494,7 @@ void P_MobjThinker(mobj_t *mobj) } mobj->flags2 ^= MF2_DONTDRAW; - if (mobj->z <= mobj->floorz) + if (P_IsObjectOnGround(mobj)) { P_RemoveMobj(mobj); return; @@ -8160,7 +8163,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->friction = ORIG_FRICTION/4; if (mobj->momx || mobj->momy) P_SpawnGhostMobj(mobj); - if (mobj->z <= mobj->floorz && mobj->health > 1) + if (P_IsObjectOnGround(mobj) && mobj->health > 1) { S_StartSound(mobj, mobj->info->activesound); mobj->momx = mobj->momy = 0; @@ -8180,7 +8183,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_SINK: if (mobj->momx || mobj->momy) P_SpawnGhostMobj(mobj); - if (mobj->z <= mobj->floorz) + if (P_IsObjectOnGround(mobj)) { S_StartSound(mobj, mobj->info->deathsound); P_SetMobjState(mobj, S_NULL); @@ -8358,6 +8361,7 @@ void P_MobjThinker(mobj_t *mobj) break; case MT_INSTASHIELDB: mobj->flags2 ^= MF2_DONTDRAW; + K_MatchGenericExtraFlags(mobj, mobj->target); /* FALLTHRU */ case MT_INSTASHIELDA: if (!mobj->target || !mobj->target->health || (mobj->target->player && !mobj->target->player->kartstuff[k_instashield])) @@ -8366,6 +8370,7 @@ void P_MobjThinker(mobj_t *mobj) return; } P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z); + K_MatchGenericExtraFlags(mobj, mobj->target); break; case MT_BATTLEPOINT: if (!mobj->target || P_MobjWasRemoved(mobj->target)) @@ -8386,7 +8391,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->movefactor < mobj->target->height) mobj->movefactor = mobj->target->height; } - + K_MatchGenericExtraFlags(mobj, mobj->target); P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z + (mobj->target->height/2) + mobj->movefactor); break; case MT_THUNDERSHIELD: @@ -8511,6 +8516,10 @@ void P_MobjThinker(mobj_t *mobj) mobj->flags2 &= ~MF2_DONTDRAW; } + // Update mobj antigravity status: + mobj->eflags = (mobj->eflags & ~MFE_VERTICALFLIP)|(mobj->target->eflags & MFE_VERTICALFLIP); + mobj->flags2 = (mobj->flags2 & ~MF2_OBJECTFLIP)|(mobj->target->flags2 & MF2_OBJECTFLIP); + // Now for the wheels { const fixed_t rad = FixedMul(mobjinfo[MT_PLAYER].radius, mobj->target->scale); @@ -8532,6 +8541,7 @@ void P_MobjThinker(mobj_t *mobj) P_SetScale(cur, mobj->target->scale); cur->color = mobj->target->color; cur->colorized = true; + K_FlipFromObject(cur, mobj->target); if (mobj->flags2 & MF2_DONTDRAW) cur->flags2 |= MF2_DONTDRAW; From 04fe5de985ecbf0c11a6398a28d4eddd34fc063d Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 16 Feb 2019 08:16:56 -0600 Subject: [PATCH 003/114] Incomplete: Split files added with -file into their own array Compiles with no errors but the game errors on launch. With no files added, it gives "W_InitMultipleFiles: no files found". With files loaded via -file it gives "W_GetNumForName: PLAYPAL not found!" --- src/d_main.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 28f89f4f..125c8f1e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -111,6 +111,7 @@ UINT8 window_notinfocus = false; //static INT32 demosequence; static const char *pagename = "MAP1PIC"; static char *startupwadfiles[MAX_WADFILES]; +static char *startuppwads[MAX_WADFILES]; boolean devparm = false; // started game with -devparm @@ -824,12 +825,12 @@ void D_StartTitle(void) // // D_AddFile // -static void D_AddFile(const char *file) +static void D_AddFile(const char *file, char **filearray) { size_t pnumwadfiles; char *newfile; - for (pnumwadfiles = 0; startupwadfiles[pnumwadfiles]; pnumwadfiles++) + for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++) ; newfile = malloc(strlen(file) + 1); @@ -839,16 +840,16 @@ static void D_AddFile(const char *file) } strcpy(newfile, file); - startupwadfiles[pnumwadfiles] = newfile; + filearray[pnumwadfiles] = newfile; } -static inline void D_CleanFile(void) +static inline void D_CleanFile(char **filearray) { size_t pnumwadfiles; - for (pnumwadfiles = 0; startupwadfiles[pnumwadfiles]; pnumwadfiles++) + for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++) { - free(startupwadfiles[pnumwadfiles]); - startupwadfiles[pnumwadfiles] = NULL; + free(filearray[pnumwadfiles]); + filearray[pnumwadfiles] = NULL; } } @@ -908,9 +909,9 @@ static void IdentifyVersion(void) // Load the IWAD if (srb2wad2 != NULL && FIL_ReadFileOK(srb2wad2)) - D_AddFile(srb2wad2); + D_AddFile(srb2wad2, startupwadfiles); else if (srb2wad1 != NULL && FIL_ReadFileOK(srb2wad1)) - D_AddFile(srb2wad1); + D_AddFile(srb2wad1, startupwadfiles); else I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s or %s\n", srb2waddir, srb2wad1, srb2wad2); @@ -927,12 +928,12 @@ static void IdentifyVersion(void) D_AddFile(va(pandf,srb2waddir,"patch.dta")); #endif - D_AddFile(va(pandf,srb2waddir,"gfx.kart")); - D_AddFile(va(pandf,srb2waddir,"textures.kart")); - D_AddFile(va(pandf,srb2waddir,"chars.kart")); - D_AddFile(va(pandf,srb2waddir,"maps.kart")); + D_AddFile(va(pandf,srb2waddir,"gfx.kart"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"textures.kart"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"chars.kart"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"maps.kart"), startupwadfiles); #ifdef USE_PATCH_KART - D_AddFile(va(pandf,srb2waddir,"patch.kart")); + D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupwadfiles); #endif #if !defined (HAVE_SDL) || defined (HAVE_MIXER) @@ -941,7 +942,7 @@ static void IdentifyVersion(void) const char *musicpath = va(pandf,srb2waddir,str);\ int ms = W_VerifyNMUSlumps(musicpath); \ if (ms == 1) \ - D_AddFile(musicpath); \ + D_AddFile(musicpath, startupwadfiles); \ else if (ms == 0) \ I_Error("File "str" has been modified with non-music/sound lumps"); \ } @@ -1163,7 +1164,7 @@ void D_SRB2Main(void) { if (!W_VerifyNMUSlumps(s)) G_SetGameModified(true, false); - D_AddFile(s); + D_AddFile(s, startuppwads); } } } @@ -1220,7 +1221,7 @@ void D_SRB2Main(void) #else I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); #endif - D_CleanFile(); + D_CleanFile(startupwadfiles); mainwads = 0; @@ -1254,6 +1255,10 @@ void D_SRB2Main(void) mainwadstally = packetsizetally; + if (!W_InitMultipleFiles(startuppwads)) + CONS_Error("A PWAD file was not found or not valid.\nCheck the log to see which ones.\n"); + D_CleanFile(startuppwads); + cht_Init(); //---------------------------------------------------- READY SCREEN From 91ce3617ef995560b92c943190c6410258f28642 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 18 Feb 2019 14:00:36 +0100 Subject: [PATCH 004/114] Fix respawning in reverse gravity --- src/d_player.h | 1 + src/g_game.c | 3 +++ src/p_inter.c | 1 + src/p_mobj.c | 13 ++++++++++--- src/p_spec.c | 3 ++- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index b430f20a..73279ef0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -275,6 +275,7 @@ typedef enum k_nextcheck, // Next checkpoint distance; for p_user.c (was "pw_ncd") k_waypoint, // Waypoints. k_starpostwp, // Temporarily stores player waypoint for... some reason. Used when respawning and finishing. + k_starpostflip, // the last starpost we hit requires flipping? k_respawn, // Timer for the DEZ laser respawn effect k_dropdash, // Charge up for respawn Drop Dash diff --git a/src/g_game.c b/src/g_game.c index f0d221ff..02682b27 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2371,6 +2371,7 @@ void G_PlayerReborn(INT32 player) INT32 bumper; INT32 comebackpoints; INT32 wanted; + INT32 respawnflip; boolean songcredit = false; score = players[player].score; @@ -2411,6 +2412,7 @@ void G_PlayerReborn(INT32 player) starposty = players[player].starposty; starpostz = players[player].starpostz; starpostnum = players[player].starpostnum; + respawnflip = players[player].kartstuff[k_starpostflip]; //SRB2KART starpostangle = players[player].starpostangle; jumpfactor = players[player].jumpfactor; thokitem = players[player].thokitem; @@ -2530,6 +2532,7 @@ void G_PlayerReborn(INT32 player) p->kartstuff[k_comebacktimer] = comebacktime; p->kartstuff[k_wanted] = wanted; p->kartstuff[k_eggmanblame] = -1; + p->kartstuff[k_starpostflip] = respawnflip; // Don't do anything immediately p->pflags |= PF_USEDOWN; diff --git a/src/p_inter.c b/src/p_inter.c index dd27858f..adb7e863 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1468,6 +1468,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->kartstuff[k_starpostflip] = special->spawnpoint->options & MTF_OBJECTFLIP; // store flipping //S_StartSound(toucher, special->info->painsound); return; diff --git a/src/p_mobj.c b/src/p_mobj.c index 8626e2df..0f5f5de3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11137,7 +11137,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); if (p->kartstuff[k_respawn]) - z -= 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; + z -= 128*mapobjectscale; } else { @@ -11145,7 +11145,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); if (p->kartstuff[k_respawn]) - z += 128*FRACUNIT; // Too late for v1, but for later: 128*mapobjectscale; + z += 128*mapobjectscale; } if (mthing->options & MTF_OBJECTFLIP) // flip the player! @@ -11206,7 +11206,14 @@ void P_MovePlayerToStarpost(INT32 playernum) #endif sector->ceilingheight; - z = (p->starpostz + 128) << FRACBITS; // Respawn off the ground + if (mobj->player->kartstuff[k_starpostflip]) + z = (p->starpostz<height; + else + z = (p->starpostz<starpostz + 128) << FRACBITS; // reverse gravity exists, pls + mobj->player->kartstuff[k_starpostflip] = 0; + if (z < floor) z = floor; else if (z > ceiling - mobjinfo[MT_PLAYER].height) diff --git a/src/p_spec.c b/src/p_spec.c index 24f56c43..2088d857 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4247,13 +4247,14 @@ DoneSection2: player->starpostx = player->mo->x>>FRACBITS; player->starposty = player->mo->y>>FRACBITS; player->starpostz = player->mo->floorz>>FRACBITS; + player->kartstuff[k_starpostflip] = player->mo->flags2 = MF2_OBJECTFLIP; // store flipping player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely... } else { // SRB2kart 200117 // Reset starposts (checkpoints) info - player->starpostangle = player->starpostx = player->starposty = player->starpostz = 0; + player->starpostangle = player->starpostx = player->starposty = player->starpostz = player->kartstuff[k_starpostflip] = 0; } if (P_IsLocalPlayer(player)) From f34ed24132bcf3cc3424b74065b9a8a68083d85e Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Tue, 19 Feb 2019 22:20:18 -0600 Subject: [PATCH 005/114] Correct an oversight --- src/w_wad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 29e1ba22..dc45d869 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -860,7 +860,8 @@ INT32 W_InitMultipleFiles(char **filenames) INT32 rc = 1; // open all the files, load headers, and count lumps - numwadfiles = 0; + if (!numwadfiles) + numwadfiles = 0; // will be realloced as lumps are added for (; *filenames; filenames++) From 23f1974117e0be76af29b6edf0ce443e3b59c06d Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 20 Feb 2019 18:55:53 -0600 Subject: [PATCH 006/114] Bump MAXSKINS to 128 Can't believe people actually need this now. --- src/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doomdef.h b/src/doomdef.h index ab863c6f..d538618e 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -244,7 +244,7 @@ extern FILE *logstream; // NOTE: it needs more than this to increase the number of players... #define MAXPLAYERS 16 -#define MAXSKINS 64 +#define MAXSKINS 128 #define PLAYERSMASK (MAXPLAYERS-1) #define MAXPLAYERNAME 21 From 84755ec171d25ae7688e412b12d34123fa407274 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 20 Feb 2019 19:04:18 -0600 Subject: [PATCH 007/114] Handle things in a more sensible way --- src/w_wad.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index dc45d869..5ae67aa8 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -106,7 +106,7 @@ static UINT16 lumpnumcacheindex = 0; //=========================================================================== // GLOBALS //=========================================================================== -UINT16 numwadfiles; // number of active wadfiles +UINT16 numwadfiles = 0; // number of active wadfiles wadfile_t *wadfiles[MAX_WADFILES]; // 0 to numwadfiles-1 are valid // W_Shutdown @@ -859,10 +859,6 @@ INT32 W_InitMultipleFiles(char **filenames) { INT32 rc = 1; - // open all the files, load headers, and count lumps - if (!numwadfiles) - numwadfiles = 0; - // will be realloced as lumps are added for (; *filenames; filenames++) { From 3d5d02fc15197eac5a663f5c79db21ff88cae5a4 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 3 Mar 2019 19:58:01 -0500 Subject: [PATCH 008/114] Error if the lump is a PNG lump --- src/w_wad.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/w_wad.c b/src/w_wad.c index 88e89974..9ca4e0ff 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1175,6 +1175,29 @@ void zerr(int ret) } #endif +#define NO_PNG_LUMPS + +#ifdef NO_PNG_LUMPS +static void ErrorIfPNG(void *d, size_t s, char *f, char *l) +{ + if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/ + return; +#define sigcheck ((UINT8 *)d) + if (sigcheck[0] == 0x89 + && sigcheck[1] == 0x50 + && sigcheck[2] == 0x4e + && sigcheck[3] == 0x47 + && sigcheck[4] == 0x0d + && sigcheck[5] == 0x0a + && sigcheck[6] == 0x1a + && sigcheck[7] == 0x0a) + { + I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f); + } +#undef sigcheck +} +#endif + /** Reads bytes from the head of a lump. * Note: If the lump is compressed, the whole thing has to be read anyway. * @@ -1214,7 +1237,15 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si switch(wadfiles[wad]->lumpinfo[lump].compression) { case CM_NOCOMPRESSION: // If it's uncompressed, we directly write the data into our destination, and return the bytes read. +#ifdef NO_PNG_LUMPS + { + size_t bytesread = fread(dest, 1, size, handle); + ErrorIfPNG(dest, bytesread, wadfiles[wad]->filename, l->name2); + return bytesread; + } +#else return fread(dest, 1, size, handle); +#endif case CM_LZF: // Is it LZF compressed? Used by ZWADs. { #ifdef ZWAD @@ -1249,11 +1280,15 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si M_Memcpy(dest, decData + offset, size); Z_Free(rawData); Z_Free(decData); +#ifdef NO_PNG_LUMPS + ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2); +#endif return size; #else //I_Error("ZWAD files not supported on this platform."); return 0; #endif + } #ifdef HAVE_ZLIB case CM_DEFLATE: // Is it compressed via DEFLATE? Very common in ZIPs/PK3s, also what most doom-related editors support. @@ -1307,6 +1342,9 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si Z_Free(rawData); Z_Free(decData); +#ifdef NO_PNG_LUMPS + ErrorIfPNG(dest, size, wadfiles[wad]->filename, l->name2); +#endif return size; } #endif From 15323328c5659ebee4c5b740c52b1968167e0f56 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 3 Mar 2019 22:43:21 -0500 Subject: [PATCH 009/114] Check using memcmp() --- src/w_wad.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 9ca4e0ff..b5aa95fa 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1183,14 +1183,10 @@ static void ErrorIfPNG(void *d, size_t s, char *f, char *l) if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/ return; #define sigcheck ((UINT8 *)d) - if (sigcheck[0] == 0x89 - && sigcheck[1] == 0x50 - && sigcheck[2] == 0x4e - && sigcheck[3] == 0x47 - && sigcheck[4] == 0x0d - && sigcheck[5] == 0x0a - && sigcheck[6] == 0x1a - && sigcheck[7] == 0x0a) + // Check for PNG file signature using memcmp + // As it may be faster on CPUs with slow unaligned memory access + // Ref: http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature + if (memcmp(&sigcheck[0], "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0) { I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f); } From 9542a47f7fee56f6078b9973233b911370476ef3 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 3 Mar 2019 22:57:09 -0500 Subject: [PATCH 010/114] New -noxinput and -nohidapi command line parameters. --- src/sdl/i_system.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index b5597784..517c183e 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1402,7 +1402,13 @@ static int joy_open2(const char *fname) void I_InitJoystick(void) { I_ShutdownJoystick(); - SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); + + if (M_CheckParm("-noxinput")) + SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); + + if (M_CheckParm("-nohidapi")) + SDL_SetHintWithPriority("SDL_JOYSTICK_HIDAPI", "0", SDL_HINT_OVERRIDE); + if (!strcmp(cv_usejoystick.string, "0") || M_CheckParm("-nojoy")) return; if (joy_open(cv_usejoystick.string) != -1) @@ -1418,7 +1424,13 @@ void I_InitJoystick(void) void I_InitJoystick2(void) { I_ShutdownJoystick2(); - SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); + + if (M_CheckParm("-noxinput")) + SDL_SetHintWithPriority("SDL_XINPUT_ENABLED", "0", SDL_HINT_OVERRIDE); + + if (M_CheckParm("-nohidapi")) + SDL_SetHintWithPriority("SDL_JOYSTICK_HIDAPI", "0", SDL_HINT_OVERRIDE); + if (!strcmp(cv_usejoystick2.string, "0") || M_CheckParm("-nojoy")) return; if (joy_open2(cv_usejoystick2.string) != -1) From 0f51f3b7e30fc9f7559c50efd169c7a752a45bf6 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Tue, 5 Mar 2019 22:07:53 -0500 Subject: [PATCH 011/114] Don't skip frames in software mode --- src/sdl/i_video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2a77604d..0568dcee 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1355,8 +1355,9 @@ void I_FinishUpdate(void) if (rendermode == render_none) return; //Alam: No software or OpenGl surface - if (I_SkipFrame()) - return; + // Don't skip frames + //if (I_SkipFrame()) + //return; if (cv_ticrate.value) SCR_DisplayTicRate(); From 264454ca708a7320512aba166a1ed90a5721f41e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 5 Mar 2019 22:27:25 -0600 Subject: [PATCH 012/114] hblurgle spburgle this code sucks --- src/d_clisrv.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++-- src/d_clisrv.h | 13 +++++- src/d_netcmd.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ src/d_netcmd.h | 6 +++ 4 files changed, 225 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 8e2a42de..e1c4f8bc 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1126,13 +1126,55 @@ typedef enum CL_DOWNLOADSAVEGAME, #endif CL_CONNECTED, - CL_ABORTED + CL_ABORTED, + CL_CHALLENGE } cl_mode_t; static void GetPackets(void); static cl_mode_t cl_mode = CL_SEARCHING; +static UINT8 cl_challengenum = 0; +static UINT8 cl_challengequestion[17]; +static char cl_challengepassword[65]; +static UINT8 cl_challengeanswer[17]; + +static void D_JoinChallengeInput(INT32 ch) +{ + size_t len; + + while (ch) + { + if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART]) + || ch == ' ') // Allow spaces, of course + { + len = strlen(cl_challengepassword); + if (len < 64) + { + cl_challengepassword[len+1] = 0; + cl_challengepassword[len] = ch; + } + } + else if (ch == KEY_BACKSPACE) + { + len = strlen(cl_challengepassword); + + if (len > 0) + cl_challengepassword[len-1] = 0; + } + else if (ch == KEY_ENTER) + { + // Done? + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_mode = CL_ASKJOIN; + return; + } + + ch = I_GetKey(); + } + +} + // Player name send/load static void CV_SavePlayerNames(UINT8 **p) @@ -1191,11 +1233,25 @@ static inline void CL_DrawConnectionStatus(void) // 15 pal entries total. const char *cltext; - for (i = 0; i < 16; ++i) - V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15)); + if (cl_mode != CL_CHALLENGE) + for (i = 0; i < 16; ++i) + V_DrawFill((BASEVIDWIDTH/2-128) + (i * 16), BASEVIDHEIGHT-24, 16, 8, palstart + ((animtime - i) & 15)); switch (cl_mode) { + case CL_CHALLENGE: + { + char asterisks[65]; + size_t sl = strlen(cl_challengepassword); + + memset(asterisks, '*', sl); + memset(asterisks+sl, 0, 65-sl); + + V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_MONOSPACE|V_ALLOWLOWERCASE, asterisks); + + cltext = M_GetText("Please enter the server password."); + } + break; #ifdef JOININGAME case CL_DOWNLOADSAVEGAME: if (lastfilenum != -1) @@ -1292,6 +1348,8 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.localplayers = localplayers; netbuffer->u.clientcfg.version = VERSION; netbuffer->u.clientcfg.subversion = SUBVERSION; + netbuffer->u.clientcfg.challengenum = cl_challengenum; + memcpy(netbuffer->u.clientcfg.challengeanswer, cl_challengeanswer, 16); return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak)); } @@ -2059,6 +2117,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic break; #endif + case CL_CHALLENGE: case CL_WAITJOINRESPONSE: case CL_CONNECTED: default: @@ -2091,6 +2150,8 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic D_StartTitle(); return false; } + else if (cl_mode == CL_CHALLENGE) + D_JoinChallengeInput(key); // why are these here? this is for servers, we're a client //if (key == 's' && server) @@ -3142,6 +3203,9 @@ void D_ClientServerInit(void) gametic = 0; localgametic = 0; + memset(cl_challengequestion, 0x00, 17); + memset(cl_challengeanswer, 0x00, 17); + // do not send anything before the real begin SV_StopServer(); SV_ResetServer(); @@ -3631,6 +3695,26 @@ static void HandleConnect(SINT8 node) boolean newnode = false; #endif + if (D_IsJoinPasswordOn()) + { + // Ensure node sent the correct password challenge + boolean passed = false; + + if (netbuffer->u.clientcfg.challengenum && D_VerifyJoinPasswordChallenge(netbuffer->u.clientcfg.challengenum, netbuffer->u.clientcfg.challengeanswer)) + passed = true; + + if (!passed) + { + D_MakeJoinPasswordChallenge(&netbuffer->u.joinchallenge.challengenum, netbuffer->u.joinchallenge.question); + + netbuffer->packettype = PT_JOINCHALLENGE; + HSendPacket(node, true, 0, sizeof(joinchallenge_pak)); + //Net_CloseConnection(node); + + return; + } + } + // client authorised to join nodewaiting[node] = (UINT8)(netbuffer->u.clientcfg.localplayers - playerpernode[node]); if (!nodeingame[node]) @@ -3794,6 +3878,22 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; + case PT_JOINCHALLENGE: + if (server && serverrunning) + { // But wait I thought I'm the server? + Net_CloseConnection(node); + break; + } + SERVERONLY + if (cl_mode == CL_WAITJOINRESPONSE) + { + cl_challengenum = netbuffer->u.joinchallenge.challengenum; + memcpy(cl_challengequestion, netbuffer->u.joinchallenge.question, 16); + + cl_mode = CL_CHALLENGE; + } + break; + case PT_SERVERREFUSE: // Negative response of client join request if (server && serverrunning) { // But wait I thought I'm the server? diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6615d67d..e4ff7cc7 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -73,6 +73,8 @@ typedef enum PT_CLIENT4MIS, PT_BASICKEEPALIVE,// Keep the network alive during wipes, as tics aren't advanced and NetUpdate isn't called + PT_JOINCHALLENGE, // You must give a password to joinnnnn + PT_CANFAIL, // This is kind of a priority. Anything bigger than CANFAIL // allows HSendPacket(*, true, *, *) to return false. // In addition, this packet can't occupy all the available slots. @@ -354,8 +356,16 @@ typedef struct UINT8 subversion; // Contains build version UINT8 localplayers; UINT8 mode; + UINT8 challengenum; // Non-zero if trying to join with a password attempt + UINT8 challengeanswer[16]; // Join challenge } ATTRPACK clientconfig_pak; +typedef struct +{ + UINT8 challengenum; // Number to send back in join attempt + UINT8 question[16]; // Challenge data to be manipulated and answered with +} ATTRPACK joinchallenge_pak; + #define MAXSERVERNAME 32 #define MAXFILENEEDED 915 // This packet is too large @@ -447,7 +457,8 @@ typedef struct UINT8 resynchgot; // UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...) filetx_pak filetxpak; // 139 bytes - clientconfig_pak clientcfg; // 136 bytes + clientconfig_pak clientcfg; // 153 bytes + joinchallenge_pak joinchallenge; // 17 bytes serverinfo_pak serverinfo; // 1024 bytes serverrefuse_pak serverrefuse; // 65025 bytes (somehow I feel like those values are garbage...) askinfo_pak askinfo; // 61 bytes diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a8efd306..a8014ec4 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -169,6 +169,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum); static void Got_Removal(UINT8 **cp, INT32 playernum); static void Command_Verify_f(void); static void Command_RemoveAdmin_f(void); +static void Command_ChangeJoinPassword_f(void); static void Command_MotD_f(void); static void Got_MotD_f(UINT8 **cp, INT32 playernum); @@ -534,6 +535,7 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_PICKVOTE, Got_PickVotecmd); // Remote Administration + COM_AddCommand("joinpassword", Command_ChangeJoinPassword_f); COM_AddCommand("password", Command_Changepassword_f); RegisterNetXCmd(XD_LOGIN, Got_Login); COM_AddCommand("login", Command_Login_f); // useful in dedicated to kick off remote admin @@ -3427,6 +3429,7 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, if (len > 256-sl) len = 256-sl; + memcpy(tmpbuf, buffer, len); memmove(&tmpbuf[len], salt, sl); //strcpy(&tmpbuf[len], salt); @@ -3702,6 +3705,107 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) CONS_Printf(M_GetText("You are no longer a server administrator.\n")); } +// Join password stuff +#define NUMJOINCHALLENGES 32 +static UINT8 joinpassmd5[17]; +static boolean joinpasswordset = false; +static UINT8 joinpasschallenges[NUMJOINCHALLENGES][17]; +static boolean joinpasschallengeson[NUMJOINCHALLENGES]; + +boolean D_IsJoinPasswordOn(void) +{ + return joinpasswordset; +} + +static inline void GetChallengeAnswer(UINT8 *question, UINT8 *passwordmd5, UINT8 *answer) +{ + D_MD5PasswordPass(question, 16, (char *) passwordmd5, answer); +} + +void D_ComputeChallengeAnswer(UINT8 *question, const char *pw, UINT8 *answer) +{ + static UINT8 passwordmd5[17]; + + memset(passwordmd5, 0x00, 17); + D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &passwordmd5); + GetChallengeAnswer(question, passwordmd5, answer); +} + +void D_SetJoinPassword(const char *pw) +{ + memset(joinpassmd5, 0x00, 17); + D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &joinpassmd5); + joinpasswordset = true; +} + +boolean D_VerifyJoinPasswordChallenge(UINT8 num, UINT8 *answer) +{ + boolean passed = false; + + num %= NUMJOINCHALLENGES; + + //@TODO use a constant-time memcmp.... + if (joinpasschallengeson[num] && memcmp(answer, joinpasschallenges[num], 16) == 0) + passed = true; + + // Wipe and reset the challenge so that it can't be tried against again, as a small measure against brute-force attacks. + memset(joinpasschallenges[num], 0x00, 17); + joinpasschallengeson[num] = false; + + return passed; +} + +void D_MakeJoinPasswordChallenge(UINT8 *num, UINT8 *question) +{ + size_t i; + + for (i = 0; i < NUMJOINCHALLENGES; i++) + { + (*num) = M_RandomKey(NUMJOINCHALLENGES); + + if (!joinpasschallengeson[(*num)]) + break; + } + + // If the above loop never breaks, then uh.... we're obliterating one random stored challenge. Sorry (: + joinpasschallengeson[(*num)] = true; + + memset(question, 0x00, 17); + for (i = 0; i < 16; i++) + question[i] = M_RandomByte(); + + // Store the answer in memory. What was the question again? + GetChallengeAnswer(question, joinpassmd5, joinpasschallenges[(*num)]); + + // This ensures that num is always non-zero and will be valid when used for the answer + if ((*num) == 0) + (*num) = NUMJOINCHALLENGES; +} + +// Remote Administration +static void Command_ChangeJoinPassword_f(void) +{ +#ifdef NOMD5 + // If we have no MD5 support then completely disable XD_LOGIN responses for security. + CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n"); +#else + if (client) // cannot change remotely + { + CONS_Printf(M_GetText("Only the server can use this.\n")); + return; + } + + if (COM_Argc() != 2) + { + CONS_Printf(M_GetText("joinpassword : set a password to join the server\n")); + return; + } + + D_SetJoinPassword(COM_Argv(1)); + CONS_Printf(M_GetText("Join password set.\n")); +#endif +} + static void Command_MotD_f(void) { size_t i, j; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index e0827013..438ba3ff 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -248,6 +248,12 @@ void RemoveAdminPlayer(INT32 playernum); void ItemFinder_OnChange(void); void D_SetPassword(const char *pw); +boolean D_IsJoinPasswordOn(void); +void D_ComputeChallengeAnswer(UINT8 *question, const char *pw, UINT8 *answer); +void D_SetJoinPassword(const char *pw); +boolean D_VerifyJoinPasswordChallenge(UINT8 num, UINT8 *answer); +void D_MakeJoinPasswordChallenge(UINT8 *num, UINT8 *question); + // used for the player setup menu UINT8 CanChangeSkin(INT32 playernum); From 75661f44d790e0360ae0877698611ecfbf949893 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 6 Mar 2019 21:18:01 -0600 Subject: [PATCH 013/114] Clean up the skin_t struct --- src/g_game.c | 8 +++--- src/lua_skinlib.c | 24 ++++++++-------- src/r_things.c | 72 +++++++++++++++++++++++------------------------ src/r_things.h | 28 +++++++++--------- 4 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 003c11e9..902af57e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5113,17 +5113,17 @@ void G_GhostTicker(void) INT32 type = -1; if (g->mo->skin) { - skin_t *skin = (skin_t *)g->mo->skin; + //skin_t *skin = (skin_t *)g->mo->skin; switch (ziptic & EZT_THOKMASK) { case EZT_THOK: - type = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; + type = (UINT32)mobjinfo[MT_PLAYER].painchance; // skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; break; case EZT_SPIN: - type = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; + type = (UINT32)mobjinfo[MT_PLAYER].damage; // skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; break; case EZT_REV: - type = skin->revitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; + type = (UINT32)mobjinfo[MT_PLAYER].raisestate; // skin->revitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; break; } } diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 8fdd92a5..c86376a8 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -30,24 +30,24 @@ enum skin { skin_facerank, skin_facewant, skin_facemmap, - skin_ability, + /*skin_ability, skin_ability2, skin_thokitem, skin_spinitem, skin_revitem, skin_actionspd, skin_mindash, - skin_maxdash, + skin_maxdash,*/ // SRB2kart skin_kartspeed, skin_kartweight, // - skin_normalspeed, + /*skin_normalspeed, skin_runspeed, skin_thrustfactor, skin_accelstart, skin_acceleration, - skin_jumpfactor, + skin_jumpfactor,*/ skin_starttranscolor, skin_prefcolor, skin_highresscale, @@ -64,24 +64,24 @@ static const char *const skin_opt[] = { "facerank", "facewant", "facemmap", - "ability", + /*"ability", "ability2", "thokitem", "spinitem", "revitem", "actionspd", "mindash", - "maxdash", + "maxdash",*/ // SRB2kart "kartspeed", "kartweight", // - "normalspeed", + /*"normalspeed", "runspeed", "thrustfactor", "accelstart", "acceleration", - "jumpfactor", + "jumpfactor",*/ "starttranscolor", "prefcolor", "highresscale", @@ -139,7 +139,7 @@ static int skin_get(lua_State *L) break; lua_pushlstring(L, skin->facemmap, i); break; - case skin_ability: + /*case skin_ability: lua_pushinteger(L, skin->ability); break; case skin_ability2: @@ -162,7 +162,7 @@ static int skin_get(lua_State *L) break; case skin_maxdash: lua_pushfixed(L, skin->maxdash); - break; + break;*/ // SRB2kart case skin_kartspeed: lua_pushinteger(L, skin->kartspeed); @@ -171,7 +171,7 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->kartweight); break; // - case skin_normalspeed: + /*case skin_normalspeed: lua_pushfixed(L, skin->normalspeed); break; case skin_runspeed: @@ -188,7 +188,7 @@ static int skin_get(lua_State *L) break; case skin_jumpfactor: lua_pushfixed(L, skin->jumpfactor); - break; + break;*/ case skin_starttranscolor: lua_pushinteger(L, skin->starttranscolor); break; diff --git a/src/r_things.c b/src/r_things.c index 59a904cb..be0c0d25 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2537,22 +2537,22 @@ static void Sk_SetDefaultValue(skin_t *skin) skin->kartweight = 5; // - skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; - skin->accelstart = 96; - skin->acceleration = 40; + //skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; + //skin->accelstart = 96; + //skin->acceleration = 40; - skin->ability = CA_NONE; - skin->ability2 = CA2_SPINDASH; - skin->jumpfactor = FRACUNIT; - skin->actionspd = 30<mindash = 15<maxdash = 90<ability = CA_NONE; + //skin->ability2 = CA2_SPINDASH; + //skin->jumpfactor = FRACUNIT; + //skin->actionspd = 30<mindash = 15<maxdash = 90<thokitem = -1; - skin->spinitem = -1; - skin->revitem = -1; + //skin->thokitem = -1; + //skin->spinitem = -1; + //skin->revitem = -1; skin->highresscale = FRACUNIT>>1; @@ -2596,19 +2596,19 @@ void R_InitSkins(void) strncpy(skin->facemmap, "PLAYMMAP", 9); skin->prefcolor = SKINCOLOR_BLUE; - skin->ability = CA_THOK; - skin->actionspd = 60<ability = CA_THOK; + //skin->actionspd = 60<kartspeed = 8; skin->kartweight = 2; // - skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; - skin->accelstart = 96; - skin->acceleration = 40; + //skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; + //skin->accelstart = 96; + //skin->acceleration = 40; skin->spritedef.numframes = sprites[SPR_PLAY].numframes; skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes; @@ -2673,30 +2673,30 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) if (player->mo) player->mo->skin = skin; - player->charability = (UINT8)skin->ability; - player->charability2 = (UINT8)skin->ability2; + //player->charability = (UINT8)skin->ability; + //player->charability2 = (UINT8)skin->ability2; player->charflags = (UINT32)skin->flags; - player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; - player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; - player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; + //player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; + //player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; + //player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; - player->actionspd = skin->actionspd; - player->mindash = skin->mindash; - player->maxdash = skin->maxdash; + //player->actionspd = skin->actionspd; + //player->mindash = skin->mindash; + //player->maxdash = skin->maxdash; // SRB2kart player->kartspeed = skin->kartspeed; player->kartweight = skin->kartweight; - player->normalspeed = skin->normalspeed; - player->runspeed = skin->runspeed; - player->thrustfactor = skin->thrustfactor; - player->accelstart = skin->accelstart; - player->acceleration = skin->acceleration; + //player->normalspeed = skin->normalspeed; + //player->runspeed = skin->runspeed; + //player->thrustfactor = skin->thrustfactor; + //player->accelstart = skin->accelstart; + //player->acceleration = skin->acceleration; - player->jumpfactor = skin->jumpfactor; + //player->jumpfactor = skin->jumpfactor; /*if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback || modeattacking)) { @@ -2906,7 +2906,7 @@ void R_AddSkins(UINT16 wadnum) #define GETSPEED(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)< Date: Wed, 6 Mar 2019 21:30:39 -0600 Subject: [PATCH 014/114] Add -remove option to joinpassword --- src/d_netcmd.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a8014ec4..70e6098d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3797,12 +3797,20 @@ static void Command_ChangeJoinPassword_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("joinpassword : set a password to join the server\n")); + CONS_Printf(M_GetText("joinpassword : set a password to join the server\nUse -remove to disable the password.\n")); return; } - D_SetJoinPassword(COM_Argv(1)); - CONS_Printf(M_GetText("Join password set.\n")); + if (strcmp(COM_Argv(1), "-remove") == 0) + { + joinpasswordset = false; + CONS_Printf(M_GetText("Join password removed.\n")); + } + else + { + D_SetJoinPassword(COM_Argv(1)); + CONS_Printf(M_GetText("Join password set.\n")); + } #endif } From 87d60eef86f7c1b3d35c267b07b5613826c8624d Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 6 Mar 2019 22:02:56 -0600 Subject: [PATCH 015/114] Kill SF_RUNONWATER --- src/d_player.h | 2 +- src/dehacked.c | 2 +- src/p_mobj.c | 2 +- src/r_things.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index a5d73ec7..c93cd999 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -38,7 +38,7 @@ typedef enum SF_HIRES = 1<<3, // Draw the sprite 2x as small? SF_NOSKID = 1<<4, // No skid particles etc SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust - SF_RUNONWATER = 1<<6, // Run on top of water FOFs? + //SF_RUNONWATER = 1<<6, // Run on top of water FOFs? } skinflags_t; //Primary and secondary skin abilities diff --git a/src/dehacked.c b/src/dehacked.c index e3db120f..61736bac 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8614,7 +8614,7 @@ struct { {"SF_HIRES",SF_HIRES}, {"SF_NOSKID",SF_NOSKID}, {"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST}, - {"SF_RUNONWATER",SF_RUNONWATER}, + //{"SF_RUNONWATER",SF_RUNONWATER}, // Character abilities! // Primary diff --git a/src/p_mobj.c b/src/p_mobj.c index fd42a1d7..152187ca 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3234,7 +3234,7 @@ boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) #endif *rover->topheight; - if (((player->charflags & SF_RUNONWATER) && player->mo->ceilingz-topheight >= player->mo->height) + if ((/*(player->charflags & SF_RUNONWATER) && */player->mo->ceilingz-topheight >= player->mo->height) && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) && !(player->pflags & PF_SLIDING) && abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) diff --git a/src/r_things.c b/src/r_things.c index be0c0d25..64eb20d2 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3046,8 +3046,8 @@ next_token: HWR_AddPlayerMD2(numskins); #endif - if (skin->flags & SF_RUNONWATER) // this is literally the only way a skin can be a major mod... this might be a bit heavy handed - G_SetGameModified(multiplayer, true); + /*if (skin->flags & SF_RUNONWATER) // this is literally the only way a skin can be a major mod... this might be a bit heavy handed + G_SetGameModified(multiplayer, true);*/ numskins++; } From 52b743a18ffe249a7cfc2a562c451bcee3586d13 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 6 Mar 2019 22:07:28 -0600 Subject: [PATCH 016/114] Fix join password not recognizing shifted characters --- src/d_clisrv.c | 129 ++++++++++++++++++++++++++++++------------------- src/d_clisrv.h | 1 + src/d_main.c | 3 ++ 3 files changed, 83 insertions(+), 50 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e1c4f8bc..ca32aaaf 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -22,6 +22,7 @@ #include "i_video.h" #include "d_net.h" #include "d_main.h" +#include "d_event.h" #include "g_game.h" #include "hu_stuff.h" #include "keys.h" @@ -1139,42 +1140,6 @@ static UINT8 cl_challengequestion[17]; static char cl_challengepassword[65]; static UINT8 cl_challengeanswer[17]; -static void D_JoinChallengeInput(INT32 ch) -{ - size_t len; - - while (ch) - { - if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART]) - || ch == ' ') // Allow spaces, of course - { - len = strlen(cl_challengepassword); - if (len < 64) - { - cl_challengepassword[len+1] = 0; - cl_challengepassword[len] = ch; - } - } - else if (ch == KEY_BACKSPACE) - { - len = strlen(cl_challengepassword); - - if (len > 0) - cl_challengepassword[len-1] = 0; - } - else if (ch == KEY_ENTER) - { - // Done? - D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_mode = CL_ASKJOIN; - return; - } - - ch = I_GetKey(); - } - -} - // Player name send/load static void CV_SavePlayerNames(UINT8 **p) @@ -2136,22 +2101,10 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic // Call it only once by tic if (*oldtic != I_GetTime()) { - INT32 key; - I_OsPolling(); - key = I_GetKey(); - // Only ESC and non-keyboard keys abort connection - if (key == KEY_ESCAPE || key >= KEY_MOUSE1) - { - CONS_Printf(M_GetText("Network game synchronization aborted.\n")); -// M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING); - D_QuitNetGame(); - CL_Reset(); - D_StartTitle(); + D_ProcessEvents(); + if (gamestate != GS_WAITINGPLAYERS) return false; - } - else if (cl_mode == CL_CHALLENGE) - D_JoinChallengeInput(key); // why are these here? this is for servers, we're a client //if (key == 's' && server) @@ -2180,6 +2133,82 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic return true; } +boolean CL_Responder(event_t *ev) +{ + size_t len; + INT32 ch; + + if (!(client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)) + return false; // Don't do anything outside of the connection screen + + if (ev->type != ev_keydown) + return false; + + ch = (INT32)ev->data1; + + if (ch == KEY_CAPSLOCK) // it's a toggle. + { + capslock = !capslock; + return true; + } + + // Only ESC and non-keyboard keys abort connection + if (ch == KEY_ESCAPE || ch >= KEY_MOUSE1) + { + CONS_Printf(M_GetText("Network game synchronization aborted.\n")); + //M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING); + D_QuitNetGame(); + CL_Reset(); + D_StartTitle(); + return true; + } + + if (cl_mode != CL_CHALLENGE) + return false; + + if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART]) + || ch == ' ') // Allow spaces, of course + { + len = strlen(cl_challengepassword); + if (len < 64) + { + + // shifting code stolen from lat by fickle, thx :) + + // I know this looks very messy but this works. If it ain't broke, don't fix it! + // shift LETTERS to uppercase if we have capslock or are holding shift + if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) + { + if (shiftdown ^ capslock) + ch = shiftxform[ch]; + } + else // if we're holding shift we should still shift non letter symbols + { + if (shiftdown) + ch = shiftxform[ch]; + } + + cl_challengepassword[len+1] = 0; + cl_challengepassword[len] = ch; + } + } + else if (ch == KEY_BACKSPACE) + { + len = strlen(cl_challengepassword); + + if (len > 0) + cl_challengepassword[len-1] = 0; + } + else if (ch == KEY_ENTER) + { + // Done? + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_mode = CL_ASKJOIN; + } + + return true; +} + /** Use adaptive send using net_bandwidth and stat.sendbytes * * \param viams ??? diff --git a/src/d_clisrv.h b/src/d_clisrv.h index e4ff7cc7..4d410130 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -566,6 +566,7 @@ void CL_RemoveSplitscreenPlayer(UINT8 p); void CL_Reset(void); void CL_ClearPlayer(INT32 playernum); void CL_UpdateServerList(boolean internetsearch, INT32 room); +boolean CL_Responder(event_t *ev); // Is there a game running boolean Playing(void); diff --git a/src/d_main.c b/src/d_main.c index 28f89f4f..92c1e6ae 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -236,6 +236,9 @@ void D_ProcessEvents(void) if (M_ScreenshotResponder(ev)) continue; // ate the event + if (CL_Responder(ev)) + continue; + if (gameaction == ga_nothing && gamestate == GS_TITLESCREEN) { if (cht_Responder(ev)) From bc46c3540f580c043921ba224fd4e04cb76963e4 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 6 Mar 2019 22:11:35 -0600 Subject: [PATCH 017/114] Show message on incorrect password --- src/d_clisrv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ca32aaaf..9652561e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1139,6 +1139,7 @@ static UINT8 cl_challengenum = 0; static UINT8 cl_challengequestion[17]; static char cl_challengepassword[65]; static UINT8 cl_challengeanswer[17]; +static boolean cl_challengeattempted; // Player name send/load @@ -1214,7 +1215,7 @@ static inline void CL_DrawConnectionStatus(void) V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_MONOSPACE|V_ALLOWLOWERCASE, asterisks); - cltext = M_GetText("Please enter the server password."); + cltext = M_GetText(cl_challengeattempted ? "Incorrect password. Please try again." : "Please enter the server password."); } break; #ifdef JOININGAME @@ -2191,6 +2192,8 @@ boolean CL_Responder(event_t *ev) cl_challengepassword[len+1] = 0; cl_challengepassword[len] = ch; } + + cl_challengeattempted = false; } else if (ch == KEY_BACKSPACE) { @@ -2198,12 +2201,15 @@ boolean CL_Responder(event_t *ev) if (len > 0) cl_challengepassword[len-1] = 0; + + cl_challengeattempted = false; } else if (ch == KEY_ENTER) { // Done? D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); cl_mode = CL_ASKJOIN; + cl_challengeattempted = true; } return true; @@ -2286,6 +2292,8 @@ static void CL_ConnectToServer(boolean viams) SL_ClearServerList(servernode); #endif + cl_challengeattempted = false; + do { // If the connection was aborted for some reason, leave From a181cd24cd568c1381b5ceebb9066f0f22b21a42 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Wed, 6 Mar 2019 22:28:06 -0600 Subject: [PATCH 018/114] Fix my fuckups Not fond of what I did in P_CanRunOnWater but it at least carries the desired effect... --- src/d_player.h | 1 - src/dehacked.c | 1 - src/g_game.c | 7 ++--- src/lua_skinlib.c | 70 ----------------------------------------------- src/p_mobj.c | 4 +-- src/r_things.c | 70 ----------------------------------------------- src/r_things.h | 18 ------------ 7 files changed, 5 insertions(+), 166 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c93cd999..abd7d166 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -38,7 +38,6 @@ typedef enum SF_HIRES = 1<<3, // Draw the sprite 2x as small? SF_NOSKID = 1<<4, // No skid particles etc SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust - //SF_RUNONWATER = 1<<6, // Run on top of water FOFs? } skinflags_t; //Primary and secondary skin abilities diff --git a/src/dehacked.c b/src/dehacked.c index 61736bac..34cd86b6 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8614,7 +8614,6 @@ struct { {"SF_HIRES",SF_HIRES}, {"SF_NOSKID",SF_NOSKID}, {"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST}, - //{"SF_RUNONWATER",SF_RUNONWATER}, // Character abilities! // Primary diff --git a/src/g_game.c b/src/g_game.c index 902af57e..47f50e57 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5113,17 +5113,16 @@ void G_GhostTicker(void) INT32 type = -1; if (g->mo->skin) { - //skin_t *skin = (skin_t *)g->mo->skin; switch (ziptic & EZT_THOKMASK) { case EZT_THOK: - type = (UINT32)mobjinfo[MT_PLAYER].painchance; // skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; + type = (UINT32)mobjinfo[MT_PLAYER].painchance; break; case EZT_SPIN: - type = (UINT32)mobjinfo[MT_PLAYER].damage; // skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; + type = (UINT32)mobjinfo[MT_PLAYER].damage; break; case EZT_REV: - type = (UINT32)mobjinfo[MT_PLAYER].raisestate; // skin->revitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; + type = (UINT32)mobjinfo[MT_PLAYER].raisestate; break; } } diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index c86376a8..f44e97af 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -30,24 +30,10 @@ enum skin { skin_facerank, skin_facewant, skin_facemmap, - /*skin_ability, - skin_ability2, - skin_thokitem, - skin_spinitem, - skin_revitem, - skin_actionspd, - skin_mindash, - skin_maxdash,*/ // SRB2kart skin_kartspeed, skin_kartweight, // - /*skin_normalspeed, - skin_runspeed, - skin_thrustfactor, - skin_accelstart, - skin_acceleration, - skin_jumpfactor,*/ skin_starttranscolor, skin_prefcolor, skin_highresscale, @@ -64,24 +50,10 @@ static const char *const skin_opt[] = { "facerank", "facewant", "facemmap", - /*"ability", - "ability2", - "thokitem", - "spinitem", - "revitem", - "actionspd", - "mindash", - "maxdash",*/ // SRB2kart "kartspeed", "kartweight", // - /*"normalspeed", - "runspeed", - "thrustfactor", - "accelstart", - "acceleration", - "jumpfactor",*/ "starttranscolor", "prefcolor", "highresscale", @@ -139,30 +111,6 @@ static int skin_get(lua_State *L) break; lua_pushlstring(L, skin->facemmap, i); break; - /*case skin_ability: - lua_pushinteger(L, skin->ability); - break; - case skin_ability2: - lua_pushinteger(L, skin->ability2); - break; - case skin_thokitem: - lua_pushinteger(L, skin->thokitem); - break; - case skin_spinitem: - lua_pushinteger(L, skin->spinitem); - break; - case skin_revitem: - lua_pushinteger(L, skin->revitem); - break; - case skin_actionspd: - lua_pushfixed(L, skin->actionspd); - break; - case skin_mindash: - lua_pushfixed(L, skin->mindash); - break; - case skin_maxdash: - lua_pushfixed(L, skin->maxdash); - break;*/ // SRB2kart case skin_kartspeed: lua_pushinteger(L, skin->kartspeed); @@ -171,24 +119,6 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->kartweight); break; // - /*case skin_normalspeed: - lua_pushfixed(L, skin->normalspeed); - break; - case skin_runspeed: - lua_pushfixed(L, skin->runspeed); - break; - case skin_thrustfactor: - lua_pushinteger(L, skin->thrustfactor); - break; - case skin_accelstart: - lua_pushinteger(L, skin->accelstart); - break; - case skin_acceleration: - lua_pushinteger(L, skin->acceleration); - break; - case skin_jumpfactor: - lua_pushfixed(L, skin->jumpfactor); - break;*/ case skin_starttranscolor: lua_pushinteger(L, skin->starttranscolor); break; diff --git a/src/p_mobj.c b/src/p_mobj.c index 152187ca..c070560f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3234,11 +3234,11 @@ boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) #endif *rover->topheight; - if ((/*(player->charflags & SF_RUNONWATER) && */player->mo->ceilingz-topheight >= player->mo->height) + if ((player->mo->ceilingz-topheight >= player->mo->height) && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) && !(player->pflags & PF_SLIDING) && abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) - return true; + return false; return false; } diff --git a/src/r_things.c b/src/r_things.c index 64eb20d2..82264394 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2537,23 +2537,6 @@ static void Sk_SetDefaultValue(skin_t *skin) skin->kartweight = 5; // - //skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; - //skin->accelstart = 96; - //skin->acceleration = 40; - - //skin->ability = CA_NONE; - //skin->ability2 = CA2_SPINDASH; - //skin->jumpfactor = FRACUNIT; - //skin->actionspd = 30<mindash = 15<maxdash = 90<thokitem = -1; - //skin->spinitem = -1; - //skin->revitem = -1; - skin->highresscale = FRACUNIT>>1; for (i = 0; i < sfx_skinsoundslot0; i++) @@ -2596,20 +2579,11 @@ void R_InitSkins(void) strncpy(skin->facemmap, "PLAYMMAP", 9); skin->prefcolor = SKINCOLOR_BLUE; - //skin->ability = CA_THOK; - //skin->actionspd = 60<kartspeed = 8; skin->kartweight = 2; // - //skin->normalspeed = 36<runspeed = 28<thrustfactor = 5; - //skin->accelstart = 96; - //skin->acceleration = 40; - skin->spritedef.numframes = sprites[SPR_PLAY].numframes; skin->spritedef.spriteframes = sprites[SPR_PLAY].spriteframes; ST_LoadFaceGraphics(skin->facerank, skin->facewant, skin->facemmap, 0); @@ -2673,31 +2647,12 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) if (player->mo) player->mo->skin = skin; - //player->charability = (UINT8)skin->ability; - //player->charability2 = (UINT8)skin->ability2; - player->charflags = (UINT32)skin->flags; - //player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem; - //player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem; - //player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem; - - //player->actionspd = skin->actionspd; - //player->mindash = skin->mindash; - //player->maxdash = skin->maxdash; - // SRB2kart player->kartspeed = skin->kartspeed; player->kartweight = skin->kartweight; - //player->normalspeed = skin->normalspeed; - //player->runspeed = skin->runspeed; - //player->thrustfactor = skin->thrustfactor; - //player->accelstart = skin->accelstart; - //player->acceleration = skin->acceleration; - - //player->jumpfactor = skin->jumpfactor; - /*if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback || modeattacking)) { if (playernum == consoleplayer) @@ -2896,28 +2851,8 @@ void R_AddSkins(UINT16 wadnum) #define FULLPROCESS(field) else if (!stricmp(stoken, #field)) skin->field = get_number(value); // character type identification FULLPROCESS(flags) - //FULLPROCESS(ability) - //FULLPROCESS(ability2) - - //FULLPROCESS(thokitem) - //FULLPROCESS(spinitem) - //FULLPROCESS(revitem) #undef FULLPROCESS -#define GETSPEED(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<field = atoi(value); - GETINT(thrustfactor) - GETINT(accelstart) - GETINT(acceleration) -#undef GETINT*/ - #define GETKARTSTAT(field) \ else if (!stricmp(stoken, #field)) \ { \ @@ -2935,8 +2870,6 @@ void R_AddSkins(UINT16 wadnum) else if (!stricmp(stoken, "prefcolor")) skin->prefcolor = K_GetKartColorByName(value); - //else if (!stricmp(stoken, "jumpfactor")) - //skin->jumpfactor = FLOAT_TO_FIXED(atof(value)); else if (!stricmp(stoken, "highresscale")) skin->highresscale = FLOAT_TO_FIXED(atof(value)); else @@ -3046,9 +2979,6 @@ next_token: HWR_AddPlayerMD2(numskins); #endif - /*if (skin->flags & SF_RUNONWATER) // this is literally the only way a skin can be a major mod... this might be a bit heavy handed - G_SetGameModified(multiplayer, true);*/ - numskins++; } return; diff --git a/src/r_things.h b/src/r_things.h index b4993fe8..6f48cc5b 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -83,29 +83,11 @@ typedef struct char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long) char facerank[9], facewant[9], facemmap[9]; // Arbitrarily named patch lumps - //UINT8 ability; // ability definition - //UINT8 ability2; // secondary ability definition - //INT32 thokitem; - //INT32 spinitem; - //INT32 revitem; - //fixed_t actionspd; - //fixed_t mindash; - //fixed_t maxdash; - // SRB2kart UINT8 kartspeed; UINT8 kartweight; // - //fixed_t normalspeed; // Normal ground - //fixed_t runspeed; // Speed that you break into your run animation - - //UINT8 thrustfactor; // Thrust = thrustfactor * acceleration - //UINT8 accelstart; // Acceleration if speed = 0 - //UINT8 acceleration; // Acceleration - - //fixed_t jumpfactor; // multiple of standard jump height - // Definable color translation table UINT8 starttranscolor; UINT8 prefcolor; From 219b240bcf01966256e2086dde217c6ca53da838 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 6 Mar 2019 22:36:13 -0600 Subject: [PATCH 019/114] Recycle oldest challenges first if all are taken --- src/d_clisrv.c | 1 + src/d_netcmd.c | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 9652561e..8e97ca1c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2235,6 +2235,7 @@ static void CL_ConnectToServer(boolean viams) #endif cl_mode = CL_SEARCHING; + cl_challengenum = 0; #ifdef CLIENT_LOADINGSCREEN lastfilenum = -1; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 70e6098d..789c505e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3710,7 +3710,7 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) static UINT8 joinpassmd5[17]; static boolean joinpasswordset = false; static UINT8 joinpasschallenges[NUMJOINCHALLENGES][17]; -static boolean joinpasschallengeson[NUMJOINCHALLENGES]; +static tic_t joinpasschallengeson[NUMJOINCHALLENGES]; boolean D_IsJoinPasswordOn(void) { @@ -3745,12 +3745,12 @@ boolean D_VerifyJoinPasswordChallenge(UINT8 num, UINT8 *answer) num %= NUMJOINCHALLENGES; //@TODO use a constant-time memcmp.... - if (joinpasschallengeson[num] && memcmp(answer, joinpasschallenges[num], 16) == 0) + if (joinpasschallengeson[num] > 0 && memcmp(answer, joinpasschallenges[num], 16) == 0) passed = true; // Wipe and reset the challenge so that it can't be tried against again, as a small measure against brute-force attacks. memset(joinpasschallenges[num], 0x00, 17); - joinpasschallengeson[num] = false; + joinpasschallengeson[num] = 0; return passed; } @@ -3763,12 +3763,26 @@ void D_MakeJoinPasswordChallenge(UINT8 *num, UINT8 *question) { (*num) = M_RandomKey(NUMJOINCHALLENGES); - if (!joinpasschallengeson[(*num)]) + if (joinpasschallengeson[(*num)] == 0) break; } - // If the above loop never breaks, then uh.... we're obliterating one random stored challenge. Sorry (: - joinpasschallengeson[(*num)] = true; + if (joinpasschallengeson[(*num)] > 0) + { + // Ugh, all challenges are (probably) taken. Let's find the oldest one and overwrite it. + tic_t oldesttic = INT32_MAX; + + for (i = 0; i < NUMJOINCHALLENGES; i++) + { + if (joinpasschallengeson[i] < oldesttic) + { + (*num) = i; + oldesttic = joinpasschallengeson[i]; + } + } + } + + joinpasschallengeson[(*num)] = I_GetTime(); memset(question, 0x00, 17); for (i = 0; i < 16; i++) From 0ed74b306614e399753caf1ec709d49ba1115ee5 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 6 Mar 2019 22:45:02 -0600 Subject: [PATCH 020/114] Missed an include --- src/d_clisrv.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 4d410130..55ff0749 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -13,6 +13,7 @@ #ifndef __D_CLISRV__ #define __D_CLISRV__ +#include "d_event.h" #include "d_ticcmd.h" #include "d_netcmd.h" #include "tables.h" From ddf2db8a36ec0b95f3a547bd6715d6bcc74c0e25 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 6 Mar 2019 23:32:47 -0600 Subject: [PATCH 021/114] Fix freeze when trying to host with a join password already set --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 8e97ca1c..ed6939e2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3733,7 +3733,7 @@ static void HandleConnect(SINT8 node) boolean newnode = false; #endif - if (D_IsJoinPasswordOn()) + if (node != servernode && D_IsJoinPasswordOn()) { // Ensure node sent the correct password challenge boolean passed = false; From 18dba65f17e658d7a647fad451a2a3cf8f2f2ef9 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Wed, 6 Mar 2019 23:34:30 -0600 Subject: [PATCH 022/114] Don't shoot asterisks off-screen on the join password screen --- src/d_clisrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ed6939e2..b1070426 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1207,11 +1207,11 @@ static inline void CL_DrawConnectionStatus(void) { case CL_CHALLENGE: { - char asterisks[65]; - size_t sl = strlen(cl_challengepassword); + char asterisks[33]; + size_t sl = min(32, strlen(cl_challengepassword)); memset(asterisks, '*', sl); - memset(asterisks+sl, 0, 65-sl); + memset(asterisks+sl, 0, 33-sl); V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_MONOSPACE|V_ALLOWLOWERCASE, asterisks); From 7731fe8c2441740bccc4bc09531253336c523d00 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 7 Mar 2019 18:20:57 -0500 Subject: [PATCH 023/114] Fix unused function error --- src/sdl/i_video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 0568dcee..10c78c71 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1325,7 +1325,7 @@ void I_UpdateNoBlit(void) // // Returns true if it thinks we can afford to skip this frame // from PrBoom's src/SDL/i_video.c -static inline boolean I_SkipFrame(void) +/*static inline boolean I_SkipFrame(void) { static boolean skip = false; @@ -1340,12 +1340,12 @@ static inline boolean I_SkipFrame(void) if (!paused) return false; /* FALLTHRU */ - case GS_WAITINGPLAYERS: + /*case GS_WAITINGPLAYERS: return skip; // Skip odd frames default: return false; } -} +}*/ // // I_FinishUpdate From 0e2cefe251843d40dea2414c7519f231d61b4f08 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 7 Mar 2019 18:52:27 -0500 Subject: [PATCH 024/114] Properly comment out the function --- src/sdl/i_video.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 10c78c71..53aa351c 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1325,7 +1325,8 @@ void I_UpdateNoBlit(void) // // Returns true if it thinks we can afford to skip this frame // from PrBoom's src/SDL/i_video.c -/*static inline boolean I_SkipFrame(void) +#if 0 +static inline boolean I_SkipFrame(void) { static boolean skip = false; @@ -1340,12 +1341,13 @@ void I_UpdateNoBlit(void) if (!paused) return false; /* FALLTHRU */ - /*case GS_WAITINGPLAYERS: + case GS_WAITINGPLAYERS: return skip; // Skip odd frames default: return false; } -}*/ +} +#endif // // I_FinishUpdate From 87e91ebb2cc7c9e3c254d5075fdbd23fe62b1c99 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 8 Mar 2019 18:36:25 -0500 Subject: [PATCH 025/114] Kill invincibility item caps It's a holdover from another era, our item changes have stacked up enough that we don't really need this cap anymore --- src/k_kart.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d4d2cc64..d5b8fb53 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -725,7 +725,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp const INT32 distvar = (64*14); INT32 newodds; INT32 i; - UINT8 pingame = 0, pexiting = 0, pinvin = 0; + UINT8 pingame = 0, pexiting = 0; boolean thunderisout = false; SINT8 first = -1, second = -1; INT32 secondist = 0; @@ -780,12 +780,6 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp if (players[i].mo) { - if (players[i].kartstuff[k_itemtype] == KITEM_INVINCIBILITY - || players[i].kartstuff[k_itemtype] == KITEM_GROW - || players[i].kartstuff[k_invincibilitytimer] - || players[i].kartstuff[k_growshrinktimer] > 0) - pinvin++; - if (players[i].kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) thunderisout = true; @@ -831,13 +825,6 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp switch (item) { - case KITEM_INVINCIBILITY: - case KITEM_GROW: - if (pinvin >= max(1, (pingame+3) / 4) || COOLDOWNONSTART) - newodds = 0; - else - POWERITEMODDS(newodds); - break; case KITEM_ROCKETSNEAKER: case KITEM_JAWZ: case KITEM_BALLHOG: @@ -849,7 +836,9 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp case KRITEM_DUALJAWZ: POWERITEMODDS(newodds); break; + case KITEM_INVINCIBILITY: case KITEM_MINE: + case KITEM_GROW: if (COOLDOWNONSTART) newodds = 0; else From 77649ef6d1fdcb820dbc3ec13037f16974b95190 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 8 Mar 2019 18:51:55 -0500 Subject: [PATCH 026/114] Always return false instead. --- src/sdl/i_video.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 53aa351c..f64a429a 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1325,9 +1325,9 @@ void I_UpdateNoBlit(void) // // Returns true if it thinks we can afford to skip this frame // from PrBoom's src/SDL/i_video.c -#if 0 static inline boolean I_SkipFrame(void) { +#if 0 static boolean skip = false; if (rendermode != render_soft) @@ -1346,8 +1346,9 @@ static inline boolean I_SkipFrame(void) default: return false; } -} #endif + return false; +} // // I_FinishUpdate @@ -1357,9 +1358,8 @@ void I_FinishUpdate(void) if (rendermode == render_none) return; //Alam: No software or OpenGl surface - // Don't skip frames - //if (I_SkipFrame()) - //return; + if (I_SkipFrame()) + return; if (cv_ticrate.value) SCR_DisplayTicRate(); From 4faaa932ec609d7d6494ae8bf6c7408cc47c0e1d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 8 Mar 2019 19:06:27 -0500 Subject: [PATCH 027/114] Fix macro expansion warning Sryder got --- src/k_kart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d4d2cc64..aaf77ff3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -820,12 +820,13 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, fixed_t mashed, boolean sp #define PLAYERSCALING (8 - (spbrush ? 2 : pingame)) -#define POWERITEMODDS(odds) \ +#define POWERITEMODDS(odds) {\ if (franticitems) \ odds <<= 1; \ odds = FixedMul(odds<> FRACBITS; \ if (mashed > 0) \ - odds = FixedDiv(odds<> FRACBITS \ + odds = FixedDiv(odds<> FRACBITS; \ +} #define COOLDOWNONSTART (leveltime < (30*TICRATE)+starttime) From b621723d232ac2300549fa39973ebf95258afbc4 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 9 Mar 2019 17:25:42 +0100 Subject: [PATCH 028/114] Fix boost / rocket sneakers for antigrav --- src/info.c | 4 ++-- src/k_kart.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 5701f1c9..bba961d2 100644 --- a/src/info.c +++ b/src/info.c @@ -15018,8 +15018,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_None, // deathsound 8, // speed - 8*FRACUNIT, // radius - 8*FRACUNIT, // height + 32*FRACUNIT, // radius + 64*FRACUNIT, // height 1, // display offset 100, // mass 0, // damage diff --git a/src/k_kart.c b/src/k_kart.c index 090af863..32133482 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1299,7 +1299,7 @@ void K_FlipFromObject(mobj_t *mo, mobj_t *master) void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master) { // flipping - // handle z shifting from there too; + // handle z shifting from there too. This is here since there's no reason not to flip us if needed when we do this anyway; K_FlipFromObject(mo, master); // visibility (usually for hyudoro) @@ -3274,6 +3274,7 @@ void K_DoSneaker(player_t *player, INT32 type) P_SetTarget(&overlay->target, cur); P_SetTarget(&cur->tracer, overlay); P_SetScale(overlay, (overlay->destscale = 3*cur->scale/4)); + K_FlipFromObject(overlay, cur); } cur = cur->hnext; } @@ -3284,6 +3285,7 @@ void K_DoSneaker(player_t *player, INT32 type) mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BOOSTFLAME); P_SetTarget(&overlay->target, player->mo); P_SetScale(overlay, (overlay->destscale = player->mo->scale)); + K_FlipFromObject(overlay, player->mo); } } @@ -3895,14 +3897,13 @@ static void K_MoveHeldObjects(player_t *player) targx = player->mo->x + P_ReturnThrustX(cur, cur->angle + angoffset, cur->extravalue1); targy = player->mo->y + P_ReturnThrustY(cur, cur->angle + angoffset, cur->extravalue1); - K_MatchGenericExtraFlags(cur, player->mo); // Update graviflip in real time thanks. { // bobbing, copy pasted from my kimokawaiii entry const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); targz = (player->mo->z + (player->mo->height/2)) + sine; if (player->mo->eflags & MFE_VERTICALFLIP) - targz -= player->mo->height/2 - FixedMul(player->mo->scale, cur->height); + targz += (player->mo->height/2 - FixedMul(player->mo->scale, 32*FRACUNIT))*6; // No I don't understand why this works either, but it does. } @@ -3920,7 +3921,7 @@ static void K_MoveHeldObjects(player_t *player) } P_TeleportMove(cur, targx, targy, targz); - + K_FlipFromObject(cur, player->mo); // Update graviflip in real time thanks. num = (num+1) % 2; cur = cur->hnext; } From 6bba2f16c0c0c8dd657629e829760ecf75ce37a4 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 12:01:47 -0600 Subject: [PATCH 029/114] Move HandleConnect to the same place as other packets --- src/d_clisrv.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b1070426..1afbe89e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3916,6 +3916,10 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; + case PT_CLIENTJOIN: + if (server) + HandleConnect(node); + break; case PT_JOINCHALLENGE: if (server && serverrunning) { // But wait I thought I'm the server? @@ -4592,12 +4596,6 @@ FILESTAMP while (HGetPacket()) { node = (SINT8)doomcom->remotenode; - - if (netbuffer->packettype == PT_CLIENTJOIN && server) - { - HandleConnect(node); - continue; - } if (node == servernode && client && cl_mode != CL_SEARCHING) { if (netbuffer->packettype == PT_SERVERSHUTDOWN) From 2954b68e12b62a7897069d0e3838ae385c2cb85c Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 13:30:22 -0600 Subject: [PATCH 030/114] Check password and etc before downloading files --- src/d_clisrv.c | 85 ++++++++++++++++++++++++++++++++++++++++++++------ src/d_clisrv.h | 3 +- src/d_net.c | 2 +- 3 files changed, 79 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1afbe89e..37282519 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1128,18 +1128,21 @@ typedef enum #endif CL_CONNECTED, CL_ABORTED, + CL_ASKDOWNLOADFILES, + CL_WAITDOWNLOADFILESRESPONSE, CL_CHALLENGE } cl_mode_t; static void GetPackets(void); static cl_mode_t cl_mode = CL_SEARCHING; +static boolean cl_needsdownload = false; static UINT8 cl_challengenum = 0; static UINT8 cl_challengequestion[17]; static char cl_challengepassword[65]; static UINT8 cl_challengeanswer[17]; -static boolean cl_challengeattempted; +static UINT8 cl_challengeattempted = 0; // Player name send/load @@ -1237,6 +1240,9 @@ static inline void CL_DrawConnectionStatus(void) case CL_WAITJOINRESPONSE: cltext = M_GetText("Requesting to join..."); break; + case CL_ASKDOWNLOADFILES: + case CL_WAITDOWNLOADFILESRESPONSE: + cltext = M_GetText("Waiting to download files..."); default: cltext = M_GetText("Connecting to server..."); break; @@ -1314,6 +1320,7 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.localplayers = localplayers; netbuffer->u.clientcfg.version = VERSION; netbuffer->u.clientcfg.subversion = SUBVERSION; + netbuffer->u.clientcfg.needsdownload = cl_needsdownload; netbuffer->u.clientcfg.challengenum = cl_challengenum; memcpy(netbuffer->u.clientcfg.challengeanswer, cl_challengeanswer, 16); @@ -1989,9 +1996,12 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) ), NULL, MM_NOTHING); return false; } + + cl_mode = CL_ASKDOWNLOADFILES; + // no problem if can't send packet, we will retry later - if (CL_SendRequestFile()) - cl_mode = CL_DOWNLOADFILES; + //if (CL_SendRequestFile()) + // cl_mode = CL_DOWNLOADFILES; } } else @@ -2059,6 +2069,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic /* FALLTHRU */ case CL_ASKJOIN: + cl_needsdownload = false; CL_LoadServerFiles(); #ifdef JOININGAME // prepare structures to save the file @@ -2070,6 +2081,14 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic cl_mode = CL_WAITJOINRESPONSE; break; + case CL_ASKDOWNLOADFILES: + cl_needsdownload = true; + + if (CL_SendJoin()) + cl_mode = CL_WAITDOWNLOADFILESRESPONSE; + break; + + #ifdef JOININGAME case CL_DOWNLOADSAVEGAME: // At this state, the first (and only) needed file is the gamestate @@ -2085,6 +2104,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic case CL_CHALLENGE: case CL_WAITJOINRESPONSE: + case CL_WAITDOWNLOADFILESRESPONSE: case CL_CONNECTED: default: break; @@ -2193,7 +2213,7 @@ boolean CL_Responder(event_t *ev) cl_challengepassword[len] = ch; } - cl_challengeattempted = false; + cl_challengeattempted = 0; } else if (ch == KEY_BACKSPACE) { @@ -2202,14 +2222,14 @@ boolean CL_Responder(event_t *ev) if (len > 0) cl_challengepassword[len-1] = 0; - cl_challengeattempted = false; + cl_challengeattempted = 0; } else if (ch == KEY_ENTER) { // Done? D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_mode = CL_ASKJOIN; - cl_challengeattempted = true; + cl_mode = cl_needsdownload ? CL_ASKDOWNLOADFILES : CL_ASKJOIN; + cl_challengeattempted = 1; } return true; @@ -2293,7 +2313,7 @@ static void CL_ConnectToServer(boolean viams) SL_ClearServerList(servernode); #endif - cl_challengeattempted = false; + cl_challengeattempted = 0; do { @@ -3753,6 +3773,13 @@ static void HandleConnect(SINT8 node) } } + if (netbuffer->u.clientcfg.needsdownload) + { + netbuffer->packettype = PT_DOWNLOADFILESOKAY; + HSendPacket(node, true, 0, 0); + return; + } + // client authorised to join nodewaiting[node] = (UINT8)(netbuffer->u.clientcfg.localplayers - playerpernode[node]); if (!nodeingame[node]) @@ -3761,6 +3788,7 @@ static void HandleConnect(SINT8 node) #ifndef NONET newnode = true; #endif + SV_AddNode(node); /// \note Wait what??? @@ -3927,12 +3955,19 @@ static void HandlePacketFromAwayNode(SINT8 node) break; } SERVERONLY - if (cl_mode == CL_WAITJOINRESPONSE) + if (cl_mode == CL_WAITJOINRESPONSE || cl_mode == CL_WAITDOWNLOADFILESRESPONSE) { cl_challengenum = netbuffer->u.joinchallenge.challengenum; memcpy(cl_challengequestion, netbuffer->u.joinchallenge.question, 16); cl_mode = CL_CHALLENGE; + + if (cl_challengeattempted == 2) + { + // We already sent a correct password, so throw it back up again. + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_mode = CL_ASKJOIN; + } } break; @@ -3964,6 +3999,38 @@ static void HandlePacketFromAwayNode(SINT8 node) } break; + case PT_DOWNLOADFILESOKAY: + if (server && serverrunning) + { // But wait I thought I'm the server? + Net_CloseConnection(node); + break; + } + + SERVERONLY + + // This should've already been checked, but just to be safe... + if (!CL_CheckDownloadable()) + { + D_QuitNetGame(); + CL_Reset(); + D_StartTitle(); + M_StartMessage(M_GetText( + "You cannot connect to this server\n" + "because you cannot download the files\n" + "that you are missing from the server.\n\n" + "See the console or log file for\n" + "more details.\n\n" + "Press ESC\n" + ), NULL, MM_NOTHING); + break; + } + + cl_challengeattempted = 2; + CONS_Printf("trying to download\n"); + if (CL_SendRequestFile()) + cl_mode = CL_DOWNLOADFILES; + break; + case PT_SERVERCFG: // Positive response of client join request { INT32 j; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 55ff0749..59a0b5c6 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -75,6 +75,7 @@ typedef enum PT_BASICKEEPALIVE,// Keep the network alive during wipes, as tics aren't advanced and NetUpdate isn't called PT_JOINCHALLENGE, // You must give a password to joinnnnn + PT_DOWNLOADFILESOKAY, // You can download files from the server.... PT_CANFAIL, // This is kind of a priority. Anything bigger than CANFAIL // allows HSendPacket(*, true, *, *) to return false. @@ -356,7 +357,7 @@ typedef struct UINT8 version; // Different versions don't work UINT8 subversion; // Contains build version UINT8 localplayers; - UINT8 mode; + UINT8 needsdownload; UINT8 challengenum; // Non-zero if trying to join with a password attempt UINT8 challengeanswer[16]; // Join challenge } ATTRPACK clientconfig_pak; diff --git a/src/d_net.c b/src/d_net.c index 6702a60a..530ee6df 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -868,7 +868,7 @@ static void DebugPrintpacket(const char *header) break; case PT_CLIENTJOIN: fprintf(debugfile, " number %d mode %d\n", netbuffer->u.clientcfg.localplayers, - netbuffer->u.clientcfg.mode); + netbuffer->u.clientcfg.needsdownload); break; case PT_SERVERTICS: { From d5691b92897a3b4ca3c4839d99a042131c8ca4e2 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 14:30:04 -0600 Subject: [PATCH 031/114] Show kartspeed and password status on server browser --- src/d_clisrv.c | 8 +++++++- src/d_clisrv.h | 6 +++++- src/m_menu.c | 13 ++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 37282519..6ff024cd 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1343,7 +1343,13 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.gametype = (UINT8)(G_BattleGametype() ? VANILLA_GT_MATCH : VANILLA_GT_RACE); // SRB2Kart: Vanilla's gametype constants for MS support netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame; netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled(); - netbuffer->u.serverinfo.isdedicated = (UINT8)dedicated; + + netbuffer->u.serverinfo.kartvars = (UINT8) ( + cv_kartspeed.value | + (dedicated ? SV_DEDICATED : 0) | + (D_IsJoinPasswordOn() ? SV_PASSWORD : 0) + ); + strncpy(netbuffer->u.serverinfo.servername, cv_servername.string, MAXSERVERNAME); strncpy(netbuffer->u.serverinfo.mapname, G_BuildMapName(gamemap), 7); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 59a0b5c6..2937e882 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -368,6 +368,10 @@ typedef struct UINT8 question[16]; // Challenge data to be manipulated and answered with } ATTRPACK joinchallenge_pak; +#define SV_SPEEDMASK 0x03 +#define SV_DEDICATED 0x40 +#define SV_PASSWORD 0x80 + #define MAXSERVERNAME 32 #define MAXFILENEEDED 915 // This packet is too large @@ -380,7 +384,7 @@ typedef struct UINT8 gametype; UINT8 modifiedgame; UINT8 cheatsenabled; - UINT8 isdedicated; + UINT8 kartvars; // Previously isdedicated, now appropriated for our own nefarious purposes UINT8 fileneedednum; SINT8 adminplayer; tic_t time; diff --git a/src/m_menu.c b/src/m_menu.c index 57a73c14..23e6ede4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7241,6 +7241,7 @@ static void M_DrawConnectMenu(void) { UINT16 i, j; const char *gt = "Unknown"; + const char *spd = ""; INT32 numPages = (serverlistcount+(SERVERS_PER_PAGE-1))/SERVERS_PER_PAGE; for (i = FIRSTSERVERLINE; i < min(localservercount, SERVERS_PER_PAGE)+FIRSTSERVERLINE; i++) @@ -7294,7 +7295,17 @@ static void M_DrawConnectMenu(void) V_DrawSmallString(currentMenu->x+46,S_LINEY(i)+8, globalflags, va("Players: %02d/%02d", serverlist[slindex].info.numberofplayer, serverlist[slindex].info.maxplayer)); - V_DrawSmallString(currentMenu->x+112, S_LINEY(i)+8, globalflags, va("Gametype: %s", gt)); + V_DrawSmallString(currentMenu->x+112, S_LINEY(i)+8, globalflags, gt); + + if (serverlist[slindex].info.gametype == GT_RACE) + { + spd = kartspeed_cons_t[serverlist[slindex].info.kartvars & SV_SPEEDMASK].strvalue; + + V_DrawSmallString(currentMenu->x+132, S_LINEY(i)+8, globalflags, va("(%s Speed)", spd)); + } + + if (serverlist[slindex].info.kartvars & SV_PASSWORD) + V_DrawFixedPatch((currentMenu->x - 10) << FRACBITS, (S_LINEY(i)) << FRACBITS, FRACUNIT, globalflags & (~V_ALLOWLOWERCASE), W_CachePatchName("SERVLOCK", PU_CACHE), NULL); MP_ConnectMenu[i+FIRSTSERVERLINE].status = IT_STRING | IT_CALL; } From 1b6035e322d59c60cbd0930f217b25e2fb3618d3 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 15:00:48 -0600 Subject: [PATCH 032/114] Add join password to server host menu --- src/d_netcmd.c | 5 ++++- src/d_netcmd.h | 2 ++ src/m_menu.c | 34 +++++++++++++++++++++++++++------- src/m_menu.h | 1 + 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 789c505e..451e9762 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -535,6 +535,7 @@ void D_RegisterServerCommands(void) RegisterNetXCmd(XD_PICKVOTE, Got_PickVotecmd); // Remote Administration + CV_RegisterVar(&cv_dummyjoinpassword); COM_AddCommand("joinpassword", Command_ChangeJoinPassword_f); COM_AddCommand("password", Command_Changepassword_f); RegisterNetXCmd(XD_LOGIN, Got_Login); @@ -3706,9 +3707,11 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) } // Join password stuff +consvar_t cv_dummyjoinpassword = {"dummyjoinpassword", "", CV_HIDEN|CV_NOSHOWHELP, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + #define NUMJOINCHALLENGES 32 static UINT8 joinpassmd5[17]; -static boolean joinpasswordset = false; +boolean joinpasswordset = false; static UINT8 joinpasschallenges[NUMJOINCHALLENGES][17]; static tic_t joinpasschallengeson[NUMJOINCHALLENGES]; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 438ba3ff..166c5e00 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -248,6 +248,8 @@ void RemoveAdminPlayer(INT32 playernum); void ItemFinder_OnChange(void); void D_SetPassword(const char *pw); +extern consvar_t cv_dummyjoinpassword; +extern boolean joinpasswordset; boolean D_IsJoinPasswordOn(void); void D_ComputeChallengeAnswer(UINT8 *question, const char *pw, UINT8 *answer); void D_SetJoinPassword(const char *pw); diff --git a/src/m_menu.c b/src/m_menu.c index 23e6ede4..83bec981 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -948,14 +948,15 @@ static menuitem_t MP_MainMenu[] = static menuitem_t MP_ServerMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 10}, - {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 20}, - {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 30}, + {IT_STRING|IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 0}, + {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 10}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 20}, + {IT_STRING|IT_CVAR|IT_CV_PASSWORD, NULL, "Password", &cv_dummyjoinpassword, 44}, - {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, - {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 78}, + {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, + {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 78}, - {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, + {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, }; #endif @@ -2682,7 +2683,7 @@ boolean M_Responder(event_t *ev) // BP: one of the more big hack i have never made if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR) { - if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING) + if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING || (currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD) { if (shiftdown && ch >= 32 && ch <= 127) ch = shiftxform[ch]; @@ -3557,6 +3558,8 @@ static void M_DrawGenericMenu(void) case IT_CVAR: { consvar_t *cv = (consvar_t *)currentMenu->menuitems[i].itemaction; + char asterisks[MAXSTRINGLENGTH+1]; + size_t sl; switch (currentMenu->menuitems[i].status & IT_CVARTYPE) { case IT_CV_SLIDER: @@ -3572,6 +3575,18 @@ static void M_DrawGenericMenu(void) '_' | 0x80, false); y += 16; break; + case IT_CV_PASSWORD: + sl = strlen(cv->string); + memset(asterisks, '*', sl); + memset(asterisks + sl, 0, MAXSTRINGLENGTH+1-sl); + + M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1); + V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, asterisks); + if (skullAnimCounter < 4 && i == itemOn) + V_DrawCharacter(x + 8 + V_StringWidth(asterisks, 0), y + 12, + '_' | 0x80, false); + y += 16; + break; default: w = V_StringWidth(cv->string, 0); V_DrawString(BASEVIDWIDTH - x - w, y, @@ -7540,6 +7555,11 @@ static void M_StartServer(INT32 choice) // Still need to reset devmode cv_debug = 0; + if (strlen(cv_dummyjoinpassword.string) > 0) + D_SetJoinPassword(cv_dummyjoinpassword.string); + else + joinpasswordset = false; + if (demoplayback) G_StopDemo(); if (metalrecording) diff --git a/src/m_menu.h b/src/m_menu.h index 864f4cac..06ae7114 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -104,6 +104,7 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt); #define IT_CV_NOPRINT 1536 #define IT_CV_NOMOD 2048 #define IT_CV_INVISSLIDER 2560 +#define IT_CV_PASSWORD 3072 //call/submenu specific // There used to be a lot more here but ... From b17c4e562e6fde914f0ac61ea9f76c0107ec9e76 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 9 Mar 2019 22:01:52 +0100 Subject: [PATCH 033/114] Change default showping from Warning to Always --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 53d88f2f..95492f3b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -441,7 +441,7 @@ consvar_t cv_pingtimeout = {"pingtimeout", "10", CV_SAVE, pingtimeout_cons_t, NU // show your ping on the HUD next to framerate. Defaults to warning only (shows up if your ping is > maxping) static CV_PossibleValue_t showping_cons_t[] = {{0, "Off"}, {1, "Always"}, {2, "Warning"}, {0, NULL}}; -consvar_t cv_showping = {"showping", "Warning", CV_SAVE, showping_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_showping = {"showping", "Always", CV_SAVE, showping_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif // Intermission time Tails 04-19-2002 From 870a800d89c1c585f71d6281618fc140e4a37158 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 15:14:08 -0600 Subject: [PATCH 034/114] Toggle showing password with tab --- src/m_menu.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 83bec981..dd035388 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2384,6 +2384,9 @@ static void M_NextOpt(void) { INT16 oldItemOn = itemOn; // prevent infinite loop + if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD) + ((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value = 0; + do { if (itemOn + 1 > currentMenu->numitems - 1) @@ -2397,6 +2400,9 @@ static void M_PrevOpt(void) { INT16 oldItemOn = itemOn; // prevent infinite loop + if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD) + ((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value = 0; + do { if (!itemOn) @@ -2685,6 +2691,9 @@ boolean M_Responder(event_t *ev) { if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING || (currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD) { + if (ch == KEY_TAB) + ((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value ^= 1; + if (shiftdown && ch >= 32 && ch <= 127) ch = shiftxform[ch]; if (M_ChangeStringCvar(ch)) @@ -3567,6 +3576,27 @@ static void M_DrawGenericMenu(void) case IT_CV_NOPRINT: // color use this case IT_CV_INVISSLIDER: // monitor toggles use this break; + case IT_CV_PASSWORD: + if (i == itemOn) + { + V_DrawRightAlignedThinString(x + MAXSTRINGLENGTH*8 + 10, y, V_ALLOWLOWERCASE, va(M_GetText("Tab: %s password"), cv->value ? "hide" : "show")); + } + + if (!cv->value || i != itemOn) + { + sl = strlen(cv->string); + memset(asterisks, '*', sl); + memset(asterisks + sl, 0, MAXSTRINGLENGTH+1-sl); + + M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1); + V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, asterisks); + if (skullAnimCounter < 4 && i == itemOn) + V_DrawCharacter(x + 8 + V_StringWidth(asterisks, 0), y + 12, + '_' | 0x80, false); + y += 16; + break; + } + /* fallthru */ case IT_CV_STRING: M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1); V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, cv->string); @@ -3575,18 +3605,6 @@ static void M_DrawGenericMenu(void) '_' | 0x80, false); y += 16; break; - case IT_CV_PASSWORD: - sl = strlen(cv->string); - memset(asterisks, '*', sl); - memset(asterisks + sl, 0, MAXSTRINGLENGTH+1-sl); - - M_DrawTextBox(x, y + 4, MAXSTRINGLENGTH, 1); - V_DrawString(x + 8, y + 12, V_ALLOWLOWERCASE, asterisks); - if (skullAnimCounter < 4 && i == itemOn) - V_DrawCharacter(x + 8 + V_StringWidth(asterisks, 0), y + 12, - '_' | 0x80, false); - y += 16; - break; default: w = V_StringWidth(cv->string, 0); V_DrawString(BASEVIDWIDTH - x - w, y, From e4d99605ebcb0fc8dc849f686861f74dec7b60cb Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 15:27:23 -0600 Subject: [PATCH 035/114] Nudge lock over a tad --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index dd035388..881b6682 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7338,7 +7338,7 @@ static void M_DrawConnectMenu(void) } if (serverlist[slindex].info.kartvars & SV_PASSWORD) - V_DrawFixedPatch((currentMenu->x - 10) << FRACBITS, (S_LINEY(i)) << FRACBITS, FRACUNIT, globalflags & (~V_ALLOWLOWERCASE), W_CachePatchName("SERVLOCK", PU_CACHE), NULL); + V_DrawFixedPatch((currentMenu->x - 9) << FRACBITS, (S_LINEY(i)) << FRACBITS, FRACUNIT, globalflags & (~V_ALLOWLOWERCASE), W_CachePatchName("SERVLOCK", PU_CACHE), NULL); MP_ConnectMenu[i+FIRSTSERVERLINE].status = IT_STRING | IT_CALL; } From 5f0c4271d7fdf29aa8ee28bb257985a8ece553c0 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 16:46:55 -0600 Subject: [PATCH 036/114] Use consts in place of some 16s --- src/d_clisrv.h | 4 ++-- src/d_netcmd.c | 36 ++++++++++++++++++------------------ src/md5.h | 2 ++ src/w_wad.c | 1 - 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 2937e882..d979fb28 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -359,13 +359,13 @@ typedef struct UINT8 localplayers; UINT8 needsdownload; UINT8 challengenum; // Non-zero if trying to join with a password attempt - UINT8 challengeanswer[16]; // Join challenge + UINT8 challengeanswer[MD5_LEN]; // Join challenge } ATTRPACK clientconfig_pak; typedef struct { UINT8 challengenum; // Number to send back in join attempt - UINT8 question[16]; // Challenge data to be manipulated and answered with + UINT8 question[MD5_LEN]; // Challenge data to be manipulated and answered with } ATTRPACK joinchallenge_pak; #define SV_SPEEDMASK 0x03 diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 451e9762..abc31949 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3444,7 +3444,7 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, } #define BASESALT "basepasswordstorage" -static UINT8 adminpassmd5[16]; +static UINT8 adminpassmd5[MD5_LEN]; static boolean adminpasswordset = false; void D_SetPassword(const char *pw) @@ -3483,7 +3483,7 @@ static void Command_Login_f(void) // If we have no MD5 support then completely disable XD_LOGIN responses for security. CONS_Alert(CONS_NOTICE, "Remote administration commands are not supported in this build.\n"); #else - XBOXSTATIC UINT8 finalmd5[16]; + XBOXSTATIC UINT8 finalmd5[MD5_LEN]; const char *pw; if (!netgame) @@ -3506,11 +3506,11 @@ static void Command_Login_f(void) D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &finalmd5); // Do the final pass to get the comparison the server will come up with - D_MD5PasswordPass(finalmd5, 16, va("PNUM%02d", consoleplayer), &finalmd5); + D_MD5PasswordPass(finalmd5, MD5_LEN, va("PNUM%02d", consoleplayer), &finalmd5); CONS_Printf(M_GetText("Sending login... (Notice only given if password is correct.)\n")); - SendNetXCmd(XD_LOGIN, finalmd5, 16); + SendNetXCmd(XD_LOGIN, finalmd5, MD5_LEN); #endif } @@ -3521,9 +3521,9 @@ static void Got_Login(UINT8 **cp, INT32 playernum) (void)cp; (void)playernum; #else - UINT8 sentmd5[16], finalmd5[16]; + UINT8 sentmd5[MD5_LEN], finalmd5[MD5_LEN]; - READMEM(*cp, sentmd5, 16); + READMEM(*cp, sentmd5, MD5_LEN); if (client) return; @@ -3535,9 +3535,9 @@ static void Got_Login(UINT8 **cp, INT32 playernum) } // Do the final pass to compare with the sent md5 - D_MD5PasswordPass(adminpassmd5, 16, va("PNUM%02d", playernum), &finalmd5); + D_MD5PasswordPass(adminpassmd5, MD5_LEN, va("PNUM%02d", playernum), &finalmd5); - if (!memcmp(sentmd5, finalmd5, 16)) + if (!memcmp(sentmd5, finalmd5, MD5_LEN)) { CONS_Printf(M_GetText("%s passed authentication.\n"), player_names[playernum]); COM_BufInsertText(va("promote %d\n", playernum)); // do this immediately @@ -3710,9 +3710,9 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) consvar_t cv_dummyjoinpassword = {"dummyjoinpassword", "", CV_HIDEN|CV_NOSHOWHELP, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; #define NUMJOINCHALLENGES 32 -static UINT8 joinpassmd5[17]; +static UINT8 joinpassmd5[MD5_LEN+1]; boolean joinpasswordset = false; -static UINT8 joinpasschallenges[NUMJOINCHALLENGES][17]; +static UINT8 joinpasschallenges[NUMJOINCHALLENGES][MD5_LEN+1]; static tic_t joinpasschallengeson[NUMJOINCHALLENGES]; boolean D_IsJoinPasswordOn(void) @@ -3722,21 +3722,21 @@ boolean D_IsJoinPasswordOn(void) static inline void GetChallengeAnswer(UINT8 *question, UINT8 *passwordmd5, UINT8 *answer) { - D_MD5PasswordPass(question, 16, (char *) passwordmd5, answer); + D_MD5PasswordPass(question, MD5_LEN, (char *) passwordmd5, answer); } void D_ComputeChallengeAnswer(UINT8 *question, const char *pw, UINT8 *answer) { - static UINT8 passwordmd5[17]; + static UINT8 passwordmd5[MD5_LEN+1]; - memset(passwordmd5, 0x00, 17); + memset(passwordmd5, 0x00, MD5_LEN+1); D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &passwordmd5); GetChallengeAnswer(question, passwordmd5, answer); } void D_SetJoinPassword(const char *pw) { - memset(joinpassmd5, 0x00, 17); + memset(joinpassmd5, 0x00, MD5_LEN+1); D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &joinpassmd5); joinpasswordset = true; } @@ -3748,11 +3748,11 @@ boolean D_VerifyJoinPasswordChallenge(UINT8 num, UINT8 *answer) num %= NUMJOINCHALLENGES; //@TODO use a constant-time memcmp.... - if (joinpasschallengeson[num] > 0 && memcmp(answer, joinpasschallenges[num], 16) == 0) + if (joinpasschallengeson[num] > 0 && memcmp(answer, joinpasschallenges[num], MD5_LEN) == 0) passed = true; // Wipe and reset the challenge so that it can't be tried against again, as a small measure against brute-force attacks. - memset(joinpasschallenges[num], 0x00, 17); + memset(joinpasschallenges[num], 0x00, MD5_LEN+1); joinpasschallengeson[num] = 0; return passed; @@ -3787,8 +3787,8 @@ void D_MakeJoinPasswordChallenge(UINT8 *num, UINT8 *question) joinpasschallengeson[(*num)] = I_GetTime(); - memset(question, 0x00, 17); - for (i = 0; i < 16; i++) + memset(question, 0x00, MD5_LEN+1); + for (i = 0; i < MD5_LEN; i++) question[i] = M_RandomByte(); // Store the answer in memory. What was the question again? diff --git a/src/md5.h b/src/md5.h index 0fe017f5..eaa85dc1 100644 --- a/src/md5.h +++ b/src/md5.h @@ -22,6 +22,8 @@ # include #endif +#define MD5_LEN 16 + /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but diff --git a/src/w_wad.c b/src/w_wad.c index d1c6d488..b4ae1e0a 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1556,7 +1556,6 @@ void *W_CachePatchName(const char *name, INT32 tag) return W_CachePatchNum(num, tag); } #ifndef NOMD5 -#define MD5_LEN 16 /** * Prints an MD5 string into a human-readable textual format. From 7c7034a22934e26181236307555bc785fa14cb8e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 16:49:23 -0600 Subject: [PATCH 037/114] More... --- src/d_clisrv.c | 10 +++++----- src/d_clisrv.h | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6ff024cd..6d139114 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1139,9 +1139,9 @@ static cl_mode_t cl_mode = CL_SEARCHING; static boolean cl_needsdownload = false; static UINT8 cl_challengenum = 0; -static UINT8 cl_challengequestion[17]; +static UINT8 cl_challengequestion[MD5_LEN+1]; static char cl_challengepassword[65]; -static UINT8 cl_challengeanswer[17]; +static UINT8 cl_challengeanswer[MD5_LEN+1]; static UINT8 cl_challengeattempted = 0; // Player name send/load @@ -1322,7 +1322,7 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.subversion = SUBVERSION; netbuffer->u.clientcfg.needsdownload = cl_needsdownload; netbuffer->u.clientcfg.challengenum = cl_challengenum; - memcpy(netbuffer->u.clientcfg.challengeanswer, cl_challengeanswer, 16); + memcpy(netbuffer->u.clientcfg.challengeanswer, cl_challengeanswer, MD5_LEN); return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak)); } @@ -3267,8 +3267,8 @@ void D_ClientServerInit(void) gametic = 0; localgametic = 0; - memset(cl_challengequestion, 0x00, 17); - memset(cl_challengeanswer, 0x00, 17); + memset(cl_challengequestion, 0x00, MD5_LEN+1); + memset(cl_challengeanswer, 0x00, MD5_LEN+1); // do not send anything before the real begin SV_StopServer(); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index d979fb28..f3a9011e 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -19,6 +19,8 @@ #include "tables.h" #include "d_player.h" +#include "md5.h" + // Network play related stuff. // There is a data struct that stores network // communication related stuff, and another From ad3a32f500572d0eef09fd0f041a7b0645456638 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 16:55:18 -0600 Subject: [PATCH 038/114] Handle capslock in just one place...? --- src/console.c | 10 ---------- src/d_main.c | 2 ++ src/hu_stuff.c | 10 ---------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/console.c b/src/console.c index a10d73e7..2b3ee0e2 100644 --- a/src/console.c +++ b/src/console.c @@ -1084,16 +1084,6 @@ boolean CON_Responder(event_t *ev) else if (key == KEY_KPADSLASH) key = '/'; - // capslock - if (key == KEY_CAPSLOCK) // it's a toggle. - { - if (capslock) - capslock = false; - else - capslock = true; - return true; - } - // same capslock code as hu_stuff.c's HU_responder. Check there for details. if ((key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) { diff --git a/src/d_main.c b/src/d_main.c index 92c1e6ae..07cfdfb2 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -203,6 +203,8 @@ static inline void D_ModifierKeyResponder(event_t *ev) case KEY_RCTRL: ctrldown |= 0x2; return; case KEY_LALT: altdown |= 0x1; return; case KEY_RALT: altdown |= 0x2; return; + case KEY_CAPSLOCK: capslock = !capslock; return; + default: return; } else if (ev->type == ev_keyup) switch (ev->data1) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 94cca970..bd8f7fd9 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1159,16 +1159,6 @@ boolean HU_Responder(event_t *ev) c = (INT32)ev->data1; - // capslock (now handled outside of chat on so that it works everytime......) - if (c && c == KEY_CAPSLOCK) // it's a toggle. - { - if (capslock) - capslock = false; - else - capslock = true; - return true; - } - #ifndef NONET if (!chat_on) { From 3bb014ea42a25de222619812f2af5ffbcd46a36a Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 17:03:52 -0600 Subject: [PATCH 039/114] Make password toggle only affect password fields --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 881b6682..f92b0e05 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2691,7 +2691,7 @@ boolean M_Responder(event_t *ev) { if ((currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_STRING || (currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD) { - if (ch == KEY_TAB) + if (ch == KEY_TAB && (currentMenu->menuitems[itemOn].status & IT_CVARTYPE) == IT_CV_PASSWORD) ((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->value ^= 1; if (shiftdown && ch >= 32 && ch <= 127) From d804dc3a34c1321a33cf1008b9c92e2449eedd79 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 17:06:44 -0600 Subject: [PATCH 040/114] Fix password auto-hiding if you type into it --- src/command.c | 3 ++- src/command.h | 3 ++- src/d_clisrv.c | 6 ------ src/d_netcmd.c | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/command.c b/src/command.c index bb2ea86e..a5d45bc1 100644 --- a/src/command.c +++ b/src/command.c @@ -1254,7 +1254,8 @@ found: var->string = var->zstring = Z_StrDup(valstr); - if (override) + if (var->flags & CV_PASSWORD); // Don't change value for password field + else if (override) var->value = overrideval; else if (var->flags & CV_FLOAT) { diff --git a/src/command.h b/src/command.h index 82dfaf8a..f9d177e2 100644 --- a/src/command.h +++ b/src/command.h @@ -95,7 +95,8 @@ typedef enum CV_HIDEN = 1024, // variable is not part of the cvar list so cannot be accessed by the console // can only be set when we have the pointer to it // used on menus - CV_CHEAT = 2048 // Don't let this be used in multiplayer unless cheats are on. + CV_CHEAT = 2048, // Don't let this be used in multiplayer unless cheats are on. + CV_PASSWORD = 4096 // Password field } cvflags_t; typedef struct CV_PossibleValue_s diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6d139114..08788613 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2173,12 +2173,6 @@ boolean CL_Responder(event_t *ev) ch = (INT32)ev->data1; - if (ch == KEY_CAPSLOCK) // it's a toggle. - { - capslock = !capslock; - return true; - } - // Only ESC and non-keyboard keys abort connection if (ch == KEY_ESCAPE || ch >= KEY_MOUSE1) { diff --git a/src/d_netcmd.c b/src/d_netcmd.c index abc31949..1f75a3bf 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3707,7 +3707,7 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) } // Join password stuff -consvar_t cv_dummyjoinpassword = {"dummyjoinpassword", "", CV_HIDEN|CV_NOSHOWHELP, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_dummyjoinpassword = {"dummyjoinpassword", "", CV_HIDEN|CV_NOSHOWHELP|CV_PASSWORD, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; #define NUMJOINCHALLENGES 32 static UINT8 joinpassmd5[MD5_LEN+1]; From 5500e4c2df02c82f669ec62372eda103a7519729 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Sat, 9 Mar 2019 18:09:38 -0500 Subject: [PATCH 041/114] fix VCHELP --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index cca1e904..351328ec 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5052,8 +5052,8 @@ static inline void PingUpdate(void) pingtimeout[i]++; if (pingtimeout[i] > cv_pingtimeout.value) // ok your net has been bad for too long, you deserve to die. { - pingtimeout[i] = 0; XBOXSTATIC char buf[2]; + pingtimeout[i] = 0; buf[0] = (char)i; buf[1] = KICK_MSG_PING_HIGH; From 035ad5822c4c0aaa98795529f3d1ce5c5a9d2ad8 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Sat, 9 Mar 2019 18:17:38 -0500 Subject: [PATCH 042/114] c is only for chat_in --- src/hu_stuff.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index bd8f7fd9..11a989f5 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1130,8 +1130,6 @@ static INT16 typelines = 1; // number of drawfill lines we need when drawing the // boolean HU_Responder(event_t *ev) { - INT32 c=0; - if (ev->type != ev_keydown) return false; @@ -1157,8 +1155,6 @@ boolean HU_Responder(event_t *ev) return false; } - c = (INT32)ev->data1; - #ifndef NONET if (!chat_on) { @@ -1186,6 +1182,7 @@ boolean HU_Responder(event_t *ev) } else // if chat_on { + INT32 c = (INT32)ev->data1; // Ignore modifier keys // Note that we do this here so users can still set @@ -1201,8 +1198,6 @@ boolean HU_Responder(event_t *ev) && ev->data1 != gamecontrol[gc_talkkey][1])) return false; - c = (INT32)ev->data1; - // I know this looks very messy but this works. If it ain't broke, don't fix it! // shift LETTERS to uppercase if we have capslock or are holding shift if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) From 84631b13937d06df40680610269befce2d250d84 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 17:24:20 -0600 Subject: [PATCH 043/114] Make P_NukeEnemies (including K_DoThunderShield) scale by mapscale --- src/p_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 7350b921..5777f6e7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7654,12 +7654,14 @@ static void P_NukeAllPlayers(player_t *player) // void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) { - const fixed_t ns = 60 << FRACBITS; + const fixed_t ns = 60 * mapobjectscale; mobj_t *mo; angle_t fa; thinker_t *think; INT32 i; + radius = FixedMul(radius, mapobjectscale); + for (i = 0; i < 16; i++) { fa = (i*(FINEANGLES/16)); From 814c48805c30c5018a90af9856f631109028bad9 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 17:28:05 -0600 Subject: [PATCH 044/114] Disable stacking thunder shields --- src/p_inter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_inter.c b/src/p_inter.c index 7da581a5..da652120 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -141,6 +141,9 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) || (weapon != 3 && player->kartstuff[k_itemamount]) || player->kartstuff[k_itemheld]) return false; + + if (weapon == 3 && player->kartstuff[k_itemtype] = KITEM_THUNDERSHIELD) + return false; // No stacking thunder shields! } } From 60ca6ae06b3a58e24911e95030c1748581904552 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 9 Mar 2019 19:41:56 -0500 Subject: [PATCH 045/114] TravisCI: add option for GCC 8.1 --- .travis.yml | 8 ++++++-- src/Makefile.cfg | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1131bff3..50dbab79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ matrix: - p7zip-full - gcc-4.4 compiler: gcc-4.4 + env: GCC44=1 #gcc-4.4 (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7 - os: linux addons: @@ -27,6 +28,7 @@ matrix: - p7zip-full - gcc-4.6 compiler: gcc-4.6 + env: GCC46=1 #gcc-4.6 (Ubuntu/Linaro 4.6.4-6ubuntu2) 4.6.4 - os: linux addons: @@ -42,6 +44,7 @@ matrix: #gcc-4.7 - os: linux compiler: gcc + env: GCC48=1 #gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 - os: linux addons: @@ -56,6 +59,7 @@ matrix: - p7zip-full - gcc-4.8 compiler: gcc-4.8 + env: GCC48=1 #gcc-4.8 (Ubuntu 4.8.5-2ubuntu1~14.04.1) 4.8.5 - os: linux addons: @@ -70,7 +74,7 @@ matrix: - p7zip-full - gcc-7 compiler: gcc-7 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" GCC72=1 #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux addons: @@ -85,7 +89,7 @@ matrix: - p7zip-full - gcc-8 compiler: gcc-8 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow" + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow" GCC81=1 #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 - os: linux compiler: clang diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 236d7ae2..a0398154 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,6 +7,10 @@ # and other things # +ifdef GCC81 +GCC80=1 +endif + ifdef GCC80 GCC72=1 endif From 8780800e8ee207c76f29591e0997cbd53d8ce0ce Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 9 Mar 2019 20:16:54 -0500 Subject: [PATCH 046/114] TravisCI: remove WFLAGS --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50dbab79..77fd82c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ matrix: - p7zip-full - gcc-4.7 compiler: gcc-4.7 + env: GCC47=1 #gcc-4.7 - os: linux compiler: gcc @@ -74,7 +75,7 @@ matrix: - p7zip-full - gcc-7 compiler: gcc-7 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" GCC72=1 + env: GCC72=1 #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux addons: @@ -89,7 +90,7 @@ matrix: - p7zip-full - gcc-8 compiler: gcc-8 - env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow" GCC81=1 + env: GCC81=1 #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 - os: linux compiler: clang From cd39b951bb8241fa1baef191571f0f9a64f31a66 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 9 Mar 2019 20:35:23 -0500 Subject: [PATCH 047/114] partly Revert "TravisCI: remove WFLAGS" This reverts commit 8780800e8ee207c76f29591e0997cbd53d8ce0ce. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77fd82c8..4bfc5886 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,7 +75,7 @@ matrix: - p7zip-full - gcc-7 compiler: gcc-7 - env: GCC72=1 + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough" GCC72=1 #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 - os: linux addons: @@ -90,7 +90,7 @@ matrix: - p7zip-full - gcc-8 compiler: gcc-8 - env: GCC81=1 + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wno-implicit-fallthrough -Wno-error=format-overflow" GCC81=1 #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 - os: linux compiler: clang From 766d4eec270b36e8e5f90ec767df1e9046fed28e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 20:23:49 -0600 Subject: [PATCH 048/114] bah --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index da652120..5aa6ef17 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -142,7 +142,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon) || player->kartstuff[k_itemheld]) return false; - if (weapon == 3 && player->kartstuff[k_itemtype] = KITEM_THUNDERSHIELD) + if (weapon == 3 && player->kartstuff[k_itemtype] == KITEM_THUNDERSHIELD) return false; // No stacking thunder shields! } } From cbe785d854798e8d167aa69d12ed96c3c013c567 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Sat, 9 Mar 2019 21:57:59 -0500 Subject: [PATCH 049/114] Please do not go past the doomdata_t space --- src/d_clisrv.c | 2 +- src/d_clisrv.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 351328ec..2e90d2ef 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5077,7 +5077,7 @@ static inline void PingUpdate(void) } // send the server's maxping as last element of our ping table. This is useful to let us know when we're about to get kicked. - netbuffer->u.pingtable[i++] = cv_maxping.value; + netbuffer->u.pingtable[MAXPLAYERS] = cv_maxping.value; //send out our ping packets for (i = 0; i < MAXNETNODES; i++) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 04569198..7f176bd9 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -453,7 +453,7 @@ typedef struct plrinfo playerinfo[MAXPLAYERS]; // 1152 bytes (I'd say 36~38) plrconfig playerconfig[MAXPLAYERS]; // (up to) 896 bytes (welp they ARE) #ifdef NEWPING - UINT32 pingtable[MAXPLAYERS]; // 128 bytes + UINT32 pingtable[MAXPLAYERS+1]; // 128 bytes #endif } u; // This is needed to pack diff packet types data together } ATTRPACK doomdata_t; From 416b723567fcd0e3c0887e3aebba101be4916717 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 21:08:29 -0600 Subject: [PATCH 050/114] Fix improperly-resolved merge conflict --- src/d_clisrv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index da5dd3e3..8e2a42de 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5099,7 +5099,6 @@ static inline void PingUpdate(void) if (pingtimeout[i] > cv_pingtimeout.value) // ok your net has been bad for too long, you deserve to die. { XBOXSTATIC char buf[2]; - pingtimeout[i] = 0; pingtimeout[i] = 0; From 3e1570c59d2a3a9baad1f8b38ad8397c37f6ef97 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 22:17:16 -0600 Subject: [PATCH 051/114] Revert "Move HandleConnect to the same place as other packets" This reverts commit 6bba2f16c0c0c8dd657629e829760ecf75ce37a4. --- src/d_clisrv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 08788613..6734b544 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3944,10 +3944,6 @@ static void HandlePacketFromAwayNode(SINT8 node) Net_CloseConnection(node); break; - case PT_CLIENTJOIN: - if (server) - HandleConnect(node); - break; case PT_JOINCHALLENGE: if (server && serverrunning) { // But wait I thought I'm the server? @@ -4663,6 +4659,12 @@ FILESTAMP while (HGetPacket()) { node = (SINT8)doomcom->remotenode; + + if (netbuffer->packettype == PT_CLIENTJOIN && server) + { + HandleConnect(node); + continue; + } if (node == servernode && client && cl_mode != CL_SEARCHING) { if (netbuffer->packettype == PT_SERVERSHUTDOWN) From 499dcc6bdb5550901e95c545780cbc74ba29afc7 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 9 Mar 2019 23:18:55 -0600 Subject: [PATCH 052/114] Kill all skin flags but SF_HIRES --- src/d_player.h | 7 +- src/dehacked.c | 5 - src/p_inter.c | 60 ------------ src/p_mobj.c | 97 +------------------ src/p_user.c | 252 ------------------------------------------------- src/r_things.c | 2 +- 6 files changed, 3 insertions(+), 420 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index abd7d166..959b4ed3 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -32,12 +32,7 @@ // Extra abilities/settings for skins (combinable stuff) typedef enum { - SF_SUPER = 1, // Can turn super in singleplayer/co-op mode. - SF_SUPERANIMS = 1<<1, // If super, use the super sonic animations - SF_SUPERSPIN = 1<<2, // Should spin frames be played while super? - SF_HIRES = 1<<3, // Draw the sprite 2x as small? - SF_NOSKID = 1<<4, // No skid particles etc - SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust + SF_HIRES = 1, // Draw the sprite 2x as small? } skinflags_t; //Primary and secondary skin abilities diff --git a/src/dehacked.c b/src/dehacked.c index 34cd86b6..64a6242f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8608,12 +8608,7 @@ struct { {"RW_RAIL",RW_RAIL}, // Character flags (skinflags_t) - {"SF_SUPER",SF_SUPER}, - {"SF_SUPERANIMS",SF_SUPERANIMS}, - {"SF_SUPERSPIN",SF_SUPERSPIN}, {"SF_HIRES",SF_HIRES}, - {"SF_NOSKID",SF_NOSKID}, - {"SF_NOSPEEDADJUST",SF_NOSPEEDADJUST}, // Character abilities! // Primary diff --git a/src/p_inter.c b/src/p_inter.c index dd27858f..35be83ad 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2952,66 +2952,6 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) } } -/* -static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) // SRB2kart - unused. -{ - fixed_t fallbackspeed; - angle_t ang; - - P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); - - if (player->mo->eflags & MFE_VERTICALFLIP) - player->mo->z--; - else - player->mo->z++; - - if (player->mo->eflags & MFE_UNDERWATER) - P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false); - else - P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false); - - ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); - - // explosion and rail rings send you farther back, making it more difficult - // to recover - if (inflictor->flags2 & MF2_SCATTER && source) - { - fixed_t dist = P_AproxDistance(P_AproxDistance(source->x-player->mo->x, source->y-player->mo->y), source->z-player->mo->z); - - dist = FixedMul(128*FRACUNIT, inflictor->scale) - dist/4; - - if (dist < FixedMul(4*FRACUNIT, inflictor->scale)) - dist = FixedMul(4*FRACUNIT, inflictor->scale); - - fallbackspeed = dist; - } - else if (inflictor->flags2 & MF2_EXPLOSION) - { - if (inflictor->flags2 & MF2_RAILRING) - fallbackspeed = FixedMul(28*FRACUNIT, inflictor->scale); // 7x - else - fallbackspeed = FixedMul(20*FRACUNIT, inflictor->scale); // 5x - } - else if (inflictor->flags2 & MF2_RAILRING) - fallbackspeed = FixedMul(16*FRACUNIT, inflictor->scale); // 4x - else - fallbackspeed = FixedMul(4*FRACUNIT, inflictor->scale); // the usual amount of force - - P_InstaThrust(player->mo, ang, fallbackspeed); - - // SRB2kart - This shouldn't be reachable, but this frame is invalid. - //if (player->charflags & SF_SUPERANIMS) - // P_SetPlayerMobjState(player->mo, S_PLAY_SUPERHIT); - //else - P_SetPlayerMobjState(player->mo, player->mo->info->painstate); - - P_ResetPlayer(player); - - if (player->timeshit != UINT8_MAX) - ++player->timeshit; -} -*/ - void P_RemoveShield(player_t *player) { if (player->powers[pw_shield] & SH_FORCE) diff --git a/src/p_mobj.c b/src/p_mobj.c index c070560f..0130924c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -167,58 +167,8 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) I_Error("P_SetPlayerMobjState used for non-player mobj. Use P_SetMobjState instead!\n(Mobj type: %d, State: %d)", mobj->type, state); #endif - // Catch state changes for Super Sonic - /* // SRB2kart - don't need - if (player->powers[pw_super] && (player->charflags & SF_SUPERANIMS)) - { - switch (state) - { - case S_PLAY_STND: - case S_PLAY_TAP1: - case S_PLAY_TAP2: - case S_PLAY_GASP: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERSTAND); - return true; - case S_PLAY_FALL1: - case S_PLAY_SPRING: - case S_PLAY_RUN1: - case S_PLAY_RUN2: - case S_PLAY_RUN3: - case S_PLAY_RUN4: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERWALK1); - return true; - case S_PLAY_FALL2: - case S_PLAY_RUN5: - case S_PLAY_RUN6: - case S_PLAY_RUN7: - case S_PLAY_RUN8: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERWALK2); - return true; - case S_PLAY_SPD1: - case S_PLAY_SPD2: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERFLY1); - return true; - case S_PLAY_SPD3: - case S_PLAY_SPD4: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERFLY2); - return true; - case S_PLAY_TEETER1: - case S_PLAY_TEETER2: - P_SetPlayerMobjState(mobj, S_PLAY_SUPERTEETER); - return true; - case S_PLAY_ATK1: - case S_PLAY_ATK2: - case S_PLAY_ATK3: - case S_PLAY_ATK4: - if (!(player->charflags & SF_SUPERSPIN)) - return true; - break; - default: - break; - } - } // 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] == K_GetKartFlashing(player) && state != mobj->info->painstate) + 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] = K_GetKartFlashing(player)-1; @@ -260,51 +210,6 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) st = &states[state]; mobj->state = st; mobj->tics = st->tics; - - // Adjust the player's animation speed to match their velocity. - if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST)) - { - fixed_t speed = FixedDiv(player->speed, FixedMul(mobj->scale, player->mo->movefactor)); // fixed_t speed = FixedDiv(player->speed, mobj->scale); - if (player->panim == PA_ROLL) - { - if (speed > 16<tics = 1; - else - mobj->tics = 2; - } - else if (player->panim == PA_FALL) - { - speed = FixedDiv(abs(mobj->momz), mobj->scale); - if (speed < 10<tics = 4; - else if (speed < 20<tics = 3; - else if (speed < 30<tics = 2; - else - mobj->tics = 1; - } - else if (P_IsObjectOnGround(mobj) || player->powers[pw_super]) // Only if on the ground or superflying. - { - if (player->panim == PA_WALK) - { - if (speed > 12<tics = 2; - else if (speed > 6<tics = 3; - else - mobj->tics = 4; - } - else if (player->panim == PA_RUN) - { - if (speed > 52<tics = 1; - else - mobj->tics = 2; - } - } - } - mobj->sprite = st->sprite; mobj->frame = st->frame; mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set diff --git a/src/p_user.c b/src/p_user.c index 7350b921..9dd7dc61 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3634,165 +3634,6 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) // SRB2kart - unused. } */ -#if 0 -// -// P_DoSuperStuff() -// -// Handle related superform functionality. -// -static void P_DoSuperStuff(player_t *player) -{ - mobj_t *spark; - ticcmd_t *cmd = &player->cmd; - //if (player->mo->state >= &states[S_PLAY_SUPERTRANS1] && player->mo->state <= &states[S_PLAY_SUPERTRANS9]) - // return; // don't do anything right now, we're in the middle of transforming! - - if (player->pflags & PF_NIGHTSMODE) - return; // NiGHTS Super doesn't mix with normal super - - // Does player have all emeralds? If so, flag the "Ready For Super!" - /*if ((ALL7EMERALDS(emeralds) || ALL7EMERALDS(player->powers[pw_emeralds])) && player->health > 50) - player->pflags |= PF_SUPERREADY; - else - player->pflags &= ~PF_SUPERREADY;*/ - - if (player->powers[pw_super]) - { - // If you're super and not Sonic, de-superize! - if (!((ALL7EMERALDS(emeralds)) && (player->charflags & SF_SUPER)) && !(ALL7EMERALDS(player->powers[pw_emeralds]))) - { - player->powers[pw_super] = 0; - P_SetPlayerMobjState(player->mo, S_KART_STND1); - P_RestoreMusic(player); - P_SpawnShieldOrb(player); - - // Restore color - if (player->powers[pw_shield] & SH_FIREFLOWER) - { - player->mo->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); - } - else - { - player->mo->color = player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } - - if (gametype != GT_COOP) - { - HU_SetCEchoFlags(0); - HU_SetCEchoDuration(5); - HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); - } - return; - } - - // Deplete one ring every second while super - if ((leveltime % TICRATE == 0) && !(player->exiting)) - { - player->health--; - player->mo->health--; - } - - // future todo: a skin option for this, and possibly more colors - switch (player->skin) - { - case 1: /* Tails */ player->mo->color = SKINCOLOR_TSUPER1; break; - case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break; - default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break; - } - player->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4); - - if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) - && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) - { - spark = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SUPERSPARK); - spark->destscale = player->mo->scale; - P_SetScale(spark, player->mo->scale); - } - - G_GhostAddColor(GHC_SUPER); - - // Ran out of rings while super! - if (player->health <= 1 || player->exiting) - { - player->powers[pw_emeralds] = 0; // lost the power stones - P_SpawnGhostMobj(player->mo); - - player->powers[pw_super] = 0; - - // Restore color - if (player->powers[pw_shield] & SH_FIREFLOWER) - { - player->mo->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); - } - else - { - player->mo->color = player->skincolor; - G_GhostAddColor(GHC_NORMAL); - } - - if (gametype != GT_COOP) - player->powers[pw_flashing] = K_GetKartFlashing(player)-1; - -/* - if (player->mo->health > 0) - { - if ((player->pflags & PF_JUMPED) || (player->pflags & PF_SPINNING)) - P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); - else if (player->panim == PA_RUN) - P_SetPlayerMobjState(player->mo, S_PLAY_SPD1); - else if (player->panim == PA_WALK) - P_SetPlayerMobjState(player->mo, S_PLAY_RUN1); - else - P_SetPlayerMobjState(player->mo, S_PLAY_STND); - - if (!player->exiting) - { - player->health = 1; - player->mo->health = 1; - } - } -*/ - - // Inform the netgame that the champion has fallen in the heat of battle. - if (gametype != GT_COOP) - { - S_StartSound(NULL, sfx_s3k66); //let all players hear it. - HU_SetCEchoFlags(0); - HU_SetCEchoDuration(5); - HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); - } - - // Resume normal music if you're the console player - P_RestoreMusic(player); - - // If you had a shield, restore its visual significance. - P_SpawnShieldOrb(player); - } - } -} -#endif - -// -// P_SuperReady -// -// Returns true if player is ready to turn super, duh -// -/*boolean P_SuperReady(player_t *player) -{ - if ((player->pflags & PF_SUPERREADY) && !player->powers[pw_super] && !player->powers[pw_tailsfly] - && !(player->powers[pw_shield] & SH_NOSTACK) - && !player->powers[pw_invulnerability] - && !(maptol & TOL_NIGHTS) // don't turn 'regular super' in nights levels - && player->pflags & PF_JUMPED - && ((player->charflags & SF_SUPER) || ALL7EMERALDS(player->powers[pw_emeralds]))) - return true; - - return false; -}*/ - // // P_DoJump // @@ -6382,99 +6223,6 @@ void P_ElementalFireTrail(player_t *player) } } -/*static void P_SkidStuff(player_t *player) -{ - fixed_t pmx = player->rmomx + player->cmomx; - fixed_t pmy = player->rmomy + player->cmomy; - - // Knuckles glides into the dirt. - // SRB2kart - don't need - if (player->pflags & PF_GLIDING && player->skidtime) - { - // Fell off a ledge... - if (!onground) - { - player->skidtime = 0; - player->pflags &= ~(PF_GLIDING|PF_JUMPED); - P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); - } - // Get up and brush yourself off, idiot. - else if (player->glidetime > 15) - { - P_ResetPlayer(player); - P_SetPlayerMobjState(player->mo, S_PLAY_STND); - player->mo->momx = player->cmomx; - player->mo->momy = player->cmomy; - } - // Didn't stop yet? Skid FOREVER! - else if (player->skidtime == 1) - player->skidtime = 3*TICRATE+1; - // Spawn a particle every 3 tics. - else if (!(player->skidtime % 3)) - { - mobj_t *particle = P_SpawnMobj(player->mo->x + P_RandomRange(-player->mo->radius, player->mo->radius), player->mo->y + P_RandomRange(-player->mo->radius, player->mo->radius), - player->mo->z + (player->mo->eflags & MFE_VERTICALFLIP ? player->mo->height - mobjinfo[MT_PARTICLE].height : 0), - MT_PARTICLE); - particle->tics = 10; - - particle->eflags |= player->mo->eflags & MFE_VERTICALFLIP; - P_SetScale(particle, player->mo->scale >> 2); - particle->destscale = player->mo->scale << 2; - particle->scalespeed = FixedMul(particle->scalespeed, player->mo->scale); // scale the scaling speed! - P_SetObjectMomZ(particle, FRACUNIT, false); - S_StartSound(player->mo, sfx_s3k7e); // the proper "Knuckles eats dirt" sfx. - } - } - // Skidding! - elseif (onground && !(player->mo->eflags & MFE_GOOWATER) && !(player->pflags & (PF_JUMPED|PF_SPINNING|PF_SLIDING)) && !(player->charflags & SF_NOSKID)) - { - if (player->skidtime) - { - // Spawn a particle every 3 tics. - if (!(player->skidtime % 3)) - { - mobj_t *particle = P_SpawnMobj(player->mo->x, player->mo->y, - player->mo->z + (player->mo->eflags & MFE_VERTICALFLIP ? player->mo->height - mobjinfo[MT_PARTICLE].height : 0), - MT_PARTICLE); - particle->tics = 10; - - particle->eflags |= player->mo->eflags & MFE_VERTICALFLIP; - P_SetScale(particle, player->mo->scale >> 2); - particle->destscale = player->mo->scale << 2; - particle->scalespeed = FixedMul(particle->scalespeed, player->mo->scale); // scale the scaling speed! - P_SetObjectMomZ(particle, FRACUNIT, false); - } - } - else if (P_AproxDistance(pmx, pmy) >= FixedMul(player->runspeed/2, player->mo->scale) // if you were moving faster than half your run speed last frame - && (player->mo->momx != pmx || player->mo->momy != pmy) // and you are moving differently this frame - && P_GetPlayerControlDirection(player) == 2) // and your controls are pointing in the opposite direction to your movement - { // check for skidding - angle_t mang = R_PointToAngle2(0,0,pmx,pmy); // movement angle - angle_t pang = R_PointToAngle2(pmx,pmy,player->mo->momx,player->mo->momy); // push angle - angle_t dang = mang - pang; // delta angle - - if (dang > ANGLE_180) // Make delta angle always positive, invert it if it's negative. - dang = InvAngle(dang); - - // If your push angle is more than this close to a full 180 degrees, trigger a skid. - if (dang > ANGLE_157h) - { - player->skidtime = (player->mo->movefactor == FRACUNIT) ? TICRATE/2 : (FixedDiv(35<<(FRACBITS-1), FixedSqrt(player->mo->movefactor)))>>FRACBITS; //player->skidtime = TICRATE/2; - S_StartSound(player->mo, sfx_skid); - if (player->panim != PA_WALK) - P_SetPlayerMobjState(player->mo, S_KART_WALK2); // SRB2kart - was S_PLAY_RUN4 - player->mo->tics = player->skidtime; - } - } - } - else { - if (player->skidtime) { - player->skidtime = 0; - S_StopSound(player->mo); - } - } -}*/ - // // P_MovePlayer static void P_MovePlayer(player_t *player) diff --git a/src/r_things.c b/src/r_things.c index 82264394..a40830ac 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2570,7 +2570,7 @@ void R_InitSkins(void) #ifdef SKINVALUES skin_cons_t[0].strvalue = skins[0].name; #endif - skin->flags = SF_SUPER|SF_SUPERANIMS|SF_SUPERSPIN; + skin->flags = 0; strcpy(skin->realname, "Sonic"); strcpy(skin->hudname, "SONIC"); From 386360ff43ba83d84e87d47010a79500dffbceb7 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 23:36:11 -0600 Subject: [PATCH 053/114] Properly close and reopen the client connection for password challenges --- src/d_clisrv.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6734b544..b05babd6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1909,7 +1909,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room) /** Called by CL_ServerConnectionTicker * * \param viams ??? - * \param asksent ??? + * \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit. * \return False if the connection was aborted * \sa CL_ServerConnectionTicker * \sa CL_ConnectToServer @@ -2037,7 +2037,7 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent) * \param viams ??? * \param tmpsave The name of the gamestate file??? * \param oldtic Used for knowing when to poll events and redraw - * \param asksent ??? + * \param asksent The last time we asked the server to join. We re-ask every second in case our request got lost in transmit. * \return False if the connection was aborted * \sa CL_ServerConnectionSearchTicker * \sa CL_ConnectToServer @@ -2109,6 +2109,9 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic #endif case CL_CHALLENGE: + (*asksent) = I_GetTime() - NEWTICRATE + 2; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... + break; + case CL_WAITJOINRESPONSE: case CL_WAITDOWNLOADFILESRESPONSE: case CL_CONNECTED: @@ -2226,10 +2229,26 @@ boolean CL_Responder(event_t *ev) } else if (ch == KEY_ENTER) { - // Done? - D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_mode = cl_needsdownload ? CL_ASKDOWNLOADFILES : CL_ASKJOIN; - cl_challengeattempted = 1; + // Done? Try to reconnect to the server... + if (!netgame && I_NetOpenSocket) + { + MSCloseUDPSocket(); // Tidy up before wiping the slate. + if (I_NetOpenSocket()) + { + netgame = true; + multiplayer = true; + +#ifndef NONET + SL_ClearServerList(servernode); +#endif + cl_mode = CL_SEARCHING; + + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_challengeattempted = 1; + } + } + else + I_Error("haha that ain't it"); } return true; @@ -3956,6 +3975,8 @@ static void HandlePacketFromAwayNode(SINT8 node) cl_challengenum = netbuffer->u.joinchallenge.challengenum; memcpy(cl_challengequestion, netbuffer->u.joinchallenge.question, 16); + D_CloseConnection(); // Don't need to stay connected while challenging + cl_mode = CL_CHALLENGE; if (cl_challengeattempted == 2) From ce8150441035056f36b391e65ff6a128da285134 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 9 Mar 2019 23:56:13 -0600 Subject: [PATCH 054/114] Try a partial disconnect instead --- src/d_clisrv.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b05babd6..170c9645 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2109,7 +2109,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic #endif case CL_CHALLENGE: - (*asksent) = I_GetTime() - NEWTICRATE + 2; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... + (*asksent) = I_GetTime() - NEWTICRATE; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... break; case CL_WAITJOINRESPONSE: @@ -2229,26 +2229,16 @@ boolean CL_Responder(event_t *ev) } else if (ch == KEY_ENTER) { - // Done? Try to reconnect to the server... - if (!netgame && I_NetOpenSocket) - { - MSCloseUDPSocket(); // Tidy up before wiping the slate. - if (I_NetOpenSocket()) - { - netgame = true; - multiplayer = true; + netgame = true; + multiplayer = true; #ifndef NONET - SL_ClearServerList(servernode); + SL_ClearServerList(servernode); #endif - cl_mode = CL_SEARCHING; + cl_mode = CL_SEARCHING; - D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_challengeattempted = 1; - } - } - else - I_Error("haha that ain't it"); + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_challengeattempted = 1; } return true; @@ -3975,7 +3965,7 @@ static void HandlePacketFromAwayNode(SINT8 node) cl_challengenum = netbuffer->u.joinchallenge.challengenum; memcpy(cl_challengequestion, netbuffer->u.joinchallenge.question, 16); - D_CloseConnection(); // Don't need to stay connected while challenging + Net_CloseConnection(node|FORCECLOSE); // Don't need to stay connected while challenging cl_mode = CL_CHALLENGE; From bafa4cee7b3da60bdb1cad4ea4d9b37863418ac9 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 12:50:24 -0500 Subject: [PATCH 055/114] Improve stability when joining netgames maybe --- src/d_clisrv.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 170c9645..1da11e71 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2084,14 +2084,20 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic CL_PrepareDownloadSaveGame(tmpsave); #endif if (CL_SendJoin()) + { + *asksent = I_GetTime(); cl_mode = CL_WAITJOINRESPONSE; + } break; case CL_ASKDOWNLOADFILES: cl_needsdownload = true; if (CL_SendJoin()) + { + *asksent = I_GetTime(); cl_mode = CL_WAITDOWNLOADFILESRESPONSE; + } break; @@ -2114,6 +2120,13 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic case CL_WAITJOINRESPONSE: case CL_WAITDOWNLOADFILESRESPONSE: + if (*asksent + NEWTICRATE < I_GetTime() && CL_SendJoin()) + { + *asksent = I_GetTime(); + } + + break; + case CL_CONNECTED: default: break; From 82f3d2cdb8c7f71d5b63f32c6fb5834cf6963a6c Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 15:48:11 -0500 Subject: [PATCH 056/114] Skip password check if node is already in-game? idk --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1da11e71..ca9e2084 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3775,7 +3775,7 @@ static void HandleConnect(SINT8 node) boolean newnode = false; #endif - if (node != servernode && D_IsJoinPasswordOn()) + if (node != servernode && !nodeingame[node] && D_IsJoinPasswordOn()) { // Ensure node sent the correct password challenge boolean passed = false; From be79b4beeceaa31cf9bda47c27a667dd544214ec Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 15:48:55 -0500 Subject: [PATCH 057/114] Fix dehacked color list being wrong --- src/dehacked.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index b0d0df96..97cf243f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8147,8 +8147,8 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "GREY", // SKINCOLOR_GREY "NICKEL", // SKINCOLOR_NICKEL "BLACK", // SKINCOLOR_BLACK - "FAIRY", // SKINCOLOR_FAIRY "POPCORN", // SKINCOLOR_POPCORN + "FAIRY", // SKINCOLOR_FAIRY "SEPIA", // SKINCOLOR_SEPIA "BEIGE", // SKINCOLOR_BEIGE "BROWN", // SKINCOLOR_BROWN @@ -8226,12 +8226,16 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "PURPLE", // SKINCOLOR_PURPLE "FUCHSIA", // SKINCOLOR_FUCHSIA "TOXIC", // SKINCOLOR_TOXIC + "MAUVE", // SKINCOLOR_MAUVE "LAVENDER", // SKINCOLOR_LAVENDER "BYZANTIUM", // SKINCOLOR_BYZANTIUM - "MAUVE", // SKINCOLOR_MAUVE "POMEGRANATE", // SKINCOLOR_POMEGRANATE "LILAC", // SKINCOLOR_LILAC + + + + // Special super colors // Super Sonic Yellow "SUPER1", // SKINCOLOR_SUPER1 @@ -8239,48 +8243,56 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "SUPER3", // SKINCOLOR_SUPER3, "SUPER4", // SKINCOLOR_SUPER4, "SUPER5", // SKINCOLOR_SUPER5, + // Super Tails Orange "TSUPER1", // SKINCOLOR_TSUPER1, "TSUPER2", // SKINCOLOR_TSUPER2, "TSUPER3", // SKINCOLOR_TSUPER3, "TSUPER4", // SKINCOLOR_TSUPER4, "TSUPER5", // SKINCOLOR_TSUPER5, + // Super Knuckles Red "KSUPER1", // SKINCOLOR_KSUPER1, "KSUPER2", // SKINCOLOR_KSUPER2, "KSUPER3", // SKINCOLOR_KSUPER3, "KSUPER4", // SKINCOLOR_KSUPER4, "KSUPER5", // SKINCOLOR_KSUPER5, + // Hyper Sonic Pink "PSUPER1", // SKINCOLOR_PSUPER1, "PSUPER2", // SKINCOLOR_PSUPER2, "PSUPER3", // SKINCOLOR_PSUPER3, "PSUPER4", // SKINCOLOR_PSUPER4, "PSUPER5", // SKINCOLOR_PSUPER5, + // Hyper Sonic Blue "BSUPER1", // SKINCOLOR_BSUPER1, "BSUPER2", // SKINCOLOR_BSUPER2, "BSUPER3", // SKINCOLOR_BSUPER3, "BSUPER4", // SKINCOLOR_BSUPER4, - "BSUPER5" // SKINCOLOR_BSUPER5, + "BSUPER5", // SKINCOLOR_BSUPER5, + // Aqua Super "ASUPER1", // SKINCOLOR_ASUPER1, "ASUPER2", // SKINCOLOR_ASUPER2, "ASUPER3", // SKINCOLOR_ASUPER3, "ASUPER4", // SKINCOLOR_ASUPER4, "ASUPER5", // SKINCOLOR_ASUPER5, + // Hyper Sonic Green "GSUPER1", // SKINCOLOR_GSUPER1, "GSUPER2", // SKINCOLOR_GSUPER2, "GSUPER3", // SKINCOLOR_GSUPER3, "GSUPER4", // SKINCOLOR_GSUPER4, "GSUPER5", // SKINCOLOR_GSUPER5, + // Hyper Sonic White "WSUPER1", // SKINCOLOR_WSUPER1, "WSUPER2", // SKINCOLOR_WSUPER2, "WSUPER3", // SKINCOLOR_WSUPER3, "WSUPER4", // SKINCOLOR_WSUPER4, "WSUPER5", // SKINCOLOR_WSUPER5, + // Creamy Super (Shadow?) "CSUPER1", // SKINCOLOR_CSUPER1, "CSUPER2", // SKINCOLOR_CSUPER2, From 0c6f3c58e6628fcde24a407d9205a01e4bbe414f Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 16:06:46 -0500 Subject: [PATCH 058/114] Update packettypenames --- src/d_net.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/d_net.c b/src/d_net.c index 530ee6df..9f719967 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -821,10 +821,6 @@ static const char *packettypename[NUMPACKETTYPE] = "CLIENTMIS", "CLIENT2CMD", "CLIENT2MIS", - "CLIENT3CMD", - "CLIENT3MIS", - "CLIENT4CMD", - "CLIENT4MIS", "NODEKEEPALIVE", "NODEKEEPALIVEMIS", "SERVERTICS", @@ -841,6 +837,15 @@ static const char *packettypename[NUMPACKETTYPE] = "RESYNCHEND", "RESYNCHGET", + "CLIENT3CMD", + "CLIENT3MIS", + "CLIENT4CMD", + "CLIENT4MIS", + "BASICKEEPALIVE", + + "JOINCHALLENGE", + "DOWNLOADFILESOKAY", + "FILEFRAGMENT", "TEXTCMD", "TEXTCMD2", From 693da54d94481bf65a63f47bea19cf4d39829114 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 16:22:03 -0500 Subject: [PATCH 059/114] Properly close the connection on the server's side... --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ca9e2084..be39f707 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3789,7 +3789,7 @@ static void HandleConnect(SINT8 node) netbuffer->packettype = PT_JOINCHALLENGE; HSendPacket(node, true, 0, sizeof(joinchallenge_pak)); - //Net_CloseConnection(node); + Net_CloseConnection(node); return; } From f70163cfb9a3e253aab2e9bed07da810da8279d6 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 17:00:27 -0500 Subject: [PATCH 060/114] Show notice of a password-protected server on the join screen --- src/d_clisrv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index be39f707..4954a762 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1179,6 +1179,8 @@ static void CV_LoadPlayerNames(UINT8 **p) } #ifdef CLIENT_LOADINGSCREEN +static UINT32 SL_SearchServer(INT32 node); + // // CL_DrawConnectionStatus // @@ -1212,12 +1214,28 @@ static inline void CL_DrawConnectionStatus(void) { char asterisks[33]; size_t sl = min(32, strlen(cl_challengepassword)); + UINT32 i; memset(asterisks, '*', sl); memset(asterisks+sl, 0, 33-sl); V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_MONOSPACE|V_ALLOWLOWERCASE, asterisks); + i = SL_SearchServer(servernode); + + if (i == -1) + { + M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT/2-8, 32, 1); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, V_REDMAP, M_GetText("This server is password protected.")); + } + else + { + M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT/2-8-8, 32, 3); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2-8, V_REDMAP, M_GetText("This server,")); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, V_ALLOWLOWERCASE, serverlist[i].info.servername); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+8, V_REDMAP, M_GetText("is password protected.")); + } + cltext = M_GetText(cl_challengeattempted ? "Incorrect password. Please try again." : "Please enter the server password."); } break; From 4a8d682b434b17bb1c8792fb8a25e88b3c097994 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 17:25:55 -0500 Subject: [PATCH 061/114] Draw a padlock on-screen! --- src/d_clisrv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4954a762..01304f38 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1220,6 +1220,7 @@ static inline void CL_DrawConnectionStatus(void) memset(asterisks+sl, 0, 33-sl); V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_MONOSPACE|V_ALLOWLOWERCASE, asterisks); + V_DrawFixedPatch((BASEVIDWIDTH/2) << FRACBITS, (BASEVIDHEIGHT/2) << FRACBITS, FRACUNIT, 0, W_CachePatchName("BSRVLOCK", PU_CACHE), NULL); i = SL_SearchServer(servernode); @@ -1230,10 +1231,10 @@ static inline void CL_DrawConnectionStatus(void) } else { - M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT/2-8-8, 32, 3); - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2-8, V_REDMAP, M_GetText("This server,")); - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, V_ALLOWLOWERCASE, serverlist[i].info.servername); - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+8, V_REDMAP, M_GetText("is password protected.")); + M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT/2-8, 32, 3); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, V_REDMAP, M_GetText("This server,")); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+8, V_ALLOWLOWERCASE, serverlist[i].info.servername); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+16, V_REDMAP, M_GetText("is password protected.")); } cltext = M_GetText(cl_challengeattempted ? "Incorrect password. Please try again." : "Please enter the server password."); @@ -2133,7 +2134,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic #endif case CL_CHALLENGE: - (*asksent) = I_GetTime() - NEWTICRATE; // This is SUPPOSED to remove the delay from sending the password but it doesn't work... + (*asksent) = I_GetTime() - NEWTICRATE; // Send password immediately upon entering break; case CL_WAITJOINRESPONSE: From 048ce8496fd2d5d72b04395a098904be2c41a3bc Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 17:36:16 -0500 Subject: [PATCH 062/114] Make noises on the password entry screen --- src/d_clisrv.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 01304f38..98330c84 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4001,11 +4001,23 @@ static void HandlePacketFromAwayNode(SINT8 node) cl_mode = CL_CHALLENGE; - if (cl_challengeattempted == 2) + switch (cl_challengeattempted) { - // We already sent a correct password, so throw it back up again. - D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); - cl_mode = CL_ASKJOIN; + case 2: + // We already sent a correct password, so throw it back up again. + D_ComputeChallengeAnswer(cl_challengequestion, cl_challengepassword, cl_challengeanswer); + cl_mode = CL_ASKJOIN; + break; + + case 1: + // We entered the wrong password! + S_StartSound(NULL, sfx_s26d); + break; + + default: + // First entry to the password screen. + S_StartSound(NULL, sfx_s224); + break; } } break; @@ -4064,6 +4076,9 @@ static void HandlePacketFromAwayNode(SINT8 node) break; } + if (cl_challengeattempted == 1) // Successful password noise. + S_StartSound(NULL, sfx_s221); + cl_challengeattempted = 2; CONS_Printf("trying to download\n"); if (CL_SendRequestFile()) @@ -4085,6 +4100,9 @@ static void HandlePacketFromAwayNode(SINT8 node) if (cl_mode != CL_WAITJOINRESPONSE) break; + if (cl_challengeattempted == 1) // Successful password noise. + S_StartSound(NULL, sfx_s221); + if (client) { maketic = gametic = neededtic = (tic_t)LONG(netbuffer->u.servercfg.gametic); From 0e586537271ddd2cd86300e68d81d2b5da1c2901 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 17:43:39 -0500 Subject: [PATCH 063/114] Make sure we don't write kartspeed beyond SV_SPEEDMASK --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 98330c84..0202ff6f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1364,7 +1364,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled(); netbuffer->u.serverinfo.kartvars = (UINT8) ( - cv_kartspeed.value | + (cv_kartspeed.value & SV_SPEEDMASK) | (dedicated ? SV_DEDICATED : 0) | (D_IsJoinPasswordOn() ? SV_PASSWORD : 0) ); From c0ea78590025a618d82b8fbe1d962a3a1ee52a34 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 17:54:17 -0500 Subject: [PATCH 064/114] Remove unnecessary padding byte from stored challenge answers --- src/d_netcmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 2c6d6003..7c7f5690 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3712,7 +3712,7 @@ consvar_t cv_dummyjoinpassword = {"dummyjoinpassword", "", CV_HIDEN|CV_NOSHOWHEL #define NUMJOINCHALLENGES 32 static UINT8 joinpassmd5[MD5_LEN+1]; boolean joinpasswordset = false; -static UINT8 joinpasschallenges[NUMJOINCHALLENGES][MD5_LEN+1]; +static UINT8 joinpasschallenges[NUMJOINCHALLENGES][MD5_LEN]; static tic_t joinpasschallengeson[NUMJOINCHALLENGES]; boolean D_IsJoinPasswordOn(void) @@ -3752,7 +3752,7 @@ boolean D_VerifyJoinPasswordChallenge(UINT8 num, UINT8 *answer) passed = true; // Wipe and reset the challenge so that it can't be tried against again, as a small measure against brute-force attacks. - memset(joinpasschallenges[num], 0x00, MD5_LEN+1); + memset(joinpasschallenges[num], 0x00, MD5_LEN); joinpasschallengeson[num] = 0; return passed; @@ -3787,7 +3787,7 @@ void D_MakeJoinPasswordChallenge(UINT8 *num, UINT8 *question) joinpasschallengeson[(*num)] = I_GetTime(); - memset(question, 0x00, MD5_LEN+1); + memset(question, 0x00, MD5_LEN); for (i = 0; i < MD5_LEN; i++) question[i] = M_RandomByte(); From c65ff70faf9530717dfe1dfafb281ec4ff3f2dd7 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 18:09:15 -0500 Subject: [PATCH 065/114] Deduplicate character shifting code --- src/console.c | 16 ++++++++++++++++ src/console.h | 2 ++ src/d_clisrv.c | 18 +----------------- src/hu_stuff.c | 13 +------------ 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/src/console.c b/src/console.c index 2b3ee0e2..44bb03a3 100644 --- a/src/console.c +++ b/src/console.c @@ -544,6 +544,22 @@ static void CON_MoveConsole(void) } } +INT32 CON_ShiftChar(INT32 ch) +{ + if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) + { + if (shiftdown ^ capslock) + ch = shiftxform[ch]; + } + else // if we're holding shift we should still shift non letter symbols + { + if (shiftdown) + ch = shiftxform[ch]; + } + + return ch; +} + // Clear time of console heads up messages // void CON_ClearHUD(void) diff --git a/src/console.h b/src/console.h index 98df6ee2..11621746 100644 --- a/src/console.h +++ b/src/console.h @@ -44,6 +44,8 @@ extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *or // Console bg color (auto updated to match) extern UINT8 *consolebgmap; +INT32 CON_ShiftChar(INT32 ch); + void CON_SetupBackColormap(void); void CON_ClearHUD(void); // clear heads up messages diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 0202ff6f..5fe378e0 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2228,24 +2228,8 @@ boolean CL_Responder(event_t *ev) len = strlen(cl_challengepassword); if (len < 64) { - - // shifting code stolen from lat by fickle, thx :) - - // I know this looks very messy but this works. If it ain't broke, don't fix it! - // shift LETTERS to uppercase if we have capslock or are holding shift - if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) - { - if (shiftdown ^ capslock) - ch = shiftxform[ch]; - } - else // if we're holding shift we should still shift non letter symbols - { - if (shiftdown) - ch = shiftxform[ch]; - } - cl_challengepassword[len+1] = 0; - cl_challengepassword[len] = ch; + cl_challengepassword[len] = CON_ShiftChar(ch); } cl_challengeattempted = 0; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index a540e0a1..b4357073 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1293,18 +1293,7 @@ boolean HU_Responder(event_t *ev) && ev->data1 != gamecontrol[gc_talkkey][1])) return false; - // I know this looks very messy but this works. If it ain't broke, don't fix it! - // shift LETTERS to uppercase if we have capslock or are holding shift - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) - { - if (shiftdown ^ capslock) - c = shiftxform[c]; - } - else // if we're holding shift we should still shift non letter symbols - { - if (shiftdown) - c = shiftxform[c]; - } + c = CON_ShiftChar(c); // pasting. pasting is cool. chat is a bit limited, though :( if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE) From 07ecfbc1d715085148e6fc6ea017ba7eb0c1dec1 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 10 Mar 2019 23:51:52 +0000 Subject: [PATCH 066/114] Fix compile warnings. --- src/d_clisrv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 5fe378e0..f337b170 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1214,7 +1214,7 @@ static inline void CL_DrawConnectionStatus(void) { char asterisks[33]; size_t sl = min(32, strlen(cl_challengepassword)); - UINT32 i; + UINT32 serverid; memset(asterisks, '*', sl); memset(asterisks+sl, 0, 33-sl); @@ -1222,9 +1222,9 @@ static inline void CL_DrawConnectionStatus(void) V_DrawString(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, V_MONOSPACE|V_ALLOWLOWERCASE, asterisks); V_DrawFixedPatch((BASEVIDWIDTH/2) << FRACBITS, (BASEVIDHEIGHT/2) << FRACBITS, FRACUNIT, 0, W_CachePatchName("BSRVLOCK", PU_CACHE), NULL); - i = SL_SearchServer(servernode); + serverid = SL_SearchServer(servernode); - if (i == -1) + if (serverid == UINT32_MAX) { M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT/2-8, 32, 1); V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, V_REDMAP, M_GetText("This server is password protected.")); @@ -1233,7 +1233,7 @@ static inline void CL_DrawConnectionStatus(void) { M_DrawTextBox(BASEVIDWIDTH/2-128-8, BASEVIDHEIGHT/2-8, 32, 3); V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2, V_REDMAP, M_GetText("This server,")); - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+8, V_ALLOWLOWERCASE, serverlist[i].info.servername); + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+8, V_ALLOWLOWERCASE, serverlist[serverid].info.servername); V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2+16, V_REDMAP, M_GetText("is password protected.")); } From b955f4f66d7f5f1345d85dad22f70ffe8888eeb3 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 10 Mar 2019 18:55:55 -0500 Subject: [PATCH 067/114] Attempt to fix replaced maps not marking the game as modified What this ACTUALLY does is mark the game as modified by default. --- src/d_main.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 125c8f1e..c87c59f7 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1007,9 +1007,12 @@ static inline void D_MakeTitleString(char *s) // void D_SRB2Main(void) { - INT32 p; + INT32 p, i; char srb2[82]; // srb2 title banner char title[82]; + lumpinfo_t *lumpinfo; + UINT16 wadnum; + char *name; INT32 pstartmap = 1; boolean autostart = false; @@ -1235,7 +1238,7 @@ void D_SRB2Main(void) mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_GFX_KART); // gfx.kart mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_TEXTURES_KART); // textures.kart mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_CHARS_KART); // chars.kart - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_KART); // maps.kart + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_KART); // maps.kart -- 4 - If you touch this, make sure to touch up the majormods stuff below. #ifdef USE_PATCH_KART mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_KART); // patch.kart #endif @@ -1255,10 +1258,69 @@ void D_SRB2Main(void) mainwadstally = packetsizetally; + // + // search for maps + // + for (wadnum = 4; wadnum < 6; wadnum++) // fucking arbitrary numbers + { + lumpinfo = wadfiles[wadnum]->lumpinfo; + for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++) + { + name = lumpinfo->name; + + if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers + { + INT16 num; + if (name[5] != '\0') + continue; + num = (INT16)M_MapNumber(name[3], name[4]); + + // we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant + if (num <= NUMMAPS && mapheaderinfo[num - 1]) + { + mapheaderinfo[num - 1]->menuflags |= LF2_EXISTSHACK; + } + + CONS_Printf("%s\n", name); + //mapsadded = true; + } + } + } + if (!W_InitMultipleFiles(startuppwads)) CONS_Error("A PWAD file was not found or not valid.\nCheck the log to see which ones.\n"); D_CleanFile(startuppwads); + // + // search for maps... again. + // + for (wadnum = mainwads; wadnum < numwadfiles; wadnum++) + { + lumpinfo = wadfiles[wadnum]->lumpinfo; + for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++) + { + name = lumpinfo->name; + + if (name[0] == 'M' && name[1] == 'A' && name[2] == 'P') // Ignore the headers + { + INT16 num; + if (name[5] != '\0') + continue; + num = (INT16)M_MapNumber(name[3], name[4]); + + // we want to record whether this map exists. if it doesn't have a header, we can assume it's not relephant + if (num <= NUMMAPS && mapheaderinfo[num - 1]) + { + if (mapheaderinfo[num - 1]->menuflags & LF2_EXISTSHACK) + G_SetGameModified(multiplayer, true); // oops, double-defined - no record attack privileges for you + mapheaderinfo[num - 1]->menuflags |= LF2_EXISTSHACK; + } + + CONS_Printf("%s\n", name); + } + } + } + cht_Init(); //---------------------------------------------------- READY SCREEN From b9c3e56500f3b95acaa693c6330c6d499aa8ed7b Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 11 Mar 2019 00:13:43 +0000 Subject: [PATCH 068/114] Move FORCECLOSE definition to be out of NONET ifdef Should this just be moved into d_net.h instead of defining it here and in d_net.c? --- src/d_clisrv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f337b170..e227ce2e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -73,6 +73,7 @@ #define PREDICTIONQUEUE BACKUPTICS #define PREDICTIONMASK (PREDICTIONQUEUE-1) #define MAX_REASONLENGTH 30 +#define FORCECLOSE 0x8000 boolean server = true; // true or false but !server == client #define client (!server) @@ -1801,8 +1802,6 @@ static void SendAskInfo(INT32 node, boolean viams) serverelem_t serverlist[MAXSERVERLIST]; UINT32 serverlistcount = 0; -#define FORCECLOSE 0x8000 - static void SL_ClearServerList(INT32 connectedserver) { UINT32 i; From fae8833ff4db9540092ba91a23a9444d04dbadac Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 10 Mar 2019 19:27:45 -0500 Subject: [PATCH 069/114] Fix the game getting flagged as modified by default As a result, majormods trips for Lua and map replacements now, but modifiedgame isn't set for minor addons... --- src/d_main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index c87c59f7..31320267 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1280,9 +1280,6 @@ void D_SRB2Main(void) { mapheaderinfo[num - 1]->menuflags |= LF2_EXISTSHACK; } - - CONS_Printf("%s\n", name); - //mapsadded = true; } } } @@ -1294,7 +1291,7 @@ void D_SRB2Main(void) // // search for maps... again. // - for (wadnum = mainwads; wadnum < numwadfiles; wadnum++) + for (wadnum = mainwads+1; wadnum < numwadfiles; wadnum++) { lumpinfo = wadfiles[wadnum]->lumpinfo; for (i = 0; i < wadfiles[wadnum]->numlumps; i++, lumpinfo++) From 66c9d9aa838b1b80dbceedc3b2b43c520112ad15 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 10 Mar 2019 19:44:31 -0500 Subject: [PATCH 070/114] Move modified check on -file addons later in startup --- src/d_main.c | 8 ++------ src/w_wad.c | 5 ++++- src/w_wad.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 31320267..ba67eee9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1164,11 +1164,7 @@ void D_SRB2Main(void) const char *s = M_GetNextParm(); if (s) // Check for NULL? - { - if (!W_VerifyNMUSlumps(s)) - G_SetGameModified(true, false); D_AddFile(s, startuppwads); - } } } } @@ -1218,7 +1214,7 @@ void D_SRB2Main(void) // load wad, including the main wad file CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); - if (!W_InitMultipleFiles(startupwadfiles)) + if (!W_InitMultipleFiles(startupwadfiles, false)) #ifdef _DEBUG CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); #else @@ -1284,7 +1280,7 @@ void D_SRB2Main(void) } } - if (!W_InitMultipleFiles(startuppwads)) + if (!W_InitMultipleFiles(startuppwads, true)) CONS_Error("A PWAD file was not found or not valid.\nCheck the log to see which ones.\n"); D_CleanFile(startuppwads); diff --git a/src/w_wad.c b/src/w_wad.c index 5ae67aa8..15e4177e 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -855,13 +855,16 @@ void W_UnloadWadFile(UINT16 num) * \return 1 if all files were loaded, 0 if at least one was missing or * invalid. */ -INT32 W_InitMultipleFiles(char **filenames) +INT32 W_InitMultipleFiles(char **filenames, boolean addons) { INT32 rc = 1; // will be realloced as lumps are added for (; *filenames; filenames++) { + if (addons && !W_VerifyNMUSlumps(*filenames)) + G_SetGameModified(true, false); + //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); rc &= (W_InitFile(*filenames) != INT16_MAX) ? 1 : 0; } diff --git a/src/w_wad.h b/src/w_wad.h index e2e17740..762d3708 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -133,7 +133,7 @@ void W_UnloadWadFile(UINT16 num); // W_InitMultipleFiles returns 1 if all is okay, 0 otherwise, // so that it stops with a message if a file was not found, but not if all is okay. -INT32 W_InitMultipleFiles(char **filenames); +INT32 W_InitMultipleFiles(char **filenames, boolean addons); const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump); const char *W_CheckNameForNum(lumpnum_t lumpnum); From 3de3f10ad3ebb20a170d127a585cba5d0a90630b Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 11 Mar 2019 00:10:03 -0500 Subject: [PATCH 071/114] Make sure Fairy is before Popcorn --- src/dehacked.c | 2 +- src/doomdef.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 97cf243f..da1e471f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8147,8 +8147,8 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart. "GREY", // SKINCOLOR_GREY "NICKEL", // SKINCOLOR_NICKEL "BLACK", // SKINCOLOR_BLACK - "POPCORN", // SKINCOLOR_POPCORN "FAIRY", // SKINCOLOR_FAIRY + "POPCORN", // SKINCOLOR_POPCORN "SEPIA", // SKINCOLOR_SEPIA "BEIGE", // SKINCOLOR_BEIGE "BROWN", // SKINCOLOR_BROWN diff --git a/src/doomdef.h b/src/doomdef.h index dcb7d7dd..1cdcf52a 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -256,8 +256,8 @@ typedef enum SKINCOLOR_GREY, SKINCOLOR_NICKEL, SKINCOLOR_BLACK, - SKINCOLOR_POPCORN, SKINCOLOR_FAIRY, + SKINCOLOR_POPCORN, SKINCOLOR_SEPIA, SKINCOLOR_BEIGE, SKINCOLOR_BROWN, From 2b66daf12daeda781b22be9b48a4163b86c2f53e Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Mon, 11 Mar 2019 00:28:30 -0500 Subject: [PATCH 072/114] Remove P_CanRunOnWater --- src/lua_baselib.c | 14 -------------- src/p_local.h | 2 -- src/p_map.c | 2 +- src/p_maputl.c | 4 ++-- src/p_mobj.c | 23 +---------------------- 5 files changed, 4 insertions(+), 41 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 78f972f8..dde57c2d 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -632,19 +632,6 @@ static int lib_pCheckSolidLava(lua_State *L) return 1; } -static int lib_pCanRunOnWater(lua_State *L) -{ - player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); - //HUDSAFE - if (!player) - return LUA_ErrInvalid(L, "player_t"); - if (!rover) - return LUA_ErrInvalid(L, "ffloor_t"); - lua_pushboolean(L, P_CanRunOnWater(player, rover)); - return 1; -} - static int lib_pSpawnShadowMobj(lua_State *L) { mobj_t *caster = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -2627,7 +2614,6 @@ static luaL_Reg lib[] = { {"P_InsideANonSolidFFloor",lib_pInsideANonSolidFFloor}, {"P_CheckDeathPitCollide",lib_pCheckDeathPitCollide}, {"P_CheckSolidLava",lib_pCheckSolidLava}, - {"P_CanRunOnWater",lib_pCanRunOnWater}, {"P_SpawnShadowMobj",lib_pSpawnShadowMobj}, // p_user diff --git a/src/p_local.h b/src/p_local.h index cf1387fe..1ac613bd 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -274,8 +274,6 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled void P_Attract(mobj_t *source, mobj_t *enemy, boolean nightsgrab); mobj_t *P_GetClosestAxis(mobj_t *source); -boolean P_CanRunOnWater(player_t *player, ffloor_t *rover); - void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration); #define PAL_WHITE 1 #define PAL_MIXUP 2 diff --git a/src/p_map.c b/src/p_map.c index ccb66676..5ed88653 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2096,7 +2096,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) continue; } - if (thing->player && (P_CheckSolidLava(thing, rover) || P_CanRunOnWater(thing->player, rover))) + if (thing->player && P_CheckSolidLava(thing, rover)) ; else if (thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)) ; diff --git a/src/p_maputl.c b/src/p_maputl.c index 1be57399..c5a593d3 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -649,7 +649,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && P_CheckSolidLava(mobj, rover)) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) @@ -693,7 +693,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && P_CheckSolidLava(mobj, rover)) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0130924c..cf085370 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2004,7 +2004,7 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp topheight = P_GetFOFTopZ(mo, sector, rover, mo->x, mo->y, NULL); bottomheight = P_GetFOFBottomZ(mo, sector, rover, mo->x, mo->y, NULL); - if (mo->player && (P_CheckSolidLava(mo, rover) || P_CanRunOnWater(mo->player, rover))) // only the player should be affected + if (mo->player && P_CheckSolidLava(mo, rover)) // only the player should be affected ; else if (motype != 0 && rover->flags & FF_SWIMMABLE) // "scenery" only continue; @@ -3127,27 +3127,6 @@ static boolean P_SceneryZMovement(mobj_t *mo) return true; } -// P_CanRunOnWater -// -// Returns true if player can waterrun on the 3D floor -// -boolean P_CanRunOnWater(player_t *player, ffloor_t *rover) -{ - fixed_t topheight = -#ifdef ESLOPE - *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : -#endif - *rover->topheight; - - if ((player->mo->ceilingz-topheight >= player->mo->height) - && (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale) - && !(player->pflags & PF_SLIDING) - && abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale)) - return false; - - return false; -} - // // P_MobjCheckWater // From 5ca69ce2346e1a8ab72c2134f43f6d1067c97213 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Mon, 11 Mar 2019 09:58:37 -0400 Subject: [PATCH 073/114] Fix compiling with VS --- src/hardware/r_opengl/r_opengl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 3a8be6a0..af3f3cb6 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2056,7 +2056,7 @@ EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransfor EXPORT void HWRAPI(SetTransform) (FTransform *stransform) { static boolean special_splitscreen; - float used_fov; + GLdouble used_fov; pglLoadIdentity(); if (stransform) { @@ -2088,7 +2088,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglLoadIdentity(); if (special_splitscreen) { - used_fov = atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI; + used_fov = atan(tan(used_fov*M_PIl/360)*0.8)*360/M_PIl; GLPerspective(used_fov, 2*ASPECT_RATIO); } else From 0e6083cf02831b765404e4e5094a4da8f62ed1eb Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 11 Mar 2019 18:53:23 +0100 Subject: [PATCH 074/114] Fix what was discussed, minus the rocksneaker math which is still shady, but let's not break what currently works --- src/k_kart.c | 10 +++------- src/p_spec.c | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 32133482..616a6770 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2864,10 +2864,6 @@ void K_DriftDustHandling(mobj_t *spawner) fixed_t spawny = P_RandomRange(-spawnrange, spawnrange)<x + spawnx, spawner->y + spawny, spawner->z, MT_DRIFTDUST); - /*if (spawner->eflags & MFE_VERTICALFLIP) And say something actually bothered supporting it! MatchGenericExtraFlags does this for us now :D - { - dust->z += spawner->height - dust->height; - }*/ dust->momx = FixedMul(spawner->momx + (P_RandomRange(-speedrange, speedrange)<scale)/4); dust->momy = FixedMul(spawner->momy + (P_RandomRange(-speedrange, speedrange)<scale)/4); dust->momz = P_MobjFlip(spawner) * (P_RandomRange(1, 4) * (spawner->scale)); @@ -3900,10 +3896,10 @@ static void K_MoveHeldObjects(player_t *player) { // bobbing, copy pasted from my kimokawaiii entry const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); + fixed_t sine = FixedMul(player->mo->scale, 8 * FINESINE((((2*pi*(4*TICRATE)) * leveltime)>>ANGLETOFINESHIFT) & FINEMASK)); targz = (player->mo->z + (player->mo->height/2)) + sine; if (player->mo->eflags & MFE_VERTICALFLIP) - targz += (player->mo->height/2 - FixedMul(player->mo->scale, 32*FRACUNIT))*6; // No I don't understand why this works either, but it does. + targz += (player->mo->height/2 - 32*player->mo->scale)*6; } @@ -4468,7 +4464,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (P_IsObjectOnGround(player->mo) && player->kartstuff[k_pogospring]) { - if ((player->mo->eflags & MFE_VERTICALFLIP && player->mo->momz >= 0) || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->momz <= 0)) + if (P_MobjFlip(player->mo)*player->mo->momz <= 0) player->kartstuff[k_pogospring] = 0; } diff --git a/src/p_spec.c b/src/p_spec.c index 2088d857..67bb7472 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4247,7 +4247,7 @@ DoneSection2: player->starpostx = player->mo->x>>FRACBITS; player->starposty = player->mo->y>>FRACBITS; player->starpostz = player->mo->floorz>>FRACBITS; - player->kartstuff[k_starpostflip] = player->mo->flags2 = MF2_OBJECTFLIP; // store flipping + player->kartstuff[k_starpostflip] = player->mo->flags2 & MF2_OBJECTFLIP; // store flipping player->starpostangle = player->mo->angle; //R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); torn; a momentum-based guess is less likely to be wrong in general, but when it IS wrong, it fucks you over entirely... } else From bb187c1d2712d1bd11d90d5d375956c67ec534b4 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 11 Mar 2019 12:50:01 -0700 Subject: [PATCH 075/114] Make "Focus lost" HUD overlay optional --- src/m_menu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index fef2a5c7..f919451a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -399,6 +399,8 @@ static void Dummystaff_OnChange(void); // CONSOLE VARIABLES AND THEIR POSSIBLE VALUES GO HERE. // ========================================================================== +consvar_t cv_showfocuslost = {"showfocuslost", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL }; + static CV_PossibleValue_t map_cons_t[] = { {0,"MIN"}, {NUMMAPS, "MAX"}, @@ -1402,6 +1404,8 @@ static menuitem_t OP_HUDOptionsMenu[] = // highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 105 (see M_DrawHUDOptions) {IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120}, + + {IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 135}, }; static menuitem_t OP_ChatOptionsMenu[] = @@ -2880,7 +2884,7 @@ void M_Drawer(void) } // focus lost notification goes on top of everything, even the former everything - if (window_notinfocus) + if (window_notinfocus && cv_showfocuslost.value) { M_DrawTextBox((BASEVIDWIDTH/2) - (60), (BASEVIDHEIGHT/2) - (16), 13, 2); if (gamestate == GS_LEVEL && (P_AutoPause() || paused)) @@ -3162,6 +3166,8 @@ void M_Init(void) COM_AddCommand("manual", Command_Manual_f); + CV_RegisterVar(&cv_showfocuslost); + CV_RegisterVar(&cv_nextmap); CV_RegisterVar(&cv_newgametype); CV_RegisterVar(&cv_chooseskin); From 0f9648eac04bbad17a7f6b7523a138ddb0f2bbc8 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 11 Mar 2019 14:57:11 -0700 Subject: [PATCH 076/114] Miscellaneous window de-focus options Music pausing is now optional. Sounds may be paused--on by default. The game itself being paused in off-line mode is now optional. (showfocuslost now loads from config.) --- src/d_netcmd.c | 2 ++ src/g_game.c | 3 +++ src/g_game.h | 1 + src/m_menu.c | 5 ++-- src/m_menu.h | 1 + src/p_user.c | 2 +- src/s_sound.c | 62 +++++++++++++++++++++++++++++++++++++++++------ src/s_sound.h | 6 +++++ src/sdl/i_video.c | 9 ++++++- 9 files changed, 80 insertions(+), 11 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 438cdcd5..401344fd 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -807,6 +807,8 @@ void D_RegisterClientCommands(void) //CV_RegisterVar(&cv_alwaysfreelook2); //CV_RegisterVar(&cv_chasefreelook); //CV_RegisterVar(&cv_chasefreelook2); + CV_RegisterVar(&cv_showfocuslost); + CV_RegisterVar(&cv_pauseifunfocused); // g_input.c CV_RegisterVar(&cv_turnaxis); diff --git a/src/g_game.c b/src/g_game.c index f0d221ff..cf877664 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -437,6 +437,9 @@ consvar_t cv_chatbacktint = {"chatbacktint", "On", CV_SAVE, CV_OnOff, NULL, 0, N static CV_PossibleValue_t consolechat_cons_t[] = {{0, "Window"}, {1, "Console"}, {2, "Window (Hidden)"}, {0, NULL}}; consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +// Pause game upon window losing focus +consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; + // Display song credits consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/g_game.h b/src/g_game.h index fc7a4a4f..eea149c9 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -56,6 +56,7 @@ extern INT16 rw_maximums[NUM_WEAPONS]; // used in game menu extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection/*, cv_compactscoreboard*/; extern consvar_t cv_songcredits; +extern consvar_t cv_pauseifunfocused; //extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4; extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/; extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/; diff --git a/src/m_menu.c b/src/m_menu.c index f919451a..a6ca7c4d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1318,6 +1318,9 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95}, {IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110}, + + {IT_STRING|IT_CVAR, NULL, "Play Music While Unfocused", &cv_playmusicifunfocused, 125}, + {IT_STRING|IT_CVAR, NULL, "Play SFX While Unfocused", &cv_playsoundifunfocused, 135}, }; /*static menuitem_t OP_DataOptionsMenu[] = @@ -3166,8 +3169,6 @@ void M_Init(void) COM_AddCommand("manual", Command_Manual_f); - CV_RegisterVar(&cv_showfocuslost); - CV_RegisterVar(&cv_nextmap); CV_RegisterVar(&cv_newgametype); CV_RegisterVar(&cv_chooseskin); diff --git a/src/m_menu.h b/src/m_menu.h index 864f4cac..21b48f33 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -211,6 +211,7 @@ typedef struct extern description_t description[32]; +extern consvar_t cv_showfocuslost; extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort; extern CV_PossibleValue_t gametype_cons_t[]; diff --git a/src/p_user.c b/src/p_user.c index e26acdfd..5d8f35e2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -172,7 +172,7 @@ boolean P_AutoPause(void) if (netgame || modeattacking) return false; - return (menuactive || window_notinfocus); + return (menuactive || ( window_notinfocus && cv_pauseifunfocused.value )); } // diff --git a/src/s_sound.c b/src/s_sound.c index 856aa045..e8478844 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -57,6 +57,9 @@ static void GameMIDIMusic_OnChange(void); static void GameSounds_OnChange(void); static void GameDigiMusic_OnChange(void); +static void PlayMusicIfUnfocused_OnChange(void); +static void PlaySoundIfUnfocused_OnChange(void); + // commands for music and sound servers #ifdef MUSSERV consvar_t musserver_cmd = {"musserver_cmd", "musserver", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -110,6 +113,9 @@ consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_O #endif consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, PlayMusicIfUnfocused_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, PlaySoundIfUnfocused_OnChange, 0, NULL, NULL, 0, 0, NULL}; + #define S_MAX_VOLUME 127 // when to clip out sounds @@ -270,6 +276,9 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_gamemidimusic); #endif + CV_RegisterVar(&cv_playmusicifunfocused); + CV_RegisterVar(&cv_playsoundifunfocused); + COM_AddCommand("tunes", Command_Tunes_f); COM_AddCommand("restartaudio", Command_RestartAudio_f); @@ -1978,6 +1987,24 @@ void S_ResumeAudio(void) I_ResumeCD(); } +void S_DisableSound(void) +{ + if (sound_started && !sound_disabled) + { + sound_disabled = true; + S_StopSounds(); + } +} + +void S_EnableSound(void) +{ + if (sound_started && sound_disabled) + { + sound_disabled = false; + S_InitSfxChannels(cv_soundvolume.value); + } +} + void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) { if (digvolume < 0) @@ -2156,15 +2183,11 @@ void GameSounds_OnChange(void) if (sound_disabled) { - sound_disabled = false; - S_InitSfxChannels(cv_soundvolume.value); - S_StartSound(NULL, sfx_strpst); + if (!( cv_playsoundifunfocused.value && window_notinfocus )) + S_EnableSound(); } else - { - sound_disabled = true; - S_StopSounds(); - } + S_DisableSound(); } void GameDigiMusic_OnChange(void) @@ -2251,3 +2274,28 @@ void GameMIDIMusic_OnChange(void) } } #endif + +static void PlayMusicIfUnfocused_OnChange(void) +{ + if (window_notinfocus) + { + if (cv_playmusicifunfocused.value) + I_PauseSong(); + else + I_ResumeSong(); + } +} + +static void PlaySoundIfUnfocused_OnChange(void) +{ + if (!cv_gamesounds.value) + return; + + if (window_notinfocus) + { + if (cv_playsoundifunfocused.value) + S_DisableSound(); + else + S_EnableSound(); + } +} diff --git a/src/s_sound.h b/src/s_sound.h index 1ad519c2..1c938681 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -33,6 +33,8 @@ extern consvar_t cv_gamedigimusic; extern consvar_t cv_gamemidimusic; #endif extern consvar_t cv_gamesounds; +extern consvar_t cv_playmusicifunfocused; +extern consvar_t cv_playsoundifunfocused; #ifdef SNDSERV extern consvar_t sndserver_cmd, sndserver_arg; @@ -169,6 +171,10 @@ void S_StopMusic(void); void S_PauseAudio(void); void S_ResumeAudio(void); +// Enable and disable sound effects +void S_EnableSound(void); +void S_DisableSound(void); + // // Updates music & sounds // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index f64a429a..2c5bf994 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -616,7 +616,11 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) // Tell game we got focus back, resume music if necessary window_notinfocus = false; if (!paused) + { I_ResumeSong(); //resume it + if (cv_gamesounds.value) + S_EnableSound(); + } if (!firsttimeonmouse) { @@ -630,7 +634,10 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { // Tell game we lost focus, pause music window_notinfocus = true; - I_PauseSong(); + if (!cv_playmusicifunfocused.value) + I_PauseSong(); + if (!cv_playsoundifunfocused.value) + S_DisableSound(); if (!disable_mouse) { From 8c40f2a10edd35050d33a8ecf61b3fbd8abbd671 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Mon, 11 Mar 2019 17:23:41 -0500 Subject: [PATCH 077/114] Remove disableSpeedAdjust --- src/dehacked.c | 5 ----- src/doomstat.h | 1 - src/g_game.c | 1 - 3 files changed, 7 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 64a6242f..d6d76b53 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3103,11 +3103,6 @@ static void readmaincfg(MYFILE *f) if (creditscutscene > 128) creditscutscene = 128; } - else if (fastcmp(word, "DISABLESPEEDADJUST")) - { - DEH_WriteUndoline(word, va("%d", disableSpeedAdjust), UNDO_NONE); - disableSpeedAdjust = (value || word2[0] == 'T' || word2[0] == 'Y'); - } else if (fastcmp(word, "NUMDEMOS")) { DEH_WriteUndoline(word, va("%d", numDemos), UNDO_NONE); diff --git a/src/doomstat.h b/src/doomstat.h index 9ae2726d..9f021b64 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -57,7 +57,6 @@ extern boolean modifiedgame; extern boolean majormods; extern UINT16 mainwads; extern boolean savemoddata; // This mod saves time/emblem data. -extern boolean disableSpeedAdjust; // Don't alter the duration of player states if true extern boolean imcontinuing; // Temporary flag while continuing extern boolean metalrecording; diff --git a/src/g_game.c b/src/g_game.c index 47f50e57..12544a8d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -92,7 +92,6 @@ boolean majormods = false; // Set if Lua/Gameplay SOC/replacement map has been a boolean savemoddata = false; UINT8 paused; UINT8 modeattacking = ATTACKING_NONE; -boolean disableSpeedAdjust = true; boolean imcontinuing = false; boolean runemeraldmanager = false; From 1975a9b8855bef88d5fb7a2fd8597ccca41e0ff6 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 11 Mar 2019 21:48:29 -0500 Subject: [PATCH 078/114] Prevent music changes from playing when unfocused --- src/s_sound.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/s_sound.c b/src/s_sound.c index e8478844..2ddffa3f 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1906,6 +1906,10 @@ static boolean S_PlayMusic(boolean looping) } S_InitMusicVolume(); // switch between digi and sequence volume + + if (window_notinfocus && !cv_playmusicifunfocused.value) + I_PauseSong(); + return true; } From 3aa1e7834507f061f6029dd7f61537da5510bbf1 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 11 Mar 2019 22:40:15 -0500 Subject: [PATCH 079/114] Update version and patch hash --- CMakeLists.txt | 2 +- appveyor.yml | 4 ++-- src/config.h.in | 4 ++-- src/doomdef.h | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43142386..3ce321e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) # DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. # Version change is fine. project(SRB2 - VERSION 1.0.2 + VERSION 1.0.4 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index e7ce1b2f..10b65891 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.0.2.{branch}-{build} +version: 1.0.4.{branch}-{build} os: MinGW environment: @@ -29,7 +29,7 @@ environment: ############################## DPL_ENABLED: 0 DPL_TAG_ENABLED: 0 - DPL_INSTALLER_NAME: srb2kart-v102 + DPL_INSTALLER_NAME: srb2kart-v104 # Asset handling is barebones vs. Travis Deployer. We operate on 7z only. # Include the README files and the OpenGL batch in the main and patch archives. # The x86/x64 archives contain the DLL binaries. diff --git a/src/config.h.in b/src/config.h.in index a1f5d0a6..0b66305c 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -37,7 +37,7 @@ * Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb * Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta * Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets - * Last updated 2019 / 02 / 04 - Kart v1.0.3 - patch.kart + * Last updated 2019 / 03 / 11 - Kart v1.0.4 - patch.kart */ // Base SRB2 hashes @@ -52,7 +52,7 @@ #define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964" #define ASSET_HASH_MAPS_KART "1335cd064656aedca359cfbb5233ac4a" #ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "e06c1c90e5645c886026311964f8e1f5" +#define ASSET_HASH_PATCH_KART "440dd7b1e5c3ba27a727fed616f9c362" #endif #endif diff --git a/src/doomdef.h b/src/doomdef.h index d841b9cd..6664ff51 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -150,9 +150,9 @@ extern FILE *logstream; // we use comprevision and compbranch instead. #else #define VERSION 100 // Game version -#define SUBVERSION 3 // more precise version number -#define VERSIONSTRING "v1.0.3" -#define VERSIONSTRINGW L"v1.0.3" +#define SUBVERSION 4 // more precise version number +#define VERSIONSTRING "v1.0.4" +#define VERSIONSTRINGW L"v1.0.4" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -221,7 +221,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 3 +#define MODVERSION 4 // Filter consvars by version // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. From ee3580098b03caa8cbb1cab170e184783e2e9a5e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 12 Mar 2019 07:34:47 -0500 Subject: [PATCH 080/114] Add missing deh entry for k_starpostflip --- src/dehacked.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 46fd207c..cc81600a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8340,6 +8340,7 @@ static const char *const KARTSTUFF_LIST[] = { "NEXTCHECK", "WAYPOINT", "STARPOSTWP", + "STARPOSTFLIP", "RESPAWN", "DROPDASH", @@ -9354,6 +9355,12 @@ void DEH_Check(void) 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*); +#ifdef HAVE_BLUA + const size_t dehkartstuff = sizeof(KARTSTUFF_LIST)/sizeof(const char *); + + if (dehkartstuff != NUMKARTSTUFF) + I_Error("You forgot to update the Dehacked kartstuff list, you dolt!\n(%d props defined, versus %s in the Dehacked list)\n", NUMKARTSTUFF, sizeu1(dehstates)); +#endif if (dehstates != S_FIRSTFREESLOT) I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates)); From bae86bbca4e6dd396af753398ca527091aabf5b6 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 12 Mar 2019 08:39:25 -0500 Subject: [PATCH 081/114] Oh, this was already here... --- src/dehacked.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index cc81600a..1c88fe83 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9355,12 +9355,6 @@ void DEH_Check(void) 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*); -#ifdef HAVE_BLUA - const size_t dehkartstuff = sizeof(KARTSTUFF_LIST)/sizeof(const char *); - - if (dehkartstuff != NUMKARTSTUFF) - I_Error("You forgot to update the Dehacked kartstuff list, you dolt!\n(%d props defined, versus %s in the Dehacked list)\n", NUMKARTSTUFF, sizeu1(dehstates)); -#endif if (dehstates != S_FIRSTFREESLOT) I_Error("You forgot to update the Dehacked states list, you dolt!\n(%d states defined, versus %s in the Dehacked list)\n", S_FIRSTFREESLOT, sizeu1(dehstates)); From 6d751ff30257ce2f24b8f1aadb848438786b2949 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 15 Mar 2019 18:46:25 -0400 Subject: [PATCH 082/114] Remove the define. --- src/w_wad.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 4f014208..c4f9ceca 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1182,19 +1182,17 @@ void zerr(int ret) #define NO_PNG_LUMPS #ifdef NO_PNG_LUMPS -static void ErrorIfPNG(void *d, size_t s, char *f, char *l) +static void ErrorIfPNG(UINT8 *d, size_t s, char *f, char *l) { if (s < 67) // http://garethrees.org/2007/11/14/pngcrush/ return; -#define sigcheck ((UINT8 *)d) // Check for PNG file signature using memcmp // As it may be faster on CPUs with slow unaligned memory access // Ref: http://www.libpng.org/pub/png/spec/1.2/PNG-Rationale.html#R.PNG-file-signature - if (memcmp(&sigcheck[0], "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0) + if (memcmp(&d[0], "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a", 8) == 0) { I_Error("W_Wad: Lump \"%s\" in file \"%s\" is a .PNG - please convert to either Doom or Flat (raw) image format.", l, f); } -#undef sigcheck } #endif From abc479980cc2abbd6c7af963bd2a9131e1f6e4f9 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 16 Mar 2019 00:35:13 -0500 Subject: [PATCH 083/114] Update patch.kart hash again --- src/config.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h.in b/src/config.h.in index 0b66305c..bd7e7861 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -52,7 +52,7 @@ #define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964" #define ASSET_HASH_MAPS_KART "1335cd064656aedca359cfbb5233ac4a" #ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "440dd7b1e5c3ba27a727fed616f9c362" +#define ASSET_HASH_PATCH_KART "b5f48e1abccfa47a5745199182e2fef4" #endif #endif From cd4fc40b9e157cf114853555ad4d9c1d992e45f2 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 16 Mar 2019 00:39:52 -0500 Subject: [PATCH 084/114] Cache colormaps everywhere to avoid memory leaks --- src/f_finale.c | 6 +++++- src/k_kart.c | 20 ++++++++++---------- src/m_menu.c | 24 ++++++++++++------------ src/r_draw.h | 2 ++ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index b863ea74..fb67e927 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -611,7 +611,7 @@ void F_CreditDrawer(void) if (credits_pics[i].colorize != SKINCOLOR_NONE) { - colormap = R_GetTranslationColormap(TC_RAINBOW, credits_pics[i].colorize, 0); + colormap = R_GetTranslationColormap(TC_RAINBOW, credits_pics[i].colorize, GTC_MENUCACHE); sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics } @@ -1103,6 +1103,10 @@ void F_StartWaitingPlayers(void) finalecount = 0; randskin = M_RandomKey(numskins); + + if (waitcolormap) + Z_Free(waitcolormap); + waitcolormap = R_GetTranslationColormap(randskin, skins[randskin].prefcolor, 0); for (i = 0; i < 2; i++) diff --git a/src/k_kart.c b/src/k_kart.c index 1190ab4f..04901f86 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6989,7 +6989,7 @@ static void K_drawKartItem(void) } if (localcolor != SKINCOLOR_NONE) - colmap = R_GetTranslationColormap(colormode, localcolor, 0); + colmap = R_GetTranslationColormap(colormode, localcolor, GTC_CACHE); V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, localbg); @@ -7651,7 +7651,7 @@ static void K_drawKartSpeedometer(void) static void K_drawKartBumpersOrKarma(void) { - UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); + UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE); INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); INT32 fx = 0, fy = 0, fflags = 0; boolean flipstring = false; // same as laps, used for splitscreen @@ -7859,7 +7859,7 @@ static void K_drawKartPlayerCheck(void) else if (x > 306) x = 306; - colormap = R_GetTranslationColormap(TC_DEFAULT, players[i].mo->color, 0); + colormap = R_GetTranslationColormap(TC_DEFAULT, players[i].mo->color, GTC_CACHE); V_DrawMappedPatch(x, CHEK_Y, V_HUDTRANS|splitflags, kp_check[pnum], colormap); } } @@ -8388,16 +8388,16 @@ static void K_drawKartFirstPerson(void) // drift sparks! if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsthree)) - colmap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), 0); + colmap = R_GetTranslationColormap(TC_RAINBOW, (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))), GTC_CACHE); else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dstwo)) - colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, 0); + colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_KETCHUP, GTC_CACHE); else if ((leveltime & 1) && (stplyr->kartstuff[k_driftcharge] >= dsone)) - colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, 0); + colmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_SAPPHIRE, GTC_CACHE); else #endif // invincibility/grow/shrink! if (stplyr->mo->colorized && stplyr->mo->color) - colmap = R_GetTranslationColormap(TC_RAINBOW, stplyr->mo->color, 0); + colmap = R_GetTranslationColormap(TC_RAINBOW, stplyr->mo->color, GTC_CACHE); } V_DrawFixedPatch(x, y, scale, splitflags, kp_fpview[target], colmap); @@ -8507,7 +8507,7 @@ static void K_drawInput(void) else { UINT8 *colormap; - colormap = R_GetTranslationColormap(0, stplyr->skincolor, 0); + colormap = R_GetTranslationColormap(0, stplyr->skincolor, GTC_CACHE); V_DrawFixedPatch(x<kartstuff[k_lapanimation]; - UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0); + UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE); V_DrawFixedPatch((BASEVIDWIDTH/2 + (32*max(0, stplyr->kartstuff[k_lapanimation]-76)))*FRACUNIT, (48 - (32*max(0, progress-76)))*FRACUNIT, @@ -8906,7 +8906,7 @@ void K_drawKartHUD(void) for (c = 1; c < MAXSKINCOLORS; c++) { - UINT8 *cm = R_GetTranslationColormap(TC_RAINBOW, c, 0); + UINT8 *cm = R_GetTranslationColormap(TC_RAINBOW, c, GTC_CACHE); V_DrawFixedPatch(x<>1, 0, facewantprefix[stplyr->skin], cm); x += 16; diff --git a/src/m_menu.c b/src/m_menu.c index 873c04a3..3b4e98fa 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3474,7 +3474,7 @@ static void M_DrawMapEmblems(INT32 mapnum, INT32 x, INT32 y) if (emblem->collected) V_DrawSmallMappedPatch(x, y, 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE)); else V_DrawSmallScaledPatch(x, y, 0, W_CachePatchName("NEEDIT", PU_CACHE)); @@ -3811,7 +3811,7 @@ static void M_DrawPauseMenu(void) if (emblem->collected) V_DrawSmallMappedPatch(40, 44 + (i*8), 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE)); else V_DrawSmallScaledPatch(40, 44 + (i*8), 0, W_CachePatchName("NEEDIT", PU_CACHE)); @@ -5359,7 +5359,7 @@ static void M_DrawEmblemHints(void) { collected = recommendedflags; V_DrawMappedPatch(12, 12+(28*j), 0, W_CachePatchName(M_GetEmblemPatch(emblem), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE)); } else { @@ -5702,7 +5702,7 @@ static void M_DrawLoadGameData(void) V_DrawScaledPatch(SP_LoadDef.x,144+8,0,W_CachePatchName(skins[savegameinfo[saveSlotSelected].skinnum].face, PU_CACHE)); else { - UINT8 *colormap = R_GetTranslationColormap(savegameinfo[saveSlotSelected].skinnum, savegameinfo[saveSlotSelected].skincolor, 0); + UINT8 *colormap = R_GetTranslationColormap(savegameinfo[saveSlotSelected].skinnum, savegameinfo[saveSlotSelected].skincolor, GTC_MENUCACHE); V_DrawMappedPatch(SP_LoadDef.x,144+8,0,W_CachePatchName(skins[savegameinfo[saveSlotSelected].skinnum].face, PU_CACHE), colormap); } @@ -6392,7 +6392,7 @@ static void M_DrawStatsMaps(int location) if (exemblem->collected) V_DrawSmallMappedPatch(295, y, 0, W_CachePatchName(M_GetExtraEmblemPatch(exemblem), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetExtraEmblemColor(exemblem), GTC_CACHE)); + R_GetTranslationColormap(TC_DEFAULT, M_GetExtraEmblemColor(exemblem), GTC_MENUCACHE)); else V_DrawSmallScaledPatch(295, y, 0, W_CachePatchName("NEEDIT", PU_CACHE)); @@ -6527,7 +6527,7 @@ void M_DrawTimeAttackMenu(void) // Character face! if (W_CheckNumForName(skins[cv_chooseskin.value-1].facewant) != LUMPERROR) { - UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, 0); + UINT8 *colormap = R_GetTranslationColormap(cv_chooseskin.value-1, cv_playercolor.value, GTC_MENUCACHE); V_DrawMappedPatch(BASEVIDWIDTH-x - SHORT(facewantprefix[cv_chooseskin.value-1]->width), y, 0, facewantprefix[cv_chooseskin.value-1], colormap); } @@ -6652,7 +6652,7 @@ void M_DrawTimeAttackMenu(void) if (em->collected) V_DrawMappedPatch(BASEVIDWIDTH - 64 - 24, y+48, 0, W_CachePatchName(M_GetEmblemPatch(em), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_CACHE)); + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_MENUCACHE)); else V_DrawScaledPatch(BASEVIDWIDTH - 64 - 24, y+48, 0, W_CachePatchName("NEEDIT", PU_CACHE)); @@ -6812,7 +6812,7 @@ static boolean M_QuitTimeAttackMenu(void) if (em->collected) V_DrawSmallMappedPatch(160+88, yHeight, 0, W_CachePatchName(M_GetEmblemPatch(em), PU_CACHE), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_CACHE)); + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(em), GTC_MENUCACHE)); else V_DrawSmallScaledPatch(160+88, yHeight, 0, W_CachePatchName("NEEDIT", PU_CACHE)); @@ -7886,7 +7886,7 @@ Update the maxplayers label... if (!trans && i > cv_splitplayers.value) trans = V_TRANSLUCENT; - colmap = R_GetTranslationColormap(pskin, pcol, 0); + colmap = R_GetTranslationColormap(pskin, pcol, GTC_MENUCACHE); V_DrawFixedPatch(x< Date: Sat, 16 Mar 2019 01:29:13 -0500 Subject: [PATCH 085/114] Remove dumb special case --- src/p_map.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index d33b9e06..256c9cef 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2787,8 +2787,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #ifdef ESLOPE - // HACK TO FIX DSZ2: apply only if slopes are involved - else if (tmceilingslope && tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) + else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2801,8 +2800,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #ifdef ESLOPE - // HACK TO FIX DSZ2: apply only if slopes are involved - else if (tmfloorslope && tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) + else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) { thing->z = thing->floorz = tmfloorz; thing->eflags |= MFE_JUSTSTEPPEDDOWN; From 0b1cc92f1a00f1a686ebafcb5b03490e9c8e3891 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 16 Mar 2019 02:19:43 -0500 Subject: [PATCH 086/114] Allow reading ticcmd latency --- src/lua_playerlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 1c37f4c4..73d5ecbc 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -743,6 +743,8 @@ static int ticcmd_get(lua_State *L) lua_pushinteger(L, cmd->buttons); else if (fastcmp(field,"driftturn")) lua_pushinteger(L, cmd->driftturn); + else if (fastcmp(field,"latency")) + lua_pushinteger(L, cmd->latency); else return NOFIELD; From 875506e6cc7cbef9e4b02f284ceaa7033d2add48 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 16 Mar 2019 12:22:11 -0500 Subject: [PATCH 087/114] Don't free this cached colormap! --- src/m_menu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 3b4e98fa..3ad076ff 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8324,8 +8324,6 @@ static void M_DrawSetupMultiPlayerMenu(void) } else V_DrawMappedPatch(mx+43, my+131, flags, patch, colormap); - - Z_Free(colormap); } #undef charw } From 50c0ed0f0719e1d576d014ecac7c7340e9e57e16 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 16 Mar 2019 14:56:56 -0500 Subject: [PATCH 088/114] Fix bad merge in map data archiving code --- src/p_saveg.c | 151 ++++++++++++++++++++++++-------------------------- 1 file changed, 73 insertions(+), 78 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 0f199f8c..0061ee02 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -679,89 +679,84 @@ static void P_NetArchiveWorld(void) WRITEUINT16(put, 0xffff); - mld = W_CacheLumpNum(lastloadedmaplumpnum+ML_LINEDEFS, PU_CACHE); - msd = W_CacheLumpNum(lastloadedmaplumpnum+ML_SIDEDEFS, PU_CACHE); - if (mld && msd) + // do lines + for (i = 0; i < numlines; i++, mld++, li++) { - // do lines - for (i = 0; i < numlines; i++, mld++, li++) + diff = diff2 = 0; + + if (li->special != SHORT(mld->special)) + diff |= LD_SPECIAL; + + if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved + diff |= LD_CLLCOUNT; + + if (li->sidenum[0] != 0xffff) { - diff = diff2 = 0; + si = &sides[li->sidenum[0]]; + if (si->textureoffset != SHORT(msd[li->sidenum[0]].textureoffset)<sidenum[0]].toptexture) != -1 + && si->toptexture != R_TextureNumForName(msd[li->sidenum[0]].toptexture)) + diff |= LD_S1TOPTEX; + if (R_CheckTextureNumForName(msd[li->sidenum[0]].bottomtexture) != -1 + && si->bottomtexture != R_TextureNumForName(msd[li->sidenum[0]].bottomtexture)) + diff |= LD_S1BOTTEX; + if (R_CheckTextureNumForName(msd[li->sidenum[0]].midtexture) != -1 + && si->midtexture != R_TextureNumForName(msd[li->sidenum[0]].midtexture)) + diff |= LD_S1MIDTEX; + } + if (li->sidenum[1] != 0xffff) + { + si = &sides[li->sidenum[1]]; + if (si->textureoffset != SHORT(msd[li->sidenum[1]].textureoffset)<sidenum[1]].toptexture) != -1 + && si->toptexture != R_TextureNumForName(msd[li->sidenum[1]].toptexture)) + diff2 |= LD_S2TOPTEX; + if (R_CheckTextureNumForName(msd[li->sidenum[1]].bottomtexture) != -1 + && si->bottomtexture != R_TextureNumForName(msd[li->sidenum[1]].bottomtexture)) + diff2 |= LD_S2BOTTEX; + if (R_CheckTextureNumForName(msd[li->sidenum[1]].midtexture) != -1 + && si->midtexture != R_TextureNumForName(msd[li->sidenum[1]].midtexture)) + diff2 |= LD_S2MIDTEX; + if (diff2) + diff |= LD_DIFF2; + } - if (li->special != SHORT(mld->special)) - diff |= LD_SPECIAL; + if (diff) + { + statline++; + WRITEINT16(put, i); + WRITEUINT8(put, diff); + if (diff & LD_DIFF2) + WRITEUINT8(put, diff2); + if (diff & LD_FLAG) + WRITEINT16(put, li->flags); + if (diff & LD_SPECIAL) + WRITEINT16(put, li->special); + if (diff & LD_CLLCOUNT) + WRITEINT16(put, li->callcount); - if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved - diff |= LD_CLLCOUNT; + si = &sides[li->sidenum[0]]; + if (diff & LD_S1TEXOFF) + WRITEFIXED(put, si->textureoffset); + if (diff & LD_S1TOPTEX) + WRITEINT32(put, si->toptexture); + if (diff & LD_S1BOTTEX) + WRITEINT32(put, si->bottomtexture); + if (diff & LD_S1MIDTEX) + WRITEINT32(put, si->midtexture); - if (li->sidenum[0] != 0xffff) - { - si = &sides[li->sidenum[0]]; - if (si->textureoffset != SHORT(msd[li->sidenum[0]].textureoffset)<sidenum[0]].toptexture) != -1 - && si->toptexture != R_TextureNumForName(msd[li->sidenum[0]].toptexture)) - diff |= LD_S1TOPTEX; - if (R_CheckTextureNumForName(msd[li->sidenum[0]].bottomtexture) != -1 - && si->bottomtexture != R_TextureNumForName(msd[li->sidenum[0]].bottomtexture)) - diff |= LD_S1BOTTEX; - if (R_CheckTextureNumForName(msd[li->sidenum[0]].midtexture) != -1 - && si->midtexture != R_TextureNumForName(msd[li->sidenum[0]].midtexture)) - diff |= LD_S1MIDTEX; - } - if (li->sidenum[1] != 0xffff) - { - si = &sides[li->sidenum[1]]; - if (si->textureoffset != SHORT(msd[li->sidenum[1]].textureoffset)<sidenum[1]].toptexture) != -1 - && si->toptexture != R_TextureNumForName(msd[li->sidenum[1]].toptexture)) - diff2 |= LD_S2TOPTEX; - if (R_CheckTextureNumForName(msd[li->sidenum[1]].bottomtexture) != -1 - && si->bottomtexture != R_TextureNumForName(msd[li->sidenum[1]].bottomtexture)) - diff2 |= LD_S2BOTTEX; - if (R_CheckTextureNumForName(msd[li->sidenum[1]].midtexture) != -1 - && si->midtexture != R_TextureNumForName(msd[li->sidenum[1]].midtexture)) - diff2 |= LD_S2MIDTEX; - if (diff2) - diff |= LD_DIFF2; - } - - if (diff) - { - statline++; - WRITEINT16(put, i); - WRITEUINT8(put, diff); - if (diff & LD_DIFF2) - WRITEUINT8(put, diff2); - if (diff & LD_FLAG) - WRITEINT16(put, li->flags); - if (diff & LD_SPECIAL) - WRITEINT16(put, li->special); - if (diff & LD_CLLCOUNT) - WRITEINT16(put, li->callcount); - - si = &sides[li->sidenum[0]]; - if (diff & LD_S1TEXOFF) - WRITEFIXED(put, si->textureoffset); - if (diff & LD_S1TOPTEX) - WRITEINT32(put, si->toptexture); - if (diff & LD_S1BOTTEX) - WRITEINT32(put, si->bottomtexture); - if (diff & LD_S1MIDTEX) - WRITEINT32(put, si->midtexture); - - si = &sides[li->sidenum[1]]; - if (diff2 & LD_S2TEXOFF) - WRITEFIXED(put, si->textureoffset); - if (diff2 & LD_S2TOPTEX) - WRITEINT32(put, si->toptexture); - if (diff2 & LD_S2BOTTEX) - WRITEINT32(put, si->bottomtexture); - if (diff2 & LD_S2MIDTEX) - WRITEINT32(put, si->midtexture); - } + si = &sides[li->sidenum[1]]; + if (diff2 & LD_S2TEXOFF) + WRITEFIXED(put, si->textureoffset); + if (diff2 & LD_S2TOPTEX) + WRITEINT32(put, si->toptexture); + if (diff2 & LD_S2BOTTEX) + WRITEINT32(put, si->bottomtexture); + if (diff2 & LD_S2MIDTEX) + WRITEINT32(put, si->midtexture); } } WRITEUINT16(put, 0xffff); From 5057c37dfb03e10a5040f313ee72c2682cc46c7d Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 16 Mar 2019 15:42:18 -0700 Subject: [PATCH 089/114] Move change viewpoint control checking so it doesn't take precedence Notably over chat. --- src/g_game.c | 148 +++++++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index cf877664..41ae140a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1823,80 +1823,6 @@ static INT32 spectatedelay, spectatedelay2, spectatedelay3, spectatedelay4 = 0; // boolean G_Responder(event_t *ev) { - // allow spy mode changes even during the demo - if (gamestate == GS_LEVEL && ev->type == ev_keydown - && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) - { - if (splitscreen || !netgame) - displayplayer = consoleplayer; - else - { - UINT8 i = 0; // spy mode - for (i = 0; i < MAXPLAYERS; i++) - { - displayplayer++; - if (displayplayer == MAXPLAYERS) - displayplayer = 0; - - if (displayplayer == consoleplayer) - break; // End loop - - if (!playeringame[displayplayer]) - continue; - - if (players[displayplayer].spectator) - continue; - - // SRB2Kart: Only go through players who are actually playing - if (players[displayplayer].exiting) - continue; - - if (players[displayplayer].pflags & PF_TIMEOVER) - continue; - - // I don't know if we want this actually, but I'll humor the suggestion anyway - if (G_BattleGametype()) - { - if (players[displayplayer].kartstuff[k_bumper] <= 0) - continue; - } - - // SRB2Kart: we have no team-based modes, YET... - /*if (G_GametypeHasTeams()) - { - if (players[consoleplayer].ctfteam - && players[displayplayer].ctfteam != players[consoleplayer].ctfteam) - continue; - } - else if (gametype == GT_HIDEANDSEEK) - { - if (players[consoleplayer].pflags & PF_TAGIT) - continue; - } - // Other Tag-based gametypes? - else if (G_TagGametype()) - { - if (!players[consoleplayer].spectator - && (players[consoleplayer].pflags & PF_TAGIT) != (players[displayplayer].pflags & PF_TAGIT)) - continue; - } - else if (G_GametypeHasSpectators() && G_BattleGametype()) - { - if (!players[consoleplayer].spectator) - continue; - }*/ - - break; - } - - // change statusbar also if playing back demo - if (singledemo) - ST_changeDemoView(); - - return true; - } - } - // any other key pops up menu if in demos if (gameaction == ga_nothing && !singledemo && ((demoplayback && !modeattacking && !titledemo) || gamestate == GS_TITLESCREEN)) @@ -1974,6 +1900,80 @@ boolean G_Responder(event_t *ev) if (HU_Responder(ev)) return true; // chat ate the event + // allow spy mode changes even during the demo + if (gamestate == GS_LEVEL && ev->type == ev_keydown + && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) + { + if (splitscreen || !netgame) + displayplayer = consoleplayer; + else + { + UINT8 i = 0; // spy mode + for (i = 0; i < MAXPLAYERS; i++) + { + displayplayer++; + if (displayplayer == MAXPLAYERS) + displayplayer = 0; + + if (displayplayer == consoleplayer) + break; // End loop + + if (!playeringame[displayplayer]) + continue; + + if (players[displayplayer].spectator) + continue; + + // SRB2Kart: Only go through players who are actually playing + if (players[displayplayer].exiting) + continue; + + if (players[displayplayer].pflags & PF_TIMEOVER) + continue; + + // I don't know if we want this actually, but I'll humor the suggestion anyway + if (G_BattleGametype()) + { + if (players[displayplayer].kartstuff[k_bumper] <= 0) + continue; + } + + // SRB2Kart: we have no team-based modes, YET... + /*if (G_GametypeHasTeams()) + { + if (players[consoleplayer].ctfteam + && players[displayplayer].ctfteam != players[consoleplayer].ctfteam) + continue; + } + else if (gametype == GT_HIDEANDSEEK) + { + if (players[consoleplayer].pflags & PF_TAGIT) + continue; + } + // Other Tag-based gametypes? + else if (G_TagGametype()) + { + if (!players[consoleplayer].spectator + && (players[consoleplayer].pflags & PF_TAGIT) != (players[displayplayer].pflags & PF_TAGIT)) + continue; + } + else if (G_GametypeHasSpectators() && G_BattleGametype()) + { + if (!players[consoleplayer].spectator) + continue; + }*/ + + break; + } + + // change statusbar also if playing back demo + if (singledemo) + ST_changeDemoView(); + + return true; + } + } + // update keys current state G_MapEventsToControls(ev); From 70f40d54cb89fe22333597cbdc4d80fec73e0f55 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 16 Mar 2019 15:50:16 -0700 Subject: [PATCH 090/114] Resume sounds on unpausing after a window re-focus --- src/sdl/i_video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 2c5bf994..56766fbb 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -615,12 +615,12 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { // Tell game we got focus back, resume music if necessary window_notinfocus = false; + if (!paused) - { I_ResumeSong(); //resume it - if (cv_gamesounds.value) - S_EnableSound(); - } + + if (cv_gamesounds.value) + S_EnableSound(); if (!firsttimeonmouse) { From af17038cfb3dc84fd458a31d0830f097219e3435 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 17 Mar 2019 21:44:11 -0500 Subject: [PATCH 091/114] LAT --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 04901f86..70075858 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2546,14 +2546,14 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 // Spawns the purely visual explosion void K_SpawnMineExplosion(mobj_t *source, UINT8 color) { - INT32 i, radius, height; - mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING); - K_MatchGenericExtraFlags(smoldering, source); - mobj_t *dust; mobj_t *truc; INT32 speed, speed2; + INT32 i, radius, height; + mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING); + K_MatchGenericExtraFlags(smoldering, source); + smoldering->tics = TICRATE*3; radius = source->radius>>FRACBITS; height = source->height>>FRACBITS; From d03c53930bfa9f0265ec27223a6a4baa20bb0a73 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 18 Mar 2019 16:50:17 -0400 Subject: [PATCH 092/114] Update CMakeLists.txt, remove CMAKE_SIZEOF_VOID_P check --- CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6eb065d0..11898db5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,14 +54,6 @@ macro(copy_files_to_build_dir target dlllist_var) endif() endmacro() -# 64-bit check -if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - message(STATUS "Target is 64-bit") - set(SRB2_SYSTEM_BITS 64) -else() - set(SRB2_SYSTEM_BITS 32) -endif() - # OS macros if (UNIX) add_definitions(-DUNIXCOMMON) @@ -73,9 +65,6 @@ endif() if(${CMAKE_SYSTEM} MATCHES "Linux") add_definitions(-DLINUX) - if(${SRB2_SYSTEM_BITS} EQUAL 64) - add_definitions(-DLINUX64) - endif() endif() if(${CMAKE_SYSTEM} MATCHES "Darwin") From 6142becb4d88e638326c136982e6191aaa6a137d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 18 Mar 2019 23:58:31 -0400 Subject: [PATCH 093/114] Revert "Update CMakeLists.txt, remove CMAKE_SIZEOF_VOID_P check" This reverts commit d03c53930bfa9f0265ec27223a6a4baa20bb0a73. --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11898db5..6eb065d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,14 @@ macro(copy_files_to_build_dir target dlllist_var) endif() endmacro() +# 64-bit check +if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + message(STATUS "Target is 64-bit") + set(SRB2_SYSTEM_BITS 64) +else() + set(SRB2_SYSTEM_BITS 32) +endif() + # OS macros if (UNIX) add_definitions(-DUNIXCOMMON) @@ -65,6 +73,9 @@ endif() if(${CMAKE_SYSTEM} MATCHES "Linux") add_definitions(-DLINUX) + if(${SRB2_SYSTEM_BITS} EQUAL 64) + add_definitions(-DLINUX64) + endif() endif() if(${CMAKE_SYSTEM} MATCHES "Darwin") From 49dddf54ab4ee6ad41dd5c3b00d2f4af33cd9fe8 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 19 Mar 2019 00:04:14 -0400 Subject: [PATCH 094/114] CMake: check if CMAKE_SIZEOF_VOID_P is defined on Mac? --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6eb065d0..75aa82f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,8 @@ macro(copy_files_to_build_dir target dlllist_var) endmacro() # 64-bit check -if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) +message(STATUS "CMAKE_SIZEOF_VOID_P=" ${CMAKE_SIZEOF_VOID_P}) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Target is 64-bit") set(SRB2_SYSTEM_BITS 64) else() From 1c55daef2a5612bca39d47d490f82987cface0a9 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 19 Mar 2019 09:10:25 -0400 Subject: [PATCH 095/114] CMake: have funny check for empty CMAKE_SIZEOF_VOID_P --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75aa82f3..0a5507b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,14 +54,19 @@ macro(copy_files_to_build_dir target dlllist_var) endif() endmacro() -# 64-bit check -message(STATUS "CMAKE_SIZEOF_VOID_P=" ${CMAKE_SIZEOF_VOID_P}) +# bitness check +set(SRB2_SYSTEM_BITS 0) if(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Target is 64-bit") set(SRB2_SYSTEM_BITS 64) -else() +endif() +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + message(STATUS "Target is 32-bit") set(SRB2_SYSTEM_BITS 32) endif() +if(${SRB2_SYSTEM_BITS} EQUAL 0) + message(STATUS "Target bitness is unknown") +endif() # OS macros if (UNIX) From f139ffd1dc6c757806c506f0925f2b5a612ab475 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 20 Mar 2019 19:20:34 -0700 Subject: [PATCH 096/114] Let localhost connections --- src/i_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index f8a65b75..37e35557 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -612,7 +612,7 @@ static boolean SOCK_Get(void) if (c != ERRSOCKET) { // find remote node number - for (j = 0; j <= MAXNETNODES; j++) //include LAN + for (j = 1; j <= MAXNETNODES; j++) //include LAN { if (SOCK_cmpaddr(&fromaddress, &clientaddress[j], 0)) { From ed0f8fd96765fec8ac9b6407db7118669b07ddde Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 20 Mar 2019 20:05:45 -0700 Subject: [PATCH 097/114] Actually allow connecting to "localhost" Because IPv6 doesn't seem to work anyway. --- src/i_tcp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 37e35557..11a84ceb 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1340,8 +1340,12 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port) while (runp != NULL) { // find ip of the server - memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen); - runp = NULL; + if (sendto(mysockets[0], NULL, 0, 0, runp->ai_addr, runp->ai_addrlen) == 0) + { + memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen); + break; + } + runp = runp->ai_next; } I_freeaddrinfo(ai); return newnode; From 147221cf6e67f8d0a4260a265127030efbd880b3 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 25 Mar 2019 18:54:47 +0000 Subject: [PATCH 098/114] R_RenderThickSideRange: clamp lights that fail overflow test, rather than skipping them. --- src/r_segs.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 74836526..7495d788 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -862,16 +862,18 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) leftheight -= viewz; rightheight -= viewz; -#define OVERFLOWTEST(height, scale) \ - overflow_test = (INT64)centeryfrac - (((INT64)height*scale)>>FRACBITS); \ - if (overflow_test < 0) overflow_test = -overflow_test; \ - if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue; +#define CLAMPMAX INT32_MAX +#define CLAMPMIN (-INT32_MAX) // This is not INT32_MIN on purpose! INT32_MIN makes the drawers freak out. + // Monster Iestyn (25/03/18): do not skip these lights if they fail overflow test, just clamp them instead so they behave. + overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS); + if (overflow_test > (INT64)CLAMPMAX) rlight->height = CLAMPMAX; + else if (overflow_test > (INT64)CLAMPMIN) rlight->height = (fixed_t)overflow_test; + else rlight->height = CLAMPMIN; - OVERFLOWTEST(leftheight, ds->scale1) - OVERFLOWTEST(rightheight, ds->scale2) - - rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); - rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); + overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS); + if (overflow_test > (INT64)CLAMPMAX) rlight->heightstep = CLAMPMAX; + else if (overflow_test > (INT64)CLAMPMIN) rlight->heightstep = (fixed_t)overflow_test; + else rlight->heightstep = CLAMPMIN; rlight->heightstep = (rlight->heightstep-rlight->height)/(range); #else if (light->height < *pfloor->bottomheight) @@ -893,12 +895,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) leftheight -= viewz; rightheight -= viewz; - OVERFLOWTEST(leftheight, ds->scale1) - OVERFLOWTEST(rightheight, ds->scale2) -#undef OVERFLOWTEST + // Monster Iestyn (25/03/18): do not skip these lights if they fail overflow test, just clamp them instead so they behave. + overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS); + if (overflow_test > (INT64)CLAMPMAX) rlight->botheight = CLAMPMAX; + else if (overflow_test > (INT64)CLAMPMIN) rlight->botheight = (fixed_t)overflow_test; + else rlight->botheight = CLAMPMIN; - rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1); - rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); + overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS); + if (overflow_test > (INT64)CLAMPMAX) rlight->botheightstep = CLAMPMAX; + else if (overflow_test > (INT64)CLAMPMIN) rlight->botheightstep = (fixed_t)overflow_test; + else rlight->botheightstep = CLAMPMIN; rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range); #else lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight; @@ -1071,9 +1077,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) } #endif -#define CLAMPMAX INT32_MAX -#define CLAMPMIN (-INT32_MAX) // This is not INT32_MIN on purpose! INT32_MIN makes the drawers freak out. - // draw the columns for (dc_x = x1; dc_x <= x2; dc_x++) { From 9a8d36b822839252059701dd4824d3fbafe45e04 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:16:43 -0400 Subject: [PATCH 099/114] Travis-CI: use a new version of xcode and use homebrew add-on to install packages --- .travis.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4bfc5886..07640f83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -222,7 +222,16 @@ matrix: # osx_image: xcode7.2 # #Apple LLVM version 7.0.2 (clang-700.1.81) - os: osx - osx_image: xcode7.3 + #osx_image: xcode7.3 + addons: + homebrew: + packages: + - sdl2 + - sdl2_mixer + - game-music-emu + - p7zip + - cmake + update: false #Apple LLVM version 7.3.0 (clang-703.0.31) allow_failures: - compiler: clang-3.5 @@ -258,9 +267,6 @@ before_script: - cmake .. -DCMAKE_BUILD_TYPE=Release before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2 sdl2_mixer game-music-emu p7zip; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmake||true; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi - mkdir -p $HOME/srb2_cache From c4e8a601127d205ff9b36e26cf8b2b61a911700c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:21:52 -0400 Subject: [PATCH 100/114] CircleCI: also test compiling without BLUA support --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3674a9e..e5892b7c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,8 +43,8 @@ jobs: - /var/cache/apt/archives - checkout - run: - name: Compile without network support - command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 + name: Compile without network support and BLUA + command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1 - run: name: Clean build command: make -C src LINUX=1 clean From fe22fdc5a36fb2769ee83b880a873aa6375a6319 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:30:25 -0400 Subject: [PATCH 101/114] P_SuperDamage() is too big for inlining --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 009a2be1..29450f6e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2643,7 +2643,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) } } -static inline void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) +static void P_SuperDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) { fixed_t fallbackspeed; angle_t ang; From a8681a5b7262d013daea99250139e28d0884b4c6 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:34:25 -0400 Subject: [PATCH 102/114] CircleCI: rebuild depend file with BLUA --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e5892b7c..1b0cf340 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,10 @@ jobs: name: Compile without network support and BLUA command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1 - run: - name: Clean build + name: wipe build + command: make -C src LINUX=1 cleandep + - run: + name: rebuild depend command: make -C src LINUX=1 clean - restore_cache: keys: From 3ab0f675ecbe0d9a79ed4a0cb39c2f7903dba457 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:44:33 -0400 Subject: [PATCH 103/114] TravisCI: move homebrew packages for all mac builds --- .travis.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07640f83..78a0a30d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -223,15 +223,6 @@ matrix: # #Apple LLVM version 7.0.2 (clang-700.1.81) - os: osx #osx_image: xcode7.3 - addons: - homebrew: - packages: - - sdl2 - - sdl2_mixer - - game-music-emu - - p7zip - - cmake - update: false #Apple LLVM version 7.3.0 (clang-703.0.31) allow_failures: - compiler: clang-3.5 @@ -256,6 +247,14 @@ addons: - libgl1-mesa-dev - libgme-dev - p7zip-full + homebrew: + packages: + - sdl2_mixer + - game-music-emu + - p7zip + - cmake + update: false + before_script: - wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2115-assets-2.7z -O $HOME/srb2_cache/SRB2-v2115-assets-2.7z From 594c906376293942a73ef43ef70b13f421420512 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:48:33 -0400 Subject: [PATCH 104/114] use default osx image --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78a0a30d..f0ed0a8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -221,9 +221,11 @@ matrix: # - os: osx # osx_image: xcode7.2 # #Apple LLVM version 7.0.2 (clang-700.1.81) +# - os: osx +# osx_image: xcode7.3 +# #Apple LLVM version 7.3.0 (clang-703.0.31) - os: osx - #osx_image: xcode7.3 - #Apple LLVM version 7.3.0 (clang-703.0.31) + #Default: macOS 10.13 and Xcode 9.4.1 allow_failures: - compiler: clang-3.5 - compiler: clang-3.6 From 3472bf857cab6238fcd9d77013ea97517df48967 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 15:51:13 -0400 Subject: [PATCH 105/114] TravisCI: build custom sdl2_mixer build --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f0ed0a8e..7ef0127b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -251,7 +251,7 @@ addons: - p7zip-full homebrew: packages: - - sdl2_mixer + - sdl2 - game-music-emu - p7zip - cmake @@ -268,6 +268,7 @@ before_script: - cmake .. -DCMAKE_BUILD_TYPE=Release before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi - mkdir -p $HOME/srb2_cache From ec0afaf6c9706760428df566af790de9a9ebefe3 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 16:02:30 -0400 Subject: [PATCH 106/114] TravisCI: try updating homebew --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7ef0127b..db81b9d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -255,7 +255,7 @@ addons: - game-music-emu - p7zip - cmake - update: false + update: true before_script: From 9de5055d7fadebee347fd2af173c7e97e33b35ae Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 16:30:02 -0400 Subject: [PATCH 107/114] TravisCI: install deps on sdl2_mixer --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index db81b9d9..252abe0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -251,6 +251,9 @@ addons: - p7zip-full homebrew: packages: + - libmodplug + - liboog + - libvorbis - sdl2 - game-music-emu - p7zip From fd284f232e09562505a110817481100fabf2aaf7 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 16:43:33 -0400 Subject: [PATCH 108/114] travisCI: add sdl2_mixer from mazmazz's srb2 tap --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 252abe0f..b723f44e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -250,11 +250,10 @@ addons: - libgme-dev - p7zip-full homebrew: + taps: + - mazmazz/srb2 packages: - - libmodplug - - liboog - - libvorbis - - sdl2 + - mazmazz/srb2/sdl2_mixer - game-music-emu - p7zip - cmake @@ -271,7 +270,6 @@ before_script: - cmake .. -DCMAKE_BUILD_TYPE=Release before_install: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sdl2_mixer; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/release/SDL2-2.0.6.dmg; hdiutil attach SDL2-2.0.6.dmg; sudo cp -a /Volumes/SDL2/SDL2.framework /Library/Frameworks/; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl -O -L https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.1.dmg; hdiutil attach SDL2_mixer-2.0.1.dmg; sudo cp -a /Volumes/SDL2_mixer/SDL2_mixer.framework /Library/Frameworks/; fi - mkdir -p $HOME/srb2_cache From 73fa35baf0255a9b9fefbc8256206f8c6964e077 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 25 Mar 2019 16:59:47 -0400 Subject: [PATCH 109/114] TravisCI: use stock sdl2_mixer for prebuild bottle --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b723f44e..15a3c844 100644 --- a/.travis.yml +++ b/.travis.yml @@ -253,7 +253,7 @@ addons: taps: - mazmazz/srb2 packages: - - mazmazz/srb2/sdl2_mixer + - sdl2_mixer - game-music-emu - p7zip - cmake From 8c1c0875a2f8dd545920cf7dc7c9bd59af2d43ae Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 25 Mar 2019 21:35:04 +0000 Subject: [PATCH 110/114] Fix credits gamestate in dedicated mode, by properly separating the timer variable code from the drawing code in a semi-hacky way --- src/f_finale.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 64e37121..bcdac295 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1192,16 +1192,34 @@ void F_CreditDrawer(void) if (FixedMul(y,vid.dupy) > vid.height) break; } +} +void F_CreditTicker(void) +{ + // "Simulate" the drawing of the credits so that dedicated mode doesn't get stuck + UINT16 i; + fixed_t y = (80< vid.height) + break; + } + + // Do this here rather than in the drawer you doofus! (this is why dedicated mode broke at credits) if (!credits[i] && y <= 120< Date: Tue, 26 Mar 2019 11:54:54 -0400 Subject: [PATCH 111/114] mistype in merge of TavisCI config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a96faf49..11294ab7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -260,7 +260,7 @@ matrix: # - os: osx # osx_image: xcode7.3 # #Apple LLVM version 7.3.0 (clang-703.0.31) - - osx: osx + - os: osx if: env(DPL_ENABLED) != "1" OR env(DPL_TERMINATE_TESTS) != "1" OR NOT branch =~ /^.*deployer.*$/ #Default: macOS 10.13 and Xcode 9.4.1 From 7ad1b3ac6f3156f9fa889aebc58ac30e09e72048 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Tue, 26 Mar 2019 21:20:17 -0400 Subject: [PATCH 112/114] TravisCI: remove xcode7.3 on DPL mac build --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 11294ab7..b6f8a7aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -269,7 +269,6 @@ matrix: # Deployer Buildbots - OSX ################################ - os: osx - osx_image: xcode7.3 if: env(DPL_ENABLED) = "1" AND (env(_DPL_JOB_ENABLED) = "1" OR env(DPL_JOB_ENABLE_ALL) = "1") AND (branch =~ /^.*deployer.*$/ OR (tag IS present AND env(DPL_TAG_ENABLED) = "1")) AND env(DPL_TERMINATE_MAIN) != "1" From e6c6f048e4af94247d5a7c22fa8fde8ae2d34e9a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Mar 2019 18:23:03 -0400 Subject: [PATCH 113/114] CircleCI: Debian Jessie is dead, long live Debian Stretch --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b0cf340..74e36025 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ jobs: build: working_directory: /root/SRB2 docker: - - image: debian:jessie + - image: debian:stretch environment: CC: ccache gcc -m32 PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig From 4d34841a532a974cbc33ab026ec7820bd7055162 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Mar 2019 18:51:20 -0400 Subject: [PATCH 114/114] CircleCI: use libpng-dev --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 74e36025..1784ba1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ jobs: - v1-SRB2-APT - run: name: Install SDK - command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx openssh-client + command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx openssh-client - save_cache: key: v1-SRB2-APT paths: