diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bbf46945..855393de1 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 2.2.0 + VERSION 2.2.1 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index d33d3d3a3..20b18d7d5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.2.0.{branch}-{build} +version: 2.2.1.{branch}-{build} os: MinGW environment: diff --git a/src/config.h.in b/src/config.h.in index 233cbdc53..498f3086d 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -26,12 +26,12 @@ #else /* Manually defined asset hashes for non-CMake builds - * Last updated 2019 / 12 / 06 - v2.2.0 - main assets + * Last updated 2020 / 02 / 15 - v2.2.1 - main assets * Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3 */ -#define ASSET_HASH_SRB2_PK3 "51419a33b4982d840c6772c159ba7c0a" -#define ASSET_HASH_ZONES_PK3 "df74843919fd51af26a0baa8e21e4c19" -#define ASSET_HASH_PLAYER_DTA "56a247e074dd0dc794b6617efef1e918" +#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" +#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead" +#define ASSET_HASH_PLAYER_DTA "ad49e07b17cc662f1ad70c454910b4ae" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "there is no patch.pk3, only zuul" #endif diff --git a/src/console.c b/src/console.c index 8746bf036..59d2b3e6c 100644 --- a/src/console.c +++ b/src/console.c @@ -613,6 +613,15 @@ void CON_Ticker(void) con_tick++; con_tick &= 7; + // if the menu is open then close the console. + if (menuactive && con_destlines) + { + consoletoggle = false; + con_destlines = 0; + CON_ClearHUD(); + I_UpdateMouseGrab(); + } + // console key was pushed if (consoletoggle) { @@ -784,7 +793,7 @@ boolean CON_Responder(event_t *ev) // check other keys only if console prompt is active if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!! { - if (! menuactive && bindtable[key]) + if (bindtable[key]) { COM_BufAddText(bindtable[key]); COM_BufAddText("\n"); diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c4b5f6677..77118110e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -404,8 +404,8 @@ static void ExtraDataTicker(void) } // If you are a client, you can safely forget the net commands for this tic - // If you are the server, you need to remember them until every client has been aknowledged, - // because if you need to resend a PT_SERVERTICS packet, you need to put the commands in it + // If you are the server, you need to remember them until every client has been acknowledged, + // because if you need to resend a PT_SERVERTICS packet, you will need to put the commands in it if (client) D_FreeTextcmd(gametic); } @@ -4510,7 +4510,7 @@ static void CL_SendClientCmd(void) packetsize = sizeof (clientcmd_pak) - sizeof (ticcmd_t) - sizeof (INT16); HSendPacket(servernode, false, 0, packetsize); } - else if (gamestate != GS_NULL && addedtogame) + else if (gamestate != GS_NULL && (addedtogame || dedicated)) { G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1); netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%BACKUPTICS]); diff --git a/src/d_main.c b/src/d_main.c index dc9bfbfea..2ff0042fd 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -188,14 +188,14 @@ void D_ProcessEvents(void) continue; } - // console input - if (CON_Responder(ev)) - continue; // ate the event - // Menu input if (M_Responder(ev)) continue; // menu ate the event + // console input + if (CON_Responder(ev)) + continue; // ate the event + G_Responder(ev); } } @@ -502,12 +502,13 @@ static void D_Display(void) // vid size change is now finished if it was on... vid.recalc = 0; - M_Drawer(); // menu is drawn even on top of everything - // focus lost moved to M_Drawer - + // FIXME: draw either console or menu, not the two if (gamestate != GS_TIMEATTACK) CON_Drawer(); + M_Drawer(); // menu is drawn even on top of everything + // focus lost moved to M_Drawer + // // wipe update // @@ -1213,7 +1214,7 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#ifndef DEVELOP // md5s last updated 06/12/19 (ddmmyy) +#ifndef DEVELOP // md5s last updated 16/02/20 (ddmmyy) // Check MD5s of autoloaded files W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3 diff --git a/src/dehacked.c b/src/dehacked.c index 5f35864e2..63cfc8d41 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1293,10 +1293,7 @@ static void readgametype(MYFILE *f, char *gtname) UINT32 wordgt = 0; for (j = 0; GAMETYPERULE_LIST[j]; j++) if (fastcmp(word, GAMETYPERULE_LIST[j])) { - if (!j) // GTR_CAMPAIGN - wordgt |= 1; - else - wordgt |= (1<= 28-1) diff --git a/src/p_enemy.c b/src/p_enemy.c index db297e684..2ddbd8d29 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5198,8 +5198,8 @@ void A_SignPlayer(mobj_t *actor) player_t *player = actor->target ? actor->target->player : NULL; UINT8 skinnum; UINT8 skincount = 0; - for (skincount = 0; skincount < numskins; skincount++) - if (!skincheck(skincount)) + for (skinnum = 0; skinnum < numskins; skinnum++) + if (!skincheck(skinnum)) skincount++; skinnum = P_RandomKey(skincount); for (skincount = 0; skincount < numskins; skincount++) @@ -5232,20 +5232,23 @@ void A_SignPlayer(mobj_t *actor) { ov->color = facecolor; ov->skin = skin; - P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN + if ((statenum_t)(ov->state-states) != actor->info->seestate) + P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN } else // CLEAR! sign { ov->color = SKINCOLOR_NONE; ov->skin = NULL; // needs to be NULL in the case of SF_HIRES characters - P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN + if ((statenum_t)(ov->state-states) != actor->info->missilestate) + P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN } } else // Eggman face { ov->color = SKINCOLOR_NONE; ov->skin = NULL; - P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN + if ((statenum_t)(ov->state-states) != actor->info->meleestate) + P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN if (!signcolor) signcolor = SKINCOLOR_CARBON; } diff --git a/src/p_mobj.c b/src/p_mobj.c index f02ed4f84..10898f70e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10461,6 +10461,61 @@ void P_SceneryThinker(mobj_t *mobj) // GAME SPAWN FUNCTIONS // +static fixed_t P_DefaultMobjShadowScale (mobj_t *thing) +{ + switch (thing->type) + { + case MT_PLAYER: + case MT_ROLLOUTROCK: + + case MT_EGGMOBILE4_MACE: + case MT_SMALLMACE: + case MT_BIGMACE: + + case MT_SMALLGRABCHAIN: + case MT_BIGGRABCHAIN: + + case MT_YELLOWSPRINGBALL: + case MT_REDSPRINGBALL: + + return FRACUNIT; + + case MT_RING: + case MT_FLINGRING: + + case MT_BLUESPHERE: + case MT_FLINGBLUESPHERE: + case MT_BOMBSPHERE: + + case MT_REDTEAMRING: + case MT_BLUETEAMRING: + case MT_REDFLAG: + case MT_BLUEFLAG: + + case MT_EMBLEM: + + case MT_TOKEN: + case MT_EMERALD1: + case MT_EMERALD2: + case MT_EMERALD3: + case MT_EMERALD4: + case MT_EMERALD5: + case MT_EMERALD6: + case MT_EMERALD7: + case MT_EMERHUNT: + case MT_FLINGEMERALD: + + return 2*FRACUNIT/3; + + default: + + if (thing->flags & (MF_ENEMY|MF_BOSS)) + return FRACUNIT; + else + return 0; + } +} + // // P_SpawnMobj // @@ -10562,20 +10617,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->z = z; // Set shadowscale here, before spawn hook so that Lua can change it - if ( - type == MT_PLAYER || - type == MT_ROLLOUTROCK || - type == MT_EGGMOBILE4_MACE || - (type >= MT_SMALLMACE && type <= MT_REDSPRINGBALL) || - (mobj->flags & (MF_ENEMY|MF_BOSS)) - ) - mobj->shadowscale = FRACUNIT; - else if ( - type >= MT_RING && type <= MT_FLINGEMERALD && type != MT_EMERALDSPAWN - ) - mobj->shadowscale = 2*FRACUNIT/3; - else - mobj->shadowscale = 0; + mobj->shadowscale = P_DefaultMobjShadowScale(mobj); #ifdef HAVE_BLUA // DANGER! This can cause P_SpawnMobj to return NULL! diff --git a/src/p_polyobj.c b/src/p_polyobj.c index cd0a44bb4..a206d0171 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1001,15 +1001,35 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo) // static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy) { - if (mo->player) { // Do something similar to conveyor movement. -Red - mo->player->cmomx += dx; - mo->player->cmomy += dy; + if (mo->player) { // Finally this doesn't suck eggs -fickle + fixed_t cdx, cdy; - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); + cdx = FixedMul(dx, FRACUNIT-CARRYFACTOR); + cdy = FixedMul(dy, FRACUNIT-CARRYFACTOR); - mo->player->cmomx -= dx; - mo->player->cmomy -= dy; + if (mo->player->onconveyor == 1) + { + mo->momx += cdx; + mo->momy += cdy; + + // Multiple slides in the same tic, somehow + mo->player->cmomx += cdx; + mo->player->cmomy += cdy; + } + else + { + if (mo->player->onconveyor == 3) + { + mo->momx += cdx - mo->player->cmomx; + mo->momy += cdy - mo->player->cmomy; + } + + mo->player->cmomx = cdx; + mo->player->cmomy = cdy; + } + + dx = FixedMul(dx, FRACUNIT - mo->friction); + dy = FixedMul(dy, FRACUNIT - mo->friction); if (mo->player->pflags & PF_SPINNING && (mo->player->rmomx || mo->player->rmomy) && !(mo->player->pflags & PF_STARTDASH)) { #define SPINMULT 5184 // Consider this a substitute for properly calculating FRACUNIT-friction. I'm tired. -Red @@ -1282,7 +1302,8 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, { static INT32 pomovecount = 10000; INT32 x, y; - angle_t deltafine = delta >> ANGLETOFINESHIFT; + angle_t deltafine = (((po->angle + delta) >> ANGLETOFINESHIFT) - (po->angle >> ANGLETOFINESHIFT)) & FINEMASK; + // This fineshift trickery replaces the old delta>>ANGLETOFINESHIFT; doing it this way avoids loss of precision causing objects to slide off -fickle pomovecount++; @@ -1334,19 +1355,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, oldxoff = mo->x-origin.x; oldyoff = mo->y-origin.y; - if (mo->player) // Hack to fix players sliding off of spinning polys -Red - { - fixed_t temp; + newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s) - oldxoff; + newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s) - oldyoff; - temp = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); - oldyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); - oldxoff = temp; - } - - newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); - newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); - - Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff); + Polyobj_slideThing(mo, newxoff, newyoff); if (turnthings == 2 || (turnthings == 1 && !mo->player)) { mo->angle += delta; diff --git a/src/p_saveg.c b/src/p_saveg.c index 853856880..7d755edc6 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1255,6 +1255,7 @@ typedef enum #endif MD2_COLORIZED = 1<<12, MD2_ROLLANGLE = 1<<13, + MD2_SHADOWSCALE = 1<<14, } mobj_diff2_t; typedef enum @@ -1476,6 +1477,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_COLORIZED; if (mobj->rollangle) diff2 |= MD2_ROLLANGLE; + if (mobj->shadowscale) + diff2 |= MD2_SHADOWSCALE; if (diff2 != 0) diff |= MD_MORE; @@ -1642,6 +1645,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, mobj->colorized); if (diff2 & MD2_ROLLANGLE) WRITEANGLE(save_p, mobj->rollangle); + if (diff2 & MD2_SHADOWSCALE) + WRITEFIXED(save_p, mobj->shadowscale); WRITEUINT32(save_p, mobj->mobjnum); } @@ -2721,6 +2726,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->colorized = READUINT8(save_p); if (diff2 & MD2_ROLLANGLE) mobj->rollangle = READANGLE(save_p); + if (diff2 & MD2_SHADOWSCALE) + mobj->shadowscale = READFIXED(save_p); if (diff & MD_REDFLAG) { diff --git a/src/p_user.c b/src/p_user.c index 176b07d0a..a63022986 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12174,7 +12174,9 @@ void P_PlayerThink(player_t *player) #ifdef POLYOBJECTS if (player->onconveyor == 1) - player->cmomy = player->cmomx = 0; + player->onconveyor = 3; + else if (player->onconveyor == 3) + player->cmomy = player->cmomx = 0; #endif P_DoSuperStuff(player); diff --git a/src/r_things.c b/src/r_things.c index 7f0f43281..ca285644f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3463,6 +3463,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) GETFLAG(DASHMODE) GETFLAG(FASTEDGE) GETFLAG(MULTIABILITY) + GETFLAG(NONIGHTSROTATION) #undef GETFLAG else // let's check if it's a sound, otherwise error out diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index ab3157c44..2b03cb8d4 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.2.0; + CURRENT_PROJECT_VERSION = 2.2.1; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.2.0; + CURRENT_PROJECT_VERSION = 2.2.1; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/w_wad.c b/src/w_wad.c index 1df2eacc7..e544378c8 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1691,7 +1691,7 @@ W_VerifyName (const char *name, lumpchecklist_t *checklist, boolean status) size_t j; for (j = 0; checklist[j].len && checklist[j].name; ++j) { - if (( strncmp(name, checklist[j].name, + if (( strncasecmp(name, checklist[j].name, checklist[j].len) != false ) == status) { return true; @@ -1746,6 +1746,19 @@ W_VerifyWAD (FILE *fp, lumpchecklist_t *checklist, boolean status) return true; } +// List of blacklisted folders to use when checking the PK3 +static lumpchecklist_t folderblacklist[] = +{ + {"Lua/", 4}, + {"SOC/", 4}, + {"Sprites/", 8}, + {"Textures/", 9}, + {"Patches/", 8}, + {"Flats/", 6}, + {"Fades/", 6}, + {NULL, 0}, +}; + static int W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) { @@ -1797,7 +1810,7 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) else trimname = fullname; // Care taken for root files. - if (*trimname) // Ignore directories + if (*trimname) // Ignore directories, well kinda { if ((dotpos = strrchr(trimname, '.')) == 0) dotpos = fullname + strlen(fullname); // Watch for files without extension. @@ -1807,6 +1820,10 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) if (! W_VerifyName(lumpname, checklist, status)) return false; + + // Check for directories next, if it's blacklisted it will return false + if (W_VerifyName(fullname, folderblacklist, status)) + return false; } free(fullname); diff --git a/src/z_zone.c b/src/z_zone.c index 5a0ff638b..e0e37312a 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -232,12 +232,12 @@ void Z_Free(void *ptr) // Free the memory and get rid of the block. free(block->real); - block->prev->next = block->next; - block->next->prev = block->prev; - free(block); #ifdef VALGRIND_DESTROY_MEMPOOL VALGRIND_DESTROY_MEMPOOL(block); #endif + block->prev->next = block->next; + block->next->prev = block->prev; + free(block); } /** malloc() that doesn't accept failure. @@ -317,13 +317,9 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) // The mem header lives 'sizeof (memhdr_t)' bytes before given. hdr = (memhdr_t *)((UINT8 *)given - sizeof *hdr); -#ifdef VALGRIND_CREATE_MEMPOOL - VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc); +#ifdef HAVE_VALGRIND Z_calloc = false; #endif -#ifdef VALGRIND_MEMPOOL_ALLOC - VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr); -#endif block->next = head.next; block->prev = &head; @@ -341,6 +337,13 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) block->size = blocksize; block->realsize = size; +#ifdef VALGRIND_CREATE_MEMPOOL + VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc); +#endif +//#ifdef VALGRIND_MEMPOOL_ALLOC +// VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr); +//#endif + hdr->id = ZONEID; hdr->block = block;