From 59c6d59c00bb385789b1f7faebca4a3f787ea27f Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 19 Dec 2021 10:16:03 +0100 Subject: [PATCH] Adapt NiGHTS things to UDMF --- extras/conf/udb/Includes/SRB222_things.cfg | 18 +++++----- src/m_cheat.c | 4 +-- src/p_mobj.c | 41 +++++++--------------- src/p_saveg.c | 2 +- src/p_setup.c | 20 ++++++++++- 5 files changed, 44 insertions(+), 41 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index a0bc6f07f..cd9d360c8 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -6098,14 +6098,6 @@ udmf width = 32; height = 64; } - 1705 - { - arrow = 1; - title = "Hoop (Generic)"; - sprite = "HOOPA0"; - width = 80; - height = 160; - } 1706 { title = "Blue Sphere"; @@ -6141,10 +6133,14 @@ udmf 1713 { arrow = 1; - title = "Hoop (Customizable)"; + title = "Hoop"; sprite = "HOOPA0"; width = 80; height = 160; + arg0 + { + title = "Radius"; + } } 1714 { @@ -6152,6 +6148,10 @@ udmf sprite = "internal:axis1"; width = 8; height = 16; + arg0 + { + title = "Mare"; + } } } diff --git a/src/m_cheat.c b/src/m_cheat.c index ef896c991..52202f808 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1285,7 +1285,7 @@ void OP_NightsObjectplace(player_t *player) if (mt->type >= 600 && mt->type <= 609) // Placement patterns P_SpawnItemPattern(mt, false); - else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops + else if (mt->type == 1713) // NiGHTS Hoops P_SpawnHoop(mt); else P_SpawnMapThing(mt); @@ -1416,7 +1416,7 @@ void OP_ObjectplaceMovement(player_t *player) mt = OP_CreateNewMapThing(player, (UINT16)spawnthing, ceiling); if (mt->type >= 600 && mt->type <= 609) // Placement patterns P_SpawnItemPattern(mt, false); - else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops + else if (mt->type == 1713) // NiGHTS Hoops P_SpawnHoop(mt); else P_SpawnMapThing(mt); diff --git a/src/p_mobj.c b/src/p_mobj.c index 5defc9f2f..4d5784129 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11769,11 +11769,6 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt switch (mobjtype) { - // Bumpers never spawn flipped. - case MT_NIGHTSBUMPER: - flip = false; - break; - // Objects with a non-zero default height. case MT_CRAWLACOMMANDER: case MT_DETON: @@ -11883,7 +11878,7 @@ static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing) } else if (mthing->type == 750 // Slope vertex point (formerly chaos spawn) || (mthing->type >= 600 && mthing->type <= 609) // Special placement patterns - || mthing->type == 1705 || mthing->type == 1713) // Hoops + || mthing->type == 1713) // Hoops return true; // These are handled elsewhere. else if (mthing->type == mobjinfo[MT_EMERHUNT].doomednum) { @@ -12817,9 +12812,8 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->threshold = (TICRATE*2)-1; break; case MT_NIGHTSBUMPER: - // Lower 4 bits specify the angle of - // the bumper in 30 degree increments. - mobj->threshold = (mthing->options & 15) % 12; // It loops over, etc + // Pitch of the bumper is set in 30 degree increments. + mobj->threshold = ((mthing->pitch/30) + 3) % 12; P_SetMobjState(mobj, mobj->info->spawnstate + mobj->threshold); break; case MT_EGGCAPSULE: @@ -12838,7 +12832,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; } case MT_IDEYAANCHOR: - mobj->health = mthing->extrainfo; + mobj->health = mthing->args[0]; break; case MT_NIGHTSDRONE: if (!P_SetupNiGHTSDrone(mthing, mobj)) @@ -13258,13 +13252,18 @@ mobj_t *P_SpawnMapThing(mapthing_t *mthing) return P_SpawnMobjFromMapThing(mthing, x, y, z, i); } -static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t sizefactor) +void P_SpawnHoop(mapthing_t *mthing) { + if (metalrecording) + return; + mobj_t *mobj = NULL; mobj_t *nextmobj = NULL; mobj_t *hoopcenter; TMatrix *pitchmatrix, *yawmatrix; - fixed_t radius = hoopsize*sizefactor; + fixed_t radius = mthing->args[0] << FRACBITS; + fixed_t sizefactor = 4*FRACUNIT; + fixed_t hoopsize = radius/sizefactor; INT32 i; angle_t fa; TVector v, *res; @@ -13281,10 +13280,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size hoopcenter->y = y; P_SetThingPosition(hoopcenter); - // Scale 0-255 to 0-359 =( - hoopcenter->movedir = ((mthing->angle & 255)*360)/256; // Pitch + hoopcenter->movedir = mthing->pitch; pitchmatrix = RotateXMatrix(FixedAngle(hoopcenter->movedir << FRACBITS)); - hoopcenter->movecount = (((UINT16)mthing->angle >> 8)*360)/256; // Yaw + hoopcenter->movecount = mthing->angle; yawmatrix = RotateZMatrix(FixedAngle(hoopcenter->movecount << FRACBITS)); // For the hoop when it flies away @@ -13364,19 +13362,6 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size } while (hoopsize >= 8); } -void P_SpawnHoop(mapthing_t *mthing) -{ - if (metalrecording) - return; - - if (mthing->type == 1705) // Generic hoop - P_SpawnHoopInternal(mthing, 24, 4*FRACUNIT); - else // Customizable hoop - // For each flag add 16 fracunits to the size - // Default (0 flags) is 32 fracunits - P_SpawnHoopInternal(mthing, 8 + (4*(mthing->options & 0xF)), 4*FRACUNIT); -} - void P_SetBonusTime(mobj_t *mobj) { if (!mobj) diff --git a/src/p_saveg.c b/src/p_saveg.c index 689fa4d95..b505bdf88 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2736,7 +2736,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) { UINT16 spawnpointnum = READUINT16(save_p); - if (mapthings[spawnpointnum].type == 1705 || mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case + if (mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case { P_SpawnHoop(&mapthings[spawnpointnum]); return NULL; diff --git a/src/p_setup.c b/src/p_setup.c index f1f37eb48..aafe89ab3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -895,7 +895,7 @@ static void P_SpawnMapThings(boolean spawnemblems) if (mt->type >= 600 && mt->type <= 609) // item patterns P_SpawnItemPattern(mt, false); - else if (mt->type == 1705 || mt->type == 1713) // hoops + else if (mt->type == 1713) // hoops P_SpawnHoop(mt); else // Everything else P_SpawnMapThing(mt); @@ -5026,10 +5026,28 @@ static void P_ConvertBinaryMap(void) mapthings[i].args[0] = mapthings[i].extrainfo; mapthings[i].args[1] = mapthings[i].options; break; + case 1704: //NiGHTS bumper + mapthings[i].pitch = 30 * (((mapthings[i].options & 15) + 9) % 12); + mapthings[i].options &= ~0xF; + break; + case 1705: //Hoop + case 1713: //Hoop (Customizable) + { + UINT16 oldangle = mapthings[i].angle; + mapthings[i].angle = ((oldangle >> 8)*360)/256; + mapthings[i].pitch = ((oldangle & 255)*360)/256; + mapthings[i].args[0] = (mapthings[i].type == 1705) ? 96 : (mapthings[i].options & 0xF)*16 + 32; + mapthings[i].options &= ~0xF; + mapthings[i].type = 1713; + break; + } case 1710: //Ideya capture mapthings[i].args[0] = mapthings[i].extrainfo; mapthings[i].args[1] = mapthings[i].angle; break; + case 1714: //Ideya anchor point + mapthings[i].args[0] = mapthings[i].extrainfo; + break; default: break; }