From 9e3bde09139366a3b131cd71d818eded0fa7e439 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 12:14:37 +0100 Subject: [PATCH 01/39] - fixed: invisible line within a portal could affect floor height checks in P_CheckPosition. --- src/p_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 7908ce4a9..578375358 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -921,7 +921,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec // If the floor planes on both sides match we should recalculate open.bottom at the actual position we are checking // This is to avoid bumpy movement when crossing a linedef with the same slope on both sides. - if (open.frontfloorplane == open.backfloorplane) + if (open.frontfloorplane == open.backfloorplane && open.bottom > FIXED_MIN) { open.bottom = open.frontfloorplane.ZatPoint(cres.position.x, cres.position.y); } From b0f1e9b8f301149603b105e4083daef99a24c2af Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 12:16:58 +0100 Subject: [PATCH 02/39] - fixed typo in portal blockmap code. --- src/portal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/portal.cpp b/src/portal.cpp index cd501513a..addb92968 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -711,7 +711,7 @@ fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy) if (dx < 128 * FRACUNIT && dy < 128 * FRACUNIT) { fixed_t blockx = GetSafeBlockX(actx - bmaporgx); - fixed_t blocky = GetSafeBlockX(acty - bmaporgy); + fixed_t blocky = GetSafeBlockY(acty - bmaporgy); if (blockx < 0 || blocky < 0 || blockx >= bmapwidth || blocky >= bmapheight || !PortalBlockmap(blockx, blocky).neighborContainsLines) return dest; } From e9fa53c54dc007948d066da4ff47d3656c23e9f2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 13:59:15 +0100 Subject: [PATCH 03/39] - fixed dropoff calculation over portals. It can easily happen that the lower sector has no lines below the checked area, in which case it would not set the dropoffz correctly. To prevent this, P_LineOpening must, when it checks the opening over a sector portal, actually calculate the dropoff to the lower portal itself by calling sector_t::NextLowestPointAt. It also means that FindRefPoint must calculate a proper reference point when one side of the line to be checked is part of a floor portal. --- src/p_map.cpp | 23 ++++++++++++++++----- src/p_maputl.cpp | 52 +++++++++++++++++++++++++----------------------- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 578375358..d1878162f 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -162,11 +162,22 @@ static inline fixed_t GetCoefficientClosestPointInLine24(line_t *ld, fixedvec2 p static inline fixedvec2 FindRefPoint(line_t *ld, fixedvec2 pos) { - if (!((((ld->frontsector->floorplane.a | ld->frontsector->floorplane.b) | - (ld->backsector->floorplane.a | ld->backsector->floorplane.b) | - (ld->frontsector->ceilingplane.a | ld->frontsector->ceilingplane.b) | - (ld->backsector->ceilingplane.a | ld->backsector->ceilingplane.b)) == 0) - && ld->backsector->e->XFloor.ffloors.Size() == 0 && ld->frontsector->e->XFloor.ffloors.Size() == 0)) + // If there's any chance of slopes getting in the way we need to get a proper refpoint, otherwise we can save the work. + // Slopes can get in here when: + // - the actual sector planes are sloped + // - there's 3D floors in this sector + // - there's a crossable floor portal (for which the dropoff needs to be calculated within P_LineOpening, and the lower sector can easily have slopes) + if ( + (((ld->frontsector->floorplane.a | ld->frontsector->floorplane.b) | + (ld->backsector->floorplane.a | ld->backsector->floorplane.b) | + (ld->frontsector->ceilingplane.a | ld->frontsector->ceilingplane.b) | + (ld->backsector->ceilingplane.a | ld->backsector->ceilingplane.b)) != 0) + || + ld->backsector->e->XFloor.ffloors.Size() == 0 + || + ld->frontsector->e->XFloor.ffloors.Size() == 0 + || + !ld->frontsector->PortalBlocksMovement(sector_t::floor)) { fixed_t r = GetCoefficientClosestPointInLine24(ld, pos); if (r <= 0) @@ -972,7 +983,9 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec } if (open.lowfloor < tm.dropoffz) + { tm.dropoffz = open.lowfloor; + } } // if contacted a special line, add it to the list diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 057c4329c..9d98f4bf5 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -150,7 +150,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, if (!(flags & FFCF_ONLY3DFLOORS)) { sector_t *front, *back; - fixed_t fc, ff, bc, bf; + fixed_t fc = 0, ff = 0, bc = 0, bf = 0; if (linedef->backsector == NULL) { @@ -162,29 +162,20 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, front = linedef->frontsector; back = linedef->backsector; - if (!(flags & FFCF_NOPORTALS) && !linedef->frontsector->PortalBlocksMovement(sector_t::ceiling) && - linedef->backsector->SkyBoxes[sector_t::ceiling] && - linedef->frontsector->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup == linedef->backsector->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup) + if (!(flags & FFCF_NOPORTALS)) { - fc = bc = FIXED_MAX; - } - else - { - fc = front->ceilingplane.ZatPoint(x, y); - bc = back->ceilingplane.ZatPoint(x, y); - } - if (!(flags & FFCF_NOPORTALS) && !linedef->frontsector->PortalBlocksMovement(sector_t::floor) && - linedef->backsector->SkyBoxes[sector_t::floor] && - linedef->frontsector->SkyBoxes[sector_t::floor]->Sector->PortalGroup == linedef->backsector->SkyBoxes[sector_t::floor]->Sector->PortalGroup) - { - ff = bf = FIXED_MIN; - } - else - { - ff = front->floorplane.ZatPoint(x, y); - bf = back->floorplane.ZatPoint(x, y); + if (!linedef->frontsector->PortalBlocksMovement(sector_t::ceiling)) fc = FIXED_MAX; + if (!linedef->backsector->PortalBlocksMovement(sector_t::ceiling)) bc = FIXED_MAX; + if (!linedef->frontsector->PortalBlocksMovement(sector_t::floor)) ff = FIXED_MIN; + if (!linedef->backsector->PortalBlocksMovement(sector_t::floor)) bf = FIXED_MIN; } + if (fc == 0) fc = front->ceilingplane.ZatPoint(x, y); + if (bc == 0) bc = back->ceilingplane.ZatPoint(x, y); + if (ff == 0) ff = front->floorplane.ZatPoint(x, y); + if (bf == 0) bf = back->floorplane.ZatPoint(x, y); + + /*Printf ("]]]]]] %d %d\n", ff, bf);*/ open.topsec = fc < bc? front : back; @@ -198,8 +189,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, // that imprecisions in the plane equation mean there is a // good chance that even if a slope and non-slope look like // they line up, they won't be perfectly aligned. - if (refx == FIXED_MIN || - abs (ff-bf) > 256) + if (ff == FIXED_MIN || bf == FIXED_MIN || (refx == FIXED_MIN || abs (ff-bf) > 256)) { usefront = (ff > bf); } @@ -219,7 +209,13 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, open.bottomsec = front; open.floorpic = front->GetTexture(sector_t::floor); open.floorterrain = front->GetTerrain(sector_t::floor); - open.lowfloor = bf; + if (bf != FIXED_MIN) open.lowfloor = bf; + else + { + // We must check through the portal for the actual dropoff. + // If there's no lines in the lower sections we'd never get a usable value otherwise. + open.lowfloor = back->NextLowestFloorAt(refx, refy, back->SkyBoxes[sector_t::floor]->threshold-1); + } } else { @@ -227,7 +223,13 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, open.bottomsec = back; open.floorpic = back->GetTexture(sector_t::floor); open.floorterrain = back->GetTerrain(sector_t::floor); - open.lowfloor = ff; + if (ff != FIXED_MIN) open.lowfloor = ff; + else + { + // We must check through the portal for the actual dropoff. + // If there's no lines in the lower sections we'd never get a usable value otherwise. + open.lowfloor = front->NextLowestFloorAt(refx, refy, front->SkyBoxes[sector_t::floor]->threshold - 1); + } } open.frontfloorplane = front->floorplane; open.backfloorplane = back->floorplane; From 94f37bde304d9636b009ec478e127c0c0a0aa7f6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 14:03:57 +0100 Subject: [PATCH 04/39] - Forgot changing two comparisons when cleaning up the if statement in FindRefPoint. --- src/p_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index d1878162f..7f66fd2d4 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -173,9 +173,9 @@ static inline fixedvec2 FindRefPoint(line_t *ld, fixedvec2 pos) (ld->frontsector->ceilingplane.a | ld->frontsector->ceilingplane.b) | (ld->backsector->ceilingplane.a | ld->backsector->ceilingplane.b)) != 0) || - ld->backsector->e->XFloor.ffloors.Size() == 0 + ld->backsector->e->XFloor.ffloors.Size() != 0 || - ld->frontsector->e->XFloor.ffloors.Size() == 0 + ld->frontsector->e->XFloor.ffloors.Size() != 0 || !ld->frontsector->PortalBlocksMovement(sector_t::floor)) { From c390b989660d6a63844e7b049df999ae9cbbbdbc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 15:14:05 +0100 Subject: [PATCH 05/39] - fixed: Not all paths in A_CStaffCheck did proper checks on the player's health. --- src/g_hexen/a_clericstaff.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 964a78503..1653e5ebc 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -112,7 +112,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) { newLife = player->health + (damage >> 4); newLife = newLife > max ? max : newLife; - pmo->health = player->health = newLife; + if (newLife > player->health) + { + pmo->health = player->health = newLife; + } P_SetPsprite(player, ps_weapon, weapon->FindState("Drain")); } if (weapon != NULL) From 4bb0ca58890b1366b0df69065bdfb633c8ae67d8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 16:06:48 +0100 Subject: [PATCH 06/39] - consolidated some nearly identical code repetitions in Hexen's attack functions. --- src/g_hexen/a_clericmace.cpp | 28 ++++++--------- src/g_hexen/a_clericstaff.cpp | 66 ++++++++++++----------------------- src/g_hexen/a_fighteraxe.cpp | 39 +++++++-------------- 3 files changed, 45 insertions(+), 88 deletions(-) diff --git a/src/g_hexen/a_clericmace.cpp b/src/g_hexen/a_clericmace.cpp index ecd28da4f..c9b2e4f8d 100644 --- a/src/g_hexen/a_clericmace.cpp +++ b/src/g_hexen/a_clericmace.cpp @@ -36,26 +36,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack) damage = 25+(pr_maceatk()&15); for (i = 0; i < 16; i++) { - angle = player->mo->angle+i*(ANG45/16); - slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget); - if (linetarget) + for (int j = 1; j >= -1; j -= 2) { - P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) + angle = player->mo->angle + j*i*(ANG45 / 16); + slope = P_AimLineAttack(player->mo, angle, 2 * MELEERANGE, &linetarget); + if (linetarget) { - AdjustPlayerAngle (player->mo, linetarget); - goto macedone; - } - } - angle = player->mo->angle-i*(ANG45/16); - slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget); - if (linetarget) - { - P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) - { - AdjustPlayerAngle (player->mo, linetarget); - goto macedone; + P_LineAttack(player->mo, angle, 2 * MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); + if (linetarget != NULL) + { + AdjustPlayerAngle(player->mo, linetarget); + goto macedone; + } } } } diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 1653e5ebc..457a54738 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -70,60 +70,38 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) puff = PClass::FindActor("CStaffPuff"); for (i = 0; i < 3; i++) { - angle = pmo->angle + i*(ANG45 / 16); - slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); - if (linetarget) + for (int j = 1; j >= -1; j -= 2) { - P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); - if (linetarget != NULL) + angle = pmo->angle + j*i*(ANG45 / 16); + slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); + if (linetarget) { - pmo->angle = pmo->AngleTo(linetarget); - if (((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) - && (!(linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE)))) + P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); + if (linetarget != NULL) { - newLife = player->health + (damage >> 3); - newLife = newLife > max ? max : newLife; - if (newLife > player->health) + pmo->angle = pmo->AngleTo(linetarget); + if (((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) + && (!(linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE)))) { - pmo->health = player->health = newLife; + newLife = player->health + (damage >> 3); + newLife = newLife > max ? max : newLife; + if (newLife > player->health) + { + pmo->health = player->health = newLife; + } + if (weapon != NULL) + { + FState * newstate = weapon->FindState("Drain"); + if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate); + } } if (weapon != NULL) { - FState * newstate = weapon->FindState("Drain"); - if (newstate != NULL) P_SetPsprite(player, ps_weapon, newstate); + weapon->DepleteAmmo(weapon->bAltFire, false); } } - if (weapon != NULL) - { - weapon->DepleteAmmo(weapon->bAltFire, false); - } + return 0; } - break; - } - angle = pmo->angle - i*(ANG45 / 16); - slope = P_AimLineAttack(player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); - if (linetarget) - { - P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); - if (linetarget != NULL) - { - pmo->angle = pmo->AngleTo(linetarget); - if ((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) - { - newLife = player->health + (damage >> 4); - newLife = newLife > max ? max : newLife; - if (newLife > player->health) - { - pmo->health = player->health = newLife; - } - P_SetPsprite(player, ps_weapon, weapon->FindState("Drain")); - } - if (weapon != NULL) - { - weapon->DepleteAmmo(weapon->bAltFire, false); - } - } - break; } } return 0; diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index 575b8d8c1..047c02fc8 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -236,36 +236,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack) } for (i = 0; i < 16; i++) { - angle = pmo->angle+i*(ANG45/16); - slope = P_AimLineAttack (pmo, angle, AXERANGE, &linetarget); - if (linetarget) + for (int j = 1; j >= -1; j -= 2) { - P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); - if (linetarget != NULL) + angle = pmo->angle + j*i*(ANG45 / 16); + slope = P_AimLineAttack(pmo, angle, AXERANGE, &linetarget); + if (linetarget) { - if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) + P_LineAttack(pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); + if (linetarget != NULL) { - P_ThrustMobj (linetarget, angle, power); + if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) + { + P_ThrustMobj(linetarget, angle, power); + } + AdjustPlayerAngle(pmo, linetarget); + useMana++; + goto axedone; } - AdjustPlayerAngle (pmo, linetarget); - useMana++; - goto axedone; - } - } - angle = pmo->angle-i*(ANG45/16); - slope = P_AimLineAttack (pmo, angle, AXERANGE, &linetarget); - if (linetarget) - { - P_LineAttack (pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); - if (linetarget != NULL) - { - if (linetarget->flags3&MF3_ISMONSTER) - { - P_ThrustMobj (linetarget, angle, power); - } - AdjustPlayerAngle (pmo, linetarget); - useMana++; - goto axedone; } } } From 27ac207f4c6597a6b8a53be96b6765cfdf298798 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 18:03:42 +0100 Subject: [PATCH 07/39] - added oortal handlong to P_RecursiveSound. --- src/p_enemy.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index ed9abdcb9..576d0c4fa 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -150,9 +150,40 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun } } + bool checkabove = !sec->PortalBlocksSound(sector_t::ceiling); + bool checkbelow = !sec->PortalBlocksSound(sector_t::floor); + for (i = 0; i < sec->linecount; i++) { check = sec->lines[i]; + + // I wish there was a better method to do this than randomly looking through the portal at a few places... + if (checkabove) + { + sector_t *upper = + P_PointInSector(check->v1->x + check->dx / 2 + sec->SkyBoxes[sector_t::ceiling]->scaleX, + check->v1->y + check->dy / 2 + sec->SkyBoxes[sector_t::ceiling]->scaleY); + + P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist); + } + if (checkbelow) + { + sector_t *lower = + P_PointInSector(check->v1->x + check->dx / 2 + sec->SkyBoxes[sector_t::floor]->scaleX, + check->v1->y + check->dy / 2 + sec->SkyBoxes[sector_t::floor]->scaleY); + + P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist); + } + FLinePortal *port = check->getPortal(); + if (port && (port->mFlags & PORTF_SOUNDTRAVERSE)) + { + if (port->mDestination) + { + P_RecursiveSound(port->mDestination->frontsector, soundtarget, splash, soundblocks, emitter, maxdist); + } + } + + if (check->sidedef[1] == NULL || !(check->flags & ML_TWOSIDED)) { From 8be690fbf28ff9b67be30b2e47f382b050c23c1f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 21:16:16 +0100 Subject: [PATCH 08/39] - fixed type truncation warning. --- src/thingdef/thingdef_expression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index b5b35a770..d4bb41326 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3518,7 +3518,7 @@ FxFlopFunctionCall::FxFlopFunctionCall(size_t index, FArgumentList *args, const : FxExpression(pos) { assert(index < countof(FxFlops) && "FLOP index out of range"); - Index = index; + Index = (int)index; ArgList = args; } From d4f87203bd6da64d21f2fba68502e2524492d215 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Feb 2016 23:08:32 +0100 Subject: [PATCH 09/39] - added portal awareness to several functions. * Arch-Vile resurrection * Boom point pushers (due to complete lack of z-handling only for line portals.) * A_RadiusGive These also require a more thorough collection of portal groups than simple position checks. --- src/g_hexen/a_spike.cpp | 1 + src/p_enemy.cpp | 50 ++++---- src/p_maputl.h | 12 +- src/p_spec.cpp | 9 +- src/portal.cpp | 196 ++++++++++++++++++++---------- src/thingdef/thingdef_codeptr.cpp | 10 +- 6 files changed, 187 insertions(+), 91 deletions(-) diff --git a/src/g_hexen/a_spike.cpp b/src/g_hexen/a_spike.cpp index f1538d3d9..4af4e2d54 100644 --- a/src/g_hexen/a_spike.cpp +++ b/src/g_hexen/a_spike.cpp @@ -154,6 +154,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale) PARAM_ACTION_PROLOGUE; AActor *thing; + // This doesn't need to iterate through portals. FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), self->radius)); while ((thing = it.Next())) { diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 576d0c4fa..0e8c7d6ff 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2604,40 +2604,48 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) fixedvec2 viletry = self->Vec2Offset( FixedMul (absSpeed, xspeed[self->movedir]), FixedMul (absSpeed, yspeed[self->movedir]), true); - AActor *corpsehit; - FBlockThingsIterator it(FBoundingBox(viletry.x, viletry.y, 32*FRACUNIT)); - while ((corpsehit = it.Next())) + FPortalGroupArray check(FPortalGroupArray::PGA_Full3d); + + FMultiBlockThingsIterator it(check, viletry.x, viletry.y, self->Z() - 64* FRACUNIT, self->Top() + 64 * FRACUNIT, 32 * FRACUNIT); + FMultiBlockThingsIterator::CheckResult cres; + while (it.Next(&cres)) { + AActor *corpsehit = cres.thing; FState *raisestate = corpsehit->GetRaiseState(); if (raisestate != NULL) { // use the current actor's radius instead of the Arch Vile's default. fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius; - if (abs(corpsehit->X() - viletry.x) > maxdist || - abs(corpsehit->Y() - viletry.y) > maxdist) + if (abs(cres.position.x - viletry.x) > maxdist || + abs(cres.position.y - viletry.y) > maxdist) continue; // not actually touching // Let's check if there are floors in between the archvile and its target - // if in a different section of the map, only consider possible if a line of sight exists. - if (corpsehit->Sector->PortalGroup != self->Sector->PortalGroup && !P_CheckSight(self, corpsehit)) - continue; - - sector_t *vilesec = self->Sector; - sector_t *corpsec = corpsehit->Sector; - // We only need to test if at least one of the sectors has a 3D floor. - sector_t *testsec = vilesec->e->XFloor.ffloors.Size() ? vilesec : - (vilesec != corpsec && corpsec->e->XFloor.ffloors.Size()) ? corpsec : NULL; - if (testsec) + if (corpsehit->Sector->PortalGroup != self->Sector->PortalGroup) { - fixed_t zdist1, zdist2; - if (P_Find3DFloor(testsec, corpsehit->Pos(), false, true, zdist1) - != P_Find3DFloor(testsec, self->Pos(), false, true, zdist2)) + // if in a different section of the map, only consider possible if a line of sight exists. + if (!P_CheckSight(self, corpsehit)) + continue; + } + else + { + sector_t *vilesec = self->Sector; + sector_t *corpsec = corpsehit->Sector; + // We only need to test if at least one of the sectors has a 3D floor. + sector_t *testsec = vilesec->e->XFloor.ffloors.Size() ? vilesec : + (vilesec != corpsec && corpsec->e->XFloor.ffloors.Size()) ? corpsec : NULL; + if (testsec) { - // Not on same floor - if (vilesec == corpsec || abs(zdist1 - self->Z()) > self->height) - continue; + fixed_t zdist1, zdist2; + if (P_Find3DFloor(testsec, corpsehit->Pos(), false, true, zdist1) + != P_Find3DFloor(testsec, self->Pos(), false, true, zdist2)) + { + // Not on same floor + if (vilesec == corpsec || abs(zdist1 - self->Z()) > self->height) + continue; + } } } diff --git a/src/p_maputl.h b/src/p_maputl.h index 838c4e775..21d69e1c8 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -129,6 +129,14 @@ struct polyblock_t; struct FPortalGroupArray { + // Controls how groups are connected + enum + { + PGA_NoSectorPortals,// only collect line portals + PGA_CheckPosition, // only collects sector portals at the actual position + PGA_Full3d, // Goes up and down sector portals at any linedef within the bounding box (this is a lot slower and should only be done if really needed.) + }; + enum { LOWER = 0x4000, @@ -141,8 +149,9 @@ struct FPortalGroupArray MAX_STATIC = 4 }; - FPortalGroupArray() + FPortalGroupArray(int collectionmethod = PGA_CheckPosition) { + method = collectionmethod; varused = 0; inited = false; } @@ -171,6 +180,7 @@ struct FPortalGroupArray } bool inited; + int method; private: WORD entry[MAX_STATIC]; diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 23bd2f911..e229b973f 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -2249,11 +2249,14 @@ void DPusher::Tick () // Seek out all pushable things within the force radius of this // point pusher. Crosses sectors, so use blockmap. - FBlockThingsIterator it(FBoundingBox(m_X, m_Y, m_Radius)); - AActor *thing; + FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals); // no sector portals because this thing is utterly z-unaware. + FMultiBlockThingsIterator it(check, m_X, m_Y, 0, 0, m_Radius); + FMultiBlockThingsIterator::CheckResult cres; - while ((thing = it.Next())) + + while (it.Next(&cres)) { + AActor *thing = cres.thing; // Normal ZDoom is based only on the WINDTHRUST flag, with the noclip cheat as an exemption. bool pusharound = ((thing->flags2 & MF2_WINDTHRUST) && !(thing->flags & MF_NOCLIP)); diff --git a/src/portal.cpp b/src/portal.cpp index addb92968..92d753407 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -1117,87 +1117,157 @@ void P_CreateLinkedPortals() // //============================================================================ + +static bool ProcessLayer() +{ +} + bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t upperz, fixed_t checkradius, FPortalGroupArray &out) { // Keep this temporary work stuff static. This function can never be called recursively // and this would have to be reallocated for each call otherwise. static FPortalBits processMask; static TArray foundPortals; + static TArray groupsToCheck; bool retval = false; out.inited = true; - if (linkedPortals.Size() == 0) + if (linkedPortals.Size() != 0) { - // If there are no portals, all sectors are in group 0. - return false; - } - processMask.setSize(linkedPortals.Size()); - processMask.clear(); - foundPortals.Clear(); + processMask.setSize(linkedPortals.Size()); + processMask.clear(); + foundPortals.Clear(); - int thisgroup = startgroup; - processMask.setBit(thisgroup); - //out.Add(thisgroup); + int thisgroup = startgroup; + processMask.setBit(thisgroup); + //out.Add(thisgroup); - for (unsigned i = 0; i < linkedPortals.Size(); i++) - { - line_t *ld = linkedPortals[i]->mOrigin; - int othergroup = ld->frontsector->PortalGroup; - FDisplacement &disp = Displacements(thisgroup, othergroup); - if (!disp.isSet) continue; // no connection. - - FBoundingBox box(position.x + disp.pos.x, position.y + disp.pos.y, checkradius); - - if (box.Right() <= ld->bbox[BOXLEFT] - || box.Left() >= ld->bbox[BOXRIGHT] - || box.Top() <= ld->bbox[BOXBOTTOM] - || box.Bottom() >= ld->bbox[BOXTOP]) - continue; // not touched - - if (box.BoxOnLineSide(linkedPortals[i]->mOrigin) != -1) continue; // not touched - foundPortals.Push(linkedPortals[i]); - } - bool foundone = true; - while (foundone) - { - foundone = false; - for (int i = foundPortals.Size() - 1; i >= 0; i--) + for (unsigned i = 0; i < linkedPortals.Size(); i++) { - if (processMask.getBit(foundPortals[i]->mOrigin->frontsector->PortalGroup) && - !processMask.getBit(foundPortals[i]->mDestination->frontsector->PortalGroup)) + line_t *ld = linkedPortals[i]->mOrigin; + int othergroup = ld->frontsector->PortalGroup; + FDisplacement &disp = Displacements(thisgroup, othergroup); + if (!disp.isSet) continue; // no connection. + + FBoundingBox box(position.x + disp.pos.x, position.y + disp.pos.y, checkradius); + + if (box.Right() <= ld->bbox[BOXLEFT] + || box.Left() >= ld->bbox[BOXRIGHT] + || box.Top() <= ld->bbox[BOXBOTTOM] + || box.Bottom() >= ld->bbox[BOXTOP]) + continue; // not touched + + if (box.BoxOnLineSide(linkedPortals[i]->mOrigin) != -1) continue; // not touched + foundPortals.Push(linkedPortals[i]); + } + bool foundone = true; + while (foundone) + { + foundone = false; + for (int i = foundPortals.Size() - 1; i >= 0; i--) { - processMask.setBit(foundPortals[i]->mDestination->frontsector->PortalGroup); - out.Add(foundPortals[i]->mDestination->frontsector->PortalGroup); - foundone = true; - retval = true; - foundPortals.Delete(i); + if (processMask.getBit(foundPortals[i]->mOrigin->frontsector->PortalGroup) && + !processMask.getBit(foundPortals[i]->mDestination->frontsector->PortalGroup)) + { + processMask.setBit(foundPortals[i]->mDestination->frontsector->PortalGroup); + out.Add(foundPortals[i]->mDestination->frontsector->PortalGroup); + foundone = true; + retval = true; + foundPortals.Delete(i); + } } } } - sector_t *sec = P_PointInSector(position.x, position.y); - sector_t *wsec = sec; - while (!wsec->PortalBlocksMovement(sector_t::ceiling) && upperz > wsec->SkyBoxes[sector_t::ceiling]->threshold) + if (out.method != FPortalGroupArray::PGA_NoSectorPortals) { - sector_t *othersec = wsec->SkyBoxes[sector_t::ceiling]->Sector; - fixedvec2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup); - fixed_t dx = position.x + pos.x; - fixed_t dy = position.y + pos.y; - processMask.setBit(othersec->PortalGroup); - out.Add(othersec->PortalGroup|FPortalGroupArray::UPPER); - wsec = P_PointInSector(dx, dy); // get upper sector at the exact spot we want to check and repeat - retval = true; - } - wsec = sec; - while (!wsec->PortalBlocksMovement(sector_t::floor) && position.z < wsec->SkyBoxes[sector_t::floor]->threshold) - { - sector_t *othersec = wsec->SkyBoxes[sector_t::floor]->Sector; - fixedvec2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup); - fixed_t dx = position.x + pos.x; - fixed_t dy = position.y + pos.y; - processMask.setBit(othersec->PortalGroup|FPortalGroupArray::LOWER); - out.Add(othersec->PortalGroup); - wsec = P_PointInSector(dx, dy); // get lower sector at the exact spot we want to check and repeat - retval = true; + sector_t *sec = P_PointInSector(position.x, position.y); + sector_t *wsec = sec; + while (!wsec->PortalBlocksMovement(sector_t::ceiling) && upperz > wsec->SkyBoxes[sector_t::ceiling]->threshold) + { + sector_t *othersec = wsec->SkyBoxes[sector_t::ceiling]->Sector; + fixedvec2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup); + fixed_t dx = position.x + pos.x; + fixed_t dy = position.y + pos.y; + processMask.setBit(othersec->PortalGroup); + out.Add(othersec->PortalGroup | FPortalGroupArray::UPPER); + wsec = P_PointInSector(dx, dy); // get upper sector at the exact spot we want to check and repeat + retval = true; + } + wsec = sec; + while (!wsec->PortalBlocksMovement(sector_t::floor) && position.z < wsec->SkyBoxes[sector_t::floor]->threshold) + { + sector_t *othersec = wsec->SkyBoxes[sector_t::floor]->Sector; + fixedvec2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup); + fixed_t dx = position.x + pos.x; + fixed_t dy = position.y + pos.y; + processMask.setBit(othersec->PortalGroup | FPortalGroupArray::LOWER); + out.Add(othersec->PortalGroup); + wsec = P_PointInSector(dx, dy); // get lower sector at the exact spot we want to check and repeat + retval = true; + } + if (out.method == FPortalGroupArray::PGA_Full3d) + { + groupsToCheck.Clear(); + groupsToCheck.Push(startgroup); + int thisgroup = startgroup; + for (unsigned i = 0; i < groupsToCheck.Size();i++) + { + fixedvec2 disp = Displacements.getOffset(startgroup, thisgroup & ~FPortalGroupArray::FLAT); + FBoundingBox box(position.x + disp.x, position.y + disp.y, checkradius); + FBlockLinesIterator it(box); + line_t *ld; + while ((ld = it.Next())) + { + if (box.Right() <= ld->bbox[BOXLEFT] + || box.Left() >= ld->bbox[BOXRIGHT] + || box.Top() <= ld->bbox[BOXBOTTOM] + || box.Bottom() >= ld->bbox[BOXTOP]) + continue; + + if (box.BoxOnLineSide(ld) != -1) + continue; + + if (!(thisgroup & FPortalGroupArray::LOWER)) + { + for (int s = 0; s < 2; s++) + { + sector_t *sec = s ? ld->backsector : ld->frontsector; + if (sec && !(sec->PortalBlocksMovement(sector_t::ceiling))) + { + if (sec->SkyBoxes[sector_t::ceiling]->threshold < upperz) + { + int grp = sec->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup; + if (!(processMask.getBit(grp))) + { + processMask.setBit(grp); + groupsToCheck.Push(grp | FPortalGroupArray::UPPER); + } + } + } + } + } + if (!(thisgroup & FPortalGroupArray::UPPER)) + { + for (int s = 0; s < 2; s++) + { + sector_t *sec = s ? ld->backsector : ld->frontsector; + if (sec && !(sec->PortalBlocksMovement(sector_t::floor))) + { + if (sec->SkyBoxes[sector_t::floor]->threshold > position.z) + { + int grp = sec->SkyBoxes[sector_t::floor]->Sector->PortalGroup; + if (!(processMask.getBit(grp))) + { + processMask.setBit(grp); + groupsToCheck.Push(grp | FPortalGroupArray::LOWER); + } + } + } + } + } + } + } + } } return retval; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index ec876da15..19c34cd4f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5570,10 +5570,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) } else { - FBlockThingsIterator it(FBoundingBox(self->X(), self->Y(), distance)); - while ((thing = it.Next())) + FPortalGroupArray check(FPortalGroupArray::PGA_Full3d); + fixed_t mid = self->Z() + self->height / 2; + FMultiBlockThingsIterator it(check, self->X(), self->Y(), mid-distance, mid+distance, distance); + FMultiBlockThingsIterator::CheckResult cres; + + while ((it.Next(&cres))) { - given += DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist); + given += DoRadiusGive(self, cres.thing, item, amount, distance, flags, filter, species, mindist); } } ACTION_RETURN_INT(given); From 0fba6563c77604bb2ffc4cf91403bdbbc128aa6c Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 28 Feb 2016 10:45:56 +0200 Subject: [PATCH 10/39] Disabled fullscreen mode for OS X startup window There is no use for auxiliary fullscreen window because it behaves really weird --- src/posix/cocoa/i_common.h | 6 ++++++ src/posix/cocoa/st_console.mm | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/posix/cocoa/i_common.h b/src/posix/cocoa/i_common.h index c0986b90a..beff4a33d 100644 --- a/src/posix/cocoa/i_common.h +++ b/src/posix/cocoa/i_common.h @@ -145,6 +145,10 @@ enum static const NSOpenGLPixelFormatAttribute NSOpenGLPFAAllowOfflineRenderers = NSOpenGLPixelFormatAttribute(96); +@interface NSWindow(SetCollectionBehavior) +- (void)setCollectionBehavior:(NSUInteger)collectionBehavior; +@end + #endif // prior to 10.5 @@ -182,6 +186,8 @@ typedef NSInteger NSApplicationActivationPolicy; - (NSRect)convertRectToBacking:(NSRect)aRect; @end +static const NSWindowCollectionBehavior NSWindowCollectionBehaviorFullScreenAuxiliary = NSWindowCollectionBehavior(1 << 8); + #endif // prior to 10.7 #endif // COCOA_I_COMMON_INCLUDED diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index b990b9b33..5aafa3935 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -113,6 +113,12 @@ FConsoleWindow::FConsoleWindow() [m_window center]; [m_window exitAppOnClose]; + if (NSAppKitVersionNumber >= AppKit10_7) + { + // Do not allow fullscreen mode for this window + [m_window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; + } + [[m_window contentView] addSubview:m_scrollView]; [m_window makeKeyAndOrderFront:nil]; From c687394f727a02741bbbb666c8a07ce026fe97c4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 28 Feb 2016 10:58:50 +0200 Subject: [PATCH 11/39] Added generic way to do periodic updates of OS X startup window It's used to avoid updating of window (progress bar in particular) too often Most of time were spent on UI events processing but not on data loading --- src/posix/cocoa/st_console.mm | 44 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index 5aafa3935..d33a3e361 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -192,6 +192,39 @@ void FConsoleWindow::ShowFatalError(const char* const message) } +static const unsigned int THIRTY_FPS = 33; // milliseconds per update + + +template +struct TimedUpdater +{ + explicit TimedUpdater(const Function& function) + { + const unsigned int currentTime = I_MSTime(); + + if (currentTime - m_previousTime > interval) + { + m_previousTime = currentTime; + + function(); + + [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; + } + } + + static unsigned int m_previousTime; +}; + +template +unsigned int TimedUpdater::m_previousTime; + +template +static void UpdateTimed(const Function& function) +{ + TimedUpdater dummy(function); +} + + void FConsoleWindow::AddText(const char* message) { PalEntry color(223, 223, 223); @@ -376,18 +409,11 @@ void FConsoleWindow::Progress(const int current, const int maximum) return; } - static unsigned int previousTime = I_MSTime(); - unsigned int currentTime = I_MSTime(); - - if (currentTime - previousTime > 33) // approx. 30 FPS + UpdateTimed([&]() { - previousTime = currentTime; - [m_progressBar setMaxValue:maximum]; [m_progressBar setDoubleValue:current]; - - [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; - } + }); } From 145b7be0a16299c70084c96b3123681fe4e05461 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 28 Feb 2016 11:03:40 +0200 Subject: [PATCH 12/39] Fixed particular slowdown in OS X startup window During loading of .pk3 that stores hundred of .wad's significant amount of time were spent on scrolling text to the last line The same applies to other cases like output of thousands warnings/errors --- src/posix/cocoa/st_console.mm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index d33a3e361..09d0c9421 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -313,9 +313,10 @@ void FConsoleWindow::AddText(const char* message) if ([m_window isVisible]) { - [m_textView scrollRangeToVisible:NSMakeRange(m_characterCount, 0)]; - - [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; + UpdateTimed([&]() + { + [m_textView scrollRangeToVisible:NSMakeRange(m_characterCount, 0)]; + }); } } From 64f80456ada5e298227854de5ca390974e02f5f0 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 28 Feb 2016 11:13:15 +0200 Subject: [PATCH 13/39] Initialized scroll view with the same rectangle as other controls in OS X startup window --- src/posix/cocoa/st_console.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index 09d0c9421..09c15e395 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -94,7 +94,7 @@ FConsoleWindow::FConsoleWindow() [textContainer setContainerSize:NSMakeSize(initialWidth, FLT_MAX)]; [textContainer setWidthTracksTextView:YES]; - [m_scrollView initWithFrame:NSMakeRect(0.0f, 0.0f, initialWidth, initialHeight)]; + [m_scrollView initWithFrame:initialRect]; [m_scrollView setBorderType:NSNoBorder]; [m_scrollView setHasVerticalScroller:YES]; [m_scrollView setHasHorizontalScroller:NO]; From 067b421f39222f0b8d68ef505454b20ce33343d8 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 28 Feb 2016 11:17:52 +0200 Subject: [PATCH 14/39] Fixed default width of progress bar in OS X startup window If window was resized before progress bar appears it will have hardcoded and so incorrect width --- src/posix/cocoa/st_console.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index 09c15e395..cdeb2cbaa 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -377,7 +377,12 @@ void FConsoleWindow::SetProgressBar(const bool visible) { ExpandTextView(-PROGRESS_BAR_HEIGHT); - m_progressBar = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(2.0f, 0.0f, 508.0f, 16.0f)]; + static const CGFloat PROGRESS_BAR_X = 2.0f; + const NSRect PROGRESS_BAR_RECT = NSMakeRect( + PROGRESS_BAR_X, 0.0f, + [m_window frame].size.width - PROGRESS_BAR_X * 2, 16.0f); + + m_progressBar = [[NSProgressIndicator alloc] initWithFrame:PROGRESS_BAR_RECT]; [m_progressBar setIndeterminate:NO]; [m_progressBar setAutoresizingMask:NSViewWidthSizable]; From 243f59d96d783fd20799d5f8f43b562e57182e13 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 27 Feb 2016 18:20:22 +0200 Subject: [PATCH 15/39] Made sure that the last text line is always visible in OS X startup window These case are handled specifically: * When waiting for clients or host to join * When showing a fatal error --- src/posix/cocoa/st_console.h | 2 ++ src/posix/cocoa/st_console.mm | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/posix/cocoa/st_console.h b/src/posix/cocoa/st_console.h index 6b6f01820..b2af7bade 100644 --- a/src/posix/cocoa/st_console.h +++ b/src/posix/cocoa/st_console.h @@ -89,6 +89,8 @@ private: void ExpandTextView(float height); void AddText(const PalEntry& color, const char* message); + + void ScrollTextToBottom(); }; #endif // COCOA_ST_CONSOLE_INCLUDED diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index cdeb2cbaa..9618e7222 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -188,6 +188,8 @@ void FConsoleWindow::ShowFatalError(const char* const message) AddText(PalEntry(255, 255, 170), message); AddText("\n"); + ScrollTextToBottom(); + [NSApp runModalForWindow:m_window]; } @@ -338,6 +340,14 @@ void FConsoleWindow::AddText(const PalEntry& color, const char* const message) } +void FConsoleWindow::ScrollTextToBottom() +{ + [m_textView scrollRangeToVisible:NSMakeRange(m_characterCount, 0)]; + + [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; +} + + void FConsoleWindow::SetTitleText() { static const CGFloat TITLE_TEXT_HEIGHT = 32.0f; @@ -485,6 +495,8 @@ void FConsoleWindow::NetInit(const char* const message, const int playerCount) [m_window setFrame:windowRect display:YES]; [[m_window contentView] addSubview:m_netView]; + + ScrollTextToBottom(); } [m_netMessageText setStringValue:[NSString stringWithUTF8String:message]]; From 0822485593812dcf3be5c9580d27ba96e7927b02 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 28 Feb 2016 15:05:13 +0200 Subject: [PATCH 16/39] Used ISO Latin 1 encoding for text in startup window on OS X Attempts to output errors with bad characters encountered during text lumps parsing were failed miserably because of UTF-8 conversion Example: loading of GZ-Models-r16.pk3 with GZDoom caused 'NSConcreteAttributedString initWithString:: nil value' exception --- src/posix/cocoa/st_console.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/posix/cocoa/st_console.mm b/src/posix/cocoa/st_console.mm index 9618e7222..b59502398 100644 --- a/src/posix/cocoa/st_console.mm +++ b/src/posix/cocoa/st_console.mm @@ -324,7 +324,8 @@ void FConsoleWindow::AddText(const char* message) void FConsoleWindow::AddText(const PalEntry& color, const char* const message) { - NSString* const text = [NSString stringWithUTF8String:message]; + NSString* const text = [NSString stringWithCString:message + encoding:NSISOLatin1StringEncoding]; NSDictionary* const attributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize:14.0f], NSFontAttributeName, From fadc7de63643fb0d1218b088720376aee5ac3309 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 01:36:39 +0100 Subject: [PATCH 17/39] - added a sight check to A_Blast for cross-portal effects. --- src/g_hexen/a_blastradius.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/g_hexen/a_blastradius.cpp b/src/g_hexen/a_blastradius.cpp index c83211585..bfaec55d0 100644 --- a/src/g_hexen/a_blastradius.cpp +++ b/src/g_hexen/a_blastradius.cpp @@ -151,6 +151,11 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast) { // Out of range continue; } + if (mo->Sector->PortalGroup != self->Sector->PortalGroup && !P_CheckSight(self, mo)) + { + // in another region and cannot be seen. + continue; + } BlastActor (mo, strength, speed, self, blasteffect, !!(blastflags & BF_NOIMPACTDAMAGE)); } return 0; From 7242a0ef94234fa1c789ce2ddbe8d1b651c47835 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 10:26:07 +0100 Subject: [PATCH 18/39] - fixed: Rendering 2-sided walls with 3D floor light effects had the 'is3dfloor' flag of GetLightLevel inverted. --- src/r_defs.h | 2 +- src/r_segs.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index 6ad406eca..f325f0861 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -978,7 +978,7 @@ struct side_t BYTE Flags; int Index; // needed to access custom UDMF fields which are stored in loading order. - int GetLightLevel (bool foggy, int baselight, bool noabsolute=false, int *pfakecontrast_usedbygzdoom=NULL) const; + int GetLightLevel (bool foggy, int baselight, bool is3dlight=false, int *pfakecontrast_usedbygzdoom=NULL) const; void SetLight(SWORD l) { diff --git a/src/r_segs.cpp b/src/r_segs.cpp index ae38b3978..0448cf6aa 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -272,17 +272,17 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) if (fixedlightlev < 0) { + if (!(fake3D & FAKE3D_CLIPTOP)) + { + sclipTop = sec->ceilingplane.ZatPoint(viewx, viewy); + } for (i = frontsector->e->XFloor.lightlist.Size() - 1; i >= 0; i--) { - if (!(fake3D & FAKE3D_CLIPTOP)) - { - sclipTop = sec->ceilingplane.ZatPoint(viewx, viewy); - } - if (sclipTop <= frontsector->e->XFloor.lightlist[i].plane.ZatPoint(viewx, viewy)) + if (sclipTop <= frontsector->e->XFloor.lightlist[i].plane.Zat0()) { lightlist_t *lit = &frontsector->e->XFloor.lightlist[i]; basecolormap = lit->extra_colormap; - wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource == NULL) + r_actualextralight); + wallshade = LIGHT2SHADE(curline->sidedef->GetLightLevel(foggy, *lit->p_lightlevel, lit->lightsource != NULL) + r_actualextralight); break; } } From 6c37ab231099f0adf2884b8ad7955aa8e154c31e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 10:45:14 +0100 Subject: [PATCH 19/39] - changed: If the IWAD contains a MENUDEF lump the one in zdoom.pk3 should not print texture warnings. The reason is that in such a case it is very likely that the IWAD defines its own menu and will most likely not provide all assets for the base definitions. See 'Adventures of Square' for an example. --- src/menu/menudef.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 04c10760e..ebd002b4e 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -60,6 +60,7 @@ static FListMenuDescriptor DefaultListMenuSettings; // contains common settings static FOptionMenuDescriptor DefaultOptionMenuSettings; // contains common settings for all Option menus FOptionMenuSettings OptionSettings; FOptionMap OptionValues; +bool mustPrintErrors; void I_BuildALDeviceList(FOptionValues *opt); @@ -99,7 +100,7 @@ static FTextureID GetMenuTexture(const char* const name) { const FTextureID texture = TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch); - if (!texture.Exists()) + if (!texture.Exists() && mustPrintErrors) { Printf("Missing menu texture: \"%s\"\n", name); } @@ -956,10 +957,14 @@ void M_ParseMenuDefs() atterm( DeinitMenus); DeinitMenus(); + + int IWADMenu = Wads.CheckNumForName("MENUDEF", ns_global, FWadCollection::IWAD_FILENUM); + while ((lump = Wads.FindLump ("MENUDEF", &lastlump)) != -1) { FScanner sc(lump); + mustPrintErrors = lump >= IWADMenu; sc.SetCMode(true); while (sc.GetString()) { From 0cf9cae7f3a2a1056117970d32ff2824bfdf0d26 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 10:48:51 +0100 Subject: [PATCH 20/39] - added some #pragma warnings to i_crash.cpp to silence a warning message in Microsoft's headers. --- src/win32/i_crash.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/win32/i_crash.cpp b/src/win32/i_crash.cpp index 0735e3553..70d10fa30 100644 --- a/src/win32/i_crash.cpp +++ b/src/win32/i_crash.cpp @@ -45,7 +45,13 @@ #include #endif #ifndef __GNUC__ +#if _MSC_VER +#pragma warning(disable:4091) // this silences a warning for a bogus definition in the Windows 8.1 SDK. +#endif #include +#if _MSC_VER +#pragma warning(default:4091) +#endif #endif #include #include From 2321c9973f778717da202ae9907c58fc2ea50aca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 12:39:03 +0100 Subject: [PATCH 21/39] - fixed some serious efficiency problems with clipping masked geometry against portals. The function to do the work scanned the full list of drawsegs to find portals, which with a large amount of masked geometry and/or drawsegs could become extremely slow. Changed it so that R_DrawMasked collects all portal related drawsegs up front so that the actual clipping code can a) scan a far shorter list and b) can skip half of the validation. Also using P_PointOnLinePrecise to shave off a small bit of additional time. --- src/r_things.cpp | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index 1fb4c845b..21fd1605b 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -324,18 +324,19 @@ nextpost: // [ZZ] // R_ClipSpriteColumnWithPortals // -static inline bool R_ClipSpriteColumnWithPortals (fixed_t x, fixed_t y, vissprite_t* spr) -{ - // [ZZ] 10.01.2016: don't clip sprites from the root of a skybox. - if (CurrentPortalInSkybox) - return false; +static TArray portaldrawsegs; + +static inline void R_CollectPortals() +{ + // This function collects all drawsegs that may be of interest to R_ClipSpriteColumnWithPortals + // Having that function over the entire list of drawsegs can break down performance quite drastically. + // This is doing the costly stuff only once so that R_ClipSpriteColumnWithPortals can + // a) exit early if no relevant info is found and + // b) skip most of the collected drawsegs which have no portal attached. + portaldrawsegs.Clear(); for (drawseg_t* seg = ds_p; seg-- > firstdrawseg; ) // copied code from killough below { - // ignore segs from other portals - if (seg->CurrentPortalUniq != CurrentPortalUniq) - continue; - // I don't know what makes this happen (some old top-down portal code or possibly skybox code? something adds null lines...) // crashes at the first frame of the first map of Action2.wad if (!seg->curline) continue; @@ -352,8 +353,28 @@ static inline bool R_ClipSpriteColumnWithPortals (fixed_t x, fixed_t y, vissprit if (seg->curline->sidedef != line->sidedef[0]) continue; + portaldrawsegs.Push(seg); + } +} + +static inline bool R_ClipSpriteColumnWithPortals(fixed_t x, fixed_t y, vissprite_t* spr) +{ + // [ZZ] 10.01.2016: don't clip sprites from the root of a skybox. + if (CurrentPortalInSkybox) + return false; + + for(drawseg_t *seg : portaldrawsegs) + { + // ignore segs from other portals + if (seg->CurrentPortalUniq != CurrentPortalUniq) + continue; + + // (all checks that are already done in R_CollectPortals have been removed for performance reasons.) + + line_t* line = seg->curline->linedef; + // don't clip if the sprite is in front of the portal - if (!P_PointOnLineSide(x, y, line)) + if (!P_PointOnLineSidePrecise(x, y, line)) continue; // now if current column is covered by this drawseg, we clip it away @@ -364,6 +385,7 @@ static inline bool R_ClipSpriteColumnWithPortals (fixed_t x, fixed_t y, vissprit return false; } + // // R_DrawVisSprite // mfloorclip and mceilingclip should also be set. @@ -2332,6 +2354,7 @@ void R_DrawHeightPlanes(fixed_t height); // kg3D - fake planes void R_DrawMasked (void) { + R_CollectPortals(); R_SortVisSprites (DrewAVoxel ? sv_compare2d : sv_compare, firstvissprite - vissprites); if (height_top == NULL) From 2b74ee1eef3a164c7ef71317af05c8676d210fae Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 29 Feb 2016 13:14:33 +0200 Subject: [PATCH 22/39] Fixed assertion failure caused by a missing class to spawn This fixes debugging troubles with states that have action functions like A_SpawnItem("MissingClass") --- src/zscript/vm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zscript/vm.h b/src/zscript/vm.h index f92906fd2..5b37aa47c 100644 --- a/src/zscript/vm.h +++ b/src/zscript/vm.h @@ -900,7 +900,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction #define PARAM_STATE_AT(p,x) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_STATE || param[p].a == NULL)); FState *x = (FState *)param[p].a; #define PARAM_POINTER_AT(p,x,type) assert((p) < numparam); assert(param[p].Type == REGT_POINTER); type *x = (type *)param[p].a; #define PARAM_OBJECT_AT(p,x,type) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); type *x = (type *)param[p].a; assert(x == NULL || x->IsKindOf(RUNTIME_CLASS(type))); -#define PARAM_CLASS_AT(p,x,base) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); base::MetaClass *x = (base::MetaClass *)param[p].a; assert(x != NULL && x->IsDescendantOf(RUNTIME_CLASS(base))); +#define PARAM_CLASS_AT(p,x,base) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); base::MetaClass *x = (base::MetaClass *)param[p].a; assert(x == NULL || x->IsDescendantOf(RUNTIME_CLASS(base))); // For optional paramaters. These have dangling elses for you to fill in the default assignment. e.g.: // PARAM_INT_OPT(0,myint) { myint = 55; } @@ -918,7 +918,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction #define PARAM_STATE_OPT_AT(p,x) FState *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_STATE || param[p].a == NULL)); x = (FState *)param[p].a; } else #define PARAM_POINTER_OPT_AT(p,x,type) type *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER); x = (type *)param[p].a; } else #define PARAM_OBJECT_OPT_AT(p,x,type) type *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (type *)param[p].a; assert(x == NULL || x->IsKindOf(RUNTIME_CLASS(type))); } else -#define PARAM_CLASS_OPT_AT(p,x,base) base::MetaClass *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (base::MetaClass *)param[p].a; assert(x != NULL && x->IsDescendantOf(RUNTIME_CLASS(base))); } else +#define PARAM_CLASS_OPT_AT(p,x,base) base::MetaClass *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (base::MetaClass *)param[p].a; assert(x == NULL || x->IsDescendantOf(RUNTIME_CLASS(base))); } else // The above, but with an automatically increasing position index. #define PARAM_PROLOGUE int paramnum = -1; From 38c1b8588cd608e7c6038dcd41e5a5365cb8fe4d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 16:21:05 +0100 Subject: [PATCH 23/39] - made spawning of teleport fog portal aware. --- src/p_teleport.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index b7f9c4fd5..594ad7cc2 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -106,7 +106,6 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, fixedvec3 old; fixed_t aboveFloor; player_t *player; - angle_t an; sector_t *destsect; bool resetpitch = false; fixed_t floorheight, ceilingheight; @@ -193,8 +192,9 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, if (!predicting) { fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; - an = angle >> ANGLETOFINESHIFT; - P_SpawnTeleportFog(thing, x + 20 * finecosine[an], y + 20 * finesine[an], thing->Z() + fogDelta, false, true); + fixedvec2 vector = Vec2Angle(20 * FRACUNIT, angle); + fixedvec2 fogpos = P_GetOffsetPosition(x, y, vector.x, vector.y); + P_SpawnTeleportFog(thing, fogpos.x, fogpos.y, thing->Z() + fogDelta, false, true); } if (thing->player) From 07771bd56e731a574018967c8f5cd3427141c28d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 16:29:51 +0100 Subject: [PATCH 24/39] - changed parameter of P_GetOffsetPosition to a simple coordinate so that it can be used for other things than actors. --- src/actor.h | 8 ++++---- src/portal.cpp | 6 +++--- src/portal.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/actor.h b/src/actor.h index 25caaaede..8f38e6e8c 100644 --- a/src/actor.h +++ b/src/actor.h @@ -893,7 +893,7 @@ public: fixedvec2 ret = { X() + dx, Y() + dy }; return ret; } - else return P_GetOffsetPosition(this, dx, dy); + else return P_GetOffsetPosition(X(), Y(), dx, dy); } @@ -905,7 +905,7 @@ public: Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; return ret; } - else return P_GetOffsetPosition(this, FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); + else return P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); } fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) @@ -917,7 +917,7 @@ public: } else { - fixedvec2 op = P_GetOffsetPosition(this, dx, dy); + fixedvec2 op = P_GetOffsetPosition(X(), Y(), dx, dy); fixedvec3 pos = { op.x, op.y, Z() + dz }; return pos; } @@ -933,7 +933,7 @@ public: } else { - fixedvec2 op = P_GetOffsetPosition(this, FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); + fixedvec2 op = P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); fixedvec3 pos = { op.x, op.y, Z() + dz }; return pos; } diff --git a/src/portal.cpp b/src/portal.cpp index 92d753407..8cf4bf546 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -701,12 +701,12 @@ void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy) // //============================================================================ -fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy) +fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy) { - fixedvec2 dest = { actor->X() + dx, actor->Y() + dy }; + fixedvec2 dest = { x + dx, y + dy }; if (PortalBlockmap.containsLines) { - fixed_t actx = actor->X(), acty = actor->Y(); + fixed_t actx = x, acty = y; // Try some easily discoverable early-out first. If we know that the trace cannot possibly find a portal, this saves us from calling the traverser completely for vast parts of the map. if (dx < 128 * FRACUNIT && dy < 128 * FRACUNIT) { diff --git a/src/portal.h b/src/portal.h index ef8cec98a..127a9ec3b 100644 --- a/src/portal.h +++ b/src/portal.h @@ -198,6 +198,6 @@ void P_TranslatePortalAngle(line_t* src, line_t* dst, angle_t& angle); void P_TranslatePortalZ(line_t* src, line_t* dst, fixed_t& z); void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy); fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y); -fixedvec2 P_GetOffsetPosition(AActor *actor, fixed_t dx, fixed_t dy); +fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy); #endif \ No newline at end of file From 0c7aea88dba5beb27dc39e4c26241ce3d848921c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 16:40:28 +0100 Subject: [PATCH 25/39] - made particles portal-aware. --- src/p_effect.cpp | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/p_effect.cpp b/src/p_effect.cpp index ffd1f303c..0b4fe0e55 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -205,9 +205,9 @@ void P_FindParticleSubsectors () } for (WORD i = ActiveParticles; i != NO_PARTICLE; i = Particles[i].tnext) { - subsector_t *ssec = R_PointInSubsector (Particles[i].x, Particles[i].y); - int ssnum = int(ssec-subsectors); - Particles[i].subsector = ssec; + // Try to reuse the subsector from the last portal check, if still valid. + if (Particles[i].subsector == NULL) Particles[i].subsector = R_PointInSubsector(Particles[i].x, Particles[i].y); + int ssnum = int(Particles[i].subsector - subsectors); Particles[i].snext = ParticlesInSubsec[ssnum]; ParticlesInSubsec[ssnum] = i; } @@ -278,12 +278,37 @@ void P_ThinkParticles () InactiveParticles = (int)(particle - Particles); continue; } - particle->x += particle->velx; - particle->y += particle->vely; + + fixedvec2 newxy = P_GetOffsetPosition(particle->x, particle->y, particle->velx, particle->vely); + particle->x = newxy.x; + particle->y = newxy.y; + //particle->x += particle->velx; + //particle->y += particle->vely; particle->z += particle->velz; particle->velx += particle->accx; particle->vely += particle->accy; particle->velz += particle->accz; + particle->subsector = R_PointInSubsector(particle->x, particle->y); + if (!particle->subsector->sector->PortalBlocksMovement(sector_t::ceiling)) + { + AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::ceiling]; + if (particle->z > skybox->threshold) + { + particle->x += skybox->scaleX; + particle->y += skybox->scaleY; + particle->subsector = NULL; + } + } + else if (!particle->subsector->sector->PortalBlocksMovement(sector_t::floor)) + { + AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::floor]; + if (particle->z < skybox->threshold) + { + particle->x += skybox->scaleX; + particle->y += skybox->scaleY; + particle->subsector = NULL; + } + } prev = particle; } } From 6bcaa51968f9804f981448e61473f2bf017a8fc0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Feb 2016 21:40:37 +0100 Subject: [PATCH 26/39] - updates eternity.xlat. --- wadsrc/static/xlat/eternity.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt index a95028d28..d23bf899f 100644 --- a/wadsrc/static/xlat/eternity.txt +++ b/wadsrc/static/xlat/eternity.txt @@ -25,15 +25,14 @@ enum // 271 = 0, Static_Init (tag, Init_TransferSky, 0) // 272 = 0, Static_Init (tag, Init_TransferSky, 1) -// Small script starters. Small is considered deprecated now anyway. -273 = 0, Unsupported() // "WR_StartScript_1S" -274 = 0, Unsupported() // "W1_StartScript" -275 = 0, Unsupported() // "W1_StartScript_1S" -276 = 0, Unsupported() // "SR_StartScript" -277 = 0, Unsupported() // "S1_StartScript" -278 = 0, Unsupported() // "GR_StartScript" -279 = 0, Unsupported() // "G1_StartScript" -280 = 0, Unsupported() // "WR_StartScript" +273 = WALK|REP|FIRSTSIDE, ACS_Execute(tag) +274 = WALK, ACS_Execute(tag) +275 = WALK|FIRSTSIDE, ACS_Execute(tag) +276 = USE|REP, ACS_Execute(tag) +277 = USE, ACS_Execute(tag) +278 = SHOOT|REP, ACS_Execute(tag) +279 = SHOOT, ACS_Execute(tag) +280 = WALK|REP, ACS_Execute(tag) // 3D mid-textures 281 = 0, Sector_Attach3DMidtex(tag, 0, 0) // "3DMidTex_MoveWithFloor" @@ -214,3 +213,5 @@ enum 426 = 0, DamageThing(0) 427 = 0, Thing_Damage(0) 428 = 0, Thing_Destroy(0) +429 = 0, Door_LockedRaise(0) +430 = 0, ACS_LockedExecute(0) From 2584108200b7a72b78189efb82c7be23320040ee Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Mar 2016 01:36:36 +0100 Subject: [PATCH 27/39] - removed the one-sided line portals on polyobjects only limitation. Using Eternity's polyportal testmap shows that it expects one-sided crossable portals on non-polyobject walls. - converted the P_TranslatePortal* functions to use floating point trigonometry. The combination of R_PointToAngle and finesine even created discrepancies with perfectly parallel portals which is just not acceptable. - added a function to FPathTraverse to relocate the trace and restart from the new position. - made P_UseLines portal aware. Traversal through line portals is complete (all types, even teleporters), whether sector portals need better treatment remains to be seen - at the moment it only checks the range at the player's vertical center. --- src/actor.h | 1 + src/p_map.cpp | 47 ++++++++++++++++++++++++++++++++++------------- src/p_maputl.cpp | 46 ++++++++++++++++++++++++++++++++++++++++------ src/p_maputl.h | 5 +++-- src/p_mobj.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/p_spec.cpp | 8 ++++---- src/p_spec.h | 6 +++--- src/p_switch.cpp | 4 ++-- src/portal.cpp | 44 ++++++++++---------------------------------- 9 files changed, 133 insertions(+), 64 deletions(-) diff --git a/src/actor.h b/src/actor.h index 8f38e6e8c..d30da8922 100644 --- a/src/actor.h +++ b/src/actor.h @@ -743,6 +743,7 @@ public: inline bool IsNoClip2() const; void CheckPortalTransition(bool islinked); + fixedvec3 GetPortalTransition(fixed_t byoffset); // What species am I? virtual FName GetSpecies(); diff --git a/src/p_map.cpp b/src/p_map.cpp index 7f66fd2d4..235282434 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -820,8 +820,8 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (!ld->backsector) { // One sided line - // Needed for polyobject portals. Having two-sided lines just for portals on otherwise solid polyobjects is a messy subject. - if ((cres.line->sidedef[0]->Flags & WALLF_POLYOBJ) && cres.line->isLinePortal()) + // Needed for polyobject portals. + if (cres.line->isLinePortal()) { spechit_t spec; spec.line = ld; @@ -4731,10 +4731,11 @@ bool P_TalkFacing(AActor *player) // //========================================================================== -bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline) +bool P_UseTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy, bool &foundline) { - FPathTraverse it(usething->X(), usething->Y(), endx, endy, PT_ADDLINES | PT_ADDTHINGS); + FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES | PT_ADDTHINGS); intercept_t *in; + fixedvec3 xpos = { startx, starty, usething->Z() }; while ((in = it.Next())) { @@ -4754,6 +4755,21 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline } continue; } + if (in->d.line->isLinePortal()) + { + if (P_PointOnLineSide(xpos.x, xpos.y, in->d.line) == 0) + { + FLinePortal *port = in->d.line->getPortal(); + if (port->mType != PORTT_LINKED) // other types will cause problems with + { + return true; + } + // Also translate the player origin, so that we can use that for checks further below and in P_CheckSwitchRange + it.PortalRealign(in, PT_ADDLINES | PT_ADDTHINGS, &xpos); + } + continue; + + } FLineOpening open; if (in->d.line->special == 0 || !(in->d.line->activation & (SPAC_Use | SPAC_UseThrough | SPAC_UseBack))) @@ -4782,7 +4798,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline return true; } - sec = P_PointOnLineSide(usething->X(), usething->Y(), in->d.line) == 0 ? + sec = P_PointOnLineSide(xpos.x, xpos.y, in->d.line) == 0 ? in->d.line->frontsector : in->d.line->backsector; if (sec != NULL && sec->SecActTarget && @@ -4801,7 +4817,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline continue; // not a special line, but keep checking } - if (P_PointOnLineSide(usething->X(), usething->Y(), in->d.line) == 1) + if (P_PointOnLineSide(xpos.x, xpos.y, in->d.line) == 1) { if (!(in->d.line->activation & SPAC_UseBack)) { @@ -4811,7 +4827,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline } else { - P_ActivateLine(in->d.line, usething, 1, SPAC_UseBack); + P_ActivateLine(in->d.line, usething, 1, SPAC_UseBack, &xpos); return true; } } @@ -4822,7 +4838,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline goto blocked; // Line cannot be used from front side so treat it as a non-trigger line } - P_ActivateLine(in->d.line, usething, 0, SPAC_Use); + P_ActivateLine(in->d.line, usething, 0, SPAC_Use, &xpos); //WAS can't use more than one special line in a row //jff 3/21/98 NOW multiple use allowed with enabling line flag @@ -4859,9 +4875,9 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline // //========================================================================== -bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy) +bool P_NoWayTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy) { - FPathTraverse it(usething->X(), usething->Y(), endx, endy, PT_ADDLINES); + FPathTraverse it(startx, starty, endx, endy, PT_ADDLINES); intercept_t *in; while ((in = it.Next())) @@ -4872,6 +4888,7 @@ bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy) // [GrafZahl] de-obfuscated. Was I the only one who was unable to make sense out of // this convoluted mess? if (ld->special) continue; + if (ld->isLinePortal()) return false; if (ld->flags&(ML_BLOCKING | ML_BLOCKEVERYTHING | ML_BLOCK_PLAYERS)) return true; P_LineOpening(open, NULL, ld, it.Trace().x + FixedMul(it.Trace().dx, in->frac), it.Trace().y + FixedMul(it.Trace().dy, in->frac)); @@ -4890,12 +4907,16 @@ bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy) // //========================================================================== +CVAR(Int, userange, 0, 0); + void P_UseLines(player_t *player) { bool foundline = false; + // If the player is transitioning a portal, use the group that is at its vertical center. + fixedvec2 start = player->mo->GetPortalTransition(player->mo->height / 2); // [NS] Now queries the Player's UseRange. - fixedvec2 end = player->mo->Vec2Angle(player->mo->UseRange, player->mo->angle, true); + fixedvec2 end = start + Vec2Angle(userange > 0? fixed_t(userange<mo->UseRange, player->mo->angle); // old code: // @@ -4903,13 +4924,13 @@ void P_UseLines(player_t *player) // // This added test makes the "oof" sound work on 2s lines -- killough: - if (!P_UseTraverse(player->mo, end.x, end.y, foundline)) + if (!P_UseTraverse(player->mo, start.x, start.y, end.x, end.y, foundline)) { // [RH] Give sector a chance to eat the use sector_t *sec = player->mo->Sector; int spac = SECSPAC_Use; if (foundline) spac |= SECSPAC_UseWall; if ((!sec->SecActTarget || !sec->SecActTarget->TriggerAction(player->mo, spac)) && - P_NoWayTraverse(player->mo, end.x, end.y)) + P_NoWayTraverse(player->mo, start.x, start.y, end.x, end.y)) { S_Sound(player->mo, CHAN_VOICE, "*usefail", 1, ATTN_IDLE); } diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 9d98f4bf5..64eec19be 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1203,7 +1203,7 @@ void FPathTraverse::AddLineIntercepts(int bx, int by) P_MakeDivline (ld, &dl); frac = P_InterceptVector (&trace, &dl); - if (frac < 0 || frac > FRACUNIT) continue; // behind source or beyond end point + if (frac < startfrac || frac > FRACUNIT) continue; // behind source or beyond end point intercept_t newintercept; @@ -1284,7 +1284,7 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it { // It's a hit fixed_t frac = P_InterceptVector (&trace, &line); - if (frac < 0) + if (frac < startfrac) { // behind source continue; } @@ -1352,7 +1352,7 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it frac = P_InterceptVector (&trace, &dl); - if (frac >= 0) + if (frac >= startfrac) { intercept_t newintercept; newintercept.frac = frac; @@ -1400,7 +1400,7 @@ intercept_t *FPathTraverse::Next() // //=========================================================================== -void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags) +void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, fixed_t startfrac) { fixed_t xt1, xt2; fixed_t yt1, yt2; @@ -1424,6 +1424,7 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl validcount++; intercept_index = intercepts.Size(); + this->startfrac = startfrac; if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0) x1 += FRACUNIT; // don't side exactly on a line @@ -1444,8 +1445,8 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl trace.dy = y2 - y1; } - _x1 = (long long)x1 - bmaporgx; - _y1 = (long long)y1 - bmaporgy; + _x1 = (long long)x1 + FixedMul(trace.dx, startfrac) - bmaporgx; + _y1 = (long long)y1 + FixedMul(trace.dy, startfrac) - bmaporgy; x1 -= bmaporgx; y1 -= bmaporgy; xt1 = int(_x1 >> MAPBLOCKSHIFT); @@ -1608,6 +1609,39 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl } } +//=========================================================================== +// +// +// +//=========================================================================== + +bool FPathTraverse::PortalRealign(intercept_t *in, int flags, fixedvec3 *optpos) +{ + if (!in->isaline || !in->d.line->isLinePortal()) return false; + fixed_t hitx = trace.x; + fixed_t hity = trace.y; + fixed_t endx = trace.x + trace.dx; + fixed_t endy = trace.y + trace.dy; + line_t *out = in->d.line->getPortalDestination(); + + P_TranslatePortalXY(in->d.line, out, hitx, hity); + P_TranslatePortalXY(in->d.line, out, endx, endy); + if (optpos != NULL) + { + P_TranslatePortalXY(in->d.line, out, optpos->x, optpos->y); + P_TranslatePortalZ(in->d.line, out, optpos->z); + } + intercepts.Resize(intercept_index); + init(hitx, hity, endx, endy, flags, in->frac); + return true; +} + +//=========================================================================== +// +// +// +//=========================================================================== + FPathTraverse::~FPathTraverse() { intercepts.Resize(intercept_index); diff --git a/src/p_maputl.h b/src/p_maputl.h index 21d69e1c8..97c534c0e 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -339,6 +339,7 @@ protected: static TArray intercepts; divline_t trace; + fixed_t startfrac; unsigned int intercept_index; unsigned int intercept_count; unsigned int count; @@ -354,7 +355,8 @@ public: { init(x1, y1, x2, y2, flags); } - void init(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags); + void init(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, fixed_t startfrac = 0); + bool PortalRealign(intercept_t *in, int flags, fixedvec3 *optpos = NULL); virtual ~FPathTraverse(); const divline_t &Trace() const { return trace; } }; @@ -394,5 +396,4 @@ fixed_t P_InterceptVector (const divline_t *v2, const divline_t *v1); #define PT_COMPATIBLE 4 #define PT_DELTA 8 // x2,y2 is passed as a delta, not as an endpoint - #endif \ No newline at end of file diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 51a671369..f03362ab5 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3286,6 +3286,42 @@ void AActor::SetRoll(angle_t r, bool interpolate) } +fixedvec3 AActor::GetPortalTransition(fixed_t byoffset) +{ + bool moved = false; + sector_t *sec = Sector; + fixed_t testz = Z() + byoffset; + fixedvec3 pos = Pos(); + + while (!sec->PortalBlocksMovement(sector_t::ceiling)) + { + AActor *port = sec->SkyBoxes[sector_t::ceiling]; + if (testz > port->threshold) + { + pos = PosRelative(port->Sector); + sec = P_PointInSector(pos.x, pos.y); + moved = true; + } + else break; + } + if (!moved) + { + while (!sec->PortalBlocksMovement(sector_t::floor)) + { + AActor *port = sec->SkyBoxes[sector_t::floor]; + if (testz <= port->threshold) + { + pos = PosRelative(port->Sector); + sec = P_PointInSector(pos.x, pos.y); + } + else break; + } + } + return pos; +} + + + void AActor::CheckPortalTransition(bool islinked) { bool moved = false; diff --git a/src/p_spec.cpp b/src/p_spec.cpp index e229b973f..b9f2fa218 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -201,14 +201,14 @@ bool CheckIfExitIsGood (AActor *self, level_info_t *info) // //============================================================================ -bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType) +bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, fixedvec3 *optpos) { int lineActivation; INTBOOL repeat; INTBOOL buttonSuccess; BYTE special; - if (!P_TestActivateLine (line, mo, side, activationType)) + if (!P_TestActivateLine (line, mo, side, activationType, optpos)) { return false; } @@ -262,7 +262,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType) // //============================================================================ -bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType) +bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType, fixedvec3 *optpos) { int lineActivation = line->activation; @@ -291,7 +291,7 @@ bool P_TestActivateLine (line_t *line, AActor *mo, int side, int activationType) } if (activationType == SPAC_Use || activationType == SPAC_UseBack) { - if (!P_CheckSwitchRange(mo, line, side)) + if (!P_CheckSwitchRange(mo, line, side, optpos)) { return false; } diff --git a/src/p_spec.h b/src/p_spec.h index 0548a6b51..560ec9acd 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -165,8 +165,8 @@ void P_SpawnSpecials (void); void P_UpdateSpecials (void); // when needed -bool P_ActivateLine (line_t *ld, AActor *mo, int side, int activationType); -bool P_TestActivateLine (line_t *ld, AActor *mo, int side, int activationType); +bool P_ActivateLine (line_t *ld, AActor *mo, int side, int activationType, fixedvec3 *optpos = NULL); +bool P_TestActivateLine (line_t *ld, AActor *mo, int side, int activationType, fixedvec3 *optpos = NULL); bool P_PredictLine (line_t *ld, AActor *mo, int side, int activationType); void P_PlayerInSpecialSector (player_t *player, sector_t * sector=NULL); @@ -404,7 +404,7 @@ void EV_StartLightFading (int tag, int value, int tics); #define BUTTONTIME TICRATE // 1 second, in ticks. bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *quest=NULL); -bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno); +bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpos = NULL); // // P_PLATS diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 0c9d37ccc..98630705c 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -112,7 +112,7 @@ static bool P_StartButton (side_t *side, int Where, FSwitchDef *Switch, fixed_t // //========================================================================== -bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) +bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpos) { // Activated from an empty side -> always succeed side_t *side = line->sidedef[sideno]; @@ -140,7 +140,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) P_MakeDivline (line, &dll); - fixedvec3 pos = user->PosRelative(line); + fixedvec3 pos = optpos? *optpos : user->PosRelative(line); dlu.x = pos.x; dlu.y = pos.y; dlu.dx = finecosine[user->angle >> ANGLETOFINESHIFT]; diff --git a/src/portal.cpp b/src/portal.cpp index 8cf4bf546..6f7192a52 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -277,7 +277,7 @@ void P_SpawnLinePortal(line_t* line) for (int i = 0; i < numlines; i++) { - if (tagManager.GetFirstLineID(&lines[i]) == mytag && lines[i].args[0] == 1) + if (tagManager.GetFirstLineID(&lines[i]) == mytag && lines[i].args[0] == 1 && lines[i].special == Line_SetPortal) { line->portalindex = linePortals.Reserve(1); FLinePortal *port = &linePortals.Last(); @@ -323,12 +323,6 @@ void P_UpdatePortal(FLinePortal *port) // Portal has no destination: switch it off port->mFlags = 0; } - else if ((port->mOrigin->backsector == NULL && !(port->mOrigin->sidedef[0]->Flags & WALLF_POLYOBJ)) || - (port->mDestination->backsector == NULL && !(port->mOrigin->sidedef[0]->Flags & WALLF_POLYOBJ))) - { - // disable teleporting capability if a portal is or links to a one-sided wall (unless part of a polyobject.) - port->mFlags = PORTF_VISIBLE; - } else if (port->mDestination->getPortalDestination() != port->mOrigin) { //portal doesn't link back. This will be a simple teleporter portal. @@ -562,24 +556,17 @@ void P_TranslatePortalXY(line_t* src, line_t* dst, fixed_t& x, fixed_t& y) // Get the angle between the two linedefs, for rotating // orientation and velocity. Rotate 180 degrees, and flip // the position across the exit linedef, if reversed. - angle_t angle = - R_PointToAngle2(0, 0, dst->dx, dst->dy) - - R_PointToAngle2(0, 0, src->dx, src->dy); - angle += ANGLE_180; - - // Sine, cosine of angle adjustment - fixed_t s = finesine[angle>>ANGLETOFINESHIFT]; - fixed_t c = finecosine[angle>>ANGLETOFINESHIFT]; - - fixed_t tx, ty; + double angle = atan2(dst->dy, dst->dx) - atan2(src->dy, src->dx) + M_PI; + fixed_t s = FLOAT2FIXED(sin(angle)); + fixed_t c = FLOAT2FIXED(cos(angle)); nposx = x - src->v1->x; nposy = y - src->v1->y; // Rotate position along normal to match exit linedef - tx = FixedMul(nposx, c) - FixedMul(nposy, s); - ty = FixedMul(nposy, c) + FixedMul(nposx, s); + fixed_t tx = FixedMul(nposx, c) - FixedMul(nposy, s); + fixed_t ty = FixedMul(nposy, c) + FixedMul(nposx, s); tx += dst->v2->x; ty += dst->v2->y; @@ -596,15 +583,9 @@ void P_TranslatePortalXY(line_t* src, line_t* dst, fixed_t& x, fixed_t& y) void P_TranslatePortalVXVY(line_t* src, line_t* dst, fixed_t& vx, fixed_t& vy) { - angle_t angle = - R_PointToAngle2(0, 0, dst->dx, dst->dy) - - R_PointToAngle2(0, 0, src->dx, src->dy); - - angle += ANGLE_180; - - // Sine, cosine of angle adjustment - fixed_t s = finesine[angle>>ANGLETOFINESHIFT]; - fixed_t c = finecosine[angle>>ANGLETOFINESHIFT]; + double angle = atan2(dst->dy, dst->dx) - atan2(src->dy, src->dx) + M_PI; + fixed_t s = FLOAT2FIXED(sin(angle)); + fixed_t c = FLOAT2FIXED(cos(angle)); fixed_t orig_velx = vx; fixed_t orig_vely = vy; @@ -626,12 +607,7 @@ void P_TranslatePortalAngle(line_t* src, line_t* dst, angle_t& angle) // Get the angle between the two linedefs, for rotating // orientation and velocity. Rotate 180 degrees, and flip // the position across the exit linedef, if reversed. - angle_t xangle = - R_PointToAngle2(0, 0, dst->dx, dst->dy) - - R_PointToAngle2(0, 0, src->dx, src->dy); - - xangle += ANGLE_180; - angle += xangle; + angle += RAD2ANGLE(atan2(dst->dy, dst->dx) - atan2(src->dy, src->dx)) + ANGLE_180; } //============================================================================ From 5e7ecb3c4452a3ec21c70c7562e1e574bf6fc1b2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Mar 2016 01:53:09 +0100 Subject: [PATCH 28/39] - hm. I thouggr thia has been saved before committing. --- src/p_map.cpp | 6 +----- src/p_maputl.cpp | 4 ++-- src/p_maputl.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 235282434..ef5264f69 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4760,12 +4760,8 @@ bool P_UseTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t end if (P_PointOnLineSide(xpos.x, xpos.y, in->d.line) == 0) { FLinePortal *port = in->d.line->getPortal(); - if (port->mType != PORTT_LINKED) // other types will cause problems with - { - return true; - } // Also translate the player origin, so that we can use that for checks further below and in P_CheckSwitchRange - it.PortalRealign(in, PT_ADDLINES | PT_ADDTHINGS, &xpos); + it.PortalRelocate(in, PT_ADDLINES | PT_ADDTHINGS, &xpos); } continue; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 64eec19be..75c4e8830 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1611,11 +1611,11 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl //=========================================================================== // -// +// Relocates the trace when going through a line portal // //=========================================================================== -bool FPathTraverse::PortalRealign(intercept_t *in, int flags, fixedvec3 *optpos) +bool FPathTraverse::PortalRelocate(intercept_t *in, int flags, fixedvec3 *optpos) { if (!in->isaline || !in->d.line->isLinePortal()) return false; fixed_t hitx = trace.x; diff --git a/src/p_maputl.h b/src/p_maputl.h index 97c534c0e..b4155995f 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -356,7 +356,7 @@ public: init(x1, y1, x2, y2, flags); } void init(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, fixed_t startfrac = 0); - bool PortalRealign(intercept_t *in, int flags, fixedvec3 *optpos = NULL); + bool PortalRelocate(intercept_t *in, int flags, fixedvec3 *optpos = NULL); virtual ~FPathTraverse(); const divline_t &Trace() const { return trace; } }; From 15b6c117485b32e0ab70529487104611a5fbbcb6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Mar 2016 02:06:31 +0100 Subject: [PATCH 29/39] - did some cleanup on FPathTraverse::PortalRelocate. --- src/p_map.cpp | 9 +-------- src/p_maputl.cpp | 2 ++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index ef5264f69..1a4a18d74 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4755,16 +4755,9 @@ bool P_UseTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t end } continue; } - if (in->d.line->isLinePortal()) + if (it.PortalRelocate(in, PT_ADDLINES | PT_ADDTHINGS, &xpos)) { - if (P_PointOnLineSide(xpos.x, xpos.y, in->d.line) == 0) - { - FLinePortal *port = in->d.line->getPortal(); - // Also translate the player origin, so that we can use that for checks further below and in P_CheckSwitchRange - it.PortalRelocate(in, PT_ADDLINES | PT_ADDTHINGS, &xpos); - } continue; - } FLineOpening open; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 75c4e8830..c84d6d5e2 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1618,6 +1618,8 @@ void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int fl bool FPathTraverse::PortalRelocate(intercept_t *in, int flags, fixedvec3 *optpos) { if (!in->isaline || !in->d.line->isLinePortal()) return false; + if (P_PointOnLineSidePrecise(trace.x, trace.y, in->d.line) == 1) return false; + fixed_t hitx = trace.x; fixed_t hity = trace.y; fixed_t endx = trace.x + trace.dx; From f23c0121c562e33e999a693a8835a7a7fac84033 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 29 Feb 2016 21:11:24 -0600 Subject: [PATCH 30/39] Use new type system with DECORATE --- src/dobjtype.h | 1 - src/thingdef/thingdef_exp.h | 51 ++-- src/thingdef/thingdef_expression.cpp | 411 +++++++++++---------------- src/thingdef/thingdef_parse.cpp | 2 +- src/thingdef/thingdef_type.h | 96 ------- 5 files changed, 197 insertions(+), 364 deletions(-) delete mode 100644 src/thingdef/thingdef_type.h diff --git a/src/dobjtype.h b/src/dobjtype.h index 1e982e74b..ba2634f08 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -5,7 +5,6 @@ #error You must #include "dobject.h" to get dobjtype.h #endif -#include "thingdef/thingdef_type.h" #include "vm.h" // Variable/parameter/field flags ------------------------------------------- diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index daa824264..b5ab642d0 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -84,7 +84,7 @@ struct FCompileContext struct ExpVal { - ExpValType Type; + PType *Type; union { int Int; @@ -94,13 +94,13 @@ struct ExpVal ExpVal() { - Type = VAL_Int; + Type = TypeSInt32; Int = 0; } ~ExpVal() { - if (Type == VAL_String) + if (Type == TypeString) { ((FString *)&pointer)->~FString(); } @@ -108,14 +108,14 @@ struct ExpVal ExpVal(const FString &str) { - Type = VAL_String; + Type = TypeString; ::new(&pointer) FString(str); } ExpVal(const ExpVal &o) { Type = o.Type; - if (o.Type == VAL_String) + if (o.Type == TypeString) { ::new(&pointer) FString(*(FString *)&o.pointer); } @@ -127,12 +127,12 @@ struct ExpVal ExpVal &operator=(const ExpVal &o) { - if (Type == VAL_String) + if (Type == TypeString) { ((FString *)&pointer)->~FString(); } Type = o.Type; - if (o.Type == VAL_String) + if (o.Type == TypeString) { ::new(&pointer) FString(*(FString *)&o.pointer); } @@ -145,27 +145,30 @@ struct ExpVal int GetInt() const { - return Type == VAL_Int? Int : Type == VAL_Float? int(Float) : 0; + int regtype = Type->GetRegType(); + return regtype == REGT_INT ? Int : regtype == REGT_FLOAT ? int(Float) : 0; } double GetFloat() const { - return Type == VAL_Int? double(Int) : Type == VAL_Float? Float : 0; + int regtype = Type->GetRegType(); + return regtype == REGT_INT ? double(Int) : regtype == REGT_FLOAT ? Float : 0; } const FString GetString() const { - return Type == VAL_String ? *(FString *)&pointer : Type == VAL_Name ? FString(FName(ENamedName(Int)).GetChars()) : ""; + return Type == TypeString ? *(FString *)&pointer : Type == TypeName ? FString(FName(ENamedName(Int)).GetChars()) : ""; } bool GetBool() const { - return (Type == VAL_Int || Type == VAL_Sound) ? !!Int : Type == VAL_Float? Float!=0. : false; + int regtype = Type->GetRegType(); + return regtype == REGT_INT ? !!Int : regtype == REGT_FLOAT ? Float!=0. : false; } FName GetName() const { - return Type == VAL_Name? ENamedName(Int) : NAME_None; + return Type == TypeName ? ENamedName(Int) : NAME_None; } }; @@ -195,7 +198,7 @@ protected: { isresolved = false; ScriptPosition = pos; - ValueType = VAL_Unresolved; + ValueType = NULL; } public: virtual ~FxExpression() {} @@ -205,11 +208,13 @@ public: virtual bool isConstant() const; virtual void RequestAddress(); virtual VMFunction *GetDirectFunction(); + bool IsNumeric() const { return ValueType->GetRegType() == REGT_INT || ValueType->GetRegType() == REGT_FLOAT; } + bool IsPointer() const { return ValueType->GetRegType() == REGT_POINTER; } virtual ExpEmit Emit(VMFunctionBuilder *build); FScriptPosition ScriptPosition; - FExpressionType ValueType; + PType *ValueType; bool isresolved; }; @@ -288,35 +293,35 @@ class FxConstant : public FxExpression public: FxConstant(int val, const FScriptPosition &pos) : FxExpression(pos) { - ValueType = value.Type = VAL_Int; + ValueType = value.Type = TypeSInt32; value.Int = val; isresolved = true; } FxConstant(double val, const FScriptPosition &pos) : FxExpression(pos) { - ValueType = value.Type = VAL_Float; + ValueType = value.Type = TypeFloat64; value.Float = val; isresolved = true; } FxConstant(FSoundID val, const FScriptPosition &pos) : FxExpression(pos) { - ValueType = value.Type = VAL_Sound; + ValueType = value.Type = TypeSound; value.Int = val; isresolved = true; } FxConstant(FName val, const FScriptPosition &pos) : FxExpression(pos) { - ValueType = value.Type = VAL_Name; + ValueType = value.Type = TypeName; value.Int = val; isresolved = true; } FxConstant(const FString &str, const FScriptPosition &pos) : FxExpression(pos) { - ValueType = VAL_String; + ValueType = TypeString; value = ExpVal(str); isresolved = true; } @@ -327,19 +332,19 @@ public: ValueType = cv.Type; isresolved = true; } - - FxConstant(const PClass *val, const FScriptPosition &pos) : FxExpression(pos) + + FxConstant(PClass *val, const FScriptPosition &pos) : FxExpression(pos) { value.pointer = (void*)val; ValueType = val; - value.Type = VAL_Class; + value.Type = NewClassPointer(RUNTIME_CLASS(AActor)); isresolved = true; } FxConstant(FState *state, const FScriptPosition &pos) : FxExpression(pos) { value.pointer = state; - ValueType = value.Type = VAL_State; + ValueType = value.Type = TypeState; isresolved = true; } diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index d4bb41326..41c95379c 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -189,25 +189,20 @@ FxExpression *FxExpression::ResolveAsBoolean(FCompileContext &ctx) FxExpression *x = Resolve(ctx); if (x != NULL) { - switch (x->ValueType.Type) + if (x->ValueType->GetRegType() == REGT_INT) + { + x->ValueType = TypeSInt32; + } + else if (x->ValueType == TypeState) { - case VAL_Int: - case VAL_Sound: - case VAL_Color: - case VAL_Name: - x->ValueType = VAL_Int; - break; - - case VAL_State: x = new FxCastStateToBool(x); x = x->Resolve(ctx); - break; - - default: + } + else + { ScriptPosition.Message(MSG_ERROR, "Not an integral type"); delete this; return NULL; - break; } } return x; @@ -264,49 +259,22 @@ FxExpression *FxParameter::Resolve(FCompileContext& ctx) ExpEmit FxParameter::Emit(VMFunctionBuilder *build) { - if (Operand->isConstant()) + ExpEmit where = Operand->Emit(build); + + if (where.RegType == REGT_NIL) { - ExpVal val = static_cast(Operand)->GetValue(); - if (val.Type == VAL_Int || val.Type == VAL_Sound || val.Type == VAL_Name || val.Type == VAL_Color) - { - build->EmitParamInt(val.Int); - } - else if (val.Type == VAL_Float) - { - build->Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, build->GetConstantFloat(val.Float)); - } - else if (val.Type == VAL_Class || val.Type == VAL_Object) - { - build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(val.pointer, ATAG_OBJECT)); - } - else if (val.Type == VAL_State) - { - build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(val.pointer, ATAG_STATE)); - } - else if (val.Type == VAL_String) - { - build->Emit(OP_PARAM, 0, REGT_STRING | REGT_KONST, build->GetConstantString(val.GetString())); - } - else - { - build->Emit(OP_PARAM, 0, REGT_NIL, 0); - ScriptPosition.Message(MSG_ERROR, "Cannot emit needed constant"); - } + ScriptPosition.Message(MSG_ERROR, "Attempted to pass a non-value"); + build->Emit(OP_PARAM, 0, where.RegType, where.RegNum); } else { - ExpEmit where = Operand->Emit(build); - - if (where.RegType == REGT_NIL) + int regtype = where.RegType; + if (where.Konst) { - ScriptPosition.Message(MSG_ERROR, "Attempted to pass a non-value"); - build->Emit(OP_PARAM, 0, where.RegType, where.RegNum); - } - else - { - build->Emit(OP_PARAM, 0, where.RegType, where.RegNum); - where.Free(build); + regtype |= REGT_KONST; } + build->Emit(OP_PARAM, 0, regtype, where.RegNum); + where.Free(build); } return ExpEmit(); } @@ -350,35 +318,36 @@ ExpEmit FxConstant::Emit(VMFunctionBuilder *build) ExpEmit out; out.Konst = true; - if (value.Type == VAL_Int || value.Type == VAL_Sound || value.Type == VAL_Name || value.Type == VAL_Color) + int regtype = value.Type->GetRegType(); + out.RegType = regtype; + if (regtype == REGT_INT) { - out.RegType = REGT_INT; out.RegNum = build->GetConstantInt(value.Int); } - else if (value.Type == VAL_Float) + else if (regtype == REGT_FLOAT) { - out.RegType = REGT_FLOAT; out.RegNum = build->GetConstantFloat(value.Float); } - else if (value.Type == VAL_Class || value.Type == VAL_Object) + else if (regtype == REGT_POINTER) { - out.RegType = REGT_POINTER; - out.RegNum = build->GetConstantAddress(value.pointer, ATAG_OBJECT); + VM_ATAG tag = ATAG_GENERIC; + if (value.Type == TypeState) + { + tag = ATAG_STATE; + } + else if (value.Type->GetLoadOp() == OP_LO) + { + tag = ATAG_OBJECT; + } + out.RegNum = build->GetConstantAddress(value.pointer, tag); } - else if (value.Type == VAL_State) + else if (regtype == REGT_STRING) { - out.RegType = REGT_POINTER; - out.RegNum = build->GetConstantAddress(value.pointer, ATAG_STATE); - } - else if (value.Type == VAL_String) - { - out.RegType = REGT_STRING; out.RegNum = build->GetConstantString(value.GetString()); } else { ScriptPosition.Message(MSG_ERROR, "Cannot emit needed constant"); - out.RegType = REGT_NIL; out.RegNum = 0; } return out; @@ -394,7 +363,7 @@ FxIntCast::FxIntCast(FxExpression *x) : FxExpression(x->ScriptPosition) { basex=x; - ValueType = VAL_Int; + ValueType = TypeSInt32; } //========================================================================== @@ -419,14 +388,14 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(basex, ctx); - if (basex->ValueType == VAL_Int) + if (basex->ValueType->GetRegType() == REGT_INT) { FxExpression *x = basex; basex = NULL; delete this; return x; } - else if (basex->ValueType == VAL_Float) + else if (basex->ValueType->GetRegType() == REGT_FLOAT) { if (basex->isConstant()) { @@ -455,7 +424,7 @@ ExpEmit FxIntCast::Emit(VMFunctionBuilder *build) { ExpEmit from = basex->Emit(build); assert(!from.Konst); - assert(basex->ValueType == VAL_Float); + assert(basex->ValueType->GetRegType() == REGT_FLOAT); from.Free(build); ExpEmit to(build, REGT_INT); build->Emit(OP_CAST, to.RegNum, from.RegNum, CAST_F2I); @@ -472,7 +441,7 @@ FxFloatCast::FxFloatCast(FxExpression *x) : FxExpression(x->ScriptPosition) { basex=x; - ValueType = VAL_Float; + ValueType = TypeFloat64; } //========================================================================== @@ -497,14 +466,14 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(basex, ctx); - if (basex->ValueType == VAL_Float) + if (basex->ValueType->GetRegType() == REGT_FLOAT) { FxExpression *x = basex; basex = NULL; delete this; return x; } - else if (basex->ValueType == VAL_Int) + else if (basex->ValueType->GetRegType() == REGT_INT) { if (basex->isConstant()) { @@ -533,7 +502,7 @@ ExpEmit FxFloatCast::Emit(VMFunctionBuilder *build) { ExpEmit from = basex->Emit(build); assert(!from.Konst); - assert(basex->ValueType == VAL_Int); + assert(basex->ValueType->GetRegType() == REGT_INT); from.Free(build); ExpEmit to(build, REGT_FLOAT); build->Emit(OP_CAST, to.RegNum, from.RegNum, CAST_I2F); @@ -550,7 +519,7 @@ FxCastStateToBool::FxCastStateToBool(FxExpression *x) : FxExpression(x->ScriptPosition) { basex = x; - ValueType = VAL_Int; + ValueType = TypeSInt32; } //========================================================================== @@ -575,7 +544,7 @@ FxExpression *FxCastStateToBool::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(basex, ctx); - assert(basex->ValueType == VAL_State); + assert(basex->ValueType == TypeState); assert(!basex->isConstant() && "We shouldn't be able to generate a constant state ref"); return this; } @@ -635,7 +604,7 @@ FxExpression *FxPlusSign::Resolve(FCompileContext& ctx) CHECKRESOLVED(); SAFE_RESOLVE(Operand, ctx); - if (Operand->ValueType.isNumeric()) + if (Operand->IsNumeric()) { FxExpression *e = Operand; Operand = NULL; @@ -689,12 +658,12 @@ FxExpression *FxMinusSign::Resolve(FCompileContext& ctx) CHECKRESOLVED(); SAFE_RESOLVE(Operand, ctx); - if (Operand->ValueType.isNumeric()) + if (Operand->IsNumeric()) { if (Operand->isConstant()) { ExpVal val = static_cast(Operand)->GetValue(); - FxExpression *e = val.Type == VAL_Int? + FxExpression *e = val.Type->GetRegType() == REGT_INT ? new FxConstant(-val.Int, ScriptPosition) : new FxConstant(-val.Float, ScriptPosition); delete this; @@ -719,17 +688,17 @@ FxExpression *FxMinusSign::Resolve(FCompileContext& ctx) ExpEmit FxMinusSign::Emit(VMFunctionBuilder *build) { - assert(ValueType.Type == Operand->ValueType.Type); + assert(ValueType == Operand->ValueType); ExpEmit from = Operand->Emit(build); assert(from.Konst == 0); // Do it in-place. - if (ValueType == VAL_Int) + if (ValueType->GetRegType() == REGT_INT) { build->Emit(OP_NEG, from.RegNum, from.RegNum, 0); } else { - assert(ValueType == VAL_Float); + assert(ValueType->GetRegType() == REGT_FLOAT); build->Emit(OP_FLOP, from.RegNum, from.RegNum, FLOP_NEG); } return from; @@ -769,7 +738,7 @@ FxExpression *FxUnaryNotBitwise::Resolve(FCompileContext& ctx) CHECKRESOLVED(); SAFE_RESOLVE(Operand, ctx); - if (Operand->ValueType == VAL_Float /* lax */) + if (Operand->ValueType->GetRegType() == REGT_FLOAT /* lax */) { // DECORATE allows floats here so cast them to int. Operand = new FxIntCast(Operand); @@ -781,7 +750,7 @@ FxExpression *FxUnaryNotBitwise::Resolve(FCompileContext& ctx) } } - if (Operand->ValueType != VAL_Int) + if (Operand->ValueType->GetRegType() != REGT_INT) { ScriptPosition.Message(MSG_ERROR, "Integer type expected"); delete this; @@ -795,7 +764,7 @@ FxExpression *FxUnaryNotBitwise::Resolve(FCompileContext& ctx) delete this; return e; } - ValueType = VAL_Int; + ValueType = TypeSInt32; return this; } @@ -807,8 +776,8 @@ FxExpression *FxUnaryNotBitwise::Resolve(FCompileContext& ctx) ExpEmit FxUnaryNotBitwise::Emit(VMFunctionBuilder *build) { - assert(ValueType.Type == Operand->ValueType.Type); - assert(ValueType == VAL_Int); + assert(ValueType == Operand->ValueType); + assert(ValueType == TypeSInt32); ExpEmit from = Operand->Emit(build); assert(from.Konst == 0); // Do it in-place. @@ -858,7 +827,7 @@ FxExpression *FxUnaryNotBoolean::Resolve(FCompileContext& ctx) return NULL; } - if (Operand->ValueType.isNumeric() || Operand->ValueType.isPointer()) + if (Operand->IsNumeric() || Operand->IsPointer()) { if (Operand->isConstant()) { @@ -874,7 +843,7 @@ FxExpression *FxUnaryNotBoolean::Resolve(FCompileContext& ctx) delete this; return NULL; } - ValueType = VAL_Int; + ValueType = TypeSInt32; return this; } @@ -956,25 +925,21 @@ bool FxBinary::ResolveLR(FCompileContext& ctx, bool castnumeric) return false; } - if (left->ValueType == VAL_Int && right->ValueType == VAL_Int) + if (left->ValueType->GetRegType() == REGT_INT && right->ValueType->GetRegType() == REGT_INT) { - ValueType = VAL_Int; + ValueType = TypeSInt32; } - else if (left->ValueType.isNumeric() && right->ValueType.isNumeric()) + else if (left->IsNumeric() && right->IsNumeric()) { - ValueType = VAL_Float; + ValueType = TypeFloat64; } - else if (left->ValueType == VAL_Object && right->ValueType == VAL_Object) + else if (left->ValueType->GetRegType() == REGT_POINTER && left->ValueType == right->ValueType) { - ValueType = VAL_Object; - } - else if (left->ValueType == VAL_Class && right->ValueType == VAL_Class) - { - ValueType = VAL_Class; + ValueType = left->ValueType; } else { - ValueType = VAL_Unknown; + ValueType = TypeVoid; } if (castnumeric) @@ -986,11 +951,11 @@ bool FxBinary::ResolveLR(FCompileContext& ctx, bool castnumeric) void FxBinary::Promote(FCompileContext &ctx) { - if (left->ValueType == VAL_Float && right->ValueType == VAL_Int) + if (left->ValueType->GetRegType() == REGT_FLOAT && right->ValueType->GetRegType() == REGT_INT) { right = (new FxFloatCast(right))->Resolve(ctx); } - else if (left->ValueType == VAL_Int && right->ValueType == VAL_Float) + else if (left->ValueType->GetRegType() == REGT_INT && right->ValueType->GetRegType() == REGT_FLOAT) { left = (new FxFloatCast(left))->Resolve(ctx); } @@ -1018,7 +983,7 @@ FxExpression *FxAddSub::Resolve(FCompileContext& ctx) CHECKRESOLVED(); if (!ResolveLR(ctx, true)) return NULL; - if (!ValueType.isNumeric()) + if (!IsNumeric()) { ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); delete this; @@ -1026,7 +991,7 @@ FxExpression *FxAddSub::Resolve(FCompileContext& ctx) } else if (left->isConstant() && right->isConstant()) { - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { double v; double v1 = static_cast(left)->GetValue().GetFloat(); @@ -1079,7 +1044,7 @@ ExpEmit FxAddSub::Emit(VMFunctionBuilder *build) assert(!op1.Konst); op1.Free(build); op2.Free(build); - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { assert(op1.RegType == REGT_FLOAT && op2.RegType == REGT_FLOAT); ExpEmit to(build, REGT_FLOAT); @@ -1088,7 +1053,7 @@ ExpEmit FxAddSub::Emit(VMFunctionBuilder *build) } else { - assert(ValueType == VAL_Int); + assert(ValueType->GetRegType() == REGT_INT); assert(op1.RegType == REGT_INT && op2.RegType == REGT_INT); ExpEmit to(build, REGT_INT); build->Emit(op2.Konst ? OP_ADD_RK : OP_ADD_RR, to.RegNum, op1.RegNum, op2.RegNum); @@ -1101,7 +1066,7 @@ ExpEmit FxAddSub::Emit(VMFunctionBuilder *build) assert(!op1.Konst || !op2.Konst); op1.Free(build); op2.Free(build); - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { assert(op1.RegType == REGT_FLOAT && op2.RegType == REGT_FLOAT); ExpEmit to(build, REGT_FLOAT); @@ -1111,7 +1076,7 @@ ExpEmit FxAddSub::Emit(VMFunctionBuilder *build) } else { - assert(ValueType == VAL_Int); + assert(ValueType->GetRegType() == REGT_INT); assert(op1.RegType == REGT_INT && op2.RegType == REGT_INT); ExpEmit to(build, REGT_INT); build->Emit(op1.Konst ? OP_SUB_KR : op2.Konst ? OP_SUB_RK : OP_SUB_RR, @@ -1144,7 +1109,7 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx) if (!ResolveLR(ctx, true)) return NULL; - if (!ValueType.isNumeric()) + if (!IsNumeric()) { ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); delete this; @@ -1152,7 +1117,7 @@ FxExpression *FxMulDiv::Resolve(FCompileContext& ctx) } else if (left->isConstant() && right->isConstant()) { - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { double v; double v1 = static_cast(left)->GetValue().GetFloat(); @@ -1222,7 +1187,7 @@ ExpEmit FxMulDiv::Emit(VMFunctionBuilder *build) assert(!op1.Konst); op1.Free(build); op2.Free(build); - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { assert(op1.RegType == REGT_FLOAT && op2.RegType == REGT_FLOAT); ExpEmit to(build, REGT_FLOAT); @@ -1231,7 +1196,7 @@ ExpEmit FxMulDiv::Emit(VMFunctionBuilder *build) } else { - assert(ValueType == VAL_Int); + assert(ValueType->GetRegType() == REGT_INT); assert(op1.RegType == REGT_INT && op2.RegType == REGT_INT); ExpEmit to(build, REGT_INT); build->Emit(op2.Konst ? OP_MUL_RK : OP_MUL_RR, to.RegNum, op1.RegNum, op2.RegNum); @@ -1245,7 +1210,7 @@ ExpEmit FxMulDiv::Emit(VMFunctionBuilder *build) assert(Operator == '%' || Operator == '/'); op1.Free(build); op2.Free(build); - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { assert(op1.RegType == REGT_FLOAT && op2.RegType == REGT_FLOAT); ExpEmit to(build, REGT_FLOAT); @@ -1256,7 +1221,7 @@ ExpEmit FxMulDiv::Emit(VMFunctionBuilder *build) } else { - assert(ValueType == VAL_Int); + assert(ValueType->GetRegType() == REGT_INT); assert(op1.RegType == REGT_INT && op2.RegType == REGT_INT); ExpEmit to(build, REGT_INT); build->Emit(Operator == '/' ? (op1.Konst ? OP_DIV_KR : op2.Konst ? OP_DIV_RK : OP_DIV_RR) @@ -1289,7 +1254,7 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx) CHECKRESOLVED(); if (!ResolveLR(ctx, true)) return NULL; - if (!ValueType.isNumeric()) + if (!IsNumeric()) { ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); delete this; @@ -1299,7 +1264,7 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx) { int v; - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { double v1 = static_cast(left)->GetValue().GetFloat(); double v2 = static_cast(right)->GetValue().GetFloat(); @@ -1322,7 +1287,7 @@ FxExpression *FxCompareRel::Resolve(FCompileContext& ctx) return e; } Promote(ctx); - ValueType = VAL_Int; + ValueType = TypeSInt32; return this; } @@ -1410,28 +1375,18 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& ctx) return NULL; } - if (!ValueType.isNumeric() && !ValueType.isPointer()) + if (!IsNumeric() && !IsPointer()) { - if (left->ValueType.Type == right->ValueType.Type) - { - // compare other types? - if (left->ValueType == VAL_Sound || left->ValueType == VAL_Color || left->ValueType == VAL_Name) - { - left->ValueType = right->ValueType = VAL_Int; - goto cont; - } - } - ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); delete this; return NULL; } -cont: + if (left->isConstant() && right->isConstant()) { int v; - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { double v1 = static_cast(left)->GetValue().GetFloat(); double v2 = static_cast(right)->GetValue().GetFloat(); @@ -1448,7 +1403,7 @@ cont: return e; } Promote(ctx); - ValueType = VAL_Int; + ValueType = TypeSInt32; return this; } @@ -1505,7 +1460,7 @@ ExpEmit FxCompareEq::Emit(VMFunctionBuilder *build) FxBinaryInt::FxBinaryInt(int o, FxExpression *l, FxExpression *r) : FxBinary(o, l, r) { - ValueType = VAL_Int; + ValueType = TypeSInt32; } //========================================================================== @@ -1519,15 +1474,15 @@ FxExpression *FxBinaryInt::Resolve(FCompileContext& ctx) CHECKRESOLVED(); if (!ResolveLR(ctx, false)) return NULL; - if (ValueType == VAL_Float /* lax */) + if (ValueType->GetRegType() == REGT_FLOAT /* lax */) { // For DECORATE which allows floats here. - if (left->ValueType != VAL_Int) + if (left->ValueType->GetRegType() != REGT_INT) { left = new FxIntCast(left); left = left->Resolve(ctx); } - if (right->ValueType != VAL_Int) + if (right->ValueType->GetRegType() != REGT_INT) { right = new FxIntCast(right); right = right->Resolve(ctx); @@ -1537,10 +1492,10 @@ FxExpression *FxBinaryInt::Resolve(FCompileContext& ctx) delete this; return NULL; } - ValueType = VAL_Int; + ValueType = TypeSInt32; } - if (ValueType != VAL_Int) + if (ValueType->GetRegType() != REGT_INT) { ScriptPosition.Message(MSG_ERROR, "Integer type expected"); delete this; @@ -1573,8 +1528,8 @@ FxExpression *FxBinaryInt::Resolve(FCompileContext& ctx) ExpEmit FxBinaryInt::Emit(VMFunctionBuilder *build) { - assert(left->ValueType == VAL_Int); - assert(right->ValueType == VAL_Int); + assert(left->ValueType->GetRegType() == REGT_INT); + assert(right->ValueType->GetRegType() == REGT_INT); static const VM_UBYTE InstrMap[][4] = { { OP_SLL_RR, OP_SLL_KR, OP_SLL_RI }, // TK_LShift @@ -1656,7 +1611,7 @@ FxBinaryLogical::FxBinaryLogical(int o, FxExpression *l, FxExpression *r) Operator=o; left=l; right=r; - ValueType = VAL_Int; + ValueType = TypeSInt32; } //========================================================================== @@ -1753,11 +1708,11 @@ FxExpression *FxBinaryLogical::Resolve(FCompileContext& ctx) return x; } } - if (left->ValueType != VAL_Int && left->ValueType != VAL_Sound) + if (left->ValueType->GetRegType() != REGT_INT) { left = new FxIntCast(left); } - if (right->ValueType != VAL_Int && right->ValueType != VAL_Sound) + if (right->ValueType->GetRegType() != REGT_INT) { right = new FxIntCast(right); } @@ -1775,7 +1730,7 @@ ExpEmit FxBinaryLogical::Emit(VMFunctionBuilder *build) // This is not the "right" way to do these, but it works for now. // (Problem: No information sharing is done between nodes to reduce the // code size if you have something like a1 && a2 && a3 && ... && an.) - assert(left->ValueType == VAL_Int && right->ValueType == VAL_Int); + assert(left->ValueType->GetRegType() == REGT_INT && right->ValueType->GetRegType() == REGT_INT); ExpEmit op1 = left->Emit(build); assert(!op1.Konst); int zero = build->GetConstantInt(0); @@ -1865,10 +1820,10 @@ FxExpression *FxConditional::Resolve(FCompileContext& ctx) RESOLVE(falsex, ctx); ABORT(condition && truex && falsex); - if (truex->ValueType == VAL_Int && falsex->ValueType == VAL_Int) - ValueType = VAL_Int; - else if (truex->ValueType.isNumeric() && falsex->ValueType.isNumeric()) - ValueType = VAL_Float; + if (truex->ValueType->GetRegType() == REGT_INT && falsex->ValueType->GetRegType() == REGT_INT) + ValueType = TypeSInt32; + else if (truex->IsNumeric() && falsex->IsNumeric()) + ValueType = TypeFloat64; //else if (truex->ValueType != falsex->ValueType) if (condition->isConstant()) @@ -1883,14 +1838,14 @@ FxExpression *FxConditional::Resolve(FCompileContext& ctx) return e; } - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { - if (truex->ValueType != VAL_Float) + if (truex->ValueType->GetRegType() != REGT_FLOAT) { truex = new FxFloatCast(truex); RESOLVE(truex, ctx); } - if (falsex->ValueType != VAL_Float) + if (falsex->ValueType->GetRegType() != REGT_FLOAT) { falsex = new FxFloatCast(falsex); RESOLVE(falsex, ctx); @@ -1921,7 +1876,7 @@ ExpEmit FxConditional::Emit(VMFunctionBuilder *build) size_t patchspot = build->Emit(OP_JMP, 0); // Evaluate true expression. - if (truex->isConstant() && truex->ValueType == VAL_Int) + if (truex->isConstant() && truex->ValueType->GetRegType() == REGT_INT) { out = ExpEmit(build, REGT_INT); build->EmitLoadInt(out.RegNum, static_cast(truex)->GetValue().GetInt()); @@ -1945,7 +1900,7 @@ ExpEmit FxConditional::Emit(VMFunctionBuilder *build) // Evaluate false expression. build->BackpatchToHere(patchspot); - if (falsex->isConstant() && falsex->ValueType == VAL_Int) + if (falsex->isConstant() && falsex->ValueType->GetRegType() == REGT_INT) { build->EmitLoadInt(out.RegNum, static_cast(falsex)->GetValue().GetInt()); } @@ -2013,7 +1968,7 @@ FxExpression *FxAbs::Resolve(FCompileContext &ctx) SAFE_RESOLVE(val, ctx); - if (!val->ValueType.isNumeric()) + if (!val->IsNumeric()) { ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); delete this; @@ -2022,13 +1977,13 @@ FxExpression *FxAbs::Resolve(FCompileContext &ctx) else if (val->isConstant()) { ExpVal value = static_cast(val)->GetValue(); - switch (value.Type) + switch (value.Type->GetRegType()) { - case VAL_Int: + case REGT_INT: value.Int = abs(value.Int); break; - case VAL_Float: + case REGT_FLOAT: value.Float = fabs(value.Float); break; @@ -2079,7 +2034,6 @@ FxMinMax::FxMinMax(TArray &expr, FName type, const FScriptPositio assert(expr.Size() > 0); assert(type == NAME_Min || type == NAME_Max); - ValueType = VAL_Unknown; choices.Resize(expr.Size()); for (unsigned i = 0; i < expr.Size(); ++i) { @@ -2106,11 +2060,11 @@ FxExpression *FxMinMax::Resolve(FCompileContext &ctx) RESOLVE(choices[i], ctx); ABORT(choices[i]); - if (choices[i]->ValueType == VAL_Float) + if (choices[i]->ValueType->GetRegType() == REGT_FLOAT) { floatcount++; } - else if (choices[i]->ValueType == VAL_Int) + else if (choices[i]->ValueType->GetRegType() == REGT_INT) { intcount++; } @@ -2123,12 +2077,12 @@ FxExpression *FxMinMax::Resolve(FCompileContext &ctx) } if (floatcount != 0) { - ValueType = VAL_Float; + ValueType = TypeFloat64; if (intcount != 0) { // There are some ints that need to be cast to floats for (i = 0; i < choices.Size(); ++i) { - if (choices[i]->ValueType == VAL_Int) + if (choices[i]->ValueType->GetRegType() == REGT_INT) { choices[i] = new FxFloatCast(choices[i]); RESOLVE(choices[i], ctx); @@ -2139,7 +2093,7 @@ FxExpression *FxMinMax::Resolve(FCompileContext &ctx) } else { - ValueType = VAL_Int; + ValueType = TypeSInt32; } // If at least two arguments are constants, they can be solved now. @@ -2161,10 +2115,10 @@ FxExpression *FxMinMax::Resolve(FCompileContext &ctx) else { ExpVal value = static_cast(choices[j])->GetValue(); - assert(value.Type == ValueType.Type); + assert(value.Type == ValueType); if (Type == NAME_Min) { - if (value.Type == VAL_Float) + if (value.Type->GetRegType() == REGT_FLOAT) { if (value.Float < best.Float) { @@ -2181,7 +2135,7 @@ FxExpression *FxMinMax::Resolve(FCompileContext &ctx) } else { - if (value.Type == VAL_Float) + if (value.Type->GetRegType() == REGT_FLOAT) { if (value.Float > best.Float) { @@ -2245,12 +2199,12 @@ ExpEmit FxMinMax::Emit(VMFunctionBuilder *build) if (Type == NAME_Min) { - opcode = ValueType.Type == VAL_Float ? OP_LEF_RR : OP_LE_RR; + opcode = ValueType->GetRegType() == REGT_FLOAT ? OP_LEF_RR : OP_LE_RR; opA = 1; } else { - opcode = ValueType.Type == VAL_Float ? OP_LTF_RR : OP_LT_RR; + opcode = ValueType->GetRegType() == REGT_FLOAT ? OP_LTF_RR : OP_LT_RR; opA = 0; } @@ -2259,7 +2213,7 @@ ExpEmit FxMinMax::Emit(VMFunctionBuilder *build) // Get first value into a register. This will also be the result register. if (choices[0]->isConstant()) { - bestreg = ExpEmit(build, ValueType.Type == VAL_Float ? REGT_FLOAT : REGT_INT); + bestreg = ExpEmit(build, ValueType->GetRegType()); EmitLoad(build, bestreg, static_cast(choices[0])->GetValue()); } else @@ -2302,7 +2256,7 @@ FxRandom::FxRandom(FRandom * r, FxExpression *mi, FxExpression *ma, const FScrip } else min = max = NULL; rng = r; - ValueType = VAL_Int; + ValueType = TypeSInt32; } //========================================================================== @@ -2331,8 +2285,8 @@ FxExpression *FxRandom::Resolve(FCompileContext &ctx) RESOLVE(min, ctx); RESOLVE(max, ctx); ABORT(min && max); - assert(min->ValueType == ValueType.Type); - assert(max->ValueType == ValueType.Type); + assert(min->ValueType == ValueType); + assert(max->ValueType == ValueType); } return this; }; @@ -2418,7 +2372,14 @@ FxRandomPick::FxRandomPick(FRandom *r, TArray &expr, bool floaty, } rng = r; - ValueType = floaty ? VAL_Float : VAL_Int; + if (floaty) + { + ValueType = TypeFloat64; + } + else + { + ValueType = TypeSInt32; + } } //========================================================================== @@ -2444,7 +2405,7 @@ FxExpression *FxRandomPick::Resolve(FCompileContext &ctx) { RESOLVE(choices[index], ctx); ABORT(choices[index]); - assert(choices[index]->ValueType == ValueType.Type); + assert(choices[index]->ValueType == ValueType); } return this; }; @@ -2498,7 +2459,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) // For floating point results, we need to get a new register, since we can't // reuse the integer one used to store the random result. - if (ValueType == VAL_Float) + if (ValueType->GetRegType() == REGT_FLOAT) { resultreg = ExpEmit(build, REGT_FLOAT); resultreg.Free(build); @@ -2528,7 +2489,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) // was expected. Copy it to the one we wanted. resultreg.Reuse(build); // This is really just for the assert in Reuse() - build->Emit(ValueType == VAL_Int ? OP_MOVE : OP_MOVEF, resultreg.RegNum, casereg.RegNum, 0); + build->Emit(ValueType->GetRegType() == REGT_INT ? OP_MOVE : OP_MOVEF, resultreg.RegNum, casereg.RegNum, 0); resultreg.Free(build); } // Free this register so the remaining cases can use it. @@ -2565,7 +2526,7 @@ FxFRandom::FxFRandom(FRandom *r, FxExpression *mi, FxExpression *ma, const FScri min = new FxParameter(new FxFloatCast(mi)); max = new FxParameter(new FxFloatCast(ma)); } - ValueType = VAL_Float; + ValueType = TypeFloat64; } //========================================================================== @@ -2637,7 +2598,7 @@ FxRandom2::FxRandom2(FRandom *r, FxExpression *m, const FScriptPosition &pos) if (m) mask = new FxIntCast(m); else mask = new FxConstant(-1, pos); mask = new FxParameter(mask); - ValueType = VAL_Int; + ValueType = TypeSInt32; } //========================================================================== @@ -2814,7 +2775,7 @@ FxExpression *FxSelf::Resolve(FCompileContext& ctx) return NULL; } ValueType = ctx.cls; - ValueType.Type = VAL_Object; + ValueType = NewPointer(RUNTIME_CLASS(DObject)); return this; } @@ -2853,7 +2814,7 @@ FxDamage::FxDamage(const FScriptPosition &pos) FxExpression *FxDamage::Resolve(FCompileContext& ctx) { CHECKRESOLVED(); - ValueType = VAL_Int; + ValueType = TypeSInt32; return this; } @@ -2940,41 +2901,14 @@ FxExpression *FxClassMember::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(classx, ctx); - if (classx->ValueType != VAL_Object && classx->ValueType != VAL_Class) + PPointer *ptrtype = dyn_cast(classx->ValueType); + if (ptrtype == NULL || !ptrtype->IsKindOf(RUNTIME_CLASS(DObject))) { ScriptPosition.Message(MSG_ERROR, "Member variable requires a class or object"); delete this; return NULL; } - PType *type = membervar->Type; - PArray *arraytype = dyn_cast(type); - - if (arraytype != NULL) - { - type = arraytype->ElementType; - } - if (type->IsKindOf(RUNTIME_CLASS(PPointer))) - { - ValueType = VAL_Object; - } - else if (type->IsKindOf(RUNTIME_CLASS(PInt))) - { - ValueType = VAL_Int; - } - else if (type->IsKindOf(RUNTIME_CLASS(PFloat))) - { - ValueType = VAL_Float; - } - else - { - ScriptPosition.Message(MSG_ERROR, "Invalid type for member variable %s", membervar->SymbolName.GetChars()); - delete this; - return NULL; - } - if (arraytype != NULL) - { - ValueType.MakeArray(arraytype->ElementCount); - } + ValueType = membervar->Type; return this; } @@ -3067,7 +3001,7 @@ FxExpression *FxArrayElement::Resolve(FCompileContext &ctx) SAFE_RESOLVE(Array,ctx); SAFE_RESOLVE(index,ctx); - if (index->ValueType == VAL_Float /* lax */) + if (index->ValueType->GetRegType() == REGT_FLOAT /* lax */) { // DECORATE allows floats here so cast them to int. index = new FxIntCast(index); @@ -3078,22 +3012,23 @@ FxExpression *FxArrayElement::Resolve(FCompileContext &ctx) return NULL; } } - if (index->ValueType != VAL_Int) + if (index->ValueType->GetRegType() != REGT_INT) { ScriptPosition.Message(MSG_ERROR, "Array index must be integer"); delete this; return NULL; } - if (Array->ValueType != VAL_Array) + PArray *arraytype = dyn_cast(Array->ValueType); + if (arraytype == NULL) { ScriptPosition.Message(MSG_ERROR, "'[]' can only be used with arrays."); delete this; return NULL; } - ValueType = Array->ValueType.GetBaseType(); - if (ValueType != VAL_Int) + ValueType = arraytype->ElementType; + if (ValueType->GetRegType() != REGT_INT) { // int arrays only for now ScriptPosition.Message(MSG_ERROR, "Only integer arrays are supported."); @@ -3122,8 +3057,8 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build) } if (index->isConstant()) { - int indexval = static_cast(index)->GetValue().GetInt(); - if (indexval < 0 || indexval >= Array->ValueType.size) + unsigned indexval = static_cast(index)->GetValue().GetInt(); + if (indexval >= static_cast(Array->ValueType)->ElementCount) { I_Error("Array index out of bounds"); } @@ -3134,7 +3069,7 @@ ExpEmit FxArrayElement::Emit(VMFunctionBuilder *build) { ExpEmit indexv(index->Emit(build)); build->Emit(OP_SLL_RI, indexv.RegNum, indexv.RegNum, 2); - build->Emit(OP_BOUND, indexv.RegNum, Array->ValueType.size); + build->Emit(OP_BOUND, indexv.RegNum, static_cast(Array->ValueType)->ElementCount); build->Emit(OP_LW_R, dest.RegNum, start.RegNum, indexv.RegNum); indexv.Free(build); } @@ -3275,21 +3210,21 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx) if (ArgList != NULL) { - for(unsigned i = 0; i < ArgList->Size(); i++) + for (unsigned i = 0; i < ArgList->Size(); i++) { (*ArgList)[i] = (*ArgList)[i]->Resolve(ctx); if ((*ArgList)[i] == NULL) failed = true; if (Special < 0 && i == 0) { - if ((*ArgList)[i]->ValueType != VAL_Name) + if ((*ArgList)[i]->ValueType != TypeName) { ScriptPosition.Message(MSG_ERROR, "Name expected for parameter %d", i); failed = true; } } - else if ((*ArgList)[i]->ValueType != VAL_Int) + else if ((*ArgList)[i]->ValueType->GetRegType() != REGT_INT) { - if ((*ArgList)[i]->ValueType == VAL_Float /* lax */) + if ((*ArgList)[i]->ValueType->GetRegType() == REGT_FLOAT /* lax */) { (*ArgList)[i] = new FxIntCast((*ArgList)[i]); } @@ -3306,7 +3241,7 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx) return NULL; } } - ValueType = VAL_Int; + ValueType = TypeSInt32; return this; } @@ -3347,13 +3282,13 @@ ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build) FxExpression *argex = (*ArgList)[i]; if (Special < 0 && i == 0) { - assert(argex->ValueType == VAL_Name); + assert(argex->ValueType == TypeName); assert(argex->isConstant()); build->EmitParamInt(-static_cast(argex)->GetValue().GetName()); } else { - assert(argex->ValueType == VAL_Int); + assert(argex->ValueType->GetRegType() == REGT_INT); if (argex->isConstant()) { build->EmitParamInt(static_cast(argex)->GetValue().GetInt()); @@ -3432,17 +3367,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) TArray &rets = Function->Variants[0].Implementation->Proto->ReturnTypes; if (rets.Size() > 0) { - // If more types are added to ParseNativeFunction(), add them here too. - if (rets[0] == TypeSInt32) ValueType = VAL_Int; - else if (rets[0] == TypeFloat64) ValueType = VAL_Float; - else if (rets[0] == TypeAngle) ValueType = VAL_Angle; - else if (rets[0] == TypeFixed) ValueType = VAL_Fixed; - else if (rets[0] == TypeState) ValueType = VAL_State; - else - { - ValueType = VAL_Int; - assert(0 && "Unhandled return type in FxVMFunctionCall::Resolve"); - } + ValueType = rets[0]; } return this; } @@ -3551,7 +3476,7 @@ FxExpression *FxFlopFunctionCall::Resolve(FCompileContext& ctx) return NULL; } - if (!(*ArgList)[0]->ValueType.isNumeric()) + if (!(*ArgList)[0]->IsNumeric()) { ScriptPosition.Message(MSG_ERROR, "numeric value expected for parameter"); delete this; @@ -3565,11 +3490,11 @@ FxExpression *FxFlopFunctionCall::Resolve(FCompileContext& ctx) delete this; return x; } - if ((*ArgList)[0]->ValueType == VAL_Int) + if ((*ArgList)[0]->ValueType->GetRegType() == REGT_INT) { (*ArgList)[0] = new FxFloatCast((*ArgList)[0]); } - ValueType = VAL_Float; + ValueType = TypeFloat64; return this; } @@ -3682,7 +3607,7 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx) WhenFalse = WhenFalse->Resolve(ctx); ABORT(WhenFalse); } - ValueType = VAL_Unknown; + ValueType = TypeVoid; if (Condition->isConstant()) { @@ -3834,7 +3759,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(basex, ctx); - if (basex->ValueType != VAL_Name) + if (basex->ValueType != TypeName) { ScriptPosition.Message(MSG_ERROR, "Cannot convert to class type"); delete this; @@ -3904,7 +3829,7 @@ int DecoNameToClass(VMFrameStack *stack, VMValue *param, int numparam, VMReturn ExpEmit FxClassTypeCast::Emit(VMFunctionBuilder *build) { - if (basex->ValueType != VAL_Name) + if (basex->ValueType != TypeName) { return ExpEmit(build->GetConstantAddress(NULL, ATAG_OBJECT), REGT_POINTER, true); } @@ -4035,7 +3960,7 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx) } names.Delete(0); names.ShrinkToFit(); - ValueType = VAL_State; + ValueType = TypeState; return this; } @@ -4133,7 +4058,7 @@ FxDamageValue::FxDamageValue(FxExpression *v, bool calc) : FxExpression(v->ScriptPosition) { val = v; - ValueType = VAL_Unknown; + ValueType = TypeVoid; Calculated = calc; MyFunction = NULL; @@ -4154,7 +4079,7 @@ FxExpression *FxDamageValue::Resolve(FCompileContext &ctx) CHECKRESOLVED(); SAFE_RESOLVE(val, ctx) - if (!val->ValueType.isNumeric()) + if (!val->IsNumeric()) { ScriptPosition.Message(MSG_ERROR, "Numeric type expected"); delete this; diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index daff4a99b..105bf237f 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -127,7 +127,7 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type, bool c v = MAKEARGB(1, RPART(c), GPART(c), BPART(c)); } ExpVal val; - val.Type = VAL_Color; + val.Type = TypeColor; val.Int = v; x = new FxConstant(val, sc); } diff --git a/src/thingdef/thingdef_type.h b/src/thingdef/thingdef_type.h deleted file mode 100644 index 1707a8939..000000000 --- a/src/thingdef/thingdef_type.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef THINGDEF_TYPE_H -#define THINGDEF_TYPE_H -//========================================================================== -// -// -// -//========================================================================== - -enum ExpValType -{ - VAL_Unresolved, // type not yet known - VAL_Int, // integer number - VAL_Float, // floating point number - VAL_Unknown, // nothing - VAL_Array, // Array (very limited right now) - VAL_Object, // Object reference - VAL_Class, // Class reference - VAL_Sound, // Sound identifier. Internally it's an int. - VAL_Name, // A Name - VAL_String, // A string - VAL_Color, // A color - VAL_State, // A State pointer - - // only used for accessing external variables to ensure proper conversion - VAL_Fixed, - VAL_Angle, - VAL_Bool, -}; - -struct FExpressionType -{ - BYTE Type; - BYTE BaseType; - WORD size; // for arrays; - const PClass *ClassType; - - FExpressionType &operator=(int typeval) - { - Type = typeval; - BaseType = 0; - size = 0; - ClassType = NULL; - return *this; - } - - FExpressionType &operator=(const PClass *cls) - { - Type = VAL_Class; - BaseType = 0; - size = 0; - ClassType = cls; - return *this; - } - - bool operator==(int typeval) const - { - return Type == typeval; - } - - bool operator!=(int typeval) const - { - return Type != typeval; - } - - bool isNumeric() const - { - return Type == VAL_Float || Type == VAL_Int; - } - - bool isPointer() const - { - return Type == VAL_Object || Type == VAL_Class; - } - - FExpressionType GetBaseType() const - { - FExpressionType ret = *this; - ret.Type = BaseType; - ret.BaseType = 0; - ret.size = 0; - return ret; - } - - - // currently only used for args[]. - // Needs to be done differently for a generic implementation! - void MakeArray(int siz) - { - BaseType = Type; - Type = VAL_Array; - size = siz; - } - -}; - -#endif From cb1d9597f2d9c990ff291dbad6040948c9593f3f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 29 Feb 2016 21:40:10 -0600 Subject: [PATCH 31/39] Allow `if {} else if {}` with DECORATE This is as opposed to `if {} else { if {} }`, which is what was required previously to express the same construct. --- src/thingdef/thingdef_states.cpp | 66 +++++++++++++++++++------------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 50b03eb27..bf48e671d 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -441,6 +441,45 @@ static PPrototype *ReturnCheck(PPrototype *proto1, PPrototype *proto2, FScanner // //========================================================================== +static FxExpression *ParseIf(FScanner &sc, FState state, FString statestring, Baggage &bag, + PPrototype *&retproto, bool &lastwasret) +{ + FxExpression *add, *cond; + FxExpression *true_part, *false_part = NULL; + PPrototype *true_proto, *false_proto = NULL; + bool true_ret, false_ret = false; + sc.MustGetStringName("("); + cond = ParseExpression(sc, bag.Info); + sc.MustGetStringName(")"); + sc.MustGetStringName("{"); // braces are mandatory + true_part = ParseActions(sc, state, statestring, bag, true_proto, true_ret); + sc.MustGetString(); + if (sc.Compare("else")) + { + if (sc.CheckString("if")) + { + false_part = ParseIf(sc, state, statestring, bag, false_proto, false_ret); + } + else + { + sc.MustGetStringName("{"); // braces are still mandatory + false_part = ParseActions(sc, state, statestring, bag, false_proto, false_ret); + sc.MustGetString(); + } + } + add = new FxIfStatement(cond, true_part, false_part, sc); + retproto = ReturnCheck(retproto, true_proto, sc); + retproto = ReturnCheck(retproto, false_proto, sc); + // If one side does not end with a return, we don't consider the if statement + // to end with a return. If the else case is missing, it can never be considered + // as ending with a return. + if (true_ret && false_ret) + { + lastwasret = true; + } + return add; +} + FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Baggage &bag, PPrototype *&retproto, bool &endswithret) { @@ -467,32 +506,7 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg lastwasret = false; if (sc.Compare("if")) { // Hangle an if statement - FxExpression *cond; - FxExpression *true_part, *false_part = NULL; - PPrototype *true_proto, *false_proto = NULL; - bool true_ret, false_ret = false; - sc.MustGetStringName("("); - cond = ParseExpression(sc, bag.Info); - sc.MustGetStringName(")"); - sc.MustGetStringName("{"); // braces are mandatory - true_part = ParseActions(sc, state, statestring, bag, true_proto, true_ret); - sc.MustGetString(); - if (sc.Compare("else")) - { - sc.MustGetStringName("{"); // braces are still mandatory - false_part = ParseActions(sc, state, statestring, bag, false_proto, false_ret); - sc.MustGetString(); - } - add = new FxIfStatement(cond, true_part, false_part, sc); - proto = ReturnCheck(proto, true_proto, sc); - proto = ReturnCheck(proto, false_proto, sc); - // If one side does not end with a return, we don't consider the if statement - // to end with a return. If the else case is missing, it can never be considered - // as ending with a return. - if (true_ret && false_ret) - { - lastwasret = true; - } + add = ParseIf(sc, state, statestring, bag, proto, lastwasret); } else if (sc.Compare("return")) { // Handle a return statement From fb8d8dc775708b9c487f3cdbb40a95019adcd519 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 29 Feb 2016 21:44:12 -0600 Subject: [PATCH 32/39] Remove "state" from "Invalid state parameter" error message - It's confusing to see this from inside an anonymous function. Actually, maybe it should be reworded altogether? --- src/thingdef/thingdef_states.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index bf48e671d..4df275921 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -583,7 +583,7 @@ FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, B } return call; } - sc.ScriptError("Invalid state parameter %s\n", sc.String); + sc.ScriptError("Invalid parameter '%s'\n", sc.String); return NULL; } From 92f74634d6bbe961dbd795216134c12680bf88b1 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 29 Feb 2016 22:08:06 -0600 Subject: [PATCH 33/39] Remove FxParameter and use a single function instead --- src/thingdef/thingdef_exp.h | 11 ----- src/thingdef/thingdef_expression.cpp | 60 ++++++---------------------- src/thingdef/thingdef_states.cpp | 6 +-- 3 files changed, 16 insertions(+), 61 deletions(-) diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index b5ab642d0..74ccf1ba2 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -219,17 +219,6 @@ public: bool isresolved; }; -class FxParameter : public FxExpression -{ - FxExpression *Operand; - -public: - FxParameter(FxExpression*); - ~FxParameter(); - FxExpression *Resolve(FCompileContext&); - ExpEmit Emit(VMFunctionBuilder *build); -}; - //========================================================================== // // FxIdentifier diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 41c95379c..bacb83e0f 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -225,45 +225,13 @@ void FxExpression::RequestAddress() // //========================================================================== -FxParameter::FxParameter(FxExpression *operand) -: FxExpression(operand->ScriptPosition) +static void EmitParameter(VMFunctionBuilder *build, FxExpression *operand, const FScriptPosition &pos) { - Operand = operand; - ValueType = operand->ValueType; -} - -//========================================================================== -// -// -// -//========================================================================== - -FxParameter::~FxParameter() -{ - SAFE_DELETE(Operand); -} - -//========================================================================== -// -// -// -//========================================================================== - -FxExpression *FxParameter::Resolve(FCompileContext& ctx) -{ - CHECKRESOLVED(); - SAFE_RESOLVE(Operand, ctx); - ValueType = Operand->ValueType; - return this; -} - -ExpEmit FxParameter::Emit(VMFunctionBuilder *build) -{ - ExpEmit where = Operand->Emit(build); + ExpEmit where = operand->Emit(build); if (where.RegType == REGT_NIL) { - ScriptPosition.Message(MSG_ERROR, "Attempted to pass a non-value"); + pos.Message(MSG_ERROR, "Attempted to pass a non-value"); build->Emit(OP_PARAM, 0, where.RegType, where.RegNum); } else @@ -276,7 +244,6 @@ ExpEmit FxParameter::Emit(VMFunctionBuilder *build) build->Emit(OP_PARAM, 0, regtype, where.RegNum); where.Free(build); } - return ExpEmit(); } //========================================================================== @@ -2251,8 +2218,8 @@ FxRandom::FxRandom(FRandom * r, FxExpression *mi, FxExpression *ma, const FScrip { if (mi != NULL && ma != NULL) { - min = new FxParameter(new FxIntCast(mi)); - max = new FxParameter(new FxIntCast(ma)); + min = new FxIntCast(mi); + max = new FxIntCast(ma); } else min = max = NULL; rng = r; @@ -2336,8 +2303,8 @@ ExpEmit FxRandom::Emit(VMFunctionBuilder *build) build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(rng, ATAG_RNG)); if (min != NULL && max != NULL) { - min->Emit(build); - max->Emit(build); + EmitParameter(build, min, ScriptPosition); + EmitParameter(build, max, ScriptPosition); build->Emit(OP_CALL_K, build->GetConstantAddress(callfunc, ATAG_OBJECT), 3, 1); } else @@ -2523,8 +2490,8 @@ FxFRandom::FxFRandom(FRandom *r, FxExpression *mi, FxExpression *ma, const FScri { if (mi != NULL && ma != NULL) { - min = new FxParameter(new FxFloatCast(mi)); - max = new FxParameter(new FxFloatCast(ma)); + min = new FxFloatCast(mi); + max = new FxFloatCast(ma); } ValueType = TypeFloat64; } @@ -2572,8 +2539,8 @@ ExpEmit FxFRandom::Emit(VMFunctionBuilder *build) build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(rng, ATAG_RNG)); if (min != NULL && max != NULL) { - min->Emit(build); - max->Emit(build); + EmitParameter(build, min, ScriptPosition); + EmitParameter(build, max, ScriptPosition); build->Emit(OP_CALL_K, build->GetConstantAddress(callfunc, ATAG_OBJECT), 3, 1); } else @@ -2597,7 +2564,6 @@ FxRandom2::FxRandom2(FRandom *r, FxExpression *m, const FScriptPosition &pos) rng = r; if (m) mask = new FxIntCast(m); else mask = new FxConstant(-1, pos); - mask = new FxParameter(mask); ValueType = TypeSInt32; } @@ -2642,7 +2608,7 @@ ExpEmit FxRandom2::Emit(VMFunctionBuilder *build) callfunc = ((PSymbolVMFunction *)sym)->Function; build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(rng, ATAG_RNG)); - mask->Emit(build); + EmitParameter(build, mask, ScriptPosition); build->Emit(OP_CALL_K, build->GetConstantAddress(callfunc, ATAG_OBJECT), 2, 1); ExpEmit out(build, REGT_INT); build->Emit(OP_RESULT, 0, REGT_INT, out.RegNum); @@ -3407,7 +3373,7 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build, bool tailcall) { for (unsigned i = 0; i < ArgList->Size(); ++i) { - (*ArgList)[i]->Emit(build); + EmitParameter(build, (*ArgList)[i], ScriptPosition); } } // Get a constant register for this function diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 4df275921..702758eb7 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -77,7 +77,7 @@ FxVMFunctionCall *DoActionSpecials(FScanner &sc, FState & state, Baggage &bag) if (special > 0 && min_args >= 0) { FArgumentList *args = new FArgumentList; - args->Push(new FxParameter(new FxConstant(special, sc))); + args->Push(new FxConstant(special, sc)); i = 0; // Make this consistent with all other parameter parsing @@ -85,7 +85,7 @@ FxVMFunctionCall *DoActionSpecials(FScanner &sc, FState & state, Baggage &bag) { while (i < 5) { - args->Push(new FxParameter(new FxIntCast(ParseExpression(sc, bag.Info)))); + args->Push(new FxIntCast(ParseExpression(sc, bag.Info))); i++; if (!sc.CheckToken (',')) break; } @@ -661,7 +661,7 @@ void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray 0) From 7c9fd12fc032ef489dd39cb10b7ee45b5d909e10 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 29 Feb 2016 22:26:05 -0600 Subject: [PATCH 34/39] Don't generate code to call DECORATE cast functions - All the cast functions do is return their parameter, so skip the function call and use the parameter directly. --- src/thingdef/thingdef_exp.h | 1 + src/thingdef/thingdef_expression.cpp | 49 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index 74ccf1ba2..3ae20a83d 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -858,6 +858,7 @@ public: FxExpression *Resolve(FCompileContext&); ExpEmit Emit(VMFunctionBuilder *build); ExpEmit Emit(VMFunctionBuilder *build, bool tailcall); + bool CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit ®); unsigned GetArgCount() const { return ArgList == NULL ? 0 : ArgList->Size(); } VMFunction *GetVMFunction() const { return Function->Variants[0].Implementation; } bool IsDirectFunction(); diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index bacb83e0f..5eb77aa80 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3356,6 +3356,14 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build, bool tailcall) assert(build->Registers[REGT_POINTER].GetMostUsed() >= 3); int count = GetArgCount(); + if (count == 1) + { + ExpEmit reg; + if (CheckEmitCast(build, tailcall, reg)) + { + return reg; + } + } // Emit code to pass implied parameters if (Function->Flags & VARF_Method) { @@ -3399,6 +3407,47 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build, bool tailcall) } } +//========================================================================== +// +// If calling one of the casting kludge functions, don't bother calling the +// function; just use the parameter directly. Returns true if this was a +// kludge function, false otherwise. +// +//========================================================================== + +bool FxVMFunctionCall::CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit ®) +{ + FName funcname = Function->SymbolName; + if (funcname == NAME___decorate_internal_int__ || + funcname == NAME___decorate_internal_bool__ || + funcname == NAME___decorate_internal_state__) + { + FxExpression *arg = (*ArgList)[0]; + if (returnit) + { + if (arg->isConstant() && + (funcname == NAME___decorate_internal_int__ || + funcname == NAME___decorate_internal_bool__)) + { // Use immediate version for integers in range + build->EmitRetInt(0, true, static_cast(arg)->GetValue().Int); + } + else + { + ExpEmit where = arg->Emit(build); + build->Emit(OP_RET, RET_FINAL, where.RegType | (where.Konst ? REGT_KONST : 0), where.RegNum); + where.Free(build); + } + reg = ExpEmit(); + } + else + { + reg = arg->Emit(build); + } + return true; + } + return false; +} + //========================================================================== // // From 44a6cafd4b546ac544741aa078cd036627970028 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Mar 2016 09:38:49 +0100 Subject: [PATCH 35/39] - we are using C++11 now, so all those old VC 2005 project files are of no use anymore. --- bzip2/bzip2.vcproj | 329 - dumb/vc6/dumb/dumb.vcproj | 2007 ------ dumb/vc6/dumb_static/dumb_static.vcproj | 2069 ------ game-music-emu/game-music-emu.vcproj | 887 --- gdtoa/gdtoa.vcproj | 1727 ----- jpeg-6b/jpeg-6b.vcproj | 419 -- lzma/lzmalib.vcproj | 463 -- src/win32/zdoom.RES | Bin 13600 -> 0 bytes tools/fixrtext/fixrtext.vcproj | 183 - tools/lemon/lemon.vcproj | 434 -- tools/re2c/re2c.vcproj | 845 --- tools/updaterevision/updaterevision.vcproj | 379 -- tools/zipdir/zipdir.vcproj | 359 - wadsrc/wadsrc.vcproj | 120 - zdoom.sln | 177 - zdoom.vcproj | 6970 -------------------- zlib/zlib.vcproj | 432 -- 17 files changed, 17800 deletions(-) delete mode 100644 bzip2/bzip2.vcproj delete mode 100644 dumb/vc6/dumb/dumb.vcproj delete mode 100644 dumb/vc6/dumb_static/dumb_static.vcproj delete mode 100644 game-music-emu/game-music-emu.vcproj delete mode 100644 gdtoa/gdtoa.vcproj delete mode 100644 jpeg-6b/jpeg-6b.vcproj delete mode 100644 lzma/lzmalib.vcproj delete mode 100644 src/win32/zdoom.RES delete mode 100644 tools/fixrtext/fixrtext.vcproj delete mode 100644 tools/lemon/lemon.vcproj delete mode 100644 tools/re2c/re2c.vcproj delete mode 100644 tools/updaterevision/updaterevision.vcproj delete mode 100644 tools/zipdir/zipdir.vcproj delete mode 100644 wadsrc/wadsrc.vcproj delete mode 100644 zdoom.sln delete mode 100644 zdoom.vcproj delete mode 100644 zlib/zlib.vcproj diff --git a/bzip2/bzip2.vcproj b/bzip2/bzip2.vcproj deleted file mode 100644 index 72510949d..000000000 --- a/bzip2/bzip2.vcproj +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dumb/vc6/dumb/dumb.vcproj b/dumb/vc6/dumb/dumb.vcproj deleted file mode 100644 index 525bc56fc..000000000 --- a/dumb/vc6/dumb/dumb.vcproj +++ /dev/null @@ -1,2007 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dumb/vc6/dumb_static/dumb_static.vcproj b/dumb/vc6/dumb_static/dumb_static.vcproj deleted file mode 100644 index 6d6736259..000000000 --- a/dumb/vc6/dumb_static/dumb_static.vcproj +++ /dev/null @@ -1,2069 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/game-music-emu/game-music-emu.vcproj b/game-music-emu/game-music-emu.vcproj deleted file mode 100644 index 45de9ebfb..000000000 --- a/game-music-emu/game-music-emu.vcproj +++ /dev/null @@ -1,887 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gdtoa/gdtoa.vcproj b/gdtoa/gdtoa.vcproj deleted file mode 100644 index 3ac6ce39d..000000000 --- a/gdtoa/gdtoa.vcproj +++ /dev/null @@ -1,1727 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpeg-6b/jpeg-6b.vcproj b/jpeg-6b/jpeg-6b.vcproj deleted file mode 100644 index c6d6ce0d5..000000000 --- a/jpeg-6b/jpeg-6b.vcproj +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lzma/lzmalib.vcproj b/lzma/lzmalib.vcproj deleted file mode 100644 index f1e085f3d..000000000 --- a/lzma/lzmalib.vcproj +++ /dev/null @@ -1,463 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/win32/zdoom.RES b/src/win32/zdoom.RES deleted file mode 100644 index 55d9e7549cfaf33537b14597b9eb7bdfcd4339d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13600 zcmeHNUu+x4ng1xs4kOT6{t<&7PJs95qUW@+BAbpY=j=E!+2RPvq1xC=+m{?oac!Qp zOM#@UI4B@CE^>Uhhg<_hpzfsy+#TA77QH+cFrcS4Xb9Xr6v;~i1W14uRC-ZxF9J^R z-tRZFEAG;itfwn*=aFY;=9_Q6`OP=qeDm$nA|fWT>*|bZDE(o??;izEMD@kvkB|9G zCs8qxUqFtCN5+`psU?Dc(rW1fPgG@da}y;y2!e&H3p_P05{IQ|yA>jj474R0?w6T? zcKdES~c{GvG-J|Vksw0{`?X_21BGIX1c7V5)OOJMrQYKKt8AKHgJ2T_b<8Z2oKOf%X>P0#d3G+2pv zrHJZ>b&L}54CJIxj+{85w*F*$)$oAS% zYkRHT-bVXlv^S3*wKk1*Yx6P7+Qfm{0sl7mcU;T*$rC|6jw;E6dL+KTL5}!Kd|a^& zd9xE-yYjYtAns>f`PB!X%Ll*zy}b3)pJ5_;2Mf7_+|^Bbj4Wtb z(6XdKL1eK&w@|S_w?MZ*=dcdw9nd>ybU^QbjzYSicR}xh-UXoxx{J1pw%b)RXYtHJ zcou@P7?g#7RMX>;1%@mzWPu?I3VgZW< zEJ`iFVF8B)92Rg`z@bzH92PKGz+eFbRc8T*1q>E2ba^k}sZ@x0^dH(vz0?j+VeSsN zl&Udz2bemTw1Wvcz|_Iq9dvdeq=UITm|Ja!nj3V?-@*JH%+D?AVEztt(*cGKFm#{? zZX2|sRu2kFJh_d~K^OCNfvpQ1UCgJpmN=k;E^u^-0}E5zjX_;t=>kg^Ai9`PnE$tTk5_2i2$zL1@r9ohbGSN{3O zKgKz3LAyKyEFe#{D3?uF#)qZ2VZ`IZI)>8{$zC#@7~VIG+H)MImmJnJjAj_QMx)^z zmLJ%SWUrUb4U;v5Mt*y1%T5pJ8%FZvClAX%uJ9z2hs8f`#1i069(saUESW~i9TJcc zGtyjd?{FIyN9th-M!Gjl8-p~m$1}uZ40a7|Q=9QL3>OwOlp#zcJGOUgYwK|QMuz-_ zLZ(nC90HJ$@%X`hD1IeBL+O|!40TwGV2~7?L-2!D1HuY`=b;NAnt~CF8EU!4LjlFe z&Xg(O8h^NaNH+30PJ-3qSPolafQC>ZmdWSyIjjQWGY`Q-_E-%3`FtX27>S43gXYI# zAsUN*2)~g}r4nF^(LnPVR1UQNM0|GRUNeE7JEdmD49WIUD2C8*Ox zVmzIOwgL(XRP(*Y#!54v%f*aj${S#$x%S~B^7*ZXorcnZyO8!qr1JU9EJg(6`qlhw zb7L-_r$u1b(wKvjfImMwJL@wA%KYrx8!NMUY%mfBBva`GRGZ7p%?;xp#{_e;MvR8Z zM9tzL+jc53{N~U$Stt~d_=EvrDR6VCbSi*jubLrep}4T13N?ymH=az|$;6P8P$;gi z7uO4)78i;IL(QTl8XvdqL@xK>-W3W9#ZNJ$SjfeV91txKR6)<50BsM6S1GKouYbC} zfF7hc;H_h(Jtk;(uO6r*sY%;TrgO<+F+kt93g3*&&bHHA`?3T(oTOv-CMT2jfx)62c9<3}4c*5MO{96Zz$)*KX}o`u&^7^*Fz5d2RK=EG}P|DfhnD z-W@1+y!K$ZEruGmU-_}uzv+$lOVRE7{W89W`O!v)E{!22NDv5|C`WY}iFjpeP0=Ge zmr&w$_dZL19rtBT;oS8~ei-05zx3%0IZ1aTUioWP{seE|Cg#-N1IADj8GMg5L3;st z?>$ztfijp{c!vcIF|R7{MD@{oEZ$l03WNOUJ@(OiEZ#N$&%ehej02;)UeD=;uYpht z?>dcxt~-RjTXtwfxM3I*2fp4KImA5^;W5G1vE&3&kP@mV5t^#qml49-s)U zsb5vE6nMo%>J$4lz7!ycHj?q7>&vHdjQpXY*s!QMH@ktDKM@B2gzpcgd}E`TPV;@+ zi09%H`FuJI0zvvjJRZwUB*73*23Eka@zg?OQW*fP9~;(8Gwa50`?z>M$|fn-PmgV=>Mb|_Im_^M^6!#fSl zA!40K?ia2iczS6{;)eUHbt@c&oe<8!^RgEJn|p4bZA z1BgF@*Ix!#MbOE|K?t?;MzGCKIYxhc?_LVuLvj=TRX00_D?XWv=e_Sjh!$`m88JVi z!IzODY2)KL{|cXIgu`bXi9dyR=bhpvAY#^luAqkBX#@Yyg5LLtm}VU1nDBpPMBt}&i@!~e$TWU7rHAG(tfS!c zT6j+#1E+4$+aHn1J)a-vd##>J`v0e6^2k}x7UX4l70++Tw^1udQC>p3faf<+XSz4` zIbP2>oQWU)Za`X9mZSp74t~F?f$uwtXIjqU zm+JG#XXU#3&H7i74>2|e9vgoZ@HeFa{;P6RN@(3e%LJ{4XH^#Qd>M5MlvVWCF~U?c z)KQjIyM#WC!jwE#Rg^2}qb!bYLM~@96)!QCFoVypdreSkvI35>l3zw^5w$6d3gaqa zmE`piURCmJaJ__l5VFf2vZukd3QSeZbrbdP0doz1HtJQi_GPtBu8FfP$sP1uSEws$ zMK!F3$f)Zw`d1WIYR$*}Aiu8%6Pho{-(n0kavAeBQBFhNdHFhO*VSxS_7ISZdqo`A zvDP~FdP-TrmtimdJ`%BmkuRa-o-&!pXXPk(eA~#QrvZ$#nPs(STnSTO2LkDj1;#9> zIk{gx?-_6qZ&vhwfq7cZL0vQzuLBHA0VF}$8}e6>JqNxUii;~-25us{f!$~V%Y!si zeu~wchK9~#)>B^XoNy=iv(T^XjhMlRGeA6zCr5l+>1t8w`LBVbs%91Wkvtp1b`_{f zYG-Yfb#*SNE8kjvu4d=1my}eliT0zlpe^M=875Y2sgc7@7V&AT(tCVC#(}Bm>4#^A zy7l*yExp^X1E;p(DXi!61w zs2W%`EtEFSbK94~*{MO^3Cnoaph50GeJXos0ls(TX}YD5-Th#KJpRZsAd7#i(v_=nai8yzWf0{oceKn}$Oz;ekvBrNUzFKCgQ`X5 z|Iy>|ZJ2i)??#@fa2kQUBl7o%uzWiXo@V+G|1{gE>u5t;5N(hvA@aT^X>GjKbR461 zE;u9SGvwXCeBqt3l(qVHO4+nMS~%}w;;-R6_&dg!MBAUOv_<}4EaBq|?(cIRoHyXa zOw_f{dtFiYwWsm--qJqrA0mGqA!|@e+A}jMp-*cf({FtPE8)qjgF7m3Vbo!KTV(zh zax@b3ZF#J$g8y|COh1hN8~o2{xf}Tp`7dQxKL~cCuKm;9NNVW5(gW!Dh+d(gd0!A~dT#CEeSMXcUQD%iu7YPu$9I}rYlNd;gACp& zjGP$>a=kozeQo$F>&J-NZnXF0Ddozj4ecR#2j$SNW7e;sM(Nxo+MAX|K1R$sR`X}1 z4QQSED(_HR19r2Y zZT9VncFuXU$MWxI+9)M*yub4OQ2D!kHsbpz-fsFv3x3Dsp+AXiBENu)`vFf?(dEDs zK7N4mzu(mN%%AQ#fhC*Bt{X$9cMiw8eD9Bd;{~Nn?!Zy`*Nxh|f3X_uU;RcSOA zg0lrh6&5Q_v)a6KY}`cJ19fI>E#Y&@GuP!&Cf#+Xbyj^n2l|?g;fo5f~ z+Jqv^VK=o(n0`?|!I4_ZU~MFICI4l{;5! zw<<7}bI+cC_WHTAr_Y`(m#x!_*1)t&CFjOU=?1j@)j$t5PJvY6gBt2nl_oDd<7*0| Jj*Y|K{|CgL*`WXc diff --git a/tools/fixrtext/fixrtext.vcproj b/tools/fixrtext/fixrtext.vcproj deleted file mode 100644 index cc50b605b..000000000 --- a/tools/fixrtext/fixrtext.vcproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/lemon/lemon.vcproj b/tools/lemon/lemon.vcproj deleted file mode 100644 index 9f46d4df9..000000000 --- a/tools/lemon/lemon.vcproj +++ /dev/null @@ -1,434 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/re2c/re2c.vcproj b/tools/re2c/re2c.vcproj deleted file mode 100644 index 81d8c4941..000000000 --- a/tools/re2c/re2c.vcproj +++ /dev/null @@ -1,845 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/updaterevision/updaterevision.vcproj b/tools/updaterevision/updaterevision.vcproj deleted file mode 100644 index 0421cbb65..000000000 --- a/tools/updaterevision/updaterevision.vcproj +++ /dev/null @@ -1,379 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/zipdir/zipdir.vcproj b/tools/zipdir/zipdir.vcproj deleted file mode 100644 index d461ec5d2..000000000 --- a/tools/zipdir/zipdir.vcproj +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/wadsrc/wadsrc.vcproj b/wadsrc/wadsrc.vcproj deleted file mode 100644 index 1baa29aa5..000000000 --- a/wadsrc/wadsrc.vcproj +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/zdoom.sln b/zdoom.sln deleted file mode 100644 index 11dc1b075..000000000 --- a/zdoom.sln +++ /dev/null @@ -1,177 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zdoom", "zdoom.vcproj", "{8049475B-5C87-46F9-9358-635218A4EF18}" - ProjectSection(ProjectDependencies) = postProject - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96} = {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96} - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} = {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} - {6077B7D6-349F-4077-B552-3BC302EF5859} = {6077B7D6-349F-4077-B552-3BC302EF5859} - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E} = {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E} - {0F80ACBF-460E-44F0-B28E-B3272D1774A7} = {0F80ACBF-460E-44F0-B28E-B3272D1774A7} - {DA47396F-60C1-4BDE-A977-7F7DE461CF77} = {DA47396F-60C1-4BDE-A977-7F7DE461CF77} - {1D179D4B-F008-431B-8C72-111F8372584F} = {1D179D4B-F008-431B-8C72-111F8372584F} - {B68E0ABF-B627-48A3-A92F-D8F827A75054} = {B68E0ABF-B627-48A3-A92F-D8F827A75054} - {8997289F-10BF-4678-8BAA-3BB509C84953} = {8997289F-10BF-4678-8BAA-3BB509C84953} - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466} = {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466} - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4} = {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4} - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F} = {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcproj", "{F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lemon", "tools\lemon\lemon.vcproj", "{0F80ACBF-460E-44F0-B28E-B3272D1774A7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "tools\re2c\re2c.vcproj", "{667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wadsrc", "wadsrc\wadsrc.vcproj", "{1D179D4B-F008-431B-8C72-111F8372584F}" - ProjectSection(ProjectDependencies) = postProject - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3} = {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "updaterevision", "tools\updaterevision\updaterevision.vcproj", "{6077B7D6-349F-4077-B552-3BC302EF5859}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg-6b", "jpeg-6b\jpeg-6b.vcproj", "{AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fixrtext", "tools\fixrtext\fixrtext.vcproj", "{DA47396F-60C1-4BDE-A977-7F7DE461CF77}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dumb_static", "dumb\vc6\dumb_static\dumb_static.vcproj", "{8997289F-10BF-4678-8BAA-3BB509C84953}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdtoa", "gdtoa\gdtoa.vcproj", "{B68E0ABF-B627-48A3-A92F-D8F827A75054}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zipdir", "tools\zipdir\zipdir.vcproj", "{24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}" - ProjectSection(ProjectDependencies) = postProject - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4} = {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4} - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} = {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F} = {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzmalib", "lzma\lzmalib.vcproj", "{6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "bzip2\bzip2.vcproj", "{A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "game-music-emu", "game-music-emu\game-music-emu.vcproj", "{9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8049475B-5C87-46F9-9358-635218A4EF18}.Debug|Win32.ActiveCfg = Debug|Win32 - {8049475B-5C87-46F9-9358-635218A4EF18}.Debug|Win32.Build.0 = Debug|Win32 - {8049475B-5C87-46F9-9358-635218A4EF18}.Debug|x64.ActiveCfg = Debug|x64 - {8049475B-5C87-46F9-9358-635218A4EF18}.Debug|x64.Build.0 = Debug|x64 - {8049475B-5C87-46F9-9358-635218A4EF18}.Release|Win32.ActiveCfg = Release|Win32 - {8049475B-5C87-46F9-9358-635218A4EF18}.Release|Win32.Build.0 = Release|Win32 - {8049475B-5C87-46F9-9358-635218A4EF18}.Release|x64.ActiveCfg = Release|x64 - {8049475B-5C87-46F9-9358-635218A4EF18}.Release|x64.Build.0 = Release|x64 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Debug|Win32.ActiveCfg = Debug|Win32 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Debug|Win32.Build.0 = Debug|Win32 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Debug|x64.ActiveCfg = Debug|x64 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Debug|x64.Build.0 = Debug|x64 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Release|Win32.ActiveCfg = Release|Win32 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Release|Win32.Build.0 = Release|Win32 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Release|x64.ActiveCfg = Release|x64 - {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}.Release|x64.Build.0 = Release|x64 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Debug|Win32.ActiveCfg = Debug|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Debug|Win32.Build.0 = Debug|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Debug|x64.ActiveCfg = Release|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Debug|x64.Build.0 = Release|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Release|Win32.ActiveCfg = Release|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Release|Win32.Build.0 = Release|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Release|x64.ActiveCfg = Release|Win32 - {0F80ACBF-460E-44F0-B28E-B3272D1774A7}.Release|x64.Build.0 = Release|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Debug|Win32.ActiveCfg = Debug|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Debug|Win32.Build.0 = Debug|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Debug|x64.ActiveCfg = Release|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Debug|x64.Build.0 = Release|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Release|Win32.ActiveCfg = Release|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Release|Win32.Build.0 = Release|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Release|x64.ActiveCfg = Release|Win32 - {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}.Release|x64.Build.0 = Release|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Debug|Win32.ActiveCfg = Debug|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Debug|Win32.Build.0 = Debug|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Debug|x64.ActiveCfg = Release|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Debug|x64.Build.0 = Release|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Release|Win32.ActiveCfg = Release|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Release|Win32.Build.0 = Release|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Release|x64.ActiveCfg = Release|Win32 - {1D179D4B-F008-431B-8C72-111F8372584F}.Release|x64.Build.0 = Release|Win32 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|Win32.ActiveCfg = Debug|Win32 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|Win32.Build.0 = Debug|Win32 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|x64.ActiveCfg = Debug|x64 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|x64.Build.0 = Debug|x64 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Release|Win32.ActiveCfg = Release|Win32 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Release|Win32.Build.0 = Release|Win32 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Release|x64.ActiveCfg = Release|x64 - {6077B7D6-349F-4077-B552-3BC302EF5859}.Release|x64.Build.0 = Release|x64 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Debug|Win32.ActiveCfg = Debug|Win32 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Debug|Win32.Build.0 = Debug|Win32 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Debug|x64.ActiveCfg = Debug|x64 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Debug|x64.Build.0 = Debug|x64 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Release|Win32.ActiveCfg = Release|Win32 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Release|Win32.Build.0 = Release|Win32 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Release|x64.ActiveCfg = Release|x64 - {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}.Release|x64.Build.0 = Release|x64 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Debug|Win32.ActiveCfg = Debug|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Debug|Win32.Build.0 = Debug|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Debug|x64.ActiveCfg = Debug|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Debug|x64.Build.0 = Debug|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Release|Win32.ActiveCfg = Release|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Release|Win32.Build.0 = Release|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Release|x64.ActiveCfg = Release|Win32 - {DA47396F-60C1-4BDE-A977-7F7DE461CF77}.Release|x64.Build.0 = Release|Win32 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Debug|Win32.ActiveCfg = Debug|Win32 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Debug|Win32.Build.0 = Debug|Win32 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Debug|x64.ActiveCfg = Debug|x64 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Debug|x64.Build.0 = Debug|x64 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Release|Win32.ActiveCfg = Release|Win32 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Release|Win32.Build.0 = Release|Win32 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Release|x64.ActiveCfg = Release|x64 - {8997289F-10BF-4678-8BAA-3BB509C84953}.Release|x64.Build.0 = Release|x64 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Debug|Win32.ActiveCfg = Debug|Win32 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Debug|Win32.Build.0 = Debug|Win32 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Debug|x64.ActiveCfg = Debug|x64 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Debug|x64.Build.0 = Debug|x64 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Release|Win32.ActiveCfg = Release|Win32 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Release|Win32.Build.0 = Release|Win32 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Release|x64.ActiveCfg = Release|x64 - {B68E0ABF-B627-48A3-A92F-D8F827A75054}.Release|x64.Build.0 = Release|x64 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Debug|Win32.ActiveCfg = Debug|Win32 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Debug|Win32.Build.0 = Debug|Win32 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Debug|x64.ActiveCfg = Debug|x64 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Debug|x64.Build.0 = Debug|x64 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|Win32.ActiveCfg = Release|Win32 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|Win32.Build.0 = Release|Win32 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|x64.ActiveCfg = Release|x64 - {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|x64.Build.0 = Release|x64 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Debug|Win32.ActiveCfg = Debug|Win32 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Debug|Win32.Build.0 = Debug|Win32 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Debug|x64.ActiveCfg = Debug|x64 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Debug|x64.Build.0 = Debug|x64 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Release|Win32.ActiveCfg = Release|Win32 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Release|Win32.Build.0 = Release|Win32 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Release|x64.ActiveCfg = Release|x64 - {6EB27E78-7C7A-4F08-8E19-957E8EB3A20F}.Release|x64.Build.0 = Release|x64 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Debug|Win32.ActiveCfg = Debug|Win32 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Debug|Win32.Build.0 = Debug|Win32 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Debug|x64.ActiveCfg = Debug|x64 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Debug|x64.Build.0 = Debug|x64 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|Win32.ActiveCfg = Release|Win32 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|Win32.Build.0 = Release|Win32 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|x64.ActiveCfg = Release|x64 - {A7DE5C73-D623-4118-A48A-BDFD1FAE97D4}.Release|x64.Build.0 = Release|x64 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|Win32.ActiveCfg = Debug|Win32 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|Win32.Build.0 = Debug|Win32 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|x64.ActiveCfg = Release|x64 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Debug|x64.Build.0 = Release|x64 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Release|Win32.ActiveCfg = Release|Win32 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Release|Win32.Build.0 = Release|Win32 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Release|x64.ActiveCfg = Release|x64 - {9B465A9E-E5C7-4577-B559-3CA2F7AE7D96}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/zdoom.vcproj b/zdoom.vcproj deleted file mode 100644 index 3b98c29b1..000000000 --- a/zdoom.vcproj +++ /dev/null @@ -1,6970 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/zlib/zlib.vcproj b/zlib/zlib.vcproj deleted file mode 100644 index 3e0ba5ff7..000000000 --- a/zlib/zlib.vcproj +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From a16f92c508d3b19d9c540a5d11356d9518e60538 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 1 Mar 2016 08:47:51 -0600 Subject: [PATCH 36/39] Convert "lump" names from directories to lowercase - Zip and 7z already do this. Directories should too. --- src/resourcefiles/file_directory.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/resourcefiles/file_directory.cpp b/src/resourcefiles/file_directory.cpp index 8b85425f1..068ea508a 100644 --- a/src/resourcefiles/file_directory.cpp +++ b/src/resourcefiles/file_directory.cpp @@ -302,8 +302,13 @@ void FDirectory::AddEntry(const char *fullpath, int size) // Store the full path here so that we can access the file later, even if it is from a filter directory. lump_p->mFullPath = fullpath; + + // [mxd] Convert name to lowercase + FString name = fullpath + strlen(Filename); + name.ToLower(); + // The lump's name is only the part relative to the main directory - lump_p->LumpNameSetup(fullpath + strlen(Filename)); + lump_p->LumpNameSetup(name); lump_p->LumpSize = size; lump_p->Owner = this; lump_p->Flags = 0; From b4a002a07fa6d6c95d7cb5201f46e5665edbc450 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Mar 2016 16:38:45 +0100 Subject: [PATCH 37/39] - preparations for allowing hitscans through portals. To allow processing the hit through an arbitrary portal without reference to the portal group table, P_AimLineAttack and P_LineAttack need to pass some more info than just the linetarget. We need the relative positions of shooter and target within the visual reference of the other to calculate proper angles and we need to know if such a portal was crossed at all, because a few things, e.g. seeker missiles won't work with them. - fixed setup of target acquisition for the Mage Staff. The pre-acquired seeker target was never passed to the spawned projectiles. --- src/actor.h | 22 +++++++ src/actorptrselect.cpp | 18 +++--- src/c_cmds.cpp | 26 ++++---- src/g_doom/a_doomweaps.cpp | 38 ++++++------ src/g_doom/a_scriptedmarine.cpp | 21 +++---- src/g_heretic/a_chicken.cpp | 20 +++--- src/g_heretic/a_hereticweaps.cpp | 48 +++++++-------- src/g_hexen/a_clericholy.cpp | 8 +-- src/g_hexen/a_clericmace.cpp | 16 +++-- src/g_hexen/a_clericstaff.cpp | 16 ++--- src/g_hexen/a_fighteraxe.cpp | 20 +++--- src/g_hexen/a_fighterhammer.cpp | 34 +++++------ src/g_hexen/a_fighterplayer.cpp | 25 ++++---- src/g_hexen/a_hexenglobal.h | 2 + src/g_hexen/a_hexenspecialdecs.cpp | 2 +- src/g_hexen/a_magecone.cpp | 8 +-- src/g_hexen/a_magestaff.cpp | 25 ++++---- src/g_hexen/a_pig.cpp | 12 ++-- src/g_strife/a_strifeweapons.cpp | 34 +++++------ src/p_acs.cpp | 4 +- src/p_enemy.cpp | 14 ++--- src/p_interaction.cpp | 14 +++-- src/p_local.h | 14 +++-- src/p_map.cpp | 97 +++++++++++++++++++----------- src/p_mobj.cpp | 16 ++--- src/p_pspr.cpp | 14 ++--- src/p_pspr.h | 2 +- src/thingdef/thingdef_codeptr.cpp | 40 ++++++------ 28 files changed, 331 insertions(+), 279 deletions(-) diff --git a/src/actor.h b/src/actor.h index d30da8922..7dc4bf1ee 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1397,6 +1397,28 @@ inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle) void PrintMiscActorInfo(AActor * query); AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask); +// If we want to make P_AimLineAttack capable of handling arbitrary portals, it needs to pass a lot more info than just the linetarget actor. +struct FTranslatedLineTarget +{ + AActor *linetarget; + angle_t hitangle; + fixedvec3 targetPosFromSrc; + angle_t targetAngleFromSrc; + fixedvec3 sourcePosFromTarget; + angle_t sourceAngleFromTarget; + bool unlinked; // found by a trace that went through an unlinked portal. + + angle_t SourceAngleToTarget() const + { + return R_PointToAngle2(sourcePosFromTarget.x, sourcePosFromTarget.y, linetarget->X(), linetarget->Y()); + } + angle_t TargetAngleToSource() const + { + return R_PointToAngle2(linetarget->X(), linetarget->Y(), sourcePosFromTarget.x, sourcePosFromTarget.y); + } +}; + + #define S_FREETARGMOBJ 1 #endif // __P_MOBJ_H__ diff --git a/src/actorptrselect.cpp b/src/actorptrselect.cpp index 54c41e6ba..a93ecd6a1 100644 --- a/src/actorptrselect.cpp +++ b/src/actorptrselect.cpp @@ -2,6 +2,7 @@ #include "actor.h" #include "d_player.h" #include "p_pspr.h" +#include "p_local.h" //========================================================================== // @@ -34,6 +35,8 @@ AActor *COPY_AAPTR(AActor *origin, int selector) { if (selector == AAPTR_DEFAULT) return origin; + FTranslatedLineTarget t; + if (origin) { if (origin->player) @@ -41,11 +44,9 @@ AActor *COPY_AAPTR(AActor *origin, int selector) switch (selector & AAPTR_PLAYER_SELECTORS) { case AAPTR_PLAYER_GETTARGET: - { - AActor *gettarget = NULL; - P_BulletSlope(origin, &gettarget); - return gettarget; - } + P_BulletSlope(origin, &t, ALF_PORTALRESTRICT); + return t.linetarget; + case AAPTR_PLAYER_GETCONVERSATION: return origin->player->ConversationNPC; } @@ -60,11 +61,8 @@ AActor *COPY_AAPTR(AActor *origin, int selector) return origin->FriendPlayer ? AAPTR_RESOLVE_PLAYERNUM(origin->FriendPlayer - 1) : NULL; case AAPTR_GET_LINETARGET: - { - AActor *gettarget = NULL; - P_BulletSlope(origin, &gettarget); - return gettarget; - } + P_BulletSlope(origin, &t, ALF_PORTALRESTRICT); + return t.linetarget; } } diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 70f36bea9..1e4516b27 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -872,16 +872,16 @@ CCMD (wdir) //----------------------------------------------------------------------------- CCMD(linetarget) { - AActor *linetarget; + FTranslatedLineTarget t; if (CheckCheatmode () || players[consoleplayer].mo == NULL) return; - P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, &linetarget, 0); - if (linetarget) + P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, &t, 0); + if (t.linetarget) { Printf("Target=%s, Health=%d, Spawnhealth=%d\n", - linetarget->GetClass()->TypeName.GetChars(), - linetarget->health, - linetarget->SpawnHealth()); + t.linetarget->GetClass()->TypeName.GetChars(), + t.linetarget->health, + t.linetarget->SpawnHealth()); } else Printf("No target found\n"); } @@ -889,18 +889,18 @@ CCMD(linetarget) // As linetarget, but also give info about non-shootable actors CCMD(info) { - AActor *linetarget; + FTranslatedLineTarget t; if (CheckCheatmode () || players[consoleplayer].mo == NULL) return; P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, - &linetarget, 0, ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART); - if (linetarget) + &t, 0, ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART); + if (t.linetarget) { Printf("Target=%s, Health=%d, Spawnhealth=%d\n", - linetarget->GetClass()->TypeName.GetChars(), - linetarget->health, - linetarget->SpawnHealth()); - PrintMiscActorInfo(linetarget); + t.linetarget->GetClass()->TypeName.GetChars(), + t.linetarget->health, + t.linetarget->SpawnHealth()); + PrintMiscActorInfo(t.linetarget); } else Printf("No target found. Info cannot find actors that have " "the NOBLOCKMAP flag or have height/radius of 0.\n"); diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 73fda96b3..08eb018f9 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -33,7 +33,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch) angle_t angle; int damage; int pitch; - AActor *linetarget; + FTranslatedLineTarget t; if (self->player != NULL) { @@ -53,15 +53,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch) angle = self->angle; angle += pr_punch.Random2() << 18; - pitch = P_AimLineAttack (self, angle, MELEERANGE, &linetarget); + pitch = P_AimLineAttack (self, angle, MELEERANGE); - P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, LAF_ISMELEEATTACK, &linetarget); + P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, LAF_ISMELEEATTACK, &t); // turn to face target - if (linetarget) + if (t.linetarget) { S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM); - self->angle = self->AngleTo(linetarget); + self->angle = t.SourceAngleToTarget(); } return 0; } @@ -133,7 +133,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) angle_t angle; angle_t slope; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; int actualdamage; if (NULL == (player = self->player)) @@ -159,18 +159,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) } angle = self->angle + (pr_saw.Random2() * (spread_xy / 255)); - slope = P_AimLineAttack (self, angle, range, &linetarget) + (pr_saw.Random2() * (spread_z / 255)); + slope = P_AimLineAttack (self, angle, range, &t) + (pr_saw.Random2() * (spread_z / 255)); AWeapon *weapon = self->player->ReadyWeapon; - if ((weapon != NULL) && !(flags & SF_NOUSEAMMO) && !(!linetarget && (flags & SF_NOUSEAMMOMISS)) && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_WEAPON()) + if ((weapon != NULL) && !(flags & SF_NOUSEAMMO) && !(!t.linetarget && (flags & SF_NOUSEAMMOMISS)) && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_WEAPON()) { if (!weapon->DepleteAmmo (weapon->bAltFire)) return 0; } - P_LineAttack (self, angle, range, slope, damage, NAME_Melee, pufftype, false, &linetarget, &actualdamage); + P_LineAttack (self, angle, range, slope, damage, NAME_Melee, pufftype, false, &t, &actualdamage); - if (!linetarget) + if (!t.linetarget) { if ((flags & SF_RANDOMLIGHTMISS) && (pr_saw() > 64)) { @@ -197,7 +197,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) } } - if (lifesteal && !(linetarget->flags5 & MF5_DONTDRAIN)) + if (lifesteal && !(t.linetarget->flags5 & MF5_DONTDRAIN)) { if (flags & SF_STEALARMOR) { @@ -232,7 +232,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw) // turn to face target if (!(flags & SF_NOTURN)) { - angle = self->AngleTo(linetarget); + angle = t.SourceAngleToTarget(); if (angle - self->angle > ANG180) { if (angle - self->angle < (angle_t)(-ANG90 / 20)) @@ -643,7 +643,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) int j; int damage; angle_t an; - AActor *linetarget; + FTranslatedLineTarget t; if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra"); if (numrays <= 0) numrays = 40; @@ -662,18 +662,18 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) an = self->angle - angle / 2 + angle / numrays*i; // self->target is the originator (player) of the missile - P_AimLineAttack(self->target, an, distance, &linetarget, vrange); + P_AimLineAttack(self->target, an, distance, &t, vrange); - if (linetarget != NULL) + if (t.linetarget != NULL) { - AActor *spray = Spawn(spraytype, linetarget->PosPlusZ(linetarget->height >> 2), ALLOW_REPLACE); + AActor *spray = Spawn(spraytype, t.linetarget->PosPlusZ(t.linetarget->height >> 2), ALLOW_REPLACE); int dmgFlags = 0; FName dmgType = NAME_BFGSplash; if (spray != NULL) { - if (spray->flags6 & MF6_MTHRUSPECIES && self->target->GetSpecies() == linetarget->GetSpecies()) + if (spray->flags6 & MF6_MTHRUSPECIES && self->target->GetSpecies() == t.linetarget->GetSpecies()) { spray->Destroy(); // [MC] Remove it because technically, the spray isn't trying to "hit" them. continue; @@ -696,8 +696,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage = defdamage; } - int newdam = P_DamageMobj(linetarget, self->target, self->target, damage, dmgType, dmgFlags); - P_TraceBleed(newdam > 0 ? newdam : damage, linetarget, self->target); + int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, t.SourceAngleToTarget()); + P_TraceBleed(newdam > 0 ? newdam : damage, &t, self); } } return 0; diff --git a/src/g_doom/a_scriptedmarine.cpp b/src/g_doom/a_scriptedmarine.cpp index 43eec76e1..5051a4b94 100644 --- a/src/g_doom/a_scriptedmarine.cpp +++ b/src/g_doom/a_scriptedmarine.cpp @@ -276,16 +276,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw) if (self->CheckMeleeRange ()) { angle_t angle; - AActor *linetarget; + FTranslatedLineTarget t; damage *= (pr_m_saw()%10+1); angle = self->angle + (pr_m_saw.Random2() << 18); P_LineAttack (self, angle, MELEERANGE+1, - P_AimLineAttack (self, angle, MELEERANGE+1, &linetarget), damage, - NAME_Melee, pufftype, false, &linetarget); + P_AimLineAttack (self, angle, MELEERANGE+1), damage, + NAME_Melee, pufftype, false, &t); - if (!linetarget) + if (!t.linetarget) { S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM); return 0; @@ -293,7 +293,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw) S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM); // turn to face target - angle = self->AngleTo(linetarget); + angle = t.SourceAngleToTarget(); if (angle - self->angle > ANG180) { if (angle - self->angle < (angle_t)(-ANG90/20)) @@ -328,7 +328,7 @@ static void MarinePunch(AActor *self, int damagemul) angle_t angle; int damage; int pitch; - AActor *linetarget; + FTranslatedLineTarget t; if (self->target == NULL) return; @@ -337,15 +337,14 @@ static void MarinePunch(AActor *self, int damagemul) A_FaceTarget (self); angle = self->angle + (pr_m_punch.Random2() << 18); - pitch = P_AimLineAttack (self, angle, MELEERANGE, &linetarget); - P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true, &linetarget); + pitch = P_AimLineAttack (self, angle, MELEERANGE); + P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true, &t); // turn to face target - if (linetarget) + if (t.linetarget) { S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM); - self->angle = self->AngleTo(linetarget); - + self->angle = t.SourceAngleToTarget(); } } diff --git a/src/g_heretic/a_chicken.cpp b/src/g_heretic/a_chicken.cpp index dcc3e1774..9ebdaf169 100644 --- a/src/g_heretic/a_chicken.cpp +++ b/src/g_heretic/a_chicken.cpp @@ -176,7 +176,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1) int damage; int slope; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -185,11 +185,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1) damage = 1 + (pr_beakatkpl1()&3); angle = player->mo->angle; - slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &linetarget); - if (linetarget) + slope = P_AimLineAttack (player->mo, angle, MELEERANGE); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t); + if (t.linetarget) { - player->mo->angle = player->mo->AngleTo(linetarget); + player->mo->angle = t.SourceAngleToTarget(); } P_PlayPeck (player->mo); player->chickenPeck = 12; @@ -211,7 +211,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2) int damage; int slope; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -220,11 +220,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2) damage = pr_beakatkpl2.HitDice (4); angle = player->mo->angle; - slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget); - P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &linetarget); - if (linetarget) + slope = P_AimLineAttack (player->mo, angle, MELEERANGE); + P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t); + if (t.linetarget) { - player->mo->angle = player->mo->AngleTo(linetarget); + player->mo->angle = t.SourceAngleToTarget(); } P_PlayPeck (player->mo); player->chickenPeck = 12; diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index f51de13e1..4ff89d9d2 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -66,7 +66,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack) angle_t angle; int slope; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -88,13 +88,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack) } angle = self->angle; angle += pr_sap.Random2() << 18; - slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget); - P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true, &linetarget); - if (linetarget) + slope = P_AimLineAttack (self, angle, MELEERANGE); + P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true, &t); + if (t.linetarget) { //S_StartSound(player->mo, sfx_stfhit); // turn to face target - self->angle = self->AngleTo(linetarget); + self->angle = t.SourceAngleToTarget(); } return 0; } @@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack) fixed_t dist; player_t *player; PClassActor *pufftype; - AActor *linetarget; + FTranslatedLineTarget t; int actualdamage = 0; if (NULL == (player = self->player)) @@ -290,9 +290,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack) angle += pr_gatk.Random2() << 18; pufftype = PClass::FindActor("GauntletPuff1"); } - slope = P_AimLineAttack (self, angle, dist, &linetarget); - P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype, false, &linetarget, &actualdamage); - if (!linetarget) + slope = P_AimLineAttack (self, angle, dist); + P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype, false, &t, &actualdamage); + if (!t.linetarget) { if (pr_gatk() > 64) { @@ -316,7 +316,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack) } if (power) { - if (!(linetarget->flags5 & MF5_DONTDRAIN)) P_GiveBody (self, actualdamage>>1); + if (!(t.linetarget->flags5 & MF5_DONTDRAIN)) P_GiveBody (self, actualdamage>>1); S_Sound (self, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM); } else @@ -324,7 +324,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack) S_Sound (self, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM); } // turn to face target - angle = self->AngleTo(linetarget); + angle = t.SourceAngleToTarget(); if (angle-self->angle > ANG180) { if ((int)(angle-self->angle) < -ANG90/20) @@ -594,7 +594,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2) AActor *mo; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -607,16 +607,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2) if (!weapon->DepleteAmmo (weapon->bAltFire)) return 0; } - mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->angle, &linetarget); + mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->angle, &t); if (mo) { mo->velx += self->velx; mo->vely += self->vely; mo->velz = 2*FRACUNIT+ clamp(finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT); - if (linetarget) + if (t.linetarget && !t.unlinked) { - mo->tracer = linetarget; + mo->tracer = t.linetarget; } } S_Sound (self, CHAN_WEAPON, "weapons/maceshoot", 1, ATTN_NORM); @@ -637,7 +637,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact) AActor *target; angle_t angle = 0; bool newAngle; - AActor *linetarget; + FTranslatedLineTarget t; if ((self->Z() <= self->floorz) && P_HitFloor (self)) { // Landed in some sort of liquid @@ -671,11 +671,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact) angle = 0; for (i = 0; i < 16; i++) { - P_AimLineAttack (self, angle, 10*64*FRACUNIT, &linetarget, 0, ALF_NOFRIENDS, NULL, self->target); - if (linetarget && self->target != linetarget) + P_AimLineAttack (self, angle, 10*64*FRACUNIT, &t, 0, ALF_NOFRIENDS|ALF_PORTALRESTRICT, NULL, self->target); + if (t.linetarget && self->target != t.linetarget) { - self->tracer = linetarget; - angle = self->AngleTo(linetarget); + self->tracer = t.linetarget; + angle = t.SourceAngleToTarget(); newAngle = true; break; } @@ -943,7 +943,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2) player_t *player; AActor *MissileActor; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -955,16 +955,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2) if (!weapon->DepleteAmmo (weapon->bAltFire)) return 0; } - P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AHornRodFX2), self->angle, &linetarget, &MissileActor); + P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AHornRodFX2), self->angle, &t, &MissileActor); // Use MissileActor instead of the return value from // P_SpawnPlayerMissile because we need to give info to the mobj // even if it exploded immediately. if (MissileActor != NULL) { MissileActor->special2 = (int)(player - players); - if (linetarget) + if (t.linetarget && !t.unlinked) { - MissileActor->tracer = linetarget; + MissileActor->tracer = t.linetarget; } S_Sound (MissileActor, CHAN_WEAPON, "weapons/hornrodpowshoot", 1, ATTN_NORM); } diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 466c0f7c8..f87c2dd7d 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -213,7 +213,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack) PARAM_ACTION_PROLOGUE; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -225,10 +225,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack) if (!weapon->DepleteAmmo (weapon->bAltFire)) return 0; } - AActor *missile = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("HolyMissile"), self->angle, &linetarget); - if (missile != NULL) + AActor *missile = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("HolyMissile"), self->angle, &t); + if (missile != NULL && !t.unlinked) { - missile->tracer = linetarget; + missile->tracer = t.linetarget; } weapon->CHolyCount = 3; diff --git a/src/g_hexen/a_clericmace.cpp b/src/g_hexen/a_clericmace.cpp index c9b2e4f8d..05698c086 100644 --- a/src/g_hexen/a_clericmace.cpp +++ b/src/g_hexen/a_clericmace.cpp @@ -5,8 +5,6 @@ #include "thingdef/thingdef.h" */ -extern void AdjustPlayerAngle (AActor *pmo, AActor *linetarget); - static FRandom pr_maceatk ("CMaceAttack"); //=========================================================================== @@ -24,7 +22,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack) int slope; int i; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -39,13 +37,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack) for (int j = 1; j >= -1; j -= 2) { angle = player->mo->angle + j*i*(ANG45 / 16); - slope = P_AimLineAttack(player->mo, angle, 2 * MELEERANGE, &linetarget); - if (linetarget) + slope = P_AimLineAttack(player->mo, angle, 2 * MELEERANGE, &t); + if (t.linetarget) { - P_LineAttack(player->mo, angle, 2 * MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) + P_LineAttack(player->mo, angle, 2 * MELEERANGE, slope, damage, NAME_Melee, hammertime, true, &t); + if (t.linetarget != NULL) { - AdjustPlayerAngle(player->mo, linetarget); + AdjustPlayerAngle(player->mo, &t); goto macedone; } } @@ -55,7 +53,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack) player->mo->weaponspecial = 0; angle = player->mo->angle; - slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget); + slope = P_AimLineAttack (player->mo, angle, MELEERANGE); P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, hammertime); macedone: return 0; diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 457a54738..2644b29b0 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -55,7 +55,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) int slope; int i; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; PClassActor *puff; if (NULL == (player = self->player)) @@ -73,15 +73,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) for (int j = 1; j >= -1; j -= 2) { angle = pmo->angle + j*i*(ANG45 / 16); - slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, ALF_CHECK3D); - if (linetarget) + slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &t, 0, ALF_CHECK3D); + if (t.linetarget) { - P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &linetarget); - if (linetarget != NULL) + P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &t); + if (t.linetarget != NULL) { - pmo->angle = pmo->AngleTo(linetarget); - if (((linetarget->player && (!linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER) - && (!(linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE)))) + pmo->angle = t.SourceAngleToTarget(); + if (((t.linetarget->player && (!t.linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || t.linetarget->flags3&MF3_ISMONSTER) + && (!(t.linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE)))) { newLife = player->health + (damage >> 3); newLife = newLife > max ? max : newLife; diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index 047c02fc8..1681efe9f 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -24,8 +24,6 @@ void A_FAxeCheckReadyG (AActor *actor); void A_FAxeCheckUpG (AActor *actor); void A_FAxeAttack (AActor *actor); -extern void AdjustPlayerAngle (AActor *pmo, AActor *linetarget); - // The Fighter's Axe -------------------------------------------------------- class AFWeapAxe : public AFighterWeapon @@ -210,7 +208,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack) player_t *player; AWeapon *weapon; PClassActor *pufftype; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -239,17 +237,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack) for (int j = 1; j >= -1; j -= 2) { angle = pmo->angle + j*i*(ANG45 / 16); - slope = P_AimLineAttack(pmo, angle, AXERANGE, &linetarget); - if (linetarget) + slope = P_AimLineAttack(pmo, angle, AXERANGE, &t); + if (t.linetarget) { - P_LineAttack(pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); - if (linetarget != NULL) + P_LineAttack(pmo, angle, AXERANGE, slope, damage, NAME_Melee, pufftype, true, &t); + if (t.linetarget != NULL) { - if (linetarget->flags3&MF3_ISMONSTER || linetarget->player) + if (t.linetarget->flags3&MF3_ISMONSTER || t.linetarget->player) { - P_ThrustMobj(linetarget, angle, power); + P_ThrustMobj(t.linetarget, t.hitangle, power); } - AdjustPlayerAngle(pmo, linetarget); + AdjustPlayerAngle(pmo, &t); useMana++; goto axedone; } @@ -260,7 +258,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack) pmo->weaponspecial = 0; angle = pmo->angle; - slope = P_AimLineAttack (pmo, angle, MELEERANGE, &linetarget); + slope = P_AimLineAttack (pmo, angle, MELEERANGE); P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype, true); axedone: diff --git a/src/g_hexen/a_fighterhammer.cpp b/src/g_hexen/a_fighterhammer.cpp index 2980dec7a..836f6e4b7 100644 --- a/src/g_hexen/a_fighterhammer.cpp +++ b/src/g_hexen/a_fighterhammer.cpp @@ -17,8 +17,6 @@ const fixed_t HAMMER_RANGE = MELEERANGE+MELEERANGE/2; static FRandom pr_hammeratk ("FHammerAtk"); -extern void AdjustPlayerAngle (AActor *pmo, AActor *linetarget); - //============================================================================ // // A_FHammerAttack @@ -35,7 +33,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack) int slope; int i; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; PClassActor *hammertime; if (NULL == (player = self->player)) @@ -50,32 +48,32 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack) for (i = 0; i < 16; i++) { angle = pmo->angle + i*(ANG45/32); - slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D); - if (linetarget != NULL) + slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D); + if (t.linetarget != NULL) { - P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) + P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &t); + if (t.linetarget != NULL) { - AdjustPlayerAngle(pmo, linetarget); - if (linetarget->flags3 & MF3_ISMONSTER || linetarget->player) + AdjustPlayerAngle(pmo, &t); + if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player) { - P_ThrustMobj(linetarget, angle, power); + P_ThrustMobj(t.linetarget, t.hitangle, power); } pmo->weaponspecial = false; // Don't throw a hammer goto hammerdone; } } angle = pmo->angle-i*(ANG45/32); - slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D); - if (linetarget != NULL) + slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D); + if (t.linetarget != NULL) { - P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &linetarget); - if (linetarget != NULL) + P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &t); + if (t.linetarget != NULL) { - AdjustPlayerAngle(pmo, linetarget); - if (linetarget->flags3 & MF3_ISMONSTER || linetarget->player) + AdjustPlayerAngle(pmo, &t); + if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player) { - P_ThrustMobj(linetarget, angle, power); + P_ThrustMobj(t.linetarget, t.hitangle, power); } pmo->weaponspecial = false; // Don't throw a hammer goto hammerdone; @@ -84,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack) } // didn't find any targets in meleerange, so set to throw out a hammer angle = pmo->angle; - slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, ALF_CHECK3D); + slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, NULL, 0, ALF_CHECK3D); if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true) != NULL) { pmo->weaponspecial = false; diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index 944a4aa45..dfbc43be2 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -25,12 +25,12 @@ static FRandom pr_fpatk ("FPunchAttack"); #define MAX_ANGLE_ADJUST (5*ANGLE_1) -void AdjustPlayerAngle (AActor *pmo, AActor *linetarget) +void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t) { angle_t angle; int difference; - angle = pmo->AngleTo(linetarget); + angle = t->SourceAngleToTarget(); difference = (int)angle - (int)pmo->angle; if (abs(difference) > MAX_ANGLE_ADJUST) { @@ -60,11 +60,11 @@ void AdjustPlayerAngle (AActor *pmo, AActor *linetarget) static bool TryPunch(APlayerPawn *pmo, angle_t angle, int damage, fixed_t power) { PClassActor *pufftype; - AActor *linetarget; + FTranslatedLineTarget t; int slope; - slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &linetarget); - if (linetarget != NULL) + slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &t); + if (t.linetarget != NULL) { if (++pmo->weaponspecial >= 3) { @@ -76,15 +76,15 @@ static bool TryPunch(APlayerPawn *pmo, angle_t angle, int damage, fixed_t power) { pufftype = PClass::FindActor("PunchPuff"); } - P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &linetarget); - if (linetarget != NULL) + P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true, &t); + if (t.linetarget != NULL) { - if (linetarget->player != NULL || - (linetarget->Mass != INT_MAX && (linetarget->flags3 & MF3_ISMONSTER))) + if (t.linetarget->player != NULL || + (t.linetarget->Mass != INT_MAX && (t.linetarget->flags3 & MF3_ISMONSTER))) { - P_ThrustMobj (linetarget, angle, power); + P_ThrustMobj (t.linetarget, t.hitangle, power); } - AdjustPlayerAngle (pmo, linetarget); + AdjustPlayerAngle (pmo, &t); return true; } } @@ -131,8 +131,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack) // didn't find any creatures, so try to strike any walls pmo->weaponspecial = 0; - AActor *linetarget; - int slope = P_AimLineAttack (pmo, pmo->angle, MELEERANGE, &linetarget); + int slope = P_AimLineAttack (pmo, pmo->angle, MELEERANGE); P_LineAttack (pmo, pmo->angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("PunchPuff"), true); return 0; } diff --git a/src/g_hexen/a_hexenglobal.h b/src/g_hexen/a_hexenglobal.h index ba68a9988..94b03d45d 100644 --- a/src/g_hexen/a_hexenglobal.h +++ b/src/g_hexen/a_hexenglobal.h @@ -3,6 +3,8 @@ #include "d_player.h" +void AdjustPlayerAngle(AActor *pmo, FTranslatedLineTarget *t); + class AHolySpirit : public AActor { DECLARE_CLASS (AHolySpirit, AActor) diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 86addb2cb..302048998 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -350,7 +350,7 @@ void AZBell::Activate (AActor *activator) { if (health > 0) { - P_DamageMobj (this, activator, activator, 10, NAME_Melee); // 'ring' the bell + P_DamageMobj (this, activator, activator, 10, NAME_Melee, DMG_THRUSTLESS); // 'ring' the bell } } diff --git a/src/g_hexen/a_magecone.cpp b/src/g_hexen/a_magecone.cpp index 154c76524..c157c02c0 100644 --- a/src/g_hexen/a_magecone.cpp +++ b/src/g_hexen/a_magecone.cpp @@ -60,7 +60,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1) AActor *mo; bool conedone=false; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -79,10 +79,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1) for (i = 0; i < 16; i++) { angle = self->angle+i*(ANG45/16); - slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget, 0, ALF_CHECK3D); - if (linetarget) + slope = P_AimLineAttack (self, angle, MELEERANGE, &t, 0, ALF_CHECK3D); + if (t.linetarget) { - P_DamageMobj (linetarget, self, self, damage, NAME_Ice); + P_DamageMobj (t.linetarget, self, self, damage, NAME_Ice, DMG_USEANGLE, t.SourceAngleToTarget()); conedone = true; break; } diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index d1ca7e75c..832ae96d1 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -97,17 +97,20 @@ bool AMageStaffFX2::SpecialBlastHandling (AActor *source, fixed_t strength) // //============================================================================ -void MStaffSpawn (AActor *pmo, angle_t angle) +void MStaffSpawn (AActor *pmo, angle_t angle, AActor *alttarget) { AActor *mo; - AActor *linetarget; + FTranslatedLineTarget t; mo = P_SpawnPlayerMissile (pmo, 0, 0, 8*FRACUNIT, - RUNTIME_CLASS(AMageStaffFX2), angle, &linetarget); + RUNTIME_CLASS(AMageStaffFX2), angle, &t); if (mo) { mo->target = pmo; - mo->tracer = linetarget; + if (t.linetarget && !t.unlinked) + mo->tracer = t.linetarget; + else + mo->tracer = alttarget; } } @@ -123,7 +126,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack) angle_t angle; player_t *player; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -139,18 +142,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack) angle = self->angle; // [RH] Let's try and actually track what the player aimed at - P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &linetarget, ANGLE_1*32); - if (linetarget == NULL) + P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &t, ANGLE_1*32); + if (t.linetarget == NULL) { BlockCheckLine.x = self->X(); BlockCheckLine.y = self->Y(); BlockCheckLine.dx = -finesine[angle >> ANGLETOFINESHIFT]; BlockCheckLine.dy = -finecosine[angle >> ANGLETOFINESHIFT]; - linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck); + t.linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck); } - MStaffSpawn (self, angle); - MStaffSpawn (self, angle-ANGLE_1*5); - MStaffSpawn (self, angle+ANGLE_1*5); + MStaffSpawn (self, angle, t.linetarget); + MStaffSpawn (self, angle-ANGLE_1*5, t.linetarget); + MStaffSpawn (self, angle+ANGLE_1*5, t.linetarget); S_Sound (self, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM); weapon->MStaffCount = 3; return 0; diff --git a/src/g_hexen/a_pig.cpp b/src/g_hexen/a_pig.cpp index 8ce394a28..b07bfc4a0 100644 --- a/src/g_hexen/a_pig.cpp +++ b/src/g_hexen/a_pig.cpp @@ -18,8 +18,6 @@ static FRandom pr_snoutattack ("SnoutAttack"); static FRandom pr_pigattack ("PigAttack"); static FRandom pr_pigplayerthink ("PigPlayerThink"); -extern void AdjustPlayerAngle (AActor *, AActor *); - // Pig player --------------------------------------------------------------- class APigPlayer : public APlayerPawn @@ -67,7 +65,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack) int slope; player_t *player; AActor *puff; - AActor *linetarget; + FTranslatedLineTarget t; if (NULL == (player = self->player)) { @@ -76,12 +74,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack) damage = 3+(pr_snoutattack()&3); angle = player->mo->angle; - slope = P_AimLineAttack(player->mo, angle, MELEERANGE, &linetarget); - puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &linetarget); + slope = P_AimLineAttack(player->mo, angle, MELEERANGE); + puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &t); S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM); - if(linetarget) + if(t.linetarget) { - AdjustPlayerAngle(player->mo, linetarget); + AdjustPlayerAngle(player->mo, &t); if(puff != NULL) { // Bit something S_Sound(player->mo, CHAN_VOICE, "PigAttack", 1, ATTN_NORM); diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 561f52746..60e86a34b 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -100,7 +100,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger) int damage; int pitch; int power; - AActor *linetarget; + FTranslatedLineTarget t; power = MIN(10, self->player->mo->stamina / 10); damage = (pr_jabdagger() % (power + 8)) * (power + 2); @@ -111,18 +111,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger) } angle = self->angle + (pr_jabdagger.Random2() << 18); - pitch = P_AimLineAttack (self, angle, 80*FRACUNIT, &linetarget); - P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true, &linetarget); + pitch = P_AimLineAttack (self, angle, 80*FRACUNIT); + P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true, &t); // turn to face target - if (linetarget) + if (t.linetarget) { S_Sound (self, CHAN_WEAPON, - linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit", + t.linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit", 1, ATTN_NORM); - self->angle = self->AngleTo(linetarget); + self->angle = t.SourceAngleToTarget(); self->flags |= MF_JUSTATTACKED; - P_DaggerAlert (self, linetarget); + P_DaggerAlert (self, t.linetarget); } else { @@ -978,7 +978,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) AActor *spot; player_t *player = self->player; - AActor *linetarget; + FTranslatedLineTarget t; if (player == NULL || player->ReadyWeapon == NULL) return 0; @@ -986,13 +986,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) P_DamageMobj (self, self, NULL, 1*4, 0, DMG_NO_ARMOR); S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM); - P_BulletSlope (self, &linetarget); - if (linetarget != NULL) + P_BulletSlope (self, &t, ALF_PORTALRESTRICT); + if (t.linetarget != NULL) { - spot = Spawn("SpectralLightningSpot", linetarget->X(), linetarget->Y(), linetarget->floorz, ALLOW_REPLACE); + spot = Spawn("SpectralLightningSpot", t.linetarget->X(), t.linetarget->Y(), t.linetarget->floorz, ALLOW_REPLACE); if (spot != NULL) { - spot->tracer = linetarget; + spot->tracer = t.linetarget; } } else @@ -1080,7 +1080,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4) AActor *spot; player_t *player = self->player; - AActor *linetarget; + FTranslatedLineTarget t; if (player == NULL || player->ReadyWeapon == NULL) return 0; @@ -1088,13 +1088,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4) P_DamageMobj (self, self, NULL, 4*4, 0, DMG_NO_ARMOR); S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM); - P_BulletSlope (self, &linetarget); - if (linetarget != NULL) + P_BulletSlope (self, &t, ALF_PORTALRESTRICT); + if (t.linetarget != NULL) { - spot = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("SpectralLightningBigV1"), self->angle, &linetarget); + spot = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("SpectralLightningBigV1"), self->angle, &t, NULL, false, false, ALF_PORTALRESTRICT); if (spot != NULL) { - spot->tracer = linetarget; + spot->tracer = t.linetarget; } } else diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 52e11ee8b..b6a718f65 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4939,7 +4939,9 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) { if (actor->player != NULL && actor->player->playerstate == PST_LIVE) { - P_BulletSlope(actor, &actor); + FTranslatedLineTarget t; + P_BulletSlope(actor, &t, ALF_PORTALRESTRICT); + actor = t.linetarget; } else { diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 0e8c7d6ff..af4a9042d 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -425,16 +425,16 @@ bool AActor::SuggestMissileAttack (fixed_t dist) bool P_HitFriend(AActor * self) { - AActor *linetarget; + FTranslatedLineTarget t; if (self->flags&MF_FRIENDLY && self->target != NULL) { angle_t angle = self->AngleTo(self->target); fixed_t dist = self->AproxDistance (self->target); - P_AimLineAttack (self, angle, dist, &linetarget, 0, true); - if (linetarget != NULL && linetarget != self->target) + P_AimLineAttack (self, angle, dist, &t, 0, true); + if (t.linetarget != NULL && t.linetarget != self->target) { - return self->IsFriend (linetarget); + return self->IsFriend (t.linetarget); } } return false; @@ -2990,7 +2990,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) return 0; fixed_t saved_pitch = self->pitch; - AActor *linetarget; + FTranslatedLineTarget t; // [RH] Andy Baker's stealth monsters if (self->flags & MF_STEALTH) @@ -3002,8 +3002,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) self->angle = self->AngleTo(self->target); - self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, &linetarget, ANGLE_1*60, 0, self->target); - if (linetarget == NULL) + self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, &t, ANGLE_1*60, 0, self->target); + if (t.linetarget == NULL) { // We probably won't hit the target, but aim at it anyway so we don't look stupid. fixedvec2 pos = self->Vec2To(self->target); diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 98d08832e..313531425 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -927,7 +927,7 @@ static inline bool isFakePain(AActor *target, AActor *inflictor, int damage) // Returns the amount of damage actually inflicted upon the target, or -1 if // the damage was cancelled. -int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags) +int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags, angle_t angle) { unsigned ang; player_t *player = NULL; @@ -1151,11 +1151,15 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { AActor *origin = (source && (flags & DMG_INFLICTOR_IS_PUFF))? source : inflictor; - // If the origin and target are in exactly the same spot, choose a random direction. - // (Most likely cause is from telefragging somebody during spawning because they - // haven't moved from their spawn spot at all.) - if (origin->X() == target->X() && origin->Y() == target->Y()) + if (flags & DMG_USEANGLE) { + ang = angle; + } + else if (origin->X() == target->X() && origin->Y() == target->Y()) + { + // If the origin and target are in exactly the same spot, choose a random direction. + // (Most likely cause is from telefragging somebody during spawning because they + // haven't moved from their spawn spot at all.) ang = pr_kickbackdir.GenRand32(); } else diff --git a/src/p_local.h b/src/p_local.h index 7e11010c5..75ee1e695 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -37,6 +37,7 @@ struct sector_t; struct msecnode_t; struct secplane_t; struct FCheckPosition; +struct FTranslatedLineTarget; #include @@ -173,7 +174,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassAct AActor *P_SpawnPlayerMissile (AActor* source, PClassActor *type); AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, angle_t angle); AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, PClassActor *type, angle_t angle, - AActor **pLineTarget = NULL, AActor **MissileActor = NULL, bool nofreeaim = false, bool noautoaim = false); + FTranslatedLineTarget *pLineTarget = NULL, AActor **MissileActor = NULL, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0); void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheight=false); @@ -304,7 +305,7 @@ void P_FindFloorCeiling (AActor *actor, int flags=0); bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset); -fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, int flags = 0, AActor *target=NULL, AActor *friender=NULL); +fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, FTranslatedLineTarget *pLineTarget = NULL, fixed_t vrange=0, int flags = 0, AActor *target=NULL, AActor *friender=NULL); enum // P_AimLineAttack flags { @@ -313,6 +314,7 @@ enum // P_AimLineAttack flags ALF_CHECKNONSHOOTABLE = 4, ALF_CHECKCONVERSATION = 8, ALF_NOFRIENDS = 16, + ALF_PORTALRESTRICT = 32, // only work through portals with a global offset (to be used for stuff that cannot remember the calculated FTranslatedLineTarget info) }; enum // P_LineAttack flags @@ -322,11 +324,12 @@ enum // P_LineAttack flags LAF_NOIMPACTDECAL = 4 }; -AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL); -AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL); +AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL); +AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, int flags = 0, FTranslatedLineTarget *victim = NULL, int *actualdamage = NULL); void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version +void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff); // hitscan version void P_TraceBleed (int damage, AActor *target); // random direction version bool P_HitFloor (AActor *thing); bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true, bool force = false); @@ -382,7 +385,7 @@ extern BYTE* rejectmatrix; // for fast sight rejection // P_INTER // void P_TouchSpecialThing (AActor *special, AActor *toucher); -int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags=0); +int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags=0, angle_t angle = 0); void P_PoisonMobj (AActor *target, AActor *inflictor, AActor *source, int damage, int duration, int period, FName type); bool P_GiveBody (AActor *actor, int num, int max=0); bool P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poison); @@ -399,6 +402,7 @@ enum EDmgFlags DMG_FOILINVUL = 64, DMG_FOILBUDDHA = 128, DMG_NO_PROTECT = 256, + DMG_USEANGLE = 512, }; diff --git a/src/p_map.cpp b/src/p_map.cpp index 1a4a18d74..150348fc3 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3787,7 +3787,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en // //============================================================================ -fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, +fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, FTranslatedLineTarget *pLineTarget, fixed_t vrange, int flags, AActor *target, AActor *friender) { fixed_t x2; @@ -3881,7 +3881,18 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL } if (pLineTarget) { - *pLineTarget = aim.linetarget; + if (aim.linetarget) + { + pLineTarget->linetarget = aim.linetarget; + pLineTarget->hitangle = angle; + pLineTarget->targetPosFromSrc = aim.linetarget->Pos(); + pLineTarget->targetAngleFromSrc = aim.linetarget->angle; + pLineTarget->sourcePosFromTarget = t1->Pos(); + pLineTarget->sourceAngleFromTarget = t1->angle; + pLineTarget->unlinked = false; + } + else + memset(pLineTarget, 0, sizeof(*pLineTarget)); } return aim.linetarget ? aim.aimpitch : t1->pitch; } @@ -3936,7 +3947,7 @@ static ETraceStatus CheckForActor(FTraceResults &res, void *userdata) //========================================================================== AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, - int pitch, int damage, FName damageType, PClassActor *pufftype, int flags, AActor **victim, int *actualdamage) + int pitch, int damage, FName damageType, PClassActor *pufftype, int flags, FTranslatedLineTarget*victim, int *actualdamage) { fixed_t vx, vy, vz, shootz; FTraceResults trace; @@ -3953,7 +3964,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, if (victim != NULL) { - *victim = NULL; + memset(victim, 0, sizeof(*victim)); } if (actualdamage != NULL) { @@ -4136,6 +4147,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, puff = P_SpawnPuff(t1, pufftype, hitx, hity, hitz, angle - ANG180, 2, puffFlags | PF_HITTHING | PF_TEMPORARY); killPuff = true; } +#pragma message("damage angle") newdam = P_DamageMobj(trace.Actor, puff ? puff : t1, t1, damage, damageType, dmgflags); if (actualdamage != NULL) { @@ -4175,7 +4187,13 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, } if (victim != NULL) { - *victim = trace.Actor; + victim->linetarget = trace.Actor; + victim->hitangle = angle; + victim->targetPosFromSrc = trace.Actor->Pos(); + victim->targetAngleFromSrc = trace.Actor->angle; + victim->sourcePosFromTarget = t1->Pos(); + victim->sourceAngleFromTarget = t1->angle; + victim->unlinked = false; } } if (trace.Crossed3DWater || trace.CrossedWater) @@ -4198,22 +4216,22 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, } AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, - int pitch, int damage, FName damageType, FName pufftype, int flags, AActor **victim, int *actualdamage) + int pitch, int damage, FName damageType, FName pufftype, int flags, FTranslatedLineTarget *victim, int *actualdamage) { PClassActor *type = PClass::FindActor(pufftype); - if (victim != NULL) - { - *victim = NULL; - } if (type == NULL) { + if (victim != NULL) + { + memset(victim, 0, sizeof(*victim)); + } Printf("Attempt to spawn unknown actor type '%s'\n", pufftype.GetChars()); + return NULL; } else { return P_LineAttack(t1, angle, distance, pitch, damage, damageType, type, flags, victim, actualdamage); } - return NULL; } //========================================================================== @@ -4395,6 +4413,24 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile) // //========================================================================== +void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff) +{ + if (t->linetarget == NULL || puff->flags3 & MF3_BLOODLESSIMPACT) + { + return; + } + + fixed_t randpitch = (pr_tracebleed() - 128) << 16; + P_TraceBleed(damage, t->linetarget->X(), t->linetarget->Y(), t->linetarget->Z() + t->linetarget->height / 2, + t->linetarget, t->SourceAngleToTarget(), 0); +} + +//========================================================================== +// +// +// +//========================================================================== + void P_TraceBleed(int damage, AActor *target) { if (target != NULL) @@ -4573,6 +4609,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i if (puffDefaults->flags3 & MF3_FOILINVUL) dmgFlagPass |= DMG_FOILINVUL; if (puffDefaults->flags7 & MF7_FOILBUDDHA) dmgFlagPass |= DMG_FOILBUDDHA; } +#pragma message("damage angle") int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, dmgFlagPass); if (bleed) @@ -4690,38 +4727,26 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera bool P_TalkFacing(AActor *player) { - AActor *linetarget; + static const int angleofs[] = { 0, ANGLE_90 >> 4, - ANGLE_90 >> 4 }; + FTranslatedLineTarget t; - P_AimLineAttack(player, player->angle, TALKRANGE, &linetarget, ANGLE_1 * 35, ALF_FORCENOSMART | ALF_CHECKCONVERSATION); - if (linetarget == NULL) + for (int angle : angleofs) { - P_AimLineAttack(player, player->angle + (ANGLE_90 >> 4), TALKRANGE, &linetarget, ANGLE_1 * 35, ALF_FORCENOSMART | ALF_CHECKCONVERSATION); - if (linetarget == NULL) + P_AimLineAttack(player, player->angle + angle, TALKRANGE, &t, ANGLE_1 * 35, ALF_FORCENOSMART | ALF_CHECKCONVERSATION | ALF_PORTALRESTRICT); + if (t.linetarget != NULL) { - P_AimLineAttack(player, player->angle - (ANGLE_90 >> 4), TALKRANGE, &linetarget, ANGLE_1 * 35, ALF_FORCENOSMART | ALF_CHECKCONVERSATION); - if (linetarget == NULL) + if (t.linetarget->health > 0 && // Dead things can't talk. + t.linetarget->flags4 & MF4_INCOMBAT && // Fighting things don't talk either. + t.linetarget->Conversation != NULL) { - return false; + // Give the NPC a chance to play a brief animation + t.linetarget->ConversationAnimation(0); + P_StartConversation(t.linetarget, player, true, true); + return true; } + return false; } } - // Dead things can't talk. - if (linetarget->health <= 0) - { - return false; - } - // Fighting things don't talk either. - if (linetarget->flags4 & MF4_INCOMBAT) - { - return false; - } - if (linetarget->Conversation != NULL) - { - // Give the NPC a chance to play a brief animation - linetarget->ConversationAnimation(0); - P_StartConversation(linetarget, player, true, true); - return true; - } return false; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f03362ab5..fbceb5d3f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6164,13 +6164,13 @@ AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, angle_t angle) } AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, - PClassActor *type, angle_t angle, AActor **pLineTarget, AActor **pMissileActor, - bool nofreeaim, bool noautoaim) + PClassActor *type, angle_t angle, FTranslatedLineTarget *pLineTarget, AActor **pMissileActor, + bool nofreeaim, bool noautoaim, int aimflags) { static const int angdiff[3] = { -(1<<26), 1<<26, 0 }; angle_t an = angle; angle_t pitch; - AActor *linetarget; + FTranslatedLineTarget scratch; AActor *defaultobject = GetDefaultByType(type); int vrange = nofreeaim ? ANGLE_1*35 : 0; @@ -6178,12 +6178,13 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, { return NULL; } + if (!pLineTarget) pLineTarget = &scratch; if (source->player && source->player->ReadyWeapon && ((source->player->ReadyWeapon->WeaponFlags & WIF_NOAUTOAIM) || noautoaim)) { // Keep exactly the same angle and pitch as the player's own aim an = angle; pitch = source->pitch; - linetarget = NULL; + pLineTarget->linetarget = NULL; } else // see which target is to be aimed at { @@ -6196,7 +6197,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, do { an = angle + angdiff[i]; - pitch = P_AimLineAttack (source, an, linetargetrange, &linetarget, vrange); + pitch = P_AimLineAttack (source, an, linetargetrange, pLineTarget, vrange, aimflags); if (source->player != NULL && !nofreeaim && @@ -6205,9 +6206,9 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, { break; } - } while (linetarget == NULL && --i >= 0); + } while (pLineTarget->linetarget == NULL && --i >= 0); - if (linetarget == NULL) + if (pLineTarget->linetarget == NULL) { an = angle; if (nofreeaim || !level.IsFreelookAllowed()) @@ -6216,7 +6217,6 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, } } } - if (pLineTarget) *pLineTarget = linetarget; if (z != ONFLOORZ && z != ONCEILINGZ) { diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index ec6c38f77..2f2af36c3 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -919,20 +919,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash) // the height of the intended target // -angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget) +angle_t P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget, int aimflags) { static const int angdiff[3] = { -(1<<26), 1<<26, 0 }; int i; angle_t an; angle_t pitch; - AActor *linetarget; + FTranslatedLineTarget scratch; + if (pLineTarget == NULL) pLineTarget = &scratch; // see which target is to be aimed at i = 2; do { an = mo->angle + angdiff[i]; - pitch = P_AimLineAttack (mo, an, 16*64*FRACUNIT, &linetarget); + pitch = P_AimLineAttack (mo, an, 16*64*FRACUNIT, pLineTarget, 0, aimflags); if (mo->player != NULL && level.IsFreelookAllowed() && @@ -940,11 +941,8 @@ angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget) { break; } - } while (linetarget == NULL && --i >= 0); - if (pLineTarget != NULL) - { - *pLineTarget = linetarget; - } + } while (pLineTarget->linetarget == NULL && --i >= 0); + return pitch; } diff --git a/src/p_pspr.h b/src/p_pspr.h index a9eec48b6..8fb6d455b 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -88,7 +88,7 @@ void P_BringUpWeapon (player_t *player); void P_FireWeapon (player_t *player); void P_DropWeapon (player_t *player); void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y); -angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget = NULL); +angle_t P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget = NULL, int aimflags = 0); void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, angle_t pitch); void DoReadyWeapon(AActor *self); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 19c34cd4f..c1724c2c5 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -960,7 +960,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) else { // Does the player aim at something that can be shot? - P_BulletSlope(self, &target); + FTranslatedLineTarget t; + P_BulletSlope(self, &t, ALF_PORTALRESTRICT); + target = t.linetarget; } return DoJumpIfCloser(target, VM_ARGS_NAMES); } @@ -1637,7 +1639,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) player_t *player = self->player; AWeapon *weapon = player->ReadyWeapon; - AActor *linetarget; + FTranslatedLineTarget t; // Only use ammo if called from a weapon if (useammo && ACTION_CALL_FROM_WEAPON() && weapon) @@ -1659,7 +1661,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) // Temporarily adjusts the pitch fixed_t saved_player_pitch = self->pitch; self->pitch -= pitch; - AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &linetarget, NULL, false, (flags & FPF_NOAUTOAIM) != 0); + AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &t, NULL, false, (flags & FPF_NOAUTOAIM) != 0); self->pitch = saved_player_pitch; // automatic handling of seeker missiles @@ -1667,8 +1669,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) { if (flags & FPF_TRANSFERTRANSLATION) misl->Translation = self->Translation; - if (linetarget && (misl->flags2 & MF2_SEEKERMISSILE)) - misl->tracer = linetarget; + if (t.linetarget && !t.unlinked && (misl->flags2 & MF2_SEEKERMISSILE)) + misl->tracer = t.linetarget; if (!(flags & FPF_AIMATANGLE)) { // This original implementation is to aim straight ahead and then offset @@ -1727,7 +1729,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) angle_t angle; int pitch; - AActor * linetarget; + FTranslatedLineTarget t; int actualdamage; if (!norandom) @@ -1736,10 +1738,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) angle = self->angle + (pr_cwpunch.Random2() << 18); if (range == 0) range = MELEERANGE; - pitch = P_AimLineAttack (self, angle, range, &linetarget); + pitch = P_AimLineAttack (self, angle, range, &t); // only use ammo when actually hitting something! - if ((flags & CPF_USEAMMO) && linetarget && weapon && ACTION_CALL_FROM_WEAPON()) + if ((flags & CPF_USEAMMO) && t.linetarget && weapon && ACTION_CALL_FROM_WEAPON()) { if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return 0; // out of ammo @@ -1749,15 +1751,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) pufftype = PClass::FindActor(NAME_BulletPuff); int puffFlags = LAF_ISMELEEATTACK | ((flags & CPF_NORANDOMPUFFZ) ? LAF_NORANDOMPUFFZ : 0); - P_LineAttack (self, angle, range, pitch, damage, NAME_Melee, pufftype, puffFlags, &linetarget, &actualdamage); + P_LineAttack (self, angle, range, pitch, damage, NAME_Melee, pufftype, puffFlags, &t, &actualdamage); - if (!linetarget) + if (!t.linetarget) { if (MissSound) S_Sound(self, CHAN_WEAPON, MissSound, 1, ATTN_NORM); } else { - if (lifesteal && !(linetarget->flags5 & MF5_DONTDRAIN)) + if (lifesteal && !(t.linetarget->flags5 & MF5_DONTDRAIN)) { if (flags & CPF_STEALARMOR) { @@ -1794,11 +1796,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) if (!(flags & CPF_NOTURN)) { // turn to face target - self->angle = self->AngleTo(linetarget); + self->angle = t.SourceAngleToTarget(); } if (flags & CPF_PULLIN) self->flags |= MF_JUSTATTACKED; - if (flags & CPF_DAGGER) P_DaggerAlert (self, linetarget); + if (flags & CPF_DAGGER) P_DaggerAlert (self, t.linetarget); } return 0; } @@ -1900,7 +1902,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) if (range == 0) range = 8192*FRACUNIT; if (sparsity == 0) sparsity = 1; - AActor *linetarget; + FTranslatedLineTarget t; fixedvec3 savedpos = self->Pos(); angle_t saved_angle = self->angle; @@ -1923,8 +1925,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) { self->angle = self->AngleTo(self->target); } - self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, &linetarget, ANGLE_1*60, 0, aim ? self->target : NULL); - if (linetarget == NULL && aim) + self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, &t, ANGLE_1*60, 0, aim ? self->target : NULL); + if (t.linetarget == NULL && aim) { // We probably won't hit the target, but aim at it anyway so we don't look stupid. fixedvec2 pos = self->Vec2To(self->target); @@ -3929,6 +3931,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) angle_t an; AActor *target, *viewport; + FTranslatedLineTarget t; bool doCheckSight; @@ -3964,12 +3967,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) else { // Does the player aim at something that can be shot? - P_AimLineAttack(self, self->angle, MISSILERANGE, &target, (flags & JLOSF_NOAUTOAIM) ? ANGLE_1/2 : 0); + P_AimLineAttack(self, self->angle, MISSILERANGE, &t, (flags & JLOSF_NOAUTOAIM) ? ANGLE_1/2 : 0, ALF_PORTALRESTRICT); - if (!target) + if (!t.linetarget) { ACTION_RETURN_STATE(NULL); } + target = t.linetarget; switch (flags & (JLOSF_TARGETLOS|JLOSF_FLIPFOV)) { From 8b5137461f55161de747c89bbc666bb77b4ae6a4 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 1 Mar 2016 09:38:14 -0600 Subject: [PATCH 38/39] Add a couple more directories to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 422957e23..e94b5b5f6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.pdb *.ilk *.aps +/fmodapi*/ /Release /wadsrc_wad *.user @@ -43,3 +44,4 @@ /build_vc2015 /build_vc2015-32 /build_vc2015-64 +/build From 165d26baa1569685651baf4575e12e73c8cbfd2e Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 1 Mar 2016 09:29:40 -0600 Subject: [PATCH 39/39] Add .gitattributes --- .gitattributes | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..d12f3a703 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +* text=auto + +*.h text +*.c text +*.cc text +*.cpp text +*.mm text +*.lemon text +*.y text +*.re text +*.i text +*.asm text +*.S text + +*.vcproj text eol=crlf +*.sln text eol=crlf +*.bat text eol=crlf + +*.txt text +language.* text + +*.png binary +*.imgz binary +*.lmp binary +*.flac binary +*.dat binary