From 54f0d0c1104a2f51dced0d58a7a432d9f3c76afb Mon Sep 17 00:00:00 2001 From: Ronald Kinard Date: Tue, 18 Nov 2014 18:45:57 -0600 Subject: [PATCH 001/364] IN PROGRESS: porting eternity slopes from srb2cb --- src/Makefile | 2 + src/doomdef.h | 8 + src/m_fixed.h | 23 + src/m_vector.c | 1160 ++++++++++++++++++++++++++++++++++++++++++++++ src/m_vector.h | 123 +++++ src/p_enemy.c | 13 + src/p_floor.c | 11 +- src/p_local.h | 15 + src/p_map.c | 371 ++++++++++++--- src/p_maputl.c | 205 ++++++-- src/p_mobj.c | 103 +++- src/p_mobj.h | 10 + src/p_slopes.c | 1211 ++++++++++++++++++++++++++++++++++++++++++++++++ src/p_slopes.h | 84 ++++ src/p_spec.c | 90 +++- src/p_spec.h | 5 + src/p_user.c | 81 ++++ src/r_defs.h | 54 +++ src/tables.c | 5 +- src/tables.h | 5 +- 20 files changed, 3450 insertions(+), 129 deletions(-) create mode 100644 src/m_vector.c create mode 100644 src/m_vector.h create mode 100644 src/p_slopes.c create mode 100644 src/p_slopes.h diff --git a/src/Makefile b/src/Makefile index f5d58af3a..3e0ab2f76 100644 --- a/src/Makefile +++ b/src/Makefile @@ -432,6 +432,7 @@ OBJS:=$(i_main_o) \ $(OBJDIR)/m_misc.o \ $(OBJDIR)/m_random.o \ $(OBJDIR)/m_queue.o \ + $(OBJDIR)/m_vector.o \ $(OBJDIR)/info.o \ $(OBJDIR)/p_ceilng.o \ $(OBJDIR)/p_enemy.o \ @@ -450,6 +451,7 @@ OBJS:=$(i_main_o) \ $(OBJDIR)/p_telept.o \ $(OBJDIR)/p_tick.o \ $(OBJDIR)/p_user.o \ + $(OBJDIR)/p_slopes.o \ $(OBJDIR)/tables.o \ $(OBJDIR)/r_bsp.o \ $(OBJDIR)/r_data.o \ diff --git a/src/doomdef.h b/src/doomdef.h index c4896a764..924d09685 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -436,6 +436,14 @@ extern const char *compdate, *comptime, *comprevision; /// Fun experimental slope stuff! //#define SLOPENESS +/// Kalaron/Eternity Engine slope code (SRB2CB ported) +/// Depends on NEED_FIXED_VECTORS? for a few functions. +/// However, uses own vector types for math. +#define ESLOPE + +/// Fixed and float point types +//#define NEED_FIXED_VECTOR + /// Delete file while the game is running. /// \note EXTREMELY buggy, tends to crash game. //#define DELFILE diff --git a/src/m_fixed.h b/src/m_fixed.h index e68de0308..8bf160204 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -357,6 +357,29 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x) return INT32_MAX; } +/*! + \brief convert a fixed_t number into double floating number + */ +#define FIXED_TO_DOUBLE(f) ((double)((f) / FRACUNIT)) + +/*! + \brief convert a double floating number into fixed_t number + */ +#define DOUBLE_TO_FIXED(f) ((fixed_t)((f) * FRACUNIT)) + +/*! + \brief convert a integer into fixed_t number + */ +#define INT_TO_FIXED(x) ((int)((x) * FRACUNIT)) + +/*! + \brief convert a fixed_t number into integer + */ +#define FIXED_TO_INT(x) (((int)(x)) / (FRACUNIT)) + +static inline int DivScale32 (fixed_t a, fixed_t b) { return (fixed_t)(((INT64)a << 32) / b); } + + #ifdef NEED_FIXED_VECTOR typedef struct diff --git a/src/m_vector.c b/src/m_vector.c new file mode 100644 index 000000000..af5189853 --- /dev/null +++ b/src/m_vector.c @@ -0,0 +1,1160 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2004 Stephen McGranahan +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//-------------------------------------------------------------------------- +// +// DESCRIPTION: +// Vectors +// SoM created 05/18/09 +// +//----------------------------------------------------------------------------- + +#include "doomdef.h" +#include "m_vector.h" +#include "r_main.h" +#include "m_fixed.h" +#include "m_misc.h" +#include "tables.h" + +#ifdef ESLOPE + +v3fixed_t *M_LoadVec(v3fixed_t *vec, fixed_t x, fixed_t y, fixed_t z) +{ + vec->x = x; + vec->y = y; + vec->z = z; + return vec; +} + +v3fixed_t *M_CopyVec(v3fixed_t *a_o, const v3fixed_t *a_i) +{ + return M_Memcpy(a_o, a_i, sizeof(v3fixed_t)); +} + +v3float_t *M_LoadVecf(v3float_t *vec, float x, float y, float z) +{ + vec->x = x; + vec->y = y; + vec->z = z; + return vec; +} + +v3float_t *M_CopyVecf(v3float_t *a_o, const v3float_t *a_i) +{ + return M_Memcpy(a_o, a_i, sizeof(v3float_t)); +} + +// +// M_MakeVec3 +// +// Given two points, create a vector between them. +// +v3fixed_t *M_MakeVec3(const v3fixed_t *point1, const v3fixed_t *point2, v3fixed_t *a_o) +{ + a_o->x = point1->x - point2->x; + a_o->y = point1->y - point2->y; + a_o->z = point1->z - point2->z; + return a_o; +} + + +// +// M_MakeVec3f +// +// Given two points, create a vector between them. +// +v3float_t *M_MakeVec3f(const v3float_t *point1, const v3float_t *point2, v3float_t *a_o) +{ + a_o->x = point1->x - point2->x; + a_o->y = point1->y - point2->y; + a_o->z = point1->z - point2->z; + return a_o; +} + +// +// M_TranslateVec3 +// +// Translates the given vector (in the game's coordinate system) to the camera +// space (in right-handed coordinate system) This function is used for slopes. +// +void M_TranslateVec3(v3fixed_t *vec) +{ + fixed_t tx, ty, tz; + + tx = vec->x - viewx; + ty = viewz - vec->y; + tz = vec->z - viewy; + + // Just like wall projection. + vec->x = (tx * viewcos) - (tz * viewsin); + vec->z = (tz * viewcos) + (tx * viewsin); + vec->y = ty; +} + +// +// M_TranslateVec3f +// +// Translates the given vector (in the game's coordinate system) to the camera +// space (in right-handed coordinate system) This function is used for slopes. +// +void M_TranslateVec3f(v3float_t *vec) +{ + float tx, ty, tz; + + tx = vec->x - viewx; // SRB2CBTODO: This may need float viewxyz + ty = viewz - vec->y; + tz = vec->z - viewy; + + // Just like wall projection. + vec->x = (tx * viewcos) - (tz * viewsin); + vec->z = (tz * viewcos) + (tx * viewsin); + vec->y = ty; +} + +#ifdef SESLOPE +// +// M_TranslateVec3d +// +// Translates the given vector (in the game's coordinate system) to the camera +// space (in right-handed coordinate system) This function is used for slopes. +// +void M_TranslateVec3d(v3double_t *vec) +{ + double tx, ty, tz; + + tx = vec->x - viewx; // SRB2CBTODO: This may need float viewxyz + ty = viewz - vec->y; + tz = vec->z - viewy; + + // Just like wall projection. + vec->x = (tx * viewcos) - (tz * viewsin); + vec->z = (tz * viewcos) + (tx * viewsin); + vec->y = ty; +} +#endif + +// +// M_AddVec3 +// +// Adds v2 to v1 stores in dest +// +void M_AddVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) +{ + dest->x = v1->x + v2->x; + dest->y = v1->y + v2->y; + dest->z = v1->z + v2->z; +} + +// +// M_AddVec3f +// +// Adds v2 to v1 stores in dest +// +void M_AddVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) +{ + dest->x = v1->x + v2->x; + dest->y = v1->y + v2->y; + dest->z = v1->z + v2->z; +} + +// +// M_SubVec3 +// +// Adds v2 to v1 stores in dest +// +void M_SubVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) // SRB2CBTODO: Make a function that allows the destxyz to equal the change of 2 args +{ + dest->x = v1->x - v2->x; + dest->y = v1->y - v2->y; + dest->z = v1->z - v2->z; +} + +// +// M_SubVec3f +// +// Subtracts v2 from v1 stores in dest +// +void M_SubVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) +{ + dest->x = v1->x - v2->x; + dest->y = v1->y - v2->y; + dest->z = v1->z - v2->z; +} + +// +// M_DotVec3 +// +// Returns the dot product of v1 and v2 +// +fixed_t M_DotVec3(const v3fixed_t *v1, const v3fixed_t *v2) +{ + return FixedMul(v1->x, v2->x) + FixedMul(v1->y, v2->y) + FixedMul(v1->z, v2->z); +} + +// +// M_DotVec3f +// +// Returns the dot product of v1 and v2 +// +float M_DotVec3f(const v3float_t *v1, const v3float_t *v2) +{ + if (!v1 || !v2) + I_Error("M_DotVec3f: No vertexes!"); + if (!(v1 || v2 || v1->x || v1->y || v1->z || v2->x || v2->y || v2->z)) + I_Error("M_DotVec3f: No vertexes!"); + return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); +} + +#ifdef SESLOPE +// +// M_DotVec3d +// +// Returns the dot product of v1 and v2 +// +double M_DotVec3d(const v3double_t *v1, const v3double_t *v2) +{ + return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); +} +#endif + +// +// M_CrossProduct3 +// +// Gets the cross product of v1 and v2 and stores in dest +// +void M_CrossProduct3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) +{ + v3fixed_t tmp; + tmp.x = (v1->y * v2->z) - (v1->z * v2->y); + tmp.y = (v1->z * v2->x) - (v1->x * v2->z); + tmp.z = (v1->x * v2->y) - (v1->y * v2->x); + memcpy(dest, &tmp, sizeof(v3fixed_t)); +} + +// +// M_CrossProduct3f +// +// Gets the cross product of v1 and v2 and stores in dest +// +void M_CrossProduct3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) +{ + v3float_t tmp; + tmp.x = (v1->y * v2->z) - (v1->z * v2->y); + tmp.y = (v1->z * v2->x) - (v1->x * v2->z); + tmp.z = (v1->x * v2->y) - (v1->y * v2->x); + memcpy(dest, &tmp, sizeof(v3float_t)); +} + +fixed_t FV_Magnitude(const v3fixed_t *a_normal) +{ + fixed_t xs = FixedMul(a_normal->x,a_normal->x); + fixed_t ys = FixedMul(a_normal->y,a_normal->y); + fixed_t zs = FixedMul(a_normal->z,a_normal->z); + return FixedSqrt(xs+ys+zs); +} + +float FV_Magnitudef(const v3float_t *a_normal) +{ + float xs = (a_normal->x * a_normal->x); + float ys = (a_normal->y * a_normal->y); + float zs = (a_normal->z * a_normal->z); + return (float)sqrt(xs+ys+zs); +} + +// Vector Complex Math +v3fixed_t *FV_Midpoint(const v3fixed_t *a_1, const v3fixed_t *a_2, v3fixed_t *a_o) +{ + a_o->x = FixedDiv(a_2->x - a_1->x, 2*FRACUNIT); + a_o->y = FixedDiv(a_2->y - a_1->y, 2*FRACUNIT); + a_o->z = FixedDiv(a_2->z - a_1->z, 2*FRACUNIT); + a_o->x = a_1->x + a_o->x; + a_o->y = a_1->y + a_o->y; + a_o->z = a_1->z + a_o->z; + return a_o; +} + +fixed_t FV_Distance(const v3fixed_t *p1, const v3fixed_t *p2) +{ + fixed_t xs = FixedMul(p2->x-p1->x,p2->x-p1->x); + fixed_t ys = FixedMul(p2->y-p1->y,p2->y-p1->y); + fixed_t zs = FixedMul(p2->z-p1->z,p2->z-p1->z); + return FixedSqrt(xs+ys+zs); +} + +v3float_t *FV_Midpointf(const v3float_t *a_1, const v3float_t *a_2, v3float_t *a_o) +{ + a_o->x = (a_2->x - a_1->x / 2.0f); + a_o->y = (a_2->y - a_1->y / 2.0f); + a_o->z = (a_2->z - a_1->z / 2.0f); + a_o->x = a_1->x + a_o->x; + a_o->y = a_1->y + a_o->y; + a_o->z = a_1->z + a_o->z; + return a_o; +} + + + +// +// AngleBetweenVectors +// +// This checks to see if a point is inside the ranges of a polygon +// +angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector2) +{ + // Remember, above we said that the Dot Product of returns the cosine of the angle + // between 2 vectors? Well, that is assuming they are unit vectors (normalize vectors). + // So, if we don't have a unit vector, then instead of just saying arcCos(DotProduct(A, B)) + // We need to divide the dot product by the magnitude of the 2 vectors multiplied by each other. + // Here is the equation: arc cosine of (V . W / || V || * || W || ) + // the || V || means the magnitude of V. This then cancels out the magnitudes dot product magnitudes. + // But basically, if you have normalize vectors already, you can forget about the magnitude part. + + // Get the dot product of the vectors + fixed_t dotProduct = M_DotVec3(Vector1, Vector2); + + // Get the product of both of the vectors magnitudes + fixed_t vectorsMagnitude = FixedMul(FV_Magnitude(Vector1), FV_Magnitude(Vector2)); + + // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. + return FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); +} + +float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2) +{ + // Remember, above we said that the Dot Product of returns the cosine of the angle + // between 2 vectors? Well, that is assuming they are unit vectors (normalize vectors). + // So, if we don't have a unit vector, then instead of just saying arcCos(DotProduct(A, B)) + // We need to divide the dot product by the magnitude of the 2 vectors multiplied by each other. + // Here is the equation: arc cosine of (V . W / || V || * || W || ) + // the || V || means the magnitude of V. This then cancels out the magnitudes dot product magnitudes. + // But basically, if you have normalize vectors already, you can forget about the magnitude part. + + // Get the dot product of the vectors + float dotProduct = M_DotVec3f(Vector1, Vector2); + + // Get the product of both of the vectors magnitudes + float vectorsMagnitude = FV_Magnitudef(Vector1)*FV_Magnitudef(Vector2); + + // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. + return acos(dotProduct/vectorsMagnitude); +} + + + +// Crazy physics code + +float M_VectorYaw(v3float_t v) +{ + return atan2(v.x, v.z); +} +float M_VectorPitch(v3float_t v) +{ + return -atan2(v.y, sqrt(v.x*v.x+v.z*v.z)); +} + +#include "z_zone.h" + +// Returns pitch roll and yaw values, allows objects to align to a slope +angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byte AngleAxis, float Rate) +{ + CONS_Printf("P %f\n", Pitch); + CONS_Printf("R %f\n", Roll); + CONS_Printf("Y %f\n", Yaw); + if (AngleAxis == 1) + { + float DestYaw = (atan2(v.z,v.x)* 180 / M_PI); + float DestRoll = (atan2(v.y,v.x)* 180 / M_PI); + + Yaw = Yaw+(DestYaw-Yaw)*Rate; + Roll = Roll+(DestRoll-Roll)*Rate; + } + else if (AngleAxis == 2) + { + float DestPitch = (atan2(v.z,v.y)* 180 / M_PI); + float DestRoll = (-atan2(v.x,v.y)* 180 / M_PI); + + Pitch = Pitch+(DestPitch-Pitch)*Rate; + Roll = Roll+(DestRoll-Roll)*Rate; + } + else if (AngleAxis == 3) + { + float DestPitch = (-atan2(v.y,v.z)* 180 / M_PI); + float DestYaw = (-atan2(v.x,v.z)* 180 / M_PI); + + Pitch = Pitch+(DestPitch-Pitch)*Rate; + Yaw = Yaw+(DestYaw-Yaw)*Rate; + } + + angles3d_t *returnangles = Z_Malloc(sizeof(angles3d_t), PU_LEVEL, NULL); + memset(returnangles, 0, sizeof(*returnangles)); + returnangles->yaw = Yaw; + returnangles->pitch = Pitch; + returnangles->roll = Roll; + + return returnangles; + +} + + + + + +#if 0 // Backport +v3fixed_t *FV_SubO(const v3fixed_t *a_i, const v3fixed_t *a_c, v3fixed_t *a_o) +{ + a_o->x = a_i->x - a_c->x; + a_o->y = a_i->y - a_c->y; + a_o->z = a_i->z - a_c->z; + return a_o; +} + +boolean FV_Equal(const v3fixed_t *a_1, const v3fixed_t *a_2) +{ + fixed_t Epsilon = FRACUNIT/FRACUNIT; + + if ((abs(a_2->x - a_1->x) > Epsilon) || + (abs(a_2->y - a_1->y) > Epsilon) || + (abs(a_2->z - a_1->z) > Epsilon)) + { + return true; + } + + return false; +} + +boolean FV_Equalf(const v3float_t *a_1, const v3float_t *a_2) +{ + float Epsilon = 1.0f/1.0f; + + if ((abs(a_2->x - a_1->x) > Epsilon) || + (abs(a_2->y - a_1->y) > Epsilon) || + (abs(a_2->z - a_1->z) > Epsilon)) + { + return true; + } + + return false; +} + +// +// Normal +// +// Calculates the normal of a polygon. +// +void FV_Normal (const v3fixed_t *a_triangle, v3fixed_t *a_normal) +{ + v3fixed_t a_1; + v3fixed_t a_2; + + FV_Point2Vec(&a_triangle[2], &a_triangle[0], &a_1); + FV_Point2Vec(&a_triangle[1], &a_triangle[0], &a_2); + + FV_Cross(&a_1, &a_2, a_normal); + + FV_NormalizeO(a_normal, a_normal); +} + +// +// PlaneDistance +// +// Calculates distance between a plane and the origin. +// +fixed_t FV_PlaneDistance(const v3fixed_t *a_normal, const v3fixed_t *a_point) +{ + return -(FixedMul(a_normal->x, a_point->x) + FixedMul(a_normal->y, a_point->y) + FixedMul(a_normal->z, a_point->z)); +} + +boolean FV_IntersectedPlane(const v3fixed_t *a_triangle, const v3fixed_t *a_line, v3fixed_t *a_normal, fixed_t *originDistance) +{ + fixed_t distance1 = 0, distance2 = 0; + + FV_Normal(a_triangle, a_normal); + + *originDistance = FV_PlaneDistance(a_normal, &a_triangle[0]); + + distance1 = (FixedMul(a_normal->x, a_line[0].x) + FixedMul(a_normal->y, a_line[0].y) + + FixedMul(a_normal->z, a_line[0].z)) + *originDistance; + + distance2 = (FixedMul(a_normal->x, a_line[1].x) + FixedMul(a_normal->y, a_line[1].y) + + FixedMul(a_normal->z, a_line[1].z)) + *originDistance; + + // Positive or zero number means no intersection + if (FixedMul(distance1, distance2) >= 0) + return false; + + return true; +} + +// +// PlaneIntersection +// +// Returns the distance from +// rOrigin to where the ray +// intersects the plane. Assumes +// you already know it intersects +// the plane. +// +fixed_t FV_PlaneIntersection(const v3fixed_t *pOrigin, const v3fixed_t *pNormal, const v3fixed_t *rOrigin, const v3fixed_t *rVector) +{ + fixed_t d = -(FV_Dot(pNormal, pOrigin)); + fixed_t number = FV_Dot(pNormal,rOrigin) + d; + fixed_t denom = FV_Dot(pNormal,rVector); + return -FixedDiv(number, denom); +} + +// +// IntersectRaySphere +// Input : rO - origin of ray in world space +// rV - vector describing direction of ray in world space +// sO - Origin of sphere +// sR - radius of sphere +// Notes : Normalized directional vectors expected +// Return: distance to sphere in world units, -1 if no intersection. +// +fixed_t FV_IntersectRaySphere(const v3fixed_t *rO, const v3fixed_t *rV, const v3fixed_t *sO, fixed_t sR) +{ + v3fixed_t Q; + fixed_t c, v, d; + FV_SubO(sO, rO, &Q); + + c = FV_Magnitude(&Q); + v = FV_Dot(&Q, rV); + d = FixedMul(sR, sR) - (FixedMul(c,c) - FixedMul(v,v)); + + // If there was no intersection, return -1 + if (d < 0*FRACUNIT) + return (-1*FRACUNIT); + + // Return the distance to the [first] intersecting point + return (v - FixedSqrt(d)); +} + +// +// IntersectionPoint +// +// This returns the intersection point of the line that intersects the plane +// +v3fixed_t *FV_IntersectionPoint(const v3fixed_t *vNormal, const v3fixed_t *vLine, fixed_t distance, v3fixed_t *ReturnVec) +{ + v3fixed_t vLineDir; // Variables to hold the point and the line's direction + fixed_t Numerator = 0, Denominator = 0, dist = 0; + + // Here comes the confusing part. We need to find the 3D point that is actually + // on the plane. Here are some steps to do that: + + // 1) First we need to get the vector of our line, Then normalize it so it's a length of 1 + FV_Point2Vec(&vLine[1], &vLine[0], &vLineDir); // Get the Vector of the line + FV_NormalizeO(&vLineDir, &vLineDir); // Normalize the lines vector + + + // 2) Use the plane equation (distance = Ax + By + Cz + D) to find the distance from one of our points to the plane. + // Here I just chose a arbitrary point as the point to find that distance. You notice we negate that + // distance. We negate the distance because we want to eventually go BACKWARDS from our point to the plane. + // By doing this is will basically bring us back to the plane to find our intersection point. + Numerator = - (FixedMul(vNormal->x, vLine[0].x) + // Use the plane equation with the normal and the line + FixedMul(vNormal->y, vLine[0].y) + + FixedMul(vNormal->z, vLine[0].z) + distance); + + // 3) If we take the dot product between our line vector and the normal of the polygon, + // this will give us the cosine of the angle between the 2 (since they are both normalized - length 1). + // We will then divide our Numerator by this value to find the offset towards the plane from our arbitrary point. + Denominator = FV_Dot(vNormal, &vLineDir); // Get the dot product of the line's vector and the normal of the plane + + // Since we are using division, we need to make sure we don't get a divide by zero error + // If we do get a 0, that means that there are INFINITE points because the the line is + // on the plane (the normal is perpendicular to the line - (Normal.Vector = 0)). + // In this case, we should just return any point on the line. + + if( Denominator == 0*FRACUNIT) // Check so we don't divide by zero + { + ReturnVec->x = vLine[0].x; + ReturnVec->y = vLine[0].y; + ReturnVec->z = vLine[0].z; + return ReturnVec; // Return an arbitrary point on the line + } + + // We divide the (distance from the point to the plane) by (the dot product) + // to get the distance (dist) that we need to move from our arbitrary point. We need + // to then times this distance (dist) by our line's vector (direction). When you times + // a scalar (single number) by a vector you move along that vector. That is what we are + // doing. We are moving from our arbitrary point we chose from the line BACK to the plane + // along the lines vector. It seems logical to just get the numerator, which is the distance + // from the point to the line, and then just move back that much along the line's vector. + // Well, the distance from the plane means the SHORTEST distance. What about in the case that + // the line is almost parallel with the polygon, but doesn't actually intersect it until half + // way down the line's length. The distance from the plane is short, but the distance from + // the actual intersection point is pretty long. If we divide the distance by the dot product + // of our line vector and the normal of the plane, we get the correct length. Cool huh? + + dist = FixedDiv(Numerator, Denominator); // Divide to get the multiplying (percentage) factor + + // Now, like we said above, we times the dist by the vector, then add our arbitrary point. + // This essentially moves the point along the vector to a certain distance. This now gives + // us the intersection point. Yay! + + // Return the intersection point + ReturnVec->x = vLine[0].x + FixedMul(vLineDir.x, dist); + ReturnVec->y = vLine[0].y + FixedMul(vLineDir.y, dist); + ReturnVec->z = vLine[0].z + FixedMul(vLineDir.z, dist); + return ReturnVec; +} + +// +// PointOnLineSide +// +// If on the front side of the line, returns 1. +// If on the back side of the line, returns 0. +// 2D only. +// +unsigned int FV_PointOnLineSide(const v3fixed_t *point, const v3fixed_t *line) +{ + fixed_t s1 = FixedMul((point->y - line[0].y),(line[1].x - line[0].x)); + fixed_t s2 = FixedMul((point->x - line[0].x),(line[1].y - line[0].y)); + return s1 - s2 < 0; +} + +// +// PointInsideBox +// +// Given four points of a box, +// determines if the supplied point is +// inside the box or not. +// +boolean FV_PointInsideBox(const v3fixed_t *point, const v3fixed_t *box) +{ + v3fixed_t lastLine[2]; + + FV_Load(&lastLine[0], box[3].x, box[3].y, box[3].z); + FV_Load(&lastLine[1], box[0].x, box[0].y, box[0].z); + + if (FV_PointOnLineSide(point, &box[0]) + || FV_PointOnLineSide(point, &box[1]) + || FV_PointOnLineSide(point, &box[2]) + || FV_PointOnLineSide(point, lastLine)) + return false; + + return true; +} +// +// LoadIdentity +// +// Loads the identity matrix into a matrix +// +void FM_LoadIdentity(fmatrix_t* matrix) +{ +#define M(row,col) matrix->m[col * 4 + row] + memset(matrix, 0x00, sizeof(fmatrix_t)); + + M(0, 0) = FRACUNIT; + M(1, 1) = FRACUNIT; + M(2, 2) = FRACUNIT; + M(3, 3) = FRACUNIT; +#undef M +} + +// +// CreateObjectMatrix +// +// Creates a matrix that can be used for +// adjusting the position of an object +// +void FM_CreateObjectMatrix(fmatrix_t *matrix, fixed_t x, fixed_t y, fixed_t z, fixed_t anglex, fixed_t angley, fixed_t anglez, fixed_t upx, fixed_t upy, fixed_t upz, fixed_t radius) +{ + v3fixed_t upcross; + v3fixed_t upvec; + v3fixed_t basevec; + + FV_Load(&upvec, upx, upy, upz); + FV_Load(&basevec, anglex, angley, anglez); + FV_Cross(&upvec, &basevec, &upcross); + FV_Normalize(&upcross); + + FM_LoadIdentity(matrix); + + matrix->m[0] = upcross.x; + matrix->m[1] = upcross.y; + matrix->m[2] = upcross.z; + matrix->m[3] = 0*FRACUNIT; + + matrix->m[4] = upx; + matrix->m[5] = upy; + matrix->m[6] = upz; + matrix->m[7] = 0; + + matrix->m[8] = anglex; + matrix->m[9] = angley; + matrix->m[10] = anglez; + matrix->m[11] = 0; + + matrix->m[12] = x - FixedMul(upx,radius); + matrix->m[13] = y - FixedMul(upy,radius); + matrix->m[14] = z - FixedMul(upz,radius); + matrix->m[15] = FRACUNIT; +} + +// +// MultMatrixVec +// +// Multiplies a vector by the specified matrix +// +void FM_MultMatrixVec(const fmatrix_t *matrix, const v3fixed_t *vec, v3fixed_t *out) +{ +#define M(row,col) matrix->m[col * 4 + row] + out->x = FixedMul(vec->x,M(0, 0)) + + FixedMul(vec->y,M(0, 1)) + + FixedMul(vec->z,M(0, 2)) + + M(0, 3); + + out->y = FixedMul(vec->x,M(1, 0)) + + FixedMul(vec->y,M(1, 1)) + + FixedMul(vec->z,M(1, 2)) + + M(1, 3); + + out->z = FixedMul(vec->x,M(2, 0)) + + FixedMul(vec->y,M(2, 1)) + + FixedMul(vec->z,M(2, 2)) + + M(2, 3); +#undef M +} + +// +// MultMatrix +// +// Multiples one matrix into another +// +void FM_MultMatrix(fmatrix_t *dest, const fmatrix_t *multme) +{ + fmatrix_t result; + unsigned int i, j; +#define M(row,col) multme->m[col * 4 + row] +#define D(row,col) dest->m[col * 4 + row] +#define R(row,col) result.m[col * 4 + row] + + for (i = 0; i < 4; i++) + { + for (j = 0; j < 4; j++) + R(i, j) = FixedMul(D(i, 0),M(0, j)) + FixedMul(D(i, 1),M(1, j)) + FixedMul(D(i, 2),M(2, j)) + FixedMul(D(i, 3),M(3, j)); + } + + M_Memcpy(dest, &result, sizeof(fmatrix_t)); + +#undef R +#undef D +#undef M +} + +// +// Translate +// +// Translates a matrix +// +void FM_Translate(fmatrix_t *dest, fixed_t x, fixed_t y, fixed_t z) +{ + fmatrix_t trans; +#define M(row,col) trans.m[col * 4 + row] + + memset(&trans, 0x00, sizeof(fmatrix_t)); + + M(0, 0) = M(1, 1) = M(2, 2) = M(3, 3) = FRACUNIT; + M(0, 3) = x; + M(1, 3) = y; + M(2, 3) = z; + + FM_MultMatrix(dest, &trans); +#undef M +} + +// +// Scale +// +// Scales a matrix +// +void FM_Scale(fmatrix_t *dest, fixed_t x, fixed_t y, fixed_t z) +{ + fmatrix_t scale; +#define M(row,col) scale.m[col * 4 + row] + + memset(&scale, 0x00, sizeof(fmatrix_t)); + + M(3, 3) = FRACUNIT; + M(0, 0) = x; + M(1, 1) = y; + M(2, 2) = z; + + FM_MultMatrix(dest, &scale); +#undef M +} + + +v3fixed_t *FV_Cross(const v3fixed_t *a_1, const v3fixed_t *a_2, v3fixed_t *a_o) +{ + a_o->x = FixedMul(a_1->y, a_2->z) - FixedMul(a_1->z, a_2->y); + a_o->y = FixedMul(a_1->z, a_2->x) - FixedMul(a_1->x, a_2->z); + a_o->z = FixedMul(a_1->x, a_2->y) - FixedMul(a_1->y, a_2->x); + return a_o; +} + +// +// ClosestPointOnLine +// +// Finds the point on a line closest +// to the specified point. +// +v3fixed_t *FV_ClosestPointOnLine(const v3fixed_t *Line, const v3fixed_t *p, v3fixed_t *out) +{ + // Determine t (the length of the vector from √´Line[0]√≠ to √´p√≠) + v3fixed_t c, V; + fixed_t t, d = 0; + FV_SubO(p, &Line[0], &c); + FV_SubO(&Line[1], &Line[0], &V); + FV_NormalizeO(&V, &V); + + d = FV_Distance(&Line[0], &Line[1]); + t = FV_Dot(&V, &c); + + // Check to see if √´t√≠ is beyond the extents of the line segment + if (t < 0) + { + return FV_Copy(out, &Line[0]); + } + if (t > d) + { + return FV_Copy(out, &Line[1]); + } + + // Return the point between √´Line[0]√≠ and √´Line[1]√≠ + FV_Mul(&V, t); + + return FV_AddO(&Line[0], &V, out); +} + +// +// ClosestPointOnTriangle +// +// Given a triangle and a point, +// the closest point on the edge of +// the triangle is returned. +// +void FV_ClosestPointOnTriangle (const v3fixed_t *tri, const v3fixed_t *point, v3fixed_t *result) +{ + unsigned int i; + fixed_t dist, closestdist; + v3fixed_t EdgePoints[3]; + v3fixed_t Line[2]; + + FV_Copy(&Line[0], (v3fixed_t*)&tri[0]); + FV_Copy(&Line[1], (v3fixed_t*)&tri[1]); + FV_ClosestPointOnLine(Line, point, &EdgePoints[0]); + + FV_Copy(&Line[0], (v3fixed_t*)&tri[1]); + FV_Copy(&Line[1], (v3fixed_t*)&tri[2]); + FV_ClosestPointOnLine(Line, point, &EdgePoints[1]); + + FV_Copy(&Line[0], (v3fixed_t*)&tri[2]); + FV_Copy(&Line[1], (v3fixed_t*)&tri[0]); + FV_ClosestPointOnLine(Line, point, &EdgePoints[2]); + + // Find the closest one of the three + FV_Copy(result, &EdgePoints[0]); + closestdist = FV_Distance(point, &EdgePoints[0]); + for (i = 1; i < 3; i++) + { + dist = FV_Distance(point, &EdgePoints[i]); + + if (dist < closestdist) + { + closestdist = dist; + FV_Copy(result, &EdgePoints[i]); + } + } + + // We now have the closest point! Whee! +} + +// +// InsidePolygon +// +// This checks to see if a point is inside the ranges of a polygon +// +boolean FV_InsidePolygon(const fvector_t *vIntersection, const fvector_t *Poly, const int vertexCount) +{ + int i; + UINT64 Angle = 0; // Initialize the angle + fvector_t vA, vB; // Create temp vectors + + // Just because we intersected the plane, doesn't mean we were anywhere near the polygon. + // This functions checks our intersection point to make sure it is inside of the polygon. + // This is another tough function to grasp at first, but let me try and explain. + // It's a brilliant method really, what it does is create triangles within the polygon + // from the intersection point. It then adds up the inner angle of each of those triangles. + // If the angles together add up to 360 degrees (or 2 * PI in radians) then we are inside! + // If the angle is under that value, we must be outside of polygon. To further + // understand why this works, take a pencil and draw a perfect triangle. Draw a dot in + // the middle of the triangle. Now, from that dot, draw a line to each of the vertices. + // Now, we have 3 triangles within that triangle right? Now, we know that if we add up + // all of the angles in a triangle we get 360 right? Well, that is kinda what we are doing, + // but the inverse of that. Say your triangle is an isosceles triangle, so add up the angles + // and you will get 360 degree angles. 90 + 90 + 90 is 360. + + for (i = 0; i < vertexCount; i++) // Go in a circle to each vertex and get the angle between + { + FV_Point2Vec(&Poly[i], vIntersection, &vA); // Subtract the intersection point from the current vertex + // Subtract the point from the next vertex + FV_Point2Vec(&Poly[(i + 1) % vertexCount], vIntersection, &vB); + + Angle += FV_AngleBetweenVectors(&vA, &vB); // Find the angle between the 2 vectors and add them all up as we go along + } + + // Now that we have the total angles added up, we need to check if they add up to 360 degrees. + // Since we are using the dot product, we are working in radians, so we check if the angles + // equals 2*PI. We defined PI in 3DMath.h. You will notice that we use a MATCH_FACTOR + // in conjunction with our desired degree. This is because of the inaccuracy when working + // with floating point numbers. It usually won't always be perfectly 2 * PI, so we need + // to use a little twiddling. I use .9999, but you can change this to fit your own desired accuracy. + + if(Angle >= ANGLE_MAX) // If the angle is greater than 2 PI, (360 degrees) + return 1; // The point is inside of the polygon + + return 0; // If you get here, it obviously wasn't inside the polygon. +} + +// +// IntersectedPolygon +// +// This checks if a line is intersecting a polygon +// +boolean FV_IntersectedPolygon(const fvector_t *vPoly, const fvector_t *vLine, const int vertexCount, fvector_t *collisionPoint) +{ + fvector_t vNormal, vIntersection; + fixed_t originDistance = 0*FRACUNIT; + + + // First we check to see if our line intersected the plane. If this isn't true + // there is no need to go on, so return false immediately. + // We pass in address of vNormal and originDistance so we only calculate it once + + if(!FV_IntersectedPlane(vPoly, vLine, &vNormal, &originDistance)) + return false; + + // Now that we have our normal and distance passed back from IntersectedPlane(), + // we can use it to calculate the intersection point. The intersection point + // is the point that actually is ON the plane. It is between the line. We need + // this point test next, if we are inside the polygon. To get the I-Point, we + // give our function the normal of the plane, the points of the line, and the originDistance. + + FV_IntersectionPoint(&vNormal, vLine, originDistance, &vIntersection); + + // Now that we have the intersection point, we need to test if it's inside the polygon. + // To do this, we pass in : + // (our intersection point, the polygon, and the number of vertices our polygon has) + + if(FV_InsidePolygon(&vIntersection, vPoly, vertexCount)) + { + if (collisionPoint != NULL) // Optional - load the collision point. + { + collisionPoint->x = vIntersection.x; + collisionPoint->y = vIntersection.y; + collisionPoint->z = vIntersection.z; + } + return true; // We collided! + } + + // If we get here, we must have NOT collided + return false; +} + +// +// RotateVector +// +// Rotates a vector around another vector +// +void FV_Rotate(fvector_t *rotVec, const fvector_t *axisVec, const angle_t angle) +{ + // Rotate the point (x,y,z) around the vector (u,v,w) + fixed_t ux = FixedMul(axisVec->x, rotVec->x); + fixed_t uy = FixedMul(axisVec->x, rotVec->y); + fixed_t uz = FixedMul(axisVec->x, rotVec->z); + fixed_t vx = FixedMul(axisVec->y, rotVec->x); + fixed_t vy = FixedMul(axisVec->y, rotVec->y); + fixed_t vz = FixedMul(axisVec->y, rotVec->z); + fixed_t wx = FixedMul(axisVec->z, rotVec->x); + fixed_t wy = FixedMul(axisVec->z, rotVec->y); + fixed_t wz = FixedMul(axisVec->z, rotVec->z); + fixed_t sa = FINESINE(angle); + fixed_t ca = FINECOSINE(angle); + fixed_t ua = ux+vy+wz; + fixed_t ax = FixedMul(axisVec->x,ua); + fixed_t ay = FixedMul(axisVec->y,ua); + fixed_t az = FixedMul(axisVec->z,ua); + fixed_t xs = FixedMul(axisVec->x,axisVec->x); + fixed_t ys = FixedMul(axisVec->y,axisVec->y); + fixed_t zs = FixedMul(axisVec->z,axisVec->z); + fixed_t bx = FixedMul(rotVec->x,ys+zs); + fixed_t by = FixedMul(rotVec->y,xs+zs); + fixed_t bz = FixedMul(rotVec->z,xs+ys); + fixed_t cx = FixedMul(axisVec->x,vy+wz); + fixed_t cy = FixedMul(axisVec->y,ux+wz); + fixed_t cz = FixedMul(axisVec->z,ux+vy); + fixed_t dx = FixedMul(bx-cx, ca); + fixed_t dy = FixedMul(by-cy, ca); + fixed_t dz = FixedMul(bz-cz, ca); + fixed_t ex = FixedMul(vz-wy, sa); + fixed_t ey = FixedMul(wx-uz, sa); + fixed_t ez = FixedMul(uy-vx, sa); + + rotVec->x = ax+dx+ex; + rotVec->y = ay+dy+ey; + rotVec->z = az+dz+ez; +} + +void FM_Rotate(fmatrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z) +{ +#define M(row,col) dest->m[row * 4 + col] + const fixed_t sinA = FINESINE(angle>>ANGLETOFINESHIFT); + const fixed_t cosA = FINECOSINE(angle>>ANGLETOFINESHIFT); + const fixed_t invCosA = FRACUNIT - cosA; + fvector_t nrm = {x, y, z}; + fixed_t xSq, ySq, zSq; + fixed_t sx, sy, sz; + fixed_t sxy, sxz, syz; + + FV_Normalize(&nrm); + + x = nrm.x; + y = nrm.y; + z = nrm.z; + + xSq = FixedMul(x, FixedMul(invCosA,x)); + ySq = FixedMul(y, FixedMul(invCosA,y)); + zSq = FixedMul(z, FixedMul(invCosA,z)); + + sx = FixedMul(sinA, x); + sy = FixedMul(sinA, y); + sz = FixedMul(sinA, z); + + sxy = FixedMul(x, FixedMul(invCosA,y)); + sxz = FixedMul(x, FixedMul(invCosA,z)); + syz = FixedMul(y, FixedMul(invCosA,z)); + + + M(0, 0) = xSq + cosA; + M(1, 0) = sxy - sz; + M(2, 0) = sxz + sy; + M(3, 0) = 0; + + M(0, 1) = sxy + sz; + M(1, 1) = ySq + cosA; + M(2, 1) = syz - sx; + M(3, 1) = 0; + + M(0, 2) = sxz - sy; + M(1, 2) = syz + sx; + M(2, 2) = zSq + cosA; + M(3, 2) = 0; + + M(0, 3) = 0; + M(1, 3) = 0; + M(2, 3) = 0; + M(3, 3) = FRACUNIT; +#undef M +} + +#endif + + + + +float FV_Distancef(const v3float_t *p1, const v3float_t *p2) +{ + float xs = (p2->x-p1->x * p2->x-p1->x); + float ys = (p2->y-p1->y * p2->y-p1->y); + float zs = (p2->z-p1->z * p2->z-p1->z); + return sqrt(xs+ys+zs); +} + +// Also returns the magnitude +fixed_t FV_NormalizeO(const v3fixed_t *a_normal, v3fixed_t *a_o) +{ + fixed_t magnitude = FV_Magnitude(a_normal); + a_o->x = FixedDiv(a_normal->x, magnitude); + a_o->y = FixedDiv(a_normal->y, magnitude); + a_o->z = FixedDiv(a_normal->z, magnitude); + return magnitude; +} + +// Also returns the magnitude +float FV_NormalizeOf(const v3float_t *a_normal, v3float_t *a_o) +{ + float magnitude = FV_Magnitudef(a_normal); + a_o->x = (a_normal->x/magnitude); + a_o->y = (a_normal->y/magnitude); + a_o->z = (a_normal->z/magnitude); + return magnitude; +} + +fixed_t FV_Normalize(v3fixed_t *a_normal) +{ + return FV_NormalizeO(a_normal, a_normal); +} + +fixed_t FV_Normalizef(v3float_t *a_normal) +{ + return FV_NormalizeOf(a_normal, a_normal); +} + +// +// FV_Normalf +// +// Calculates the normal of a polygon. +// +void FV_Normal(const v3fixed_t *a_triangle, v3fixed_t *a_normal) +{ + v3fixed_t a_1; + v3fixed_t a_2; + + M_MakeVec3(&a_triangle[2], &a_triangle[0], &a_1); + M_MakeVec3(&a_triangle[1], &a_triangle[0], &a_2); + + M_CrossProduct3(&a_1, &a_2, a_normal); + + FV_NormalizeO(a_normal, a_normal); +} + +// +// FV_Normalf +// +// Calculates the normal of a polygon. +// +void FV_Normalf(const v3float_t *a_triangle, v3float_t *a_normal) +{ + v3float_t a_1; + v3float_t a_2; + + M_MakeVec3f(&a_triangle[2], &a_triangle[0], &a_1); + M_MakeVec3f(&a_triangle[1], &a_triangle[0], &a_2); + + M_CrossProduct3f(&a_1, &a_2, a_normal); + + FV_NormalizeOf(a_normal, a_normal); +} + + +// EOF +#endif // #ifdef ESLOPE + diff --git a/src/m_vector.h b/src/m_vector.h new file mode 100644 index 000000000..743a26023 --- /dev/null +++ b/src/m_vector.h @@ -0,0 +1,123 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2004 Stephen McGranahan +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//-------------------------------------------------------------------------- +// +// DESCRIPTION: +// Vectors +// SoM created 05/18/09 +// +//----------------------------------------------------------------------------- + +#ifndef M_VECTOR_H__ +#define M_VECTOR_H__ + +#ifdef ESLOPE + +#include "m_fixed.h" +#include "tables.h" + +#define TWOPI M_PI*2.0 +#define HALFPI M_PI*0.5 +#define QUARTERPI M_PI*0.25 +#define EPSILON 0.000001f +#define OMEGA 10000000.0f + +typedef struct +{ + fixed_t x, y, z; +} v3fixed_t; + +typedef struct +{ + fixed_t x, y; +} v2fixed_t; + +typedef struct +{ + float x, y, z; +} v3float_t; + +typedef struct +{ + float yaw, pitch, roll; +} angles3d_t; + +typedef struct +{ + double x, y, z; +} v3double_t; + +typedef struct +{ + float x, y; +} v2float_t; + + +v3fixed_t *M_MakeVec3(const v3fixed_t *point1, const v3fixed_t *point2, v3fixed_t *a_o); +v3float_t *M_MakeVec3f(const v3float_t *point1, const v3float_t *point2, v3float_t *a_o); +void M_TranslateVec3(v3fixed_t *vec); +void M_TranslateVec3f(v3float_t *vec); +void M_AddVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2); +void M_AddVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2); +void M_SubVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2); +void M_SubVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2); +fixed_t M_DotVec3(const v3fixed_t *v1, const v3fixed_t *v2); +float M_DotVec3f(const v3float_t *v1, const v3float_t *v2); + +#ifdef SESLOPE +v3double_t *M_MakeVec3d(const v3double_t *point1, const v3double_t *point2, v3double_t *a_o); +double M_DotVec3d(const v3double_t *v1, const v3double_t *v2); +void M_TranslateVec3d(v3double_t *vec); +#endif + +void M_CrossProduct3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2); +void M_CrossProduct3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2); +fixed_t FV_Magnitude(const v3fixed_t *a_normal); +float FV_Magnitudef(const v3float_t *a_normal); +fixed_t FV_NormalizeO(const v3fixed_t *a_normal, v3fixed_t *a_o); +float FV_NormalizeOf(const v3float_t *a_normal, v3float_t *a_o); +fixed_t FV_Normalize(v3fixed_t *a_normal); +fixed_t FV_Normalizef(v3float_t *a_normal); +void FV_Normal(const v3fixed_t *a_triangle, v3fixed_t *a_normal); +void FV_Normalf(const v3float_t *a_triangle, v3float_t *a_normal); +v3fixed_t *M_LoadVec(v3fixed_t *vec, fixed_t x, fixed_t y, fixed_t z); +v3fixed_t *M_CopyVec(v3fixed_t *a_o, const v3fixed_t *a_i); +v3float_t *M_LoadVecf(v3float_t *vec, float x, float y, float z); +v3float_t *M_CopyVecf(v3float_t *a_o, const v3float_t *a_i); +v3fixed_t *FV_Midpoint(const v3fixed_t *a_1, const v3fixed_t *a_2, v3fixed_t *a_o); +fixed_t FV_Distance(const v3fixed_t *p1, const v3fixed_t *p2); +v3float_t *FV_Midpointf(const v3float_t *a_1, const v3float_t *a_2, v3float_t *a_o); +angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector2); +float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2); +float FV_Distancef(const v3float_t *p1, const v3float_t *p2); + + +// Kalaron: something crazy, vector physics +float M_VectorYaw(v3float_t v); +float M_VectorPitch(v3float_t v); +angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byte AngleAxis, float Rate); + + + +#endif + +// EOF +#endif // #ifdef ESLOPE + diff --git a/src/p_enemy.c b/src/p_enemy.c index 54e151123..61c943d02 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -28,6 +28,10 @@ #include "hardware/hw3sound.h" #endif +#ifdef ESLOPE +#include "p_slopes.h" +#endif + #ifdef HAVE_BLUA boolean LUA_CallAction(const char *action, mobj_t *actor); #endif @@ -5614,8 +5618,17 @@ void A_MixUp(mobj_t *actor) P_SetThingPosition(players[i].mo); +#ifdef ESLOPE + players[i].mo->floorz = (players[i].mo->subsector->sector->f_slope ? + P_GetZAt(players[i].mo->subsector->sector->f_slope, players[i].mo->x, players[i].mo->y) : + players[i].mo->subsector->sector->floorheight); + players[i].mo->ceilingz = (players[i].mo->subsector->sector->c_slope ? + P_GetZAt(players[i].mo->subsector->sector->c_slope, players[i].mo->x, players[i].mo->y) : + players[i].mo->subsector->sector->ceilingheight); +#else players[i].mo->floorz = players[i].mo->subsector->sector->floorheight; players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight; +#endif P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y); } diff --git a/src/p_floor.c b/src/p_floor.c index f798174ad..65c4821ca 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -19,6 +19,9 @@ #include "z_zone.h" #include "g_game.h" #include "r_main.h" +#ifdef ESLOPE +#include "p_slopes.h" +#endif // ========================================================================== // FLOORS @@ -1174,12 +1177,18 @@ void T_SpikeSector(levelspecthink_t *spikes) if (affectsec == spikes->sector) // Applied to an actual sector { + fixed_t affectpoint = affectsec->floorheight; + +#ifdef ESLOPE + if (affectsec->f_slope) + affectpoint = P_GetZAt(affectsec->f_slope, thing->x, thing->y); +#endif if (affectsec->flags & SF_FLIPSPECIAL_FLOOR) { if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0) continue; - if (thing->z == affectsec->floorheight) + if (thing->z == affectpoint) dothepain = true; } diff --git a/src/p_local.h b/src/p_local.h index 9f8918cd8..9fbab1d85 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -50,6 +50,15 @@ // above this, a height difference is considered as a 'dropoff' #define MAXSTEPMOVE (24*FRACUNIT) +#ifdef ESLOPE +// [RH] Minimum floorplane.c value for walking +// The lower the value, the steeper the slope is +#define SECPLANESTEEPSLOPE 46000 +// ESLOPE stuff - a slope of 4 or lower is so level, treat it as flat +#define LEVELSLOPE 4 +#define STEEPSLOPE 65 +#endif + #define USERANGE (64*FRACUNIT) #define MELEERANGE (64*FRACUNIT) #define MISSILERANGE (32*64*FRACUNIT) @@ -135,6 +144,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec); boolean P_InSpaceSector(mobj_t *mo); boolean P_InQuicksand(mobj_t *mo); +#ifdef ESLOPE +boolean P_IsObjectOnSlope(mobj_t *mo, boolean ceiling); +boolean P_SlopeGreaterThan(mobj_t *mo, boolean ceiling, int value); +boolean P_SlopeLessThan(mobj_t *mo, boolean ceiling, int value); +#endif + void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index 62cbf7b77..f484b6a2e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -27,6 +27,10 @@ #include "r_splats.h" +#ifdef ESLOPE +#include "p_slopes.h" +#endif + #include "z_zone.h" #include "lua_hook.h" @@ -1213,8 +1217,21 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // that contains the point. // Any contacted lines the step closer together // will adjust them. +#ifdef ESLOPE + if (newsubsec->sector->f_slope) + { + tmfloorz = tmdropoffz = P_GetZAt(newsubsec->sector->f_slope, thing->x, thing->y); + } + else +#endif tmfloorz = tmdropoffz = newsubsec->sector->floorheight; - tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight; + +#ifdef ESLOPE + if (newsubsec->sector->c_slope) + tmceilingz = P_GetZAt(newsubsec->sector->c_slope, thing->x, thing->y); + else +#endif + tmceilingz = newsubsec->sector->ceilingheight; // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) @@ -1228,32 +1245,42 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (!(rover->flags & FF_EXISTS)) continue; + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, thing->x, thing->y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y); +#endif*/ + if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY)) { // If you're inside goowater and slowing down fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale); fixed_t minspeed = FixedMul(thing->info->height/12, thing->scale); - if (thing->z < *rover->topheight && *rover->bottomheight < thingtop + if (thing->z < topheight && bottomheight < thingtop && abs(thing->momz) < minspeed) { // Oh no! The object is stick in between the surface of the goo and sinklevel! help them out! - if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z > *rover->topheight - sinklevel + if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z > topheight - sinklevel && thing->momz >= 0 && thing->momz < (minspeed>>2)) thing->momz += minspeed>>2; - else if (thing->eflags & MFE_VERTICALFLIP && thingtop < *rover->bottomheight + sinklevel + else if (thing->eflags & MFE_VERTICALFLIP && thingtop < bottomheight + sinklevel && thing->momz <= 0 && thing->momz > -(minspeed>>2)) thing->momz -= minspeed>>2; // Land on the top or the bottom, depending on gravity flip. - if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z >= *rover->topheight - sinklevel && thing->momz <= 0) + if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z >= topheight - sinklevel && thing->momz <= 0) { - if (tmfloorz < *rover->topheight - sinklevel) - tmfloorz = *rover->topheight - sinklevel; + if (tmfloorz < topheight - sinklevel) + tmfloorz = topheight - sinklevel; } - else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= *rover->bottomheight + sinklevel && thing->momz >= 0) + else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0) { - if (tmceilingz > *rover->bottomheight + sinklevel) - tmceilingz = *rover->bottomheight + sinklevel; + if (tmceilingz > bottomheight + sinklevel) + tmceilingz = bottomheight + sinklevel; } } continue; @@ -1270,7 +1297,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (rover->flags & FF_QUICKSAND) { - if (thing->z < *rover->topheight && *rover->bottomheight < thingtop) + if (thing->z < topheight && bottomheight < thingtop) { if (tmfloorz < thing->z) tmfloorz = thing->z; @@ -1279,21 +1306,21 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) continue; } - delta1 = thing->z - (*rover->bottomheight - + ((*rover->topheight - *rover->bottomheight)/2)); - delta2 = thingtop - (*rover->bottomheight - + ((*rover->topheight - *rover->bottomheight)/2)); + delta1 = thing->z - (bottomheight + + ((topheight - bottomheight)/2)); + delta2 = thingtop - (bottomheight + + ((topheight - bottomheight)/2)); - if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2) + if (topheight > tmfloorz && abs(delta1) < abs(delta2) && !(rover->flags & FF_REVERSEPLATFORM)) { - tmfloorz = tmdropoffz = *rover->topheight; + tmfloorz = tmdropoffz = topheight; } - if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2) + if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2) && !(rover->flags & FF_PLATFORM) && !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))) { - tmceilingz = tmdrpoffceilz = *rover->bottomheight; + tmceilingz = tmdrpoffceilz = bottomheight; } } } @@ -1470,8 +1497,21 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) // that contains the point. // Any contacted lines the step closer together // will adjust them. +#ifdef ESLOPE + if (newsubsec->sector->f_slope) + { + tmfloorz = tmdropoffz = P_GetZAt(newsubsec->sector->f_slope, thiscam->x, thiscam->y); + } + else +#endif tmfloorz = tmdropoffz = newsubsec->sector->floorheight; - tmceilingz = tmdrpoffceilz = newsubsec->sector->ceilingheight; + +#ifdef ESLOPE + if (newsubsec->sector->c_slope) + tmceilingz = P_GetZAt(newsubsec->sector->c_slope, thiscam->x, thiscam->y); + else +#endif + tmceilingz = newsubsec->sector->ceilingheight; // Cameras use the heightsec's heights rather then the actual sector heights. // If you can see through it, why not move the camera through it too? @@ -1500,17 +1540,27 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - delta1 = thiscam->z - (*rover->bottomheight - + ((*rover->topheight - *rover->bottomheight)/2)); - delta2 = thingtop - (*rover->bottomheight - + ((*rover->topheight - *rover->bottomheight)/2)); - if (*rover->topheight > tmfloorz && abs(delta1) < abs(delta2)) + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, thiscam->x, thiscam->y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, thiscam->x, thiscam->y); +#endif*/ + + delta1 = thiscam->z - (bottomheight + + ((topheight - bottomheight)/2)); + delta2 = thingtop - (bottomheight + + ((topheight - bottomheight)/2)); + if (topheight > tmfloorz && abs(delta1) < abs(delta2)) { - tmfloorz = tmdropoffz = *rover->topheight; + tmfloorz = tmdropoffz = topheight; } - if (*rover->bottomheight < tmceilingz && abs(delta1) >= abs(delta2)) + if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)) { - tmceilingz = tmdrpoffceilz = *rover->bottomheight; + tmceilingz = tmdrpoffceilz = bottomheight; } } } @@ -1703,8 +1753,30 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) } else { - tmfloorz = thiscam->subsector->sector->floorheight; - tmceilingz = thiscam->subsector->sector->ceilingheight; +#ifdef ESLOPE // SRB2CBTODO: Checking the things momx/y help with collision issues, but makes going done slopes not as smooth + if (thiscam->subsector->sector && thiscam->subsector->sector->f_slope) + { + // SRB2CBTODO: Support a mobj's gravity for this too + if (P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy) > P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x, thiscam->y)) + thiscam->floorz = P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy); + else + thiscam->floorz = P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x, thiscam->y); + } + else +#endif + tmfloorz = thiscam->subsector->sector->floorheight; +#ifdef ESLOPE + if (thiscam->subsector->sector && thiscam->subsector->sector->c_slope) + { + // SRB2CBTODO: Support a mobj's gravity for this too + if (P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy) < P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x, thiscam->y)) + thiscam->ceilingz = P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x, thiscam->y); + else + thiscam->ceilingz = P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy); + } + else +#endif + tmceilingz = thiscam->subsector->sector->ceilingheight; } // the move is ok, @@ -1966,8 +2038,111 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Link the thing into its new position P_UnsetThingPosition(thing); - thing->floorz = tmfloorz; - thing->ceilingz = tmceilingz; +#ifdef ESLOPE + // By virtue of being derived from SRB2 code, Kalaron's physics are GPL. + if (P_IsObjectOnSlope(thing, false)) + { + fixed_t thingspeed = P_AproxDistance(thing->momx, thing->momy); + fixed_t predictmomx = x+(thing->momx/2); + fixed_t predictmomy = y+(thing->momy/2); + sector_t *nextsector = R_PointInSubsector(predictmomx, predictmomy)->sector; + sector_t *currentsector = R_PointInSubsector(thing->x, thing->y)->sector; + fixed_t zthrust = 0; + fixed_t slopeang = currentsector->f_slope->zangle; + fixed_t nextz = nextsector->floorheight; + if (nextsector->f_slope) + nextz = P_GetZAt(nextsector->f_slope, thing->x+predictmomx+thing->momx, thing->y+predictmomy+thing->momy); + + if (nextsector != currentsector) + { + // Give a boost up from the slope you came if the next sector is lower than the first + // If your next sector does not have a slope and you're comming off of one + if (currentsector->f_slope) + if (P_GetZAt(currentsector->f_slope, thing->x, thing->y)/FRACUNIT > (nextz/FRACUNIT)+(slopeang*3)) + //&& !nextsector->f_slope // TODO: VPHYSICS height check, not this hacky check? Or is this good enough? + if (currentsector->f_slope->zangle > 9) + { + fixed_t currentz = P_GetZAt(currentsector->f_slope, thing->x, thing->y); + fixed_t predictz = P_GetZAt(currentsector->f_slope, thing->x+thing->momx, thing->y+thing->momy); + + predictz += (((thing->pitchangle/(ANGLE_45/45))+90)/70.0f)+thingspeed/9; + + // Make sure that the z doesn't go too high for steep slopes + + predictz -= ((currentsector->f_slope->zangle)/4)*FRACUNIT; + if (currentsector->f_slope->zangle > 60) // really steep + { + predictz -= ((currentsector->f_slope->zangle)/2)*FRACUNIT; + } + + zthrust = (predictz - currentz)/2; + + if (zthrust > (30*thing->scale/100)*FRACUNIT) + zthrust = (30*thing->scale/100)*FRACUNIT; + + if (zthrust < -(30*thing->scale/100)*FRACUNIT) + zthrust = -(30*thing->scale/100)*FRACUNIT; + + if (currentz/FRACUNIT > (nextz/FRACUNIT)+(slopeang*3)) + { + // Now even out the momx/momy when catapulting off a steep slope + if (currentsector->f_slope->zangle > 65) + { + thing->momx /= 4.0f; + thing->momy /= 4.0f; + } + else if (currentsector->f_slope->zangle > 60) + { + thing->momx /= 3.5f; + thing->momy /= 3.5f; + } + else if (currentsector->f_slope->zangle > 50) + { + thing->momx /= 3.4f; + thing->momy /= 3.4f; + } + else if (currentsector->f_slope->zangle > 40) + { + thing->momx /= 3.3f; + thing->momy /= 3.3f; + } + } + + thing->momz += zthrust; // VPHYSICS TODO: Make a real formula for z trajectory going off a slope + /*CONS_Printf("CurZ %i, PredictZ %i\n", currentz/FRACUNIT, predictz/FRACUNIT); + CONS_Printf("Pitch: %i\n", thing->pitchangle/(ANG45/45)+90); + CONS_Printf("ZThrust: %i\n", zthrust/FRACUNIT);*/ + } + } + } +#endif + + // P_CheckPosition sets the tmfloorz with slopes, but after P_UnsetThingPosition, recheck the function here + // TODO: Make a function for floor/ceilingz auto check with slopes? +#ifdef ESLOPE + if (thing->subsector->sector->f_slope) + { + // TODO: Support a mobj's gravity for this too + if (P_GetZAt(thing->subsector->sector->f_slope, thing->x+thing->momx, thing->y+thing->momy) > P_GetZAt(thing->subsector->sector->f_slope, thing->x, thing->y)) + thing->floorz = P_GetZAt(thing->subsector->sector->f_slope, thing->x+thing->momx, thing->y+thing->momy); + else + thing->floorz = P_GetZAt(thing->subsector->sector->f_slope, thing->x, thing->y); + } + else +#endif + thing->floorz = tmfloorz; +#ifdef ESLOPE + if (thing->subsector->sector->c_slope) + { + // SRB2CBTODO: Support a mobj's gravity for this too + if (P_GetZAt(thing->subsector->sector->c_slope, thing->x+thing->momx, thing->y+thing->momy) < P_GetZAt(thing->subsector->sector->c_slope, thing->x, thing->y)) + thing->ceilingz = P_GetZAt(thing->subsector->sector->c_slope, thing->x, thing->y); + else + thing->ceilingz = P_GetZAt(thing->subsector->sector->c_slope, thing->x+thing->momx, thing->y+thing->momy); + } + else +#endif + thing->ceilingz = tmceilingz; thing->x = x; thing->y = y; @@ -1983,6 +2158,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) { fixed_t tryx, tryy; + tryx = thing->x; tryy = thing->y; do { @@ -2004,7 +2180,15 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) if (!(thing->flags & MF_NOCLIP)) { - const fixed_t maxstep = MAXSTEPMOVE; + fixed_t maxstep = MAXSTEPMOVE; + +#ifdef ESLOPE // TODO: Make this collosion better + // Maxstepmove = 0 means the object bounces like a nut while going down a slope + if (thing->subsector->sector->f_slope) + { + maxstep *= thing->subsector->sector->f_slope->zangle; + } +#endif if (tmceilingz - tmfloorz < thing->height) return false; // doesn't fit @@ -2308,12 +2492,24 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) { fixed_t platx, platy; subsector_t *glidesector; + fixed_t floorz, ceilingz; platx = P_ReturnThrustX(player->mo, angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale)); platy = P_ReturnThrustY(player->mo, angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale)); glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy); + floorz = glidesector->sector->floorheight; +#ifdef ESLOPE + if (glidesector->sector->f_slope) + floorz = P_GetZAt(glidesector->sector->f_slope, player->mo->x + platx, player->mo->y + platy); +#endif + ceilingz = glidesector->sector->ceilingheight; +#ifdef ESLOPE + if (glidesector->sector->c_slope) + ceilingz = P_GetZAt(glidesector->sector->c_slope, player->mo->x + platx, player->mo->y + platy); +#endif + if (glidesector->sector != player->mo->subsector->sector) { boolean floorclimb = false; @@ -2326,34 +2522,44 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER)) continue; + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, player->mo->x, player->mo->y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, player->mo->x, player->mo->y); +#endif*/ + floorclimb = true; if (player->mo->eflags & MFE_VERTICALFLIP) { - if ((*rover->topheight < player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) < *rover->topheight)) + if ((topheight < player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) < topheight)) { floorclimb = true; } - if (*rover->topheight < player->mo->z) // Waaaay below the ledge. + if (topheight < player->mo->z) // Waaaay below the ledge. { floorclimb = false; } - if (*rover->bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale)) + if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale)) { floorclimb = false; } } else { - if ((*rover->bottomheight > player->mo->z) && ((player->mo->z - player->mo->momz) > *rover->bottomheight)) + if ((bottomheight > player->mo->z) && ((player->mo->z - player->mo->momz) > bottomheight)) { floorclimb = true; } - if (*rover->bottomheight > player->mo->z + player->mo->height) // Waaaay below the ledge. + if (bottomheight > player->mo->z + player->mo->height) // Waaaay below the ledge. { floorclimb = false; } - if (*rover->topheight < player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale)) + if (topheight < player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale)) { floorclimb = false; } @@ -2366,30 +2572,30 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) if (player->mo->eflags & MFE_VERTICALFLIP) { - if ((glidesector->sector->floorheight <= player->mo->z + player->mo->height) - && ((player->mo->z + player->mo->height - player->mo->momz) <= glidesector->sector->floorheight)) + if ((floorz <= player->mo->z + player->mo->height) + && ((player->mo->z + player->mo->height - player->mo->momz) <= floorz)) floorclimb = true; - if ((glidesector->sector->floorheight > player->mo->z) + if ((floorz > player->mo->z) && glidesector->sector->floorpic == skyflatnum) return false; - if ((player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale) > glidesector->sector->ceilingheight) - || (player->mo->z + player->mo->height <= glidesector->sector->floorheight)) + if ((player->mo->z + player->mo->height - FixedMul(16*FRACUNIT,player->mo->scale) > ceilingz) + || (player->mo->z + player->mo->height <= floorz)) floorclimb = true; } else { - if ((glidesector->sector->ceilingheight >= player->mo->z) - && ((player->mo->z - player->mo->momz) >= glidesector->sector->ceilingheight)) + if ((ceilingz >= player->mo->z) + && ((player->mo->z - player->mo->momz) >= ceilingz)) floorclimb = true; - if ((glidesector->sector->ceilingheight < player->mo->z+player->mo->height) + if ((ceilingz < player->mo->z+player->mo->height) && glidesector->sector->ceilingpic == skyflatnum) return false; - if ((player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale) < glidesector->sector->floorheight) - || (player->mo->z >= glidesector->sector->ceilingheight)) + if ((player->mo->z + FixedMul(16*FRACUNIT,player->mo->scale) < ceilingz) + || (player->mo->z >= ceilingz)) floorclimb = true; } @@ -2408,6 +2614,7 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) static boolean PTR_SlideTraverse(intercept_t *in) { line_t *li; + fixed_t maxstep; I_Assert(in->isaline); @@ -2440,7 +2647,17 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (opentop - slidemo->z < slidemo->height) goto isblocking; // mobj is too high - if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale)) + maxstep = FixedMul(MAXSTEPMOVE, slidemo->scale); + +#ifdef ESLOPE // TODO: Make this collosion better + // Maxstepmove = 0 means the object bounces like a nut while going down a slope + if (slidemo->subsector->sector->f_slope) + { + maxstep *= slidemo->subsector->sector->f_slope->zangle; + } +#endif + + if (openbottom - slidemo->z > maxstep) goto isblocking; // too big a step up // this line doesn't block movement @@ -2476,13 +2693,23 @@ isblocking: if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) continue; - if (*rover->topheight < slidemo->z) + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, slidemo->x, slidemo->y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, slidemo->x, slidemo->y); +#endif*/ + + if (topheight < slidemo->z) continue; - if (*rover->bottomheight > slidemo->z + slidemo->height) + if (bottomheight > slidemo->z + slidemo->height) continue; - // Got this far, so I guess it's climbable. + // Got this far, so I guess it's climbable. // TODO: Climbing check, also, better method to do this? if (rover->master->flags & ML_TFERLINE) { size_t linenum = li-checksector->lines[0]; @@ -3109,9 +3336,19 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) || ((rover->flags & FF_BLOCKOTHERS) && !thing->player)) || !(rover->flags & FF_EXISTS)) continue; - delta1 = thing->z - (*rover->bottomheight + *rover->topheight)/2; - delta2 = thingtop - (*rover->bottomheight + *rover->topheight)/2; - if (*rover->bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2)) + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, thing->x, thing->y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y); +#endif*/ + + delta1 = thing->z - (bottomheight + topheight)/2; + delta2 = thingtop - (bottomheight + topheight)/2; + if (bottomheight <= thing->ceilingz && abs(delta1) >= abs(delta2)) { if (thing->flags & MF_PUSHABLE) { @@ -3785,7 +4022,7 @@ void P_MapEnd(void) } // P_FloorzAtPos -// Returns the floorz of the XYZ position +// Returns the floorz of the XYZ position // TODO: Need ceilingpos function too // Tails 05-26-2003 fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) { @@ -3806,9 +4043,19 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) continue; + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, x, y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, x, y); +#endif*/ + if (rover->flags & FF_QUICKSAND) { - if (z < *rover->topheight && *rover->bottomheight < thingtop) + if (z < topheight && bottomheight < thingtop) { if (floorz < z) floorz = z; @@ -3816,10 +4063,10 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) continue; } - delta1 = z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)); - delta2 = thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)); - if (*rover->topheight > floorz && abs(delta1) < abs(delta2)) - floorz = *rover->topheight; + delta1 = z - (bottomheight + ((topheight - bottomheight)/2)); + delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2)); + if (topheight > floorz && abs(delta1) < abs(delta2)) + floorz = topheight; } } diff --git a/src/p_maputl.c b/src/p_maputl.c index 48dd54e8d..f311bffce 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -20,6 +20,9 @@ #include "p_maputl.h" #include "p_polyobj.h" #include "z_zone.h" +#ifdef ESLOPE +#include "p_slopes.h" +#endif // // P_AproxDistance @@ -347,31 +350,68 @@ void P_CameraLineOpening(line_t *linedef) { frontfloor = sectors[front->camsec].floorheight; frontceiling = sectors[front->camsec].ceilingheight; +#ifdef ESLOPE + if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) + frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y); + if (sectors[front->camsec].c_slope) + frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y); +#endif + } else if (front->heightsec >= 0) { frontfloor = sectors[front->heightsec].floorheight; frontceiling = sectors[front->heightsec].ceilingheight; +#ifdef ESLOPE + if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) + frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y); + if (sectors[front->heightsec].c_slope) + frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y); +#endif } else { frontfloor = front->floorheight; frontceiling = front->ceilingheight; +#ifdef ESLOPE + if (front->f_slope) + frontfloor = P_GetZAt(front->f_slope, camera.x, camera.y); + if (front->c_slope) + frontceiling = P_GetZAt(front->c_slope, camera.x, camera.y); +#endif } if (back->camsec >= 0) { backfloor = sectors[back->camsec].floorheight; backceiling = sectors[back->camsec].ceilingheight; +#ifdef ESLOPE + if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) + frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y); + if (sectors[back->camsec].c_slope) + frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y); +#endif } else if (back->heightsec >= 0) { backfloor = sectors[back->heightsec].floorheight; backceiling = sectors[back->heightsec].ceilingheight; +#ifdef ESLOPE + if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) + frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y); + if (sectors[back->heightsec].c_slope) + frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y); +#endif } else { backfloor = back->floorheight; backceiling = back->ceilingheight; +#ifdef ESLOPE + if (back->f_slope) + frontfloor = P_GetZAt(back->f_slope, camera.x, camera.y); + if (back->c_slope) + frontceiling = P_GetZAt(back->c_slope, camera.x, camera.y); +#endif } { @@ -416,17 +456,28 @@ void P_CameraLineOpening(line_t *linedef) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - delta1 = abs(mapcampointer->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - if (*rover->bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = *rover->bottomheight; - else if (*rover->bottomheight < highestceiling && delta1 >= delta2) - highestceiling = *rover->bottomheight; + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; - if (*rover->topheight > highestfloor && delta1 < delta2) - highestfloor = *rover->topheight; - else if (*rover->topheight > lowestfloor && delta1 < delta2) - lowestfloor = *rover->topheight; +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); + + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); +#endif // ESLOPE*/ + + delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); + delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); + if (bottomheight < lowestceiling && delta1 >= delta2) + lowestceiling = bottomheight; + else if (bottomheight < highestceiling && delta1 >= delta2) + highestceiling = bottomheight; + + if (topheight > highestfloor && delta1 < delta2) + highestfloor = topheight; + else if (topheight > lowestfloor && delta1 < delta2) + lowestfloor = topheight; } // Check for backsectors fake floors @@ -436,17 +487,28 @@ void P_CameraLineOpening(line_t *linedef) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - delta1 = abs(mapcampointer->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - if (*rover->bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = *rover->bottomheight; - else if (*rover->bottomheight < highestceiling && delta1 >= delta2) - highestceiling = *rover->bottomheight; + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; - if (*rover->topheight > highestfloor && delta1 < delta2) - highestfloor = *rover->topheight; - else if (*rover->topheight > lowestfloor && delta1 < delta2) - lowestfloor = *rover->topheight; +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); + + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); +#endif // ESLOPE*/ + + delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); + delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); + if (bottomheight < lowestceiling && delta1 >= delta2) + lowestceiling = bottomheight; + else if (bottomheight < highestceiling && delta1 >= delta2) + highestceiling = bottomheight; + + if (topheight > highestfloor && delta1 < delta2) + highestfloor = topheight; + else if (topheight > lowestfloor && delta1 < delta2) + lowestfloor = topheight; } if (highestceiling < highceiling) @@ -520,6 +582,33 @@ void P_LineOpening(line_t *linedef) { fixed_t thingtop = tmthing->z + tmthing->height; +#ifdef ESLOPE + // I suspect the math here is wrong and we should be comparing the slope Zs + // if either are slopes. + // -- Fury + if (front->c_slope && front->ceilingheight < back->ceilingheight) + { + opentop = P_GetZAt(front->c_slope, tmthing->x, tmthing->y); + if (back->c_slope) highceiling = P_GetZAt(back->c_slope, tmthing->x, tmthing->y); + } + else if (back->c_slope && front->ceilingheight >= back->ceilingheight) + { + opentop = P_GetZAt(back->c_slope, tmthing->x, tmthing->y); + if (front->c_slope) highceiling = P_GetZAt(front->c_slope, tmthing->x, tmthing->y); + } + + if (front->c_slope && front->floorheight < back->floorheight) + { + openbottom = P_GetZAt(front->f_slope, tmthing->x, tmthing->y); + if (back->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); + } + if (back->f_slope && front->floorheight >= back->floorheight) + { + openbottom = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); + if (front->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); + } +#endif + // Check for fake floors in the sector. if (front->ffloors || back->ffloors #ifdef POLYOBJECTS @@ -547,23 +636,34 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); + + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); +#endif*/ + + delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); + delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (*rover->bottomheight < lowestceiling) - lowestceiling = *rover->bottomheight; - else if (*rover->bottomheight < highestceiling) - highestceiling = *rover->bottomheight; + if (bottomheight < lowestceiling) + lowestceiling = bottomheight; + else if (bottomheight < highestceiling) + highestceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (*rover->topheight > highestfloor) - highestfloor = *rover->topheight; - else if (*rover->topheight > lowestfloor) - lowestfloor = *rover->topheight; + if (topheight > highestfloor) + highestfloor = topheight; + else if (topheight > lowestfloor) + lowestfloor = topheight; } } @@ -579,23 +679,34 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - delta1 = abs(tmthing->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); - delta2 = abs(thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2))); + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, tmthing->x, tmthing->y); + + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, tmthing->x, tmthing->y); +#endif*/ + + delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); + delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (*rover->bottomheight < lowestceiling) - lowestceiling = *rover->bottomheight; - else if (*rover->bottomheight < highestceiling) - highestceiling = *rover->bottomheight; + if (bottomheight < lowestceiling) + lowestceiling = bottomheight; + else if (bottomheight < highestceiling) + highestceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (*rover->topheight > highestfloor) - highestfloor = *rover->topheight; - else if (*rover->topheight > lowestfloor) - lowestfloor = *rover->topheight; + if (topheight > highestfloor) + highestfloor = topheight; + else if (topheight > lowestfloor) + lowestfloor = topheight; } } @@ -732,6 +843,16 @@ void P_SetThingPosition(mobj_t *thing) ss = thing->subsector = R_PointInSubsector(thing->x, thing->y); + fixed_t tfloorz, tceilz; + tfloorz = ss->sector->floorheight; + tceilz = ss->sector->ceilingheight; +#ifdef ESLOPE + if (ss->sector->f_slope) + tfloorz = P_GetZAt(ss->sector->f_slope, thing->x, thing->y); + if (ss->sector->c_slope) + tceilz = P_GetZAt(ss->sector->c_slope, thing->x, thing->y); +#endif + if (!(thing->flags & MF_NOSECTOR)) { // invisible things don't go into the sector links @@ -794,10 +915,10 @@ void P_SetThingPosition(mobj_t *thing) { if (thing->eflags & MFE_VERTICALFLIP) { - if (thing->z + thing->height >= thing->subsector->sector->ceilingheight) + if (thing->z + thing->height >= tceilz) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (thing->z <= thing->subsector->sector->floorheight) + else if (thing->z <= tfloorz) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } } diff --git a/src/p_mobj.c b/src/p_mobj.c index e85e25b05..9c6ce831f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -31,6 +31,9 @@ #include "i_video.h" #include "lua_hook.h" #include "b_bot.h" +#ifdef ESLOPE +#include "p_slopes.h" +#endif // protos. static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}}; @@ -700,15 +703,75 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) return false; - if (mobj->z > *rover->topheight) + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, mobj->x, mobj->y); + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, mobj->x, mobj->y); +#endif*/ + + if (mobj->z > topheight) return false; - if (mobj->z + mobj->height < *rover->bottomheight) + if (mobj->z + mobj->height < bottomheight) return false; return true; } +fixed_t P_GetMobjZAtSecF(mobj_t *mobj, sector_t *sector) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); +#ifdef ESLOPE + if (sector->f_slope) + return P_GetZAt(sector->f_slope, mobj->x, mobj->y); + else +#endif + return sector->floorheight; +} + +fixed_t P_GetMobjZAtF(mobj_t *mobj) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + sector_t *sector; + sector = R_PointInSubsector(mobj->x, mobj->y)->sector; + +#ifdef ESLOPE + if (sector->f_slope) + return P_GetZAt(sector->f_slope, mobj->x, mobj->y); + else +#endif + return sector->floorheight; +} + +fixed_t P_GetMobjZAtSecC(mobj_t *mobj, sector_t *sector) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); +#ifdef ESLOPE + if (sector->c_slope) + return P_GetZAt(sector->c_slope, mobj->x, mobj->y); + else +#endif + return sector->ceilingheight; +} + +fixed_t P_GetMobjZAtC(mobj_t *mobj) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + sector_t *sector; + sector = R_PointInSubsector(mobj->x, mobj->y)->sector; + +#ifdef ESLOPE + if (sector->c_slope) + return P_GetZAt(sector->c_slope, mobj->x, mobj->y); + else +#endif + return sector->ceilingheight; +} + static void P_PlayerFlip(mobj_t *mo) { if (!mo->player) @@ -2455,6 +2518,11 @@ void P_MobjCheckWater(mobj_t *mobj) // Default if no water exists. mobj->watertop = mobj->waterbottom = mobj->subsector->sector->floorheight - 1000*FRACUNIT; +#ifdef ESLOPE // Set the correct waterbottom/top to be below the lowest point of the slope + if (mobj->subsector->sector->f_slope) + mobj->watertop = mobj->waterbottom = mobj->subsector->sector->f_slope->lowz - 1000*FRACUNIT; +#endif + // Reset water state. mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER|MFE_GOOWATER); @@ -2465,34 +2533,45 @@ void P_MobjCheckWater(mobj_t *mobj) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) continue; + fixed_t topheight = *rover->topheight; + fixed_t bottomheight = *rover->bottomheight; + +/*#ifdef ESLOPE + if (rover->t_slope) + topheight = P_GetZAt(rover->t_slope, mobj->x, mobj->y); + + if (rover->b_slope) + bottomheight = P_GetZAt(rover->b_slope, mobj->x, mobj->y); +#endif*/ + if (mobj->eflags & MFE_VERTICALFLIP) { - if (*rover->topheight < (thingtop - FixedMul(mobj->info->height/2, mobj->scale)) - || *rover->bottomheight > thingtop) + if (topheight < (thingtop - FixedMul(mobj->info->height/2, mobj->scale)) + || bottomheight > thingtop) continue; } else { - if (*rover->topheight < mobj->z - || *rover->bottomheight > (mobj->z + FixedMul(mobj->info->height/2, mobj->scale))) + if (topheight < mobj->z + || bottomheight > (mobj->z + FixedMul(mobj->info->height/2, mobj->scale))) continue; } // Set the watertop and waterbottom - mobj->watertop = *rover->topheight; - mobj->waterbottom = *rover->bottomheight; + mobj->watertop = topheight; + mobj->waterbottom = bottomheight; // Just touching the water? - if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - FixedMul(mobj->info->height, mobj->scale) < *rover->bottomheight) - || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + FixedMul(mobj->info->height, mobj->scale) > *rover->topheight)) + if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - FixedMul(mobj->info->height, mobj->scale) < bottomheight) + || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + FixedMul(mobj->info->height, mobj->scale) > topheight)) { mobj->eflags |= MFE_TOUCHWATER; if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY)) mobj->eflags |= MFE_GOOWATER; } // Actually in the water? - if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - FixedMul(mobj->info->height/2, mobj->scale) > *rover->bottomheight) - || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + FixedMul(mobj->info->height/2, mobj->scale) < *rover->topheight)) + if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - FixedMul(mobj->info->height/2, mobj->scale) > bottomheight) + || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + FixedMul(mobj->info->height/2, mobj->scale) < topheight)) { mobj->eflags |= MFE_UNDERWATER; if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY)) diff --git a/src/p_mobj.h b/src/p_mobj.h index 6d120c473..4acdde18c 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -28,6 +28,11 @@ // Needs precompiled tables/data structures. #include "info.h" +// For slope code, we need v3float_t +#ifdef ESLOPE +#include "m_vector.h" +#endif + // // NOTES: mobj_t // @@ -349,6 +354,11 @@ typedef struct mobj_s INT32 cusval; INT32 cvmem; +#ifdef ESLOPE + angle_t pitchangle; + v3float_t vector; +#endif + // WARNING: New fields must be added separately to savegame and Lua. } mobj_t; diff --git a/src/p_slopes.c b/src/p_slopes.c new file mode 100644 index 000000000..c448b580c --- /dev/null +++ b/src/p_slopes.c @@ -0,0 +1,1211 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2004 Stephen McGranahan +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//-------------------------------------------------------------------------- +// +// DESCRIPTION: +// Slopes +// SoM created 05/10/09 +// ZDoom + Eternity Engine Slopes, ported and enhanced by Kalaron +// +//----------------------------------------------------------------------------- + + +#include "doomdef.h" +#include "r_defs.h" +#include "r_state.h" +#include "m_bbox.h" +#include "z_zone.h" +#include "p_spec.h" +#include "p_slopes.h" +#include "r_main.h" +#include "p_maputl.h" +#include "w_wad.h" + +#ifdef ESLOPE + +// +// P_MakeSlope +// +// Alocates and fill the contents of a slope structure. +// +static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, + const float zdelta, boolean isceiling) +{ + pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); + memset(ret, 0, sizeof(*ret)); + + ret->o.x = FLOAT_TO_FIXED(ret->of.x = o->x); + ret->o.y = FLOAT_TO_FIXED(ret->of.y = o->y); + ret->o.z = FLOAT_TO_FIXED(ret->of.z = o->z); + + ret->d.x = FLOAT_TO_FIXED(ret->df.x = d->x); + ret->d.y = FLOAT_TO_FIXED(ret->df.y = d->y); + + ret->zdelta = FLOAT_TO_FIXED(ret->zdeltaf = zdelta); + + // d = direction (v2float_t) + // + // direction.x = line->nx; + // direction.y = line->ny; + // + // o = origin (v3float_t) + // origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; + // origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; + + { + // Now calculate the normal of the plane! + v3float_t v1, v2, v3, d1, d2; + float len; + + v1.x = o->x; + v1.y = o->y; + v1.z = o->z; + + v2.x = v1.x; + v2.y = v1.y + 10.0f; + v2.z = P_GetZAtf(ret, v2.x, v2.y); + + v3.x = v1.x + 10.0f; + v3.y = v1.y; + v3.z = P_GetZAtf(ret, v3.x, v3.y); + + if (isceiling) + { + M_SubVec3f(&d1, &v1, &v3); + M_SubVec3f(&d2, &v2, &v3); + } + else + { + M_SubVec3f(&d1, &v1, &v2); + M_SubVec3f(&d2, &v3, &v2); + } + + M_CrossProduct3f(&ret->normalf, &d1, &d2); + + // Cross product length + len = (float)sqrt(ret->normalf.x * ret->normalf.x + + ret->normalf.y * ret->normalf.y + + ret->normalf.z * ret->normalf.z); + +#ifdef SLOPETHINGS + if (len == 0) + { + // Only happens when all vertices in this sector are on the same line. + // Let's just ignore this case. + CONS_Printf("Slope thing at (%d,%d) lies directly on its target line.\n", int(x>>16), int(y>>16)); + return; + } +#endif + + ret->normalf.x /= len; + ret->normalf.y /= len; + ret->normalf.z /= len; + + // ZDoom + // cross = ret->normalf + + // Fix backward normals + if ((ret->normalf.z < 0 && !isceiling) || (ret->normalf.z > 0 && isceiling)) + { + ret->normalf.x = -ret->normalf.x; + ret->normalf.y = -ret->normalf.x; + ret->normalf.z = -ret->normalf.x; + } + + } + + return ret; +} + +// +// P_CopySlope +// +// Allocates and returns a copy of the given slope structure. +// +static pslope_t *P_CopySlope(const pslope_t *src) +{ + pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); + memcpy(ret, src, sizeof(*ret)); + + return ret; +} + +// +// P_MakeLineNormal +// +// Calculates a 2D normal for the given line and stores it in the line +// +void P_MakeLineNormal(line_t *line) +{ + float linedx, linedy, length; + + // SRB2CBTODO: Give linedefs an fx+fy(float xy coords)? + // May cause slow downs since the float would always have to be converted/updated + linedx = FIXED_TO_FLOAT(line->v2->x) - FIXED_TO_FLOAT(line->v1->x); + linedy = FIXED_TO_FLOAT(line->v2->y) - FIXED_TO_FLOAT(line->v1->y); + + length = (float)sqrt(linedx * linedx + linedy * linedy); + line->nx = linedy / length; + line->ny = -linedx / length; + line->len = length; +} + +// +// P_GetExtent +// +// Returns the distance to the first line within the sector that +// is intersected by a line parallel to the plane normal with the point (ox, oy) +// +static float P_GetExtent(sector_t *sector, line_t *line, v3float_t *o, v2float_t *d) +{ + // ZDoom code reference: v3float_t = vertex_t + float fardist = -1.0f; + size_t i; + + // Find furthest vertex from the reference line. It, along with the two ends + // of the line, will define the plane. + // SRB2CBTODO: Use a formula to get the slope to slide objects depending on how steep + for(i = 0; i < sector->linecount; i++) + { + line_t *li = sector->lines[i]; + float dist; + + // Don't compare to the slope line. + if(li == line) + continue; + + // ZDoom code in P_AlignPlane + // dist = fabs((double(line->v1->y) - vert->y) * line->dx - (double(line->v1->x) - vert->x) * line->dy); + dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y); + if(dist > fardist) + fardist = dist; + + dist = (float)fabs((FIXED_TO_FLOAT(li->v2->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v2->y) - o->y) * d->y); + if(dist > fardist) + fardist = dist; + } + + return fardist; +} + + +// +// P_SpawnSlope_Line +// +// Creates one or more slopes based on the given line type and front/back +// sectors. +// Kalaron: Check if dynamic slopes need recalculation +// +void P_SpawnSlope_Line(int linenum) +{ + // With dynamic slopes, it's fine to just leave this function as normal, + // because checking to see if a slope had changed will waste more memory than + // if the slope was just updated when called + line_t *line = lines + linenum; + int special = line->special; + pslope_t *fslope = NULL, *cslope = NULL; + v3float_t origin, point; + v2float_t direction; + float dz, extent; + + boolean frontfloor = (special == 386 || special == 388 || special == 393); + boolean backfloor = (special == 389 || special == 391 || special == 392); + boolean frontceil = (special == 387 || special == 388 || special == 392); + boolean backceil = (special == 390 || special == 391 || special == 393); + + if(!frontfloor && !backfloor && !frontceil && !backceil) + { + CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n"); + return; + } + + if(!line->frontsector || !line->backsector) + { + CONS_Printf("P_SpawnSlope_Line used on a line without two sides.\n"); + return; + } + + // SRB2CBTODO: Transform origin relative to the bounds of an individual FOF + origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; + origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; + + // For FOF slopes, make a special function to copy to the xy origin & direction relative to the position of the FOF on the map! + if(frontfloor || frontceil) + { + origin.z = FIXED_TO_FLOAT(line->backsector->floorheight); + direction.x = line->nx; + direction.y = line->ny; + + extent = P_GetExtent(line->frontsector, line, &origin, &direction); + + if(extent < 0.0f) + { + CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum); + return; + } + + // reposition the origin according to the extent + point.x = origin.x + direction.x * extent; + point.y = origin.y + direction.y * extent; + direction.x = -direction.x; + direction.y = -direction.y; + + // TODO: We take origin and point 's xy values and translate them to the center of an FOF! + + if(frontfloor) + { + + point.z = FIXED_TO_FLOAT(line->frontsector->floorheight); // Startz + dz = (FIXED_TO_FLOAT(line->backsector->floorheight) - point.z) / extent; // Destinationz + + // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef + + int slopeangle = 0; // All floors by default have no slope (an angle of 0, completely flat) + + v3float_t A = origin; // = line source + v3float_t B = point; // destination's value + v3float_t C = origin; // Point used to make a right triangle from A & B + + C.z = point.z; + + // To find the "angle" of a slope, we make a right triangle out of the points we have, + // point A - is point 1 of the hypotenuse, + // point B - is point 2 of the hypotenuse + // point C - has the same Z value as point b, and the same XY value as A + // + // We want to find the angle accross from the right angle + // so we use some triginometry to find the angle(fun, right?) + // We want to find the tanjent of this angle, this is: + // Opposite + // ------- = tan(x) + // Adjecent + // But actually tan doesn't do want we really want, we have to use atan to find the actual angle of the triangle's corner + float triangopplength = abs(B.z - A.z); + float triangadjlength = sqrt((B.x-C.x)*(B.x-C.x) + (B.y - C.y)*(B.y - C.y)); + //float trianghyplength = sqrt(triangopplength*triangopplength + triangadjlength*triangadjlength); // This is the hypotenuse + + // So tanjent = opposite divided by adjecent + float tanrelat = triangopplength/ triangadjlength; // tanjent = opposite / adjecent + slopeangle = atan(tanrelat)* 180 / M_PI; // Now we use atan: *180 /M_PI is needed to convert the value into degrees + + fslope = line->frontsector->f_slope = + P_MakeSlope(&point, &direction, dz, false); + + // Now remember that f_slope IS a vector + // fslope->o = origin 3D point 1 of the vector + // fslope->d = destination 3D point 2 of the vector + // fslope->normal is a 3D line perpendicular to the 3D vector + + // Sync the linedata of the line that started this slope + // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + line->frontsector->f_slope->sourceline = line; + + // To find the real highz/lowz of a slope, you need to check all the vertexes + // in the slope's sector with P_GetZAt to get the REAL lowz & highz + // Although these slopes are set by floorheights the ANGLE is what a slope is, + // so technically any slope can extend on forever (they are just bound by sectors) + // *You can use sourceline as a reference to see if two slopes really are the same + + // Default points for high and low + fixed_t highest = point.z > origin.z ? point.z : origin.z; + fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = FLOAT_TO_FIXED(highest); + lowest = FLOAT_TO_FIXED(lowest); + + // Now check to see what the REAL high and low points of the slope inside the sector + size_t l; + + for (l = 0; l < line->frontsector->linecount; l++) + { + if (P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) > highest) + highest = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + + if (P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) < lowest) + lowest = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + } + + // Sets extra clipping data for the frontsector's slope + fslope->highz = line->frontsector->f_slope->highz = highest; + fslope->lowz = line->frontsector->f_slope->lowz = lowest; + + fslope->zangle = slopeangle; + fslope->xydirection = R_PointToAngle2(FLOAT_TO_FIXED(A.x), FLOAT_TO_FIXED(A.y), FLOAT_TO_FIXED(B.x), FLOAT_TO_FIXED(B.y))/(ANGLE_45/45); + + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); + // ZDoom secplane port! YAY + // ret = f_slope or c_slope + srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] + srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] + srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] + srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) or FLOAT_TO_FIXED(1.0f/cross[2]); + + // destheight takes the destination height used in dz + srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, // x + srcplane->b, line->v1->y, // y + srcplane->c, line->backsector->floorheight); // z + + // Sync the secplane! + fslope->secplane = line->frontsector->f_slope->secplane = *srcplane; + + } + if(frontceil) + { + point.z = FIXED_TO_FLOAT(line->frontsector->ceilingheight); + dz = (FIXED_TO_FLOAT(line->backsector->ceilingheight) - point.z) / extent; + + cslope = line->frontsector->c_slope = + P_MakeSlope(&point, &direction, dz, true); + + // Sync the linedata of the line that started this slope + // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + line->frontsector->c_slope->sourceline = line; + + // Remember the way the slope is formed + fixed_t highest = point.z > origin.z ? point.z : origin.z; + fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = FLOAT_TO_FIXED(highest); + lowest = FLOAT_TO_FIXED(lowest); + size_t l; + + for (l = 0; l < line->frontsector->linecount; l++) + { + if (P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) > highest) + highest = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + + if (P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) < lowest) + lowest = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + } + + // This line special sets extra clipping data for the frontsector's slope + cslope->highz = line->frontsector->c_slope->highz = highest; + cslope->lowz = line->frontsector->c_slope->lowz = lowest; + + // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: + //cslope->zangle = line->frontsector->c_slope->zangle = P_GetSlopezangle(line->frontsector, highvert, lowvert); + //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); + // Get slope XY angle with secplane_t + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); + // ZDoom secplane port! + // secplane_t! woot! + // ret = f_slope or c_slope + srcplane->a = FLOAT_TO_FIXED (cslope->normalf.x); // cross[0] + srcplane->b = FLOAT_TO_FIXED (cslope->normalf.y); // cross[1] + srcplane->c = FLOAT_TO_FIXED (cslope->normalf.z); // cross[2] + //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); + srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) +#ifdef SLOPETHINGS // For setting thing-based slopes + srcplane->d = -TMulScale16 (plane->a, x, + plane->b, y, + plane->c, z); +#endif + //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); + //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); + //P_GetZAtf(ret, v2.x, v2.y) + // destheight takes the destination height used in dz + srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, + srcplane->b, line->v1->y, + srcplane->c, line->backsector->ceilingheight); + + // Sync the secplane! + cslope->secplane = line->frontsector->c_slope->secplane = *srcplane; + } + } + if(backfloor || backceil) + { + origin.z = FIXED_TO_FLOAT(line->frontsector->floorheight); + // Backsector + direction.x = -line->nx; + direction.y = -line->ny; + + extent = P_GetExtent(line->backsector, line, &origin, &direction); + + if(extent < 0.0f) + { + CONS_Printf("P_SpawnSlope_Line failed to get backsector extent on line number %i\n", linenum); + return; + } + + // reposition the origin according to the extent + point.x = origin.x + direction.x * extent; + point.y = origin.y + direction.y * extent; + direction.x = -direction.x; + direction.y = -direction.y; + + if(backfloor) + { + point.z = FIXED_TO_FLOAT(line->backsector->floorheight); + dz = (FIXED_TO_FLOAT(line->frontsector->floorheight) - point.z) / extent; + + fslope = line->backsector->f_slope = + P_MakeSlope(&point, &direction, dz, false); + + // Sync the linedata of the line that started this slope + // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + line->backsector->f_slope->sourceline = line; + + int slopeangle = 0; // All floors by default have no slope (an angle of 0) + + v3float_t A = origin; // = line source + v3float_t B = point; // destination's value + v3float_t C = origin; + + C.z = point.z; + + // To find the "angle" of a slope, we make a right triangle out of the points we have, + // point A - is point 1 of the hypotenuse, + // point B - is point 2 of the hypotenuse + // point C - has the same Z value as point b, and the same XY value as A + // + // We want to find the angle accross from the right angle + // so we use some triginometry to find the angle(fun, right?) + // We want to find the tanjent of this angle, this is: + // Opposite + // ------- = tan(x) + // Adjecent + // But actually tan doesn't do want we really want, we have to use atan to find the actual angle of the triangle's corner + float triangopplength = abs(B.z - A.z); + float triangadjlength = sqrt((B.x-C.x)*(B.x-C.x) + (B.y - C.y)*(B.y - C.y)); + //float trianghyplength = sqrt(triangopplength*triangopplength + triangadjlength*triangadjlength); // This is the hypotenuse + + // So tanjent = opposite divided by adjecent + float tanrelat = triangopplength/ triangadjlength; // tanjent = opposite / adjecent + slopeangle = atan(tanrelat)* 180 / M_PI; // Now we use atan - *180 /M_PI is needed to convert the value into degrees + + // Remember the way the slope is formed + fixed_t highest = point.z > origin.z ? point.z : origin.z; + fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = FLOAT_TO_FIXED(highest); + lowest = FLOAT_TO_FIXED(lowest); + size_t l; + + for (l = 0; l < line->backsector->linecount; l++) + { + if (P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) > highest) + highest = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + + if (P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) < lowest) + lowest = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + } + + // This line special sets extra clipping data for the frontsector's slope + fslope->highz = line->backsector->f_slope->highz = highest; + fslope->lowz = line->backsector->f_slope->lowz = lowest; + + fslope->zangle = slopeangle; + // Get slope XY angle with secplane_t + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); + // ZDoom secplane port! + // secplane_t! woot! + // ret = f_slope or c_slope + srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] + srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] + srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] + //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); + srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) +#ifdef SLOPETHINGS // For setting thing-based slopes + srcplane->d = -TMulScale16 (plane->a, x, + plane->b, y, + plane->c, z); +#endif + //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); + //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); + //P_GetZAtf(ret, v2.x, v2.y) + // destheight takes the destination height used in dz + srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, + srcplane->b, line->v1->y, + srcplane->c, line->frontsector->floorheight); + + // Sync the secplane! + fslope->secplane = line->backsector->f_slope->secplane = *srcplane; + } + if(backceil) + { + point.z = FIXED_TO_FLOAT(line->backsector->ceilingheight); + dz = (FIXED_TO_FLOAT(line->frontsector->ceilingheight) - point.z) / extent; + + cslope = line->backsector->c_slope = + P_MakeSlope(&point, &direction, dz, true); + + // Sync the linedata of the line that started this slope + // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + line->backsector->c_slope->sourceline = line; + + // Remember the way the slope is formed + fixed_t highest = point.z > origin.z ? point.z : origin.z; + fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = FLOAT_TO_FIXED(highest); + lowest = FLOAT_TO_FIXED(lowest); + + size_t l; + + for (l = 0; l < line->backsector->linecount; l++) + { + if (P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) > highest) + highest = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + + if (P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) < lowest) + lowest = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + } + + // This line special sets extra clipping data for the backsector's slope + cslope->highz = line->backsector->c_slope->highz = highest; + cslope->lowz = line->backsector->c_slope->lowz = lowest; + + // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: + //cslope->zangle = line->backsector->c_slope->zangle = P_GetSlopezangle(line->backsector, highvert, lowvert); + //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); + // Get slope XY angle with secplane_t + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); + // ZDoom secplane port! + // secplane_t! woot! + // ret = f_slope or c_slope + srcplane->a = FLOAT_TO_FIXED (cslope->normalf.x); // cross[0] + srcplane->b = FLOAT_TO_FIXED (cslope->normalf.y); // cross[1] + srcplane->c = FLOAT_TO_FIXED (cslope->normalf.z); // cross[2] + //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); + srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) +#ifdef SLOPETHINGS // For setting thing-based slopes + srcplane->d = -TMulScale16 (plane->a, x, + plane->b, y, + plane->c, z); +#endif + //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); + //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); + //P_GetZAtf(ret, v2.x, v2.y) + // destheight takes the destination height used in dz + srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, + srcplane->b, line->v1->y, + srcplane->c, line->frontsector->ceilingheight); + + // Sync the secplane! + cslope->secplane = line->backsector->c_slope->secplane = *srcplane; + } + } + + if(!line->tag) + return; +} + + + +// +// P_CopySectorSlope +// +// Searches through tagged sectors and copies +// +void P_CopySectorSlope(line_t *line) +{ + sector_t *fsec = line->frontsector; + int i, special = line->special; + + // Check for copy linedefs + for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;) + { + sector_t *srcsec = sectors + i; + + if((special - 393) & 1 && !fsec->f_slope && srcsec->f_slope) + fsec->f_slope = P_CopySlope(srcsec->f_slope); + if((special - 393) & 2 && !fsec->c_slope && srcsec->c_slope) + fsec->c_slope = P_CopySlope(srcsec->c_slope); + } + + //SRB2CBTODO: ESLOPE: Maybe we do need it for another to check for a plane slope? + line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef +} + + +#include "byteptr.h" + +/* +typedef struct +{ + fixed_t z1; + fixed_t z2; +} mapvert_t;*/ + +#include "p_setup.h" +#include "p_local.h" + +//========================================================================== +// +// P_SetSlopesFromVertexHeights +// +//========================================================================== +void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) +{ + mapthing_t *mt; + boolean vt_found = false; + size_t i, j, k, l, q; + + //size_t i; + //mapthing_t *mt; + char *data; + char *datastart; + + // SRB2CBTODO: WHAT IS (5 * sizeof (short))?! It = 10 + // anything else seems to make a map not load properly, + // but this hard-coded value MUST have some reason for being what it is + size_t snummapthings = W_LumpLength(lumpnum) / (5 * sizeof (short)); + mapthing_t *smapthings = Z_Calloc(snummapthings * sizeof (*smapthings), PU_LEVEL, NULL); + fixed_t x, y; + sector_t *sector; + // Spawn axis points first so they are + // at the front of the list for fast searching. + data = datastart = W_CacheLumpNum(lumpnum, PU_LEVEL); + mt = smapthings; + for (i = 0; i < snummapthings; i++, mt++) + { + mt->x = READINT16(data); + mt->y = READINT16(data); + mt->angle = READINT16(data); + mt->type = READINT16(data); + mt->options = READINT16(data); + // mt->z hasn't been set yet! + //mt->extrainfo = (byte)(mt->type >> 12); // slope things are special, they have a bigger range of types + + //mt->type &= 4095; // SRB2CBTODO: WHAT IS THIS???? Mobj type limits?!!!! + x = mt->x*FRACUNIT; + y = mt->y*FRACUNIT; + sector = R_PointInSubsector(x, y)->sector; + // Z for objects +#ifdef ESLOPE + if (sector->f_slope) + mt->z = (short)(P_GetZAt(sector->f_slope, x, y)>>FRACBITS); + else +#endif + mt->z = (short)(sector->floorheight>>FRACBITS); + + mt->z = mt->z + (mt->options >> ZSHIFT); + + if (mt->type == THING_VertexFloorZ || mt->type == THING_VertexCeilingZ) // THING_VertexFloorZ + { + for(l = 0; l < numvertexes; l++) + { + if (vertexes[l].x == mt->x*FRACUNIT && vertexes[l].y == mt->y*FRACUNIT) + { + if (mt->type == THING_VertexFloorZ) + { + vertexes[l].z = mt->z*FRACUNIT; + //I_Error("Z value: %i", vertexes[l].z/FRACUNIT); + + } + else + { + vertexes[l].z = mt->z*FRACUNIT; // celing floor + } + vt_found = true; + } + } + //mt->type = 0; // VPHYSICS: Dynamic slopes + + + + + + + if (vt_found) + { + for (k = 0; k < numsectors; k++) + { + sector_t *sec = §ors[k]; + if (sec->linecount != 3) continue; // only works with triangular sectors + + v3float_t vt1, vt2, vt3; // cross = ret->normalf + v3float_t vec1, vec2; + + int vi1, vi2, vi3; + + vi1 = (int)(sec->lines[0]->v1 - vertexes); + vi2 = (int)(sec->lines[0]->v2 - vertexes); + vi3 = (sec->lines[1]->v1 == sec->lines[0]->v1 || sec->lines[1]->v1 == sec->lines[0]->v2)? + (int)(sec->lines[1]->v2 - vertexes) : (int)(sec->lines[1]->v1 - vertexes); + + //if (vertexes[vi1].z) + // I_Error("OSNAP %i", vertexes[vi1].z/FRACUNIT); + //if (vertexes[vi2].z) + // I_Error("OSNAP %i", vertexes[vi2].z/FRACUNIT); + //if (vertexes[vi3].z) + // I_Error("OSNAP %i", vertexes[vi3].z/FRACUNIT); + + //I_Error("%i, %i", mt->z*FRACUNIT, vertexes[vi1].z); + + //I_Error("%i, %i, %i", mt->x, mt->y, mt->z); + //P_SpawnMobj(mt->x*FRACUNIT, mt->y*FRACUNIT, mt->z*FRACUNIT, MT_RING); + + // TODO: Make sure not to spawn in the same place 2x! (we need an object in every vertex of the + // triangle sector to setup the real vertex slopes + // Check for the vertexes of all sectors + for(q = 0; q < numvertexes; q++) + { + if (vertexes[q].x == mt->x*FRACUNIT && vertexes[q].y == mt->y*FRACUNIT) + { + //I_Error("yeah %i", vertexes[q].z); + P_SpawnMobj(vertexes[q].x, vertexes[q].y, vertexes[q].z, MT_RING); +#if 0 + if ((mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z) + && !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z) + && !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z)) + P_SpawnMobj(vertexes[vi1].x, vertexes[vi1].y, vertexes[vi1].z, MT_RING); + else if ((mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z) + && !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z) + && !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z)) + P_SpawnMobj(vertexes[vi2].x, vertexes[vi2].y, vertexes[vi2].z, MT_BOUNCETV); + else if ((mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z) + && !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z) + && !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z)) + P_SpawnMobj(vertexes[vi3].x, vertexes[vi3].y, vertexes[vi3].z, MT_GFZFLOWER1); + else +#endif + continue; + } + } + + vt1.x = FIXED_TO_FLOAT(vertexes[vi1].x); + vt1.y = FIXED_TO_FLOAT(vertexes[vi1].y); + vt2.x = FIXED_TO_FLOAT(vertexes[vi2].x); + vt2.y = FIXED_TO_FLOAT(vertexes[vi2].y); + vt3.x = FIXED_TO_FLOAT(vertexes[vi3].x); + vt3.y = FIXED_TO_FLOAT(vertexes[vi3].y); + + for(j = 0; j < 2; j++) + { + + fixed_t z3; + //I_Error("Lo hicimos"); + + vt1.z = mt->z;//FIXED_TO_FLOAT(j==0 ? sec->floorheight : sec->ceilingheight); + vt2.z = mt->z;//FIXED_TO_FLOAT(j==0? sec->floorheight : sec->ceilingheight); + z3 = mt->z;//j==0? sec->floorheight : sec->ceilingheight; // Destination height + vt3.z = FIXED_TO_FLOAT(z3); + + if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0) + { + vec1.x = vt2.x - vt3.x; + vec1.y = vt2.y - vt3.y; + vec1.z = vt2.z - vt3.z; + + vec2.x = vt1.x - vt3.x; + vec2.y = vt1.y - vt3.y; + vec2.z = vt1.z - vt3.z; + } + else + { + vec1.x = vt1.x - vt3.x; + vec1.y = vt1.y - vt3.y; + vec1.z = vt1.z - vt3.z; + + vec2.x = vt2.x - vt3.x; + vec2.y = vt2.y - vt3.y; + vec2.z = vt2.z - vt3.z; + } + + + pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); + memset(ret, 0, sizeof(*ret)); + + { + M_CrossProduct3f(&ret->normalf, &vec1, &vec2); + + // Cross product length + float len = (float)sqrt(ret->normalf.x * ret->normalf.x + + ret->normalf.y * ret->normalf.y + + ret->normalf.z * ret->normalf.z); + + if (len == 0) + { + // Only happens when all vertices in this sector are on the same line. + // Let's just ignore this case. + //CONS_Printf("Slope thing at (%d,%d) lies directly on its target line.\n", (int)(x>>16), (int)(y>>16)); + return; + } + // cross/len + ret->normalf.x /= len; + ret->normalf.y /= len; + ret->normalf.z /= len; + + // ZDoom cross = ret->normalf + // Fix backward normals + if ((ret->normalf.z < 0 && j == 0) || (ret->normalf.z > 0 && j == 1)) + { + // cross = -cross + ret->normalf.x = -ret->normalf.x; + ret->normalf.y = -ret->normalf.x; + ret->normalf.z = -ret->normalf.x; + } + } + + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); + + srcplane->a = FLOAT_TO_FIXED (ret->normalf.x); + srcplane->b = FLOAT_TO_FIXED (ret->normalf.y); + srcplane->c = FLOAT_TO_FIXED (ret->normalf.z); + //srcplane->ic = DivScale32 (1, srcplane->c); + srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x, + srcplane->b, vertexes[vi3].y, + srcplane->c, z3); + + if (j == 0) + { + sec->f_slope = ret; + sec->f_slope->secplane = *srcplane; + } + else if (j == 1) + { + sec->c_slope = ret; + sec->c_slope->secplane = *srcplane; + } + } + } + } + + + + + + + + + } + } + Z_Free(datastart); + +#if 0 // UDMF support + for(i = 0; i < numvertexdatas; i++) + { + if (vertexdatas[i].flags & VERTEXFLAG_ZCeilingEnabled) + { + vt_heights[1][i] = vertexdatas[i].zCeiling; + vt_found = true; + } + + if (vertexdatas[i].flags & VERTEXFLAG_ZFloorEnabled) + { + vt_heights[0][i] = vertexdatas[i].zFloor; + vt_found = true; + } + } + + // If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed. + delete[] vertexdatas; + vertexdatas = NULL; + numvertexdatas = 0; +#endif + + + + +} + +#include "p_maputl.h" + +#if 0 +static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, boolean slopeCeil) +{ + int linenum = -1; + + while ((linenum = P_FindLineFromID (lineid, linenum)) != -1) + { + const line_t *line = &lines[linenum]; + sector_t *sec; + secplane_t *plane; + + if (P_PointOnLineSide (x, y, line) == 0) + { + sec = line->frontsector; + } + else + { + sec = line->backsector; + } + if (sec == NULL) + { + continue; + } + if (slopeCeil) + { + plane = &sec->ceilingplane; + } + else + { + plane = &sec->floorplane; + } + + FVector3 p, v1, v2, cross; + + p[0] = FIXED2FLOAT (line->v1->x); + p[1] = FIXED2FLOAT (line->v1->y); + p[2] = FIXED2FLOAT (plane->ZatPoint (line->v1->x, line->v1->y)); + v1[0] = FIXED2FLOAT (line->dx); + v1[1] = FIXED2FLOAT (line->dy); + v1[2] = FIXED2FLOAT (plane->ZatPoint (line->v2->x, line->v2->y)) - p[2]; + v2[0] = FIXED2FLOAT (x - line->v1->x); + v2[1] = FIXED2FLOAT (y - line->v1->y); + v2[2] = FIXED2FLOAT (z) - p[2]; + + cross = v1 ^ v2; + double len = cross.Length(); + if (len == 0) + { + Printf ("Slope thing at (%d,%d) lies directly on its target line.\n", int(x>>16), int(y>>16)); + return; + } + cross /= len; + // Fix backward normals + if ((cross.Z < 0 && !slopeCeil) || (cross.Z > 0 && slopeCeil)) + { + cross = -cross; + } + + plane->a = FLOAT2FIXED (cross[0]); + plane->b = FLOAT2FIXED (cross[1]); + plane->c = FLOAT2FIXED (cross[2]); + //plane->ic = FLOAT2FIXED (1.f/cross[2]); + plane->ic = DivScale32 (1, plane->c); + plane->d = -TMulScale16 (plane->a, x, + plane->b, y, + plane->c, z); + } +} +#else +#if 0 +// P_SlopeLineToPoint, start from a specific linedef number(not tag) and slope to a mapthing with the angle of the linedef +static void P_SlopeLineToPoint(int linenum) +{ + line_t *line = lines + linenum; + int special = line->special; + pslope_t *fslope = NULL, *cslope = NULL; + v3float_t origin, point; + v2float_t direction; + float dz, extent; + + boolean frontfloor = (special == 386 || special == 388 || special == 393); + boolean backfloor = (special == 389 || special == 391 || special == 392); + boolean frontceil = (special == 387 || special == 388 || special == 392); + boolean backceil = (special == 390 || special == 391 || special == 393); + + // SoM: We don't need the line to retain its special type + line->special = 0; //SRB2CBTODO: ESLOPE: Maybe we do need it for another to check for a plane slope? + + if(!frontfloor && !backfloor && !frontceil && !backceil) + { + CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n"); + return; + } + + if(!line->frontsector || !line->backsector) + { + CONS_Printf("P_SpawnSlope_Line used on a line without two sides.\n"); + return; + } + + origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; + origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; + + if(frontfloor || frontceil) + { + // Do the front sector + direction.x = line->nx; + direction.y = line->ny; + + extent = P_GetExtent(line->frontsector, line, &origin, &direction); + + if(extent < 0.0f) + { + CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum); + return; + } + + // reposition the origin according to the extent + point.x = origin.x + direction.x * extent; + point.y = origin.y + direction.y * extent; + direction.x = -direction.x; + direction.y = -direction.y; + + // CONS_Printf("Test: X: %f, Y: %f\n", origin.x, origin.y); + + if(frontfloor) + { + point.z = FIXED_TO_FLOAT(line->frontsector->floorheight); // Startz + dz = (FIXED_TO_FLOAT(line->backsector->floorheight) - point.z) / extent; // Destinationz + + fslope = line->frontsector->f_slope = + P_MakeSlope(&point, &direction, dz, false); + + // Sync the linedata of the line that started this slope + // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? + line->frontsector->f_slope->sourceline = line; + + // Remember the way the slope is formed + fixed_t highest = line->frontsector->floorheight > line->backsector->floorheight ? + line->frontsector->floorheight : line->backsector->floorheight; + fixed_t lowest = line->frontsector->floorheight < line->backsector->floorheight ? + line->frontsector->floorheight : line->backsector->floorheight; + // This line special sets extra clipping data for the frontsector's slope + fslope->highz = line->frontsector->f_slope->highz = highest; + fslope->lowz = line->frontsector->f_slope->lowz = lowest; + + // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: + //fslope->zangle = line->frontsector->f_slope->zangle = P_GetSlopezangle(line->frontsector, highvert, lowvert); + //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); + // Get slope XY angle with secplane_t + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); + // ZDoom secplane port! + // secplane_t! woot! + // ret = f_slope or c_slope + srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] + srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] + srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] + //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); + srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) +#ifdef SLOPETHINGS // For setting thing-based slopes + srcplane->d = -TMulScale16 (plane->a, x, + plane->b, y, + plane->c, z); +#endif + //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); + //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); + //P_GetZAtf(ret, v2.x, v2.y) + // destheight takes the destination height used in dz + srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, + srcplane->b, line->v1->y, + srcplane->c, line->backsector->floorheight); + + // Sync the secplane! + fslope->secplane = line->frontsector->f_slope->secplane = *srcplane; + + } + } +} +#endif +#endif + + + +//=========================================================================== +// +// P_SpawnSlopeMakers +// +//=========================================================================== +#if 0 +void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) +{ + FMapThing *mt; + + for (mt = firstmt; mt < lastmt; ++mt) + { + if ((mt->type >= THING_SlopeFloorPointLine && + mt->type <= THING_SetCeilingSlope) || + mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling) + { + fixed_t x, y, z; + secplane_t *refplane; + sector_t *sec; + + x = mt->x; + y = mt->y; + sec = P_PointInSector (x, y); + if (mt->type & 1) + { + refplane = &sec->ceilingplane; + } + else + { + refplane = &sec->floorplane; + } + z = refplane->ZatPoint (x, y) + (mt->z); + if (mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling) + { + P_VavoomSlope(sec, mt->thingid, x, y, mt->z, mt->type & 1); + } + else if (mt->type <= THING_SlopeCeilingPointLine) + { + P_SlopeLineToPoint (mt->args[0], x, y, z, mt->type & 1); + } + else + { + P_SetSlope (refplane, mt->type & 1, mt->angle, mt->args[0], x, y, z); + } + mt->type = 0; + } + } + + for (mt = firstmt; mt < lastmt; ++mt) + { + if (mt->type == THING_CopyFloorPlane || + mt->type == THING_CopyCeilingPlane) + { + P_CopyPlane (mt->args[0], mt->x, mt->y, mt->type & 1); + mt->type = 0; + } + } + + P_SetSlopesFromVertexHeights(firstmt, lastmt); +} +#endif + + + + +// ============================================================================ +// +// Various utilities related to slopes +// + +// +// P_GetZAt +// +// Returns the height of the sloped plane at (x, y) as a fixed_t +// +fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y) +{ + fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) + + FixedMul(y - slope->o.y, slope->d.y); + + return slope->o.z + FixedMul(dist, slope->zdelta); +} + +// +// P_GetZAtf +// +// Returns the height of the sloped plane at (x, y) as a float +// +float P_GetZAtf(pslope_t *slope, float x, float y) +{ + //if (!slope) // SRB2CBTODO: keep this when done with debugging + // I_Error("P_GetZAtf: slope parameter is NULL"); + + float dist = (x - slope->of.x) * slope->df.x + (y - slope->of.y) * slope->df.y; + return slope->of.z + (dist * slope->zdeltaf); +} + +// +// P_DistFromPlanef +// +float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, + const v3float_t *pnormal) +{ + return (point->x - pori->x) * pnormal->x + + (point->y - pori->y) * pnormal->y + + (point->z - pori->z) * pnormal->z; +} + +// EOF +#endif // #ifdef ESLOPE + diff --git a/src/p_slopes.h b/src/p_slopes.h new file mode 100644 index 000000000..8449c1020 --- /dev/null +++ b/src/p_slopes.h @@ -0,0 +1,84 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2004 Stephen McGranahan +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//-------------------------------------------------------------------------- +// +// DESCRIPTION: +// Slopes +// SoM created 05/10/09 +// +//----------------------------------------------------------------------------- + +#ifndef P_SLOPES_H__ +#define P_SLOPES_H__ + +#ifdef ESLOPE +// P_MakeLineNormal +// Calculates a 2D normal for the given line and stores it in the line +void P_MakeLineNormal(line_t *line); + + +// P_SpawnSlope_Line +// Creates one or more slopes based on the given line type and front/back +// sectors. +void P_SpawnSlope_Line(int linenum); + + +// Loads just map objects that make slopes, +// terrain affecting objects have to be spawned first +void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum); + +typedef enum +{ + THING_SlopeFloorPointLine = 9500, + THING_SlopeCeilingPointLine = 9501, + THING_SetFloorSlope = 9502, + THING_SetCeilingSlope = 9503, + THING_CopyFloorPlane = 9510, + THING_CopyCeilingPlane = 9511, + THING_VavoomFloor=1500, + THING_VavoomCeiling=1501, + THING_VertexFloorZ=1504, + THING_VertexCeilingZ=1505, +} slopething_e; + +// +// P_CopySectorSlope +// +// Searches through tagged sectors and copies +// +void P_CopySectorSlope(line_t *line); + +// Returns the height of the sloped plane at (x, y) as a fixed_t +fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); + + +// Returns the height of the sloped plane at (x, y) as a float +float P_GetZAtf(pslope_t *slope, float x, float y); + + +// Returns the distance of the given point from the given origin and normal. +float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, + const v3float_t *pnormal); + +#endif + +// EOF +#endif // #ifdef ESLOPE + diff --git a/src/p_spec.c b/src/p_spec.c index 323b93c6d..228273de0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -33,6 +33,9 @@ #include "m_misc.h" #include "m_cond.h" //unlock triggers #include "lua_hook.h" // LUAh_LinedefExecute +#ifdef ESLOPE +#include "p_slopes.h" +#endif #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -4579,16 +4582,27 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) return; } + fixed_t f_affectpoint = sector->floorheight; + fixed_t c_affectpoint = sector->ceilingheight; + +#ifdef ESLOPE + if (sector->f_slope) + f_affectpoint = P_GetZAt(sector->f_slope, player->mo->x, player->mo->y); + + if (sector->c_slope) + c_affectpoint = P_GetZAt(sector->c_slope, player->mo->x, player->mo->y); +#endif + // Only go further if on the ground - if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != sector->floorheight) + if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint) return; - if ((sector->flags & SF_FLIPSPECIAL_CEILING) && !(sector->flags & SF_FLIPSPECIAL_FLOOR) && player->mo->z + player->mo->height != sector->ceilingheight) + if ((sector->flags & SF_FLIPSPECIAL_CEILING) && !(sector->flags & SF_FLIPSPECIAL_FLOOR) && player->mo->z + player->mo->height != c_affectpoint) return; if ((sector->flags & SF_FLIPSPECIAL_BOTH) - && player->mo->z != sector->floorheight - && player->mo->z + player->mo->height != sector->ceilingheight) + && player->mo->z != f_affectpoint + && player->mo->z + player->mo->height != c_affectpoint) return; P_ProcessSpecialSector(player, sector, NULL); @@ -4749,6 +4763,9 @@ void P_UpdateSpecials(void) // POINT LIMIT P_CheckPointLimit(); + // Kalaron: ...We...have dynamic slopes *YESSSS* + P_SpawnDeferredSpecials(); + // ANIMATE TEXTURES for (anim = anims; anim < lastanim; anim++) { @@ -6500,6 +6517,63 @@ void P_SpawnSpecials(INT32 fromnetsave) P_RunLevelLoadExecutors(); } +#ifdef ESLOPE +// +// P_SpawnDeferredSpecials +// +// SoM: Specials that copy slopes, ect., need to be collected in a separate +// pass +// NOTE: SRB2CBTODO: A new function, P_SpawnDeferredSpecials is needed if objects +// are to be needed in this function, because this function currently needs to be +// done before 'things' are loaded, because slopes are part of this function, +// and slope height adjustments are needed for spawning objects +void P_SpawnDeferredSpecials(void) +{ + size_t i; + line_t *line; + + for(i = 0; i < numlines; i++) + { + line = lines + i; + + switch(line->special) + { + // Slopes, Eternity engine + /*{ 386, "Slope_FrontsectorFloor" }, + { 387, "Slope_FrontsectorCeiling" }, + { 388, "Slope_FrontsectorFloorAndCeiling" }, + { 389, "Slope_BacksectorFloor" }, + { 390, "Slope_BacksectorCeiling" }, + { 391, "Slope_BacksectorFloorAndCeiling" }, + { 392, "Slope_BackFloorAndFrontCeiling" }, + { 393, "Slope_BackCeilingAndFrontFloor" }, + + { 394, "Slope_FrontFloorToTaggedSlope" }, + { 395, "Slope_FrontCeilingToTaggedSlope" }, + { 396, "Slope_FrontFloorAndCeilingToTaggedSlope" },*/ + + // SoM 05/10/09: Slopes // SRB2CBTODO:! + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + P_SpawnSlope_Line(i); + break; + // SoM: Copy slopes + case 394: + case 395: + case 396: + P_CopySectorSlope(line); + break; + } + } +} +#endif + /** Adds 3Dfloors as appropriate based on a common control linedef. * * \param line Control linedef to use. @@ -7399,8 +7473,12 @@ void T_Pusher(pusher_t *p) || GETSECSPECIAL(referrer->special, 3) == 3) foundfloor = true; } - else if (!(GETSECSPECIAL(sec->special, 3) == 2 - || GETSECSPECIAL(sec->special, 3) == 3)) + else if ( +#ifdef ESLOPE + (!sec->f_slope) && +#endif + (!(GETSECSPECIAL(sec->special, 3) == 2 + || GETSECSPECIAL(sec->special, 3) == 3))) return; if (p->roverpusher && foundfloor == false) // Not even a 3d floor has the PUSH_MASK. diff --git a/src/p_spec.h b/src/p_spec.h index 7b6a5655c..c8cfc76da 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -36,6 +36,11 @@ void P_SpawnSpecials(INT32 fromnetsave); // every tic void P_UpdateSpecials(void); + +#ifdef ESLOPE +void P_SpawnDeferredSpecials(void); +#endif + sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 number); void P_PlayerInSpecialSector(player_t *player); void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *roversector); diff --git a/src/p_user.c b/src/p_user.c index 3c2d34a6e..e095f2a97 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1201,6 +1201,87 @@ boolean P_IsObjectOnGround(mobj_t *mo) return false; } +#ifdef ESLOPE +// +// P_IsObjectOnSlope +// +// Returns true if the player is +// on a slope. Takes reverse +// gravity into account. +// +boolean P_IsObjectOnSlope(mobj_t *mo, boolean ceiling) +{ + if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) + { + if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) // SRB2CBTODO: allow being on underside of mobj too? + return true; + } + else + { + if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) + return true; + } + + return false; +} + +// +// P_SlopeGreaterThan +// +// Returns true if the object is on a slope +// that has an angle greater than the value +// +boolean P_SlopeGreaterThan(mobj_t *mo, boolean ceiling, int value) +{ + if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) + { + if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) + { + if (value < mo->subsector->sector->c_slope->zangle) + return true; + } + } + else + { + if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) + { + if (value < mo->subsector->sector->f_slope->zangle) + return true; + } + } + + return false; +} + +// +// P_SlopeLessThan +// +// Returns true if the object is on a slope +// that has an angle less than the value +// +boolean P_SlopeLessThan(mobj_t *mo, boolean ceiling, int value) +{ + if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) + { + if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) + { + if (value < mo->subsector->sector->c_slope->zangle) + return true; + } + } + else + { + if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) + { + if (value < mo->subsector->sector->f_slope->zangle) + return true; + } + } + + return false; +} +#endif + // // P_IsObjectOnGroundIn // diff --git a/src/r_defs.h b/src/r_defs.h index 7f8bd7e1d..251140a3f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -224,6 +224,49 @@ typedef struct secplane_t fixed_t a, b, c, d, ic; } secplane_t; +// Kalaron Slopes +#ifdef ESLOPE + +#include "m_vector.h" + +typedef struct +{ + // --- Information used in clipping/projection --- + // Origin vector for the plane + // NOTE: All similarly named entries in this struct do the same thing, + // differing with just 'f' in the name for float: + // o = of, d = df, zdelta = zdeltaf; the only difference is that one's fixed, + // and the one with the 'f' is floating point, for easier reference elsewhere in the code + v3fixed_t o; + v3float_t of; + + // The normal of the 3d plane the slope creates. + v3float_t normalf; + + // 2-Dimentional vector (x, y) normalized. Used to determine distance from + // the origin in 2d mapspace. + v2fixed_t d; + v2float_t df; + + // The rate at which z changes based on distance from the origin plane. + fixed_t zdelta; + float zdeltaf; + + // For comparing when a slope should be rendered + fixed_t lowz; + fixed_t highz; + + // SRB2CBTODO: This could be used for something? + // Determining the relative z values in a slope? + struct line_s *sourceline; + + // This values only check and must be updated if the slope itself is modified + USHORT zangle; // Angle of the plane going up from the ground (not mesured in degrees) + angle_t xydirection; // The direction the slope is facing (north, west, south, etc.) + secplane_t secplane; // Extra data for collision and stuff +} pslope_t; +#endif + typedef enum { SF_FLIPSPECIAL_FLOOR = 1, @@ -337,6 +380,11 @@ typedef struct sector_s precipmobj_t *preciplist; struct mprecipsecnode_s *touching_preciplist; +#ifdef ESLOPE + // Eternity engine slope + pslope_t *f_slope; // floor slope + pslope_t *c_slope; // ceiling slope +#endif // these are saved for netgames, so do not let Lua touch these! // offsets sector spawned with (via linedef type 7) @@ -396,6 +444,12 @@ typedef struct line_s char *text; // a concatination of all front and back texture names, for linedef specials that require a string. INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0 + +#ifdef ESLOPE + // SoM 05/11/09: Pre-calculated 2D normal for the line + float nx, ny; + float len; +#endif } line_t; // diff --git a/src/tables.c b/src/tables.c index fa71effef..cfc17c9c9 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2225,9 +2225,6 @@ angle_t tantoangle[2049] = 536870912 }; - -#ifdef NEED_FIXED_VECTOR - static angle_t fineacon[65536*2] = { ANGLE_MAX, 2143707442, 2142143280, 2140943052, 2139931208, 2139039753, 2138233813, 2137492672, 2136802831, 2136154917, 2135542102, 2134959233, 2134402306, 2133868139, 2133354148, 2132858208, 2132378539, 2131913638, 2131462220, 2131023174, 2130595537, 2130178462, 2129771202, 2129373097, 2128983555, 2128602046, 2128228092, 2127861261, 2127501162, 2127147436, 2126799757, 2126457825, @@ -10429,6 +10426,8 @@ FUNCMATH angle_t FixedAcos(fixed_t x) return fineacon[((x<<(FINE_FRACBITS-FRACBITS)))+FRACUNIT]; } +#ifdef NEED_FIXED_VECTOR + // // AngleBetweenVectors // diff --git a/src/tables.h b/src/tables.h index 219d668b9..cd6a17ff5 100644 --- a/src/tables.h +++ b/src/tables.h @@ -96,12 +96,11 @@ FUNCMATH angle_t FixedAngle(fixed_t fa); // and with a factor, with +factor for (fa/factor) and -factor for (fa*factor) FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor); - -#ifdef NEED_FIXED_VECTOR - /// The FixedAcos function FUNCMATH angle_t FixedAcos(fixed_t x); +#ifdef NEED_FIXED_VECTOR + /// Fixed Point Vector functions angle_t FV2_AngleBetweenVectors(const vector2_t *Vector1, const vector2_t *Vector2); angle_t FV3_AngleBetweenVectors(const vector3_t *Vector1, const vector3_t *Vector2); From 6e1f7e5f3ab098876a60d720563cbf31bd627525 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 19 Apr 2015 16:21:19 -0500 Subject: [PATCH 002/364] Add slope files to CMakeLists --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6859e27c3..f319523b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,6 +32,7 @@ set(SRB2_CORE_SOURCES m_misc.c m_queue.c m_random.c + m_vector.c md5.c mserv.c s_sound.c @@ -95,6 +96,7 @@ set(SRB2_CORE_HEADERS m_queue.h m_random.h m_swap.h + m_vector.h md5.h mserv.h p5prof.h @@ -150,6 +152,7 @@ set(SRB2_CORE_GAME_SOURCES p_saveg.c p_setup.c p_sight.c + p_slopes.c p_spec.c p_telept.c p_tick.c @@ -162,6 +165,7 @@ set(SRB2_CORE_GAME_SOURCES p_pspr.h p_saveg.h p_setup.h + p_slopes.h p_spec.h p_tick.h ) From 8d35c5064aee66f1ec038ba0f751a72e59cbf67d Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 19 Apr 2015 16:54:20 -0500 Subject: [PATCH 003/364] Fix slope generation Physics seem to work at least partially, but no rendering yet (not even in OGL) --- src/p_setup.c | 8 ++++++++ src/p_slopes.c | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index f2b0c49d8..9ddd52b58 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -72,6 +72,10 @@ #include "hardware/hw_light.h" #endif +#ifdef ESLOPE +#include "p_slopes.h" +#endif + // // Map MD5, calculated on level load. // Sent to clients in PT_SERVERINFO. @@ -1166,6 +1170,10 @@ static void P_LoadLineDefs(lumpnum_t lumpnum) #ifdef POLYOBJECTS ld->polyobj = NULL; #endif + +#ifdef ESLOPE + P_MakeLineNormal(ld); +#endif } Z_Free(data); diff --git a/src/p_slopes.c b/src/p_slopes.c index c448b580c..23ba35f58 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -185,23 +185,27 @@ static float P_GetExtent(sector_t *sector, line_t *line, v3float_t *o, v2float_t for(i = 0; i < sector->linecount; i++) { line_t *li = sector->lines[i]; + vertex_t tempv; float dist; - + // Don't compare to the slope line. if(li == line) continue; - + // ZDoom code in P_AlignPlane // dist = fabs((double(line->v1->y) - vert->y) * line->dx - (double(line->v1->x) - vert->x) * line->dy); - dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y); + //dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y); + P_ClosestPointOnLine(li->v1->x, li->v1->y, line, &tempv); + dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, line->v1->x, line->v1->y)); if(dist > fardist) fardist = dist; - dist = (float)fabs((FIXED_TO_FLOAT(li->v2->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v2->y) - o->y) * d->y); + // We shouldn't have to do this for v2... -Red + /*dist = (float)fabs((FIXED_TO_FLOAT(li->v2->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v2->y) - o->y) * d->y); if(dist > fardist) - fardist = dist; + fardist = dist;*/ } - + return fardist; } From 65719c5b998a2bf2bfde983c8f11562e769fa4ba Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 19 Apr 2015 22:20:54 -0500 Subject: [PATCH 004/364] Make wall renderer account for slopes properly (in most cases) --- src/r_bsp.c | 12 +++- src/r_segs.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 200 insertions(+), 10 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index fb25b8e4d..d4f769433 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -854,7 +854,11 @@ static void R_Subsector(size_t num) sub->sector->extra_colormap = frontsector->extra_colormap; - if ((frontsector->floorheight < viewz || (frontsector->heightsec != -1 + if ((( +#ifdef ESLOPE + frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : +#endif + frontsector->floorheight) < viewz || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].ceilingpic == skyflatnum))) { floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel, @@ -863,7 +867,11 @@ static void R_Subsector(size_t num) else floorplane = NULL; - if ((frontsector->ceilingheight > viewz || frontsector->ceilingpic == skyflatnum + if ((( +#ifdef ESLOPE + frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : +#endif + frontsector->ceilingheight) > viewz || frontsector->ceilingpic == skyflatnum || (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum))) { diff --git a/src/r_segs.c b/src/r_segs.c index 7467f5324..d582f13fe 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -50,6 +50,9 @@ static fixed_t rw_offset2; // for splats static fixed_t rw_scale, rw_scalestep; static fixed_t rw_midtexturemid, rw_toptexturemid, rw_bottomtexturemid; static INT32 worldtop, worldbottom, worldhigh, worldlow; +#ifdef ESLOPE +static INT32 worldtopslope, worldbottomslope, worldhighslope, worldlowslope; // worldtop/bottom at end of slope +#endif static fixed_t pixhigh, pixlow, pixhighstep, pixlowstep; static fixed_t topfrac, topstep; static fixed_t bottomfrac, bottomstep; @@ -1402,6 +1405,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) INT32 i, p; lightlist_t *light; r_lightlist_t *rlight; +#ifdef ESLOPE + vertex_t segleft, segright; +#endif static size_t maxdrawsegs = 0; if (ds_p == drawsegs+maxdrawsegs) @@ -1502,8 +1508,104 @@ void R_StoreWallRange(INT32 start, INT32 stop) // calculate texture boundaries // and decide if floor / ceiling marks are needed - worldtop = frontsector->ceilingheight - viewz; - worldbottom = frontsector->floorheight - viewz; +#ifdef ESLOPE + // Figure out map coordinates of where start and end are mapping to on seg, so we can clip right for slope bullshit + if (frontsector->c_slope || frontsector->f_slope || (backsector && (backsector->c_slope || backsector->f_slope))) { + angle_t temp; + fixed_t tan; + + // left + temp = xtoviewangle[start]+viewangle; + + if (curline->v1->x == curline->v2->x) { + // Line seg is vertical, so no line-slope form for it + tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); + + segleft.x = curline->v1->x; + + segleft.y = curline->v1->y-FixedMul(viewx-segleft.x, tan); + } else if (temp>>ANGLETOFINESHIFT == ANGLE_90>>ANGLETOFINESHIFT || temp>>ANGLETOFINESHIFT == ANGLE_270>>ANGLETOFINESHIFT) { + // Same problem as above, except this time with the view angle + tan = FixedDiv(curline->v2->y-curline->v1->y, curline->v2->x-curline->v1->x); + + segleft.x = viewx; + segleft.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); + } else { + // Both lines can be written in slope-intercept form, so figure out line intersection + float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + + a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); + b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); + c1 = a1*FIXED_TO_FLOAT(curline->v1->x) + b1*FIXED_TO_FLOAT(curline->v1->y); + + a2 = -FIXED_TO_FLOAT(FINESINE(temp>>ANGLETOFINESHIFT)); + b2 = FIXED_TO_FLOAT(FINECOSINE(temp>>ANGLETOFINESHIFT)); + c2 = a2*FIXED_TO_FLOAT(viewx) + b2*FIXED_TO_FLOAT(viewy); + + det = a1*b2 - a2*b1; + + segleft.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); + segleft.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); + } + + // right + temp = xtoviewangle[stop]+viewangle; + + if (curline->v1->x == curline->v2->x) { + // Line seg is vertical, so no line-slope form for it + tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); + + segright.x = curline->v1->x; + + segright.y = curline->v1->y-FixedMul(viewx-segright.x, tan); + } else if (temp>>ANGLETOFINESHIFT == ANGLE_90>>ANGLETOFINESHIFT || temp>>ANGLETOFINESHIFT == ANGLE_270>>ANGLETOFINESHIFT) { + // Same problem as above, except this time with the view angle + tan = FixedDiv(curline->v2->y-curline->v1->y, curline->v2->x-curline->v1->x); + + segright.x = viewx; + segright.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); + } else { + // Both lines can be written in slope-intercept form, so figure out line intersection + float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + + a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); + b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); + c1 = a1*FIXED_TO_FLOAT(curline->v1->x) + b1*FIXED_TO_FLOAT(curline->v1->y); + + a2 = -FIXED_TO_FLOAT(FINESINE(temp>>ANGLETOFINESHIFT)); + b2 = FIXED_TO_FLOAT(FINECOSINE(temp>>ANGLETOFINESHIFT)); + c2 = a2*FIXED_TO_FLOAT(viewx) + b2*FIXED_TO_FLOAT(viewy); + + det = a1*b2 - a2*b1; + + segright.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); + segright.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); + } + } + + if (frontsector->c_slope) { + worldtop = P_GetZAt(frontsector->c_slope, segleft.x, segleft.y) - viewz; + worldtopslope = P_GetZAt(frontsector->c_slope, segright.x, segright.y) - viewz; + } else { + worldtopslope = +#else + { +#endif + worldtop = frontsector->ceilingheight - viewz; + } + + +#ifdef ESLOPE + if (frontsector->f_slope) { + worldbottom = P_GetZAt(frontsector->f_slope, segleft.x, segleft.y) - viewz; + worldbottomslope = P_GetZAt(frontsector->f_slope, segright.x, segright.y) - viewz; + } else { + worldbottomslope = +#else + { +#endif + worldbottom = frontsector->floorheight - viewz; + } midtexture = toptexture = bottomtexture = maskedtexture = 0; ds_p->maskedtexturecol = NULL; @@ -1616,17 +1718,46 @@ void R_StoreWallRange(INT32 start, INT32 stop) } } - worldhigh = backsector->ceilingheight - viewz; - worldlow = backsector->floorheight - viewz; +#ifdef ESLOPE + if (backsector->c_slope) { + worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz; + worldhighslope = P_GetZAt(backsector->c_slope, segright.x, segright.y) - viewz; + } else { + worldhighslope = +#else + { +#endif + worldhigh = backsector->ceilingheight - viewz; + } + + +#ifdef ESLOPE + if (backsector->f_slope) { + worldlow = P_GetZAt(backsector->f_slope, segleft.x, segleft.y) - viewz; + worldlowslope = P_GetZAt(backsector->f_slope, segright.x, segright.y) - viewz; + } else { + worldlowslope = +#else + { +#endif + worldlow = backsector->floorheight - viewz; + } + // hack to allow height changes in outdoor areas if (frontsector->ceilingpic == skyflatnum && backsector->ceilingpic == skyflatnum) { +#ifdef ESLOPE + worldtopslope = worldhighslope = +#endif worldtop = worldhigh; } if (worldlow != worldbottom +#ifdef ESLOPE + || worldlowslope != worldbottomslope +#endif || backsector->floorpic != frontsector->floorpic || backsector->lightlevel != frontsector->lightlevel //SoM: 3/22/2000: Check floor x and y offsets. @@ -1649,6 +1780,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) } if (worldhigh != worldtop +#ifdef ESLOPE + || worldhighslope != worldtopslope +#endif || backsector->ceilingpic != frontsector->ceilingpic || backsector->lightlevel != frontsector->lightlevel //SoM: 3/22/2000: Check floor x and y offsets. @@ -1678,7 +1812,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) } // check TOP TEXTURE - if (worldhigh < worldtop) + if (worldhigh < worldtop +#ifdef ESLOPE + || worldhighslope < worldtopslope +#endif + ) { // top texture if ((linedef->flags & (ML_DONTPEGTOP) && (linedef->flags & ML_DONTPEGBOTTOM)) @@ -1721,7 +1859,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) } } // check BOTTOM TEXTURE - if (worldlow > worldbottom) //seulement si VISIBLE!!! + if (worldlow > worldbottom +#ifdef ESLOPE + || worldlowslope > worldbottomslope +#endif + ) //seulement si VISIBLE!!! { // bottom texture bottomtexture = texturetranslation[sidedef->bottomtexture]; @@ -1967,6 +2109,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) // calculate incremental stepping values for texture edges worldtop >>= 4; worldbottom >>= 4; +#ifdef ESLOPE + worldtopslope >>= 4; + worldbottomslope >>= 4; +#endif topstep = -FixedMul (rw_scalestep, worldtop); topfrac = (centeryfrac>>4) - FixedMul (worldtop, rw_scale); @@ -1974,6 +2120,17 @@ void R_StoreWallRange(INT32 start, INT32 stop) bottomstep = -FixedMul (rw_scalestep,worldbottom); bottomfrac = (centeryfrac>>4) - FixedMul (worldbottom, rw_scale); +#ifdef ESLOPE + if (frontsector->c_slope) { + fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldtopslope, ds_p->scale2); + topstep = (topfracend-topfrac)/(stop-start+1); + } + if (frontsector->f_slope) { + fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldbottomslope, ds_p->scale2); + bottomstep = (bottomfracend-bottomfrac)/(stop-start+1); + } +#endif + dc_numlights = 0; if (frontsector->numlights) @@ -2036,17 +2193,42 @@ void R_StoreWallRange(INT32 start, INT32 stop) { worldhigh >>= 4; worldlow >>= 4; +#ifdef ESLOPE + worldhighslope >>= 4; + worldlowslope >>= 4; +#endif - if (worldhigh < worldtop) + if (worldhigh < worldtop +#ifdef ESLOPE + || worldhighslope < worldtopslope +#endif + ) { pixhigh = (centeryfrac>>4) - FixedMul (worldhigh, rw_scale); pixhighstep = -FixedMul (rw_scalestep,worldhigh); + +#ifdef ESLOPE + if (backsector->c_slope) { + fixed_t topfracend = (centeryfrac>>4) - FixedMul (worldhighslope, ds_p->scale2); + pixhighstep = (topfracend-pixhigh)/(stop-start+1); + } +#endif } - if (worldlow > worldbottom) + if (worldlow > worldbottom +#ifdef ESLOPE + || worldlowslope > worldbottomslope +#endif + ) { pixlow = (centeryfrac>>4) - FixedMul (worldlow, rw_scale); pixlowstep = -FixedMul (rw_scalestep,worldlow); +#ifdef ESLOPE + if (backsector->f_slope) { + fixed_t bottomfracend = (centeryfrac>>4) - FixedMul (worldlowslope, ds_p->scale2); + pixlowstep = (bottomfracend-pixlow)/(stop-start+1); + } +#endif } { From 779faaa93f480035e46ee4082c12a6ac3b44c780 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 20 Apr 2015 02:10:14 -0500 Subject: [PATCH 005/364] SLOPES IN SOFTWARE MOD EHOLY SHIT --- src/r_bsp.c | 40 +++++++++++++++++++---- src/r_draw.c | 6 ++++ src/r_draw.h | 9 ++++++ src/r_draw8.c | 43 ++++++++++++++++++++++++ src/r_main.c | 2 ++ src/r_plane.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/r_plane.h | 9 +++++- src/r_segs.c | 14 ++++++-- 8 files changed, 202 insertions(+), 11 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index d4f769433..01d2be671 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -487,6 +487,10 @@ static void R_AddLine(seg_t *line) #endif backsector->ceilingpic == frontsector->ceilingpic && backsector->floorpic == frontsector->floorpic +#ifdef ESLOPE + && backsector->f_slope == frontsector->f_slope + && backsector->c_slope == frontsector->c_slope +#endif && backsector->lightlevel == frontsector->lightlevel && !curline->sidedef->midtexture // Check offsets too! @@ -862,7 +866,11 @@ static void R_Subsector(size_t num) && sectors[frontsector->heightsec].ceilingpic == skyflatnum))) { floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel, - frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL); + frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL +#ifdef ESLOPE + , frontsector->f_slope +#endif + ); } else floorplane = NULL; @@ -877,7 +885,11 @@ static void R_Subsector(size_t num) { ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic, ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle, - ceilingcolormap, NULL); + ceilingcolormap, NULL +#ifdef ESLOPE + , frontsector->c_slope +#endif + ); } else ceilingplane = NULL; @@ -914,7 +926,11 @@ static void R_Subsector(size_t num) viewz < *rover->bottomheight); ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, - *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover); + *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover +#ifdef ESLOPE + , NULL // will ffloors be slopable eventually? +#endif + ); ffloor[numffloors].height = *rover->bottomheight; ffloor[numffloors].ffloor = rover; @@ -932,7 +948,11 @@ static void R_Subsector(size_t num) light = R_GetPlaneLight(frontsector, *rover->topheight, viewz < *rover->topheight); ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, - frontsector->lightlist[light].extra_colormap, rover); + frontsector->lightlist[light].extra_colormap, rover +#ifdef ESLOPE + , NULL // will ffloors be slopable eventually? +#endif + ); ffloor[numffloors].height = *rover->topheight; ffloor[numffloors].ffloor = rover; numffloors++; @@ -985,7 +1005,11 @@ static void R_Subsector(size_t num) polysec->lightlevel, xoff, yoff, polysec->floorpic_angle-po->angle, NULL, - NULL); + NULL +#ifdef ESLOPE + , NULL // will ffloors be slopable eventually? +#endif + ); //ffloor[numffloors].plane->polyobj = po; ffloor[numffloors].height = polysec->floorheight; @@ -1022,7 +1046,11 @@ static void R_Subsector(size_t num) light = 0; ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic, polysec->lightlevel, xoff, yoff, polysec->ceilingpic_angle-po->angle, - NULL, NULL); + NULL, NULL +#ifdef ESLOPE + , NULL // will ffloors be slopable eventually? +#endif + ); //ffloor[numffloors].plane->polyobj = po; ffloor[numffloors].polyobj = po; diff --git a/src/r_draw.c b/src/r_draw.c index cd219c15f..f4886d262 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -103,6 +103,12 @@ fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep; UINT8 *ds_source; // start of a 64*64 tile image UINT8 *ds_transmap; // one of the translucency tables +#ifdef ESLOPE +pslope_t *ds_slope; // Current slope being used +v3float_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +float focallengthf; +#endif + /** \brief Variable flat sizes */ diff --git a/src/r_draw.h b/src/r_draw.h index 061a271b1..179887536 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -60,6 +60,12 @@ extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep; extern UINT8 *ds_source; // start of a 64*64 tile image extern UINT8 *ds_transmap; +#ifdef ESLOPE +pslope_t *ds_slope; // Current slope being used +v3float_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +float focallengthf; +#endif + // Variable flat sizes extern UINT32 nflatxshift; extern UINT32 nflatyshift; @@ -141,6 +147,9 @@ void ASMCALL R_DrawSpan_8_MMX(void); void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawSpan_8(void); +#ifdef ESLOPE +void R_DrawTiltedSpan_8(void); +#endif void R_DrawSplat_8(void); void R_DrawTranslucentSplat_8(void); void R_DrawTranslucentSpan_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index e0264ba92..6a240c349 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -526,6 +526,49 @@ void R_DrawSpan_8 (void) } } +#ifdef ESLOPE +/** \brief The R_DrawTiltedSpan_8 function + Draw slopes! Holy sheit! +*/ +void R_DrawTiltedSpan_8(void) +{ + // x1, x2 = ds_x1, ds_x2 + int width = ds_x2 - ds_x1; + double iz, uz, vz; + BYTE *fb; + DWORD u, v; + int i; + + UINT8 *source; + UINT8 *colormap; + UINT8 *dest; + + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); + + uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); + vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx); + + dest = ylookup[ds_y] + columnofs[ds_x1]; + source = ds_source; + colormap = ds_colormap; + + // The "perfect" reference version of this routine. Pretty slow. + // Use it only to see how things are supposed to look. + i = 0; + do + { + double z = 1.f/iz; + u = (INT64)(uz*z) + viewx; + v = (INT64)(vz*z) + viewy; + *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + dest++; + iz += ds_sz.x; + uz += ds_su.x; + vz += ds_sv.x; + } while (--width >= 0); +} +#endif // ESLOPE + /** \brief The R_DrawSplat_8 function Just like R_DrawSpan_8, but skips transparent pixels. */ diff --git a/src/r_main.c b/src/r_main.c index 1edcb815b..127801598 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -527,6 +527,8 @@ static void R_InitTextureMapping(void) focallength = FixedDiv(centerxfrac, FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2)); + focallengthf = FIXED_TO_FLOAT(focallength); + for (i = 0; i < FINEANGLES/2; i++) { if (FINETANGENT(i) > FRACUNIT*2) diff --git a/src/r_plane.c b/src/r_plane.c index dcff25c13..44b65ad10 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -423,7 +423,11 @@ static visplane_t *new_visplane(unsigned hash) // visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap, - ffloor_t *pfloor) + ffloor_t *pfloor +#ifdef ESLOPE + , pslope_t *slope +#endif + ) { visplane_t *check; unsigned hash; @@ -462,7 +466,11 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, && xoff == check->xoffs && yoff == check->yoffs && planecolormap == check->extra_colormap && !pfloor && !check->ffloor && check->viewz == viewz - && check->viewangle == viewangle) + && check->viewangle == viewangle +#ifdef ESLOPE + && check->slope == slope +#endif + ) { return check; } @@ -485,6 +493,9 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, #ifdef POLYOBJECTS_PLANES check->polyobj = NULL; #endif +#ifdef ESLOPE + check->slope = slope; +#endif memset(check->top, 0xff, sizeof (check->top)); memset(check->bottom, 0x00, sizeof (check->bottom)); @@ -551,6 +562,9 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop) new_pl->plangle = pl->plangle; #ifdef POLYOBJECTS_PLANES new_pl->polyobj = pl->polyobj; +#endif +#ifdef ESLOPE + new_pl->slope = pl->slope; #endif pl = new_pl; pl->minx = start; @@ -905,6 +919,78 @@ void R_DrawSinglePlane(visplane_t *pl) break; } +#ifdef ESLOPE + if (pl->slope) { + // Potentially override other stuff for now cus we're mean. :< But draw a slope plane! + // I copied ZDoom's code and adapted it to SRB2... -Red + static const float ifloatpow2[16] = + { + // ifloatpow2[i] = 1 / (1 << i) + 64.f, 32.f, 16.f, 8.f, 4.f, 2.f, 1.f, 0.5f, + 0.25f, 0.125f, 0.0625f, 0.03125f, 0.015625f, 0.0078125f, + 0.00390625f, 0.001953125f + /*, 0.0009765625f, 0.00048828125f, 0.000244140625f, + 1.220703125e-4f, 6.103515625e-5, 3.0517578125e-5*/ + }; + double lxscale, lyscale; + double xscale, yscale; + v3float_t p, m, n; + angle_t ang; + double zeroheight; + + double vx = FIXED_TO_FLOAT(viewx); + double vy = FIXED_TO_FLOAT(viewy); + double vz = FIXED_TO_FLOAT(viewz); + + zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); + + // p is the texture origin in view space + // Don't add in the offsets at this stage, because doing so can result in + // errors if the flat is rotated. + ang = (ANGLE_270 - viewangle)>>ANGLETOFINESHIFT; + p.x = vx * FIXED_TO_FLOAT(FINECOSINE(ang)) - vy * FIXED_TO_FLOAT(FINESINE(ang)); + p.z = vx * FIXED_TO_FLOAT(FINESINE(ang)) + vy * FIXED_TO_FLOAT(FINECOSINE(ang)); + p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, 0, 0)) - vz; + + // m is the v direction vector in view space + ang = (ANGLE_180 - viewangle - pl->plangle) >> ANGLETOFINESHIFT; + m.x = FIXED_TO_FLOAT(FINECOSINE(ang)); + m.z = FIXED_TO_FLOAT(FINESINE(ang)); + + // n is the u direction vector in view space + ang += ANGLE_90>>ANGLETOFINESHIFT; + ang &= FINEMASK; + n.x = -FIXED_TO_FLOAT(FINECOSINE(ang)); + n.z = -FIXED_TO_FLOAT(FINESINE(ang)); + + ang = pl->plangle>>ANGLETOFINESHIFT; + m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; + ang += ANGLE_90>>ANGLETOFINESHIFT; + ang &= FINEMASK; + n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; + + M_CrossProduct3f(&ds_su, &p, &m); + M_CrossProduct3f(&ds_sv, &p, &n); + M_CrossProduct3f(&ds_sz, &m, &n); + + ds_su.z *= focallengthf; + ds_sv.z *= focallengthf; + ds_sz.z *= focallengthf; + + // Premultiply the texture vectors with the scale factors +#define SFMULT 65536.f*(1<xoffs; yoffs = pl->yoffs; planeheight = abs(pl->height - pl->viewz); diff --git a/src/r_plane.h b/src/r_plane.h index f3a7f573f..b2346636b 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -61,6 +61,9 @@ typedef struct visplane_s #ifdef POLYOBJECTS_PLANES polyobj_t *polyobj; #endif +#ifdef ESLOPE + pslope_t *slope; +#endif } visplane_t; extern visplane_t *floorplane; @@ -91,7 +94,11 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2); void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2); void R_DrawPlanes(void); visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle, - extracolormap_t *planecolormap, ffloor_t *ffloor); + extracolormap_t *planecolormap, ffloor_t *ffloor +#ifdef ESLOPE + , pslope_t *slope +#endif + ); visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop); void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop); void R_PlaneBounds(visplane_t *plane); diff --git a/src/r_segs.c b/src/r_segs.c index d582f13fe..2cb04b25e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1757,6 +1757,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldlow != worldbottom #ifdef ESLOPE || worldlowslope != worldbottomslope + || backsector->f_slope != frontsector->f_slope #endif || backsector->floorpic != frontsector->floorpic || backsector->lightlevel != frontsector->lightlevel @@ -1782,6 +1783,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldhigh != worldtop #ifdef ESLOPE || worldhighslope != worldtopslope + || backsector->c_slope != frontsector->c_slope #endif || backsector->ceilingpic != frontsector->ceilingpic || backsector->lightlevel != frontsector->lightlevel @@ -2092,13 +2094,21 @@ void R_StoreWallRange(INT32 start, INT32 stop) // and doesn't need to be marked. if (frontsector->heightsec == -1) { - if (frontsector->floorheight >= viewz) + if (( +#ifdef ESLOPE + frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : +#endif + frontsector->floorheight) >= viewz) { // above view plane markfloor = false; } - if (frontsector->ceilingheight <= viewz && + if (( +#ifdef ESLOPE + frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : +#endif + frontsector->ceilingheight) <= viewz && frontsector->ceilingpic != skyflatnum) { // below view plane From 12202d94a99e8003b8861d6b398a8bb4984d597c Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 20 Apr 2015 12:18:56 -0500 Subject: [PATCH 006/364] Fix calculation of slope extent, whoops --- src/p_slopes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 23ba35f58..44f05dedd 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -196,7 +196,7 @@ static float P_GetExtent(sector_t *sector, line_t *line, v3float_t *o, v2float_t // dist = fabs((double(line->v1->y) - vert->y) * line->dx - (double(line->v1->x) - vert->x) * line->dy); //dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y); P_ClosestPointOnLine(li->v1->x, li->v1->y, line, &tempv); - dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, line->v1->x, line->v1->y)); + dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, li->v1->x, li->v1->y)); if(dist > fardist) fardist = dist; From f4ea285f028ec2c838142bebe91259e096f2f36f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 20 Apr 2015 12:31:30 -0500 Subject: [PATCH 007/364] Fix vertical linedefs on slopes rendering improperly --- src/r_segs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 2cb04b25e..c313c955c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1517,7 +1517,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // left temp = xtoviewangle[start]+viewangle; - if (curline->v1->x == curline->v2->x) { + /*if (curline->v1->x == curline->v2->x) { // Line seg is vertical, so no line-slope form for it tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); @@ -1530,7 +1530,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) segleft.x = viewx; segleft.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); - } else { + } else */{ // Both lines can be written in slope-intercept form, so figure out line intersection float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... @@ -1551,7 +1551,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // right temp = xtoviewangle[stop]+viewangle; - if (curline->v1->x == curline->v2->x) { + /*if (curline->v1->x == curline->v2->x) { // Line seg is vertical, so no line-slope form for it tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); @@ -1564,7 +1564,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) segright.x = viewx; segright.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); - } else { + } else */{ // Both lines can be written in slope-intercept form, so figure out line intersection float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... From 7703eae0e8d531e986149324b97783a44bc6b8d3 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 20 Apr 2015 13:25:39 -0500 Subject: [PATCH 008/364] Actually fix slope generation (also whitespace stuff) --- src/p_slopes.c | 363 +++++++++++++++++++++++++------------------------ 1 file changed, 182 insertions(+), 181 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 44f05dedd..2c18d3611 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright(C) 2004 Stephen McGranahan @@ -7,12 +7,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -45,7 +45,7 @@ // // Alocates and fill the contents of a slope structure. // -static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, +static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, const float zdelta, boolean isceiling) { pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); @@ -59,7 +59,7 @@ static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, ret->d.y = FLOAT_TO_FIXED(ret->df.y = d->y); ret->zdelta = FLOAT_TO_FIXED(ret->zdeltaf = zdelta); - + // d = direction (v2float_t) // // direction.x = line->nx; @@ -101,9 +101,9 @@ static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, // Cross product length len = (float)sqrt(ret->normalf.x * ret->normalf.x + - ret->normalf.y * ret->normalf.y + + ret->normalf.y * ret->normalf.y + ret->normalf.z * ret->normalf.z); - + #ifdef SLOPETHINGS if (len == 0) { @@ -117,18 +117,18 @@ static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, ret->normalf.x /= len; ret->normalf.y /= len; ret->normalf.z /= len; - + // ZDoom // cross = ret->normalf - + // Fix backward normals if ((ret->normalf.z < 0 && !isceiling) || (ret->normalf.z > 0 && isceiling)) { ret->normalf.x = -ret->normalf.x; ret->normalf.y = -ret->normalf.x; ret->normalf.z = -ret->normalf.x; - } - + } + } return ret; @@ -200,10 +200,11 @@ static float P_GetExtent(sector_t *sector, line_t *line, v3float_t *o, v2float_t if(dist > fardist) fardist = dist; - // We shouldn't have to do this for v2... -Red - /*dist = (float)fabs((FIXED_TO_FLOAT(li->v2->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v2->y) - o->y) * d->y); + // Okay, maybe do it for v2 as well? + P_ClosestPointOnLine(li->v2->x, li->v2->y, line, &tempv); + dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, li->v2->x, li->v2->y)); if(dist > fardist) - fardist = dist;*/ + fardist = dist; } return fardist; @@ -228,72 +229,72 @@ void P_SpawnSlope_Line(int linenum) v3float_t origin, point; v2float_t direction; float dz, extent; - + boolean frontfloor = (special == 386 || special == 388 || special == 393); boolean backfloor = (special == 389 || special == 391 || special == 392); boolean frontceil = (special == 387 || special == 388 || special == 392); boolean backceil = (special == 390 || special == 391 || special == 393); - + if(!frontfloor && !backfloor && !frontceil && !backceil) { CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n"); return; } - + if(!line->frontsector || !line->backsector) { CONS_Printf("P_SpawnSlope_Line used on a line without two sides.\n"); return; } - + // SRB2CBTODO: Transform origin relative to the bounds of an individual FOF origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; - + // For FOF slopes, make a special function to copy to the xy origin & direction relative to the position of the FOF on the map! if(frontfloor || frontceil) { origin.z = FIXED_TO_FLOAT(line->backsector->floorheight); direction.x = line->nx; direction.y = line->ny; - + extent = P_GetExtent(line->frontsector, line, &origin, &direction); - + if(extent < 0.0f) { CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum); return; } - + // reposition the origin according to the extent point.x = origin.x + direction.x * extent; point.y = origin.y + direction.y * extent; direction.x = -direction.x; direction.y = -direction.y; - + // TODO: We take origin and point 's xy values and translate them to the center of an FOF! - + if(frontfloor) { - + point.z = FIXED_TO_FLOAT(line->frontsector->floorheight); // Startz dz = (FIXED_TO_FLOAT(line->backsector->floorheight) - point.z) / extent; // Destinationz - + // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef - + int slopeangle = 0; // All floors by default have no slope (an angle of 0, completely flat) - + v3float_t A = origin; // = line source v3float_t B = point; // destination's value v3float_t C = origin; // Point used to make a right triangle from A & B - + C.z = point.z; - + // To find the "angle" of a slope, we make a right triangle out of the points we have, // point A - is point 1 of the hypotenuse, // point B - is point 2 of the hypotenuse // point C - has the same Z value as point b, and the same XY value as A - // + // // We want to find the angle accross from the right angle // so we use some triginometry to find the angle(fun, right?) // We want to find the tanjent of this angle, this is: @@ -304,54 +305,54 @@ void P_SpawnSlope_Line(int linenum) float triangopplength = abs(B.z - A.z); float triangadjlength = sqrt((B.x-C.x)*(B.x-C.x) + (B.y - C.y)*(B.y - C.y)); //float trianghyplength = sqrt(triangopplength*triangopplength + triangadjlength*triangadjlength); // This is the hypotenuse - + // So tanjent = opposite divided by adjecent float tanrelat = triangopplength/ triangadjlength; // tanjent = opposite / adjecent slopeangle = atan(tanrelat)* 180 / M_PI; // Now we use atan: *180 /M_PI is needed to convert the value into degrees - - fslope = line->frontsector->f_slope = + + fslope = line->frontsector->f_slope = P_MakeSlope(&point, &direction, dz, false); - + // Now remember that f_slope IS a vector // fslope->o = origin 3D point 1 of the vector // fslope->d = destination 3D point 2 of the vector // fslope->normal is a 3D line perpendicular to the 3D vector - + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? line->frontsector->f_slope->sourceline = line; - + // To find the real highz/lowz of a slope, you need to check all the vertexes // in the slope's sector with P_GetZAt to get the REAL lowz & highz // Although these slopes are set by floorheights the ANGLE is what a slope is, // so technically any slope can extend on forever (they are just bound by sectors) // *You can use sourceline as a reference to see if two slopes really are the same - + // Default points for high and low fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; highest = FLOAT_TO_FIXED(highest); lowest = FLOAT_TO_FIXED(lowest); - + // Now check to see what the REAL high and low points of the slope inside the sector size_t l; - + for (l = 0; l < line->frontsector->linecount; l++) { if (P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) > highest) highest = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); - + if (P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) < lowest) lowest = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); } - + // Sets extra clipping data for the frontsector's slope fslope->highz = line->frontsector->f_slope->highz = highest; fslope->lowz = line->frontsector->f_slope->lowz = lowest; - + fslope->zangle = slopeangle; fslope->xydirection = R_PointToAngle2(FLOAT_TO_FIXED(A.x), FLOAT_TO_FIXED(A.y), FLOAT_TO_FIXED(B.x), FLOAT_TO_FIXED(B.y))/(ANGLE_45/45); - + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); // ZDoom secplane port! YAY // ret = f_slope or c_slope @@ -359,48 +360,48 @@ void P_SpawnSlope_Line(int linenum) srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) or FLOAT_TO_FIXED(1.0f/cross[2]); - - // destheight takes the destination height used in dz + + // destheight takes the destination height used in dz srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, // x srcplane->b, line->v1->y, // y srcplane->c, line->backsector->floorheight); // z - + // Sync the secplane! fslope->secplane = line->frontsector->f_slope->secplane = *srcplane; - + } if(frontceil) { point.z = FIXED_TO_FLOAT(line->frontsector->ceilingheight); dz = (FIXED_TO_FLOAT(line->backsector->ceilingheight) - point.z) / extent; - - cslope = line->frontsector->c_slope = + + cslope = line->frontsector->c_slope = P_MakeSlope(&point, &direction, dz, true); - + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? line->frontsector->c_slope->sourceline = line; - + // Remember the way the slope is formed fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; highest = FLOAT_TO_FIXED(highest); lowest = FLOAT_TO_FIXED(lowest); size_t l; - + for (l = 0; l < line->frontsector->linecount; l++) { if (P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) > highest) highest = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); - + if (P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) < lowest) lowest = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); } - + // This line special sets extra clipping data for the frontsector's slope cslope->highz = line->frontsector->c_slope->highz = highest; cslope->lowz = line->frontsector->c_slope->lowz = lowest; - + // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: //cslope->zangle = line->frontsector->c_slope->zangle = P_GetSlopezangle(line->frontsector, highvert, lowvert); //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); @@ -422,11 +423,11 @@ void P_SpawnSlope_Line(int linenum) //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz + // destheight takes the destination height used in dz srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, srcplane->b, line->v1->y, srcplane->c, line->backsector->ceilingheight); - + // Sync the secplane! cslope->secplane = line->frontsector->c_slope->secplane = *srcplane; } @@ -437,46 +438,46 @@ void P_SpawnSlope_Line(int linenum) // Backsector direction.x = -line->nx; direction.y = -line->ny; - + extent = P_GetExtent(line->backsector, line, &origin, &direction); - + if(extent < 0.0f) { CONS_Printf("P_SpawnSlope_Line failed to get backsector extent on line number %i\n", linenum); return; } - + // reposition the origin according to the extent point.x = origin.x + direction.x * extent; point.y = origin.y + direction.y * extent; direction.x = -direction.x; direction.y = -direction.y; - + if(backfloor) { point.z = FIXED_TO_FLOAT(line->backsector->floorheight); dz = (FIXED_TO_FLOAT(line->frontsector->floorheight) - point.z) / extent; - - fslope = line->backsector->f_slope = + + fslope = line->backsector->f_slope = P_MakeSlope(&point, &direction, dz, false); - + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? line->backsector->f_slope->sourceline = line; - + int slopeangle = 0; // All floors by default have no slope (an angle of 0) - + v3float_t A = origin; // = line source v3float_t B = point; // destination's value v3float_t C = origin; - + C.z = point.z; - + // To find the "angle" of a slope, we make a right triangle out of the points we have, // point A - is point 1 of the hypotenuse, // point B - is point 2 of the hypotenuse // point C - has the same Z value as point b, and the same XY value as A - // + // // We want to find the angle accross from the right angle // so we use some triginometry to find the angle(fun, right?) // We want to find the tanjent of this angle, this is: @@ -487,31 +488,31 @@ void P_SpawnSlope_Line(int linenum) float triangopplength = abs(B.z - A.z); float triangadjlength = sqrt((B.x-C.x)*(B.x-C.x) + (B.y - C.y)*(B.y - C.y)); //float trianghyplength = sqrt(triangopplength*triangopplength + triangadjlength*triangadjlength); // This is the hypotenuse - + // So tanjent = opposite divided by adjecent float tanrelat = triangopplength/ triangadjlength; // tanjent = opposite / adjecent slopeangle = atan(tanrelat)* 180 / M_PI; // Now we use atan - *180 /M_PI is needed to convert the value into degrees - + // Remember the way the slope is formed fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; highest = FLOAT_TO_FIXED(highest); lowest = FLOAT_TO_FIXED(lowest); size_t l; - + for (l = 0; l < line->backsector->linecount; l++) { if (P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) > highest) highest = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); - + if (P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) < lowest) lowest = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); } - + // This line special sets extra clipping data for the frontsector's slope fslope->highz = line->backsector->f_slope->highz = highest; fslope->lowz = line->backsector->f_slope->lowz = lowest; - + fslope->zangle = slopeangle; // Get slope XY angle with secplane_t secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); @@ -531,11 +532,11 @@ void P_SpawnSlope_Line(int linenum) //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz + // destheight takes the destination height used in dz srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, srcplane->b, line->v1->y, srcplane->c, line->frontsector->floorheight); - + // Sync the secplane! fslope->secplane = line->backsector->f_slope->secplane = *srcplane; } @@ -543,35 +544,35 @@ void P_SpawnSlope_Line(int linenum) { point.z = FIXED_TO_FLOAT(line->backsector->ceilingheight); dz = (FIXED_TO_FLOAT(line->frontsector->ceilingheight) - point.z) / extent; - - cslope = line->backsector->c_slope = + + cslope = line->backsector->c_slope = P_MakeSlope(&point, &direction, dz, true); - + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? line->backsector->c_slope->sourceline = line; - + // Remember the way the slope is formed fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; highest = FLOAT_TO_FIXED(highest); lowest = FLOAT_TO_FIXED(lowest); - + size_t l; - + for (l = 0; l < line->backsector->linecount; l++) { if (P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) > highest) highest = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); - + if (P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) < lowest) lowest = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); } - + // This line special sets extra clipping data for the backsector's slope cslope->highz = line->backsector->c_slope->highz = highest; cslope->lowz = line->backsector->c_slope->lowz = lowest; - + // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: //cslope->zangle = line->backsector->c_slope->zangle = P_GetSlopezangle(line->backsector, highvert, lowvert); //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); @@ -593,16 +594,16 @@ void P_SpawnSlope_Line(int linenum) //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz + // destheight takes the destination height used in dz srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, srcplane->b, line->v1->y, srcplane->c, line->frontsector->ceilingheight); - + // Sync the secplane! cslope->secplane = line->backsector->c_slope->secplane = *srcplane; } } - + if(!line->tag) return; } @@ -657,12 +658,12 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) mapthing_t *mt; boolean vt_found = false; size_t i, j, k, l, q; - + //size_t i; //mapthing_t *mt; char *data; char *datastart; - + // SRB2CBTODO: WHAT IS (5 * sizeof (short))?! It = 10 // anything else seems to make a map not load properly, // but this hard-coded value MUST have some reason for being what it is @@ -683,34 +684,34 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) mt->options = READINT16(data); // mt->z hasn't been set yet! //mt->extrainfo = (byte)(mt->type >> 12); // slope things are special, they have a bigger range of types - + //mt->type &= 4095; // SRB2CBTODO: WHAT IS THIS???? Mobj type limits?!!!! x = mt->x*FRACUNIT; y = mt->y*FRACUNIT; sector = R_PointInSubsector(x, y)->sector; // Z for objects -#ifdef ESLOPE +#ifdef ESLOPE if (sector->f_slope) mt->z = (short)(P_GetZAt(sector->f_slope, x, y)>>FRACBITS); else #endif mt->z = (short)(sector->floorheight>>FRACBITS); - + mt->z = mt->z + (mt->options >> ZSHIFT); - + if (mt->type == THING_VertexFloorZ || mt->type == THING_VertexCeilingZ) // THING_VertexFloorZ { for(l = 0; l < numvertexes; l++) { if (vertexes[l].x == mt->x*FRACUNIT && vertexes[l].y == mt->y*FRACUNIT) { - if (mt->type == THING_VertexFloorZ) + if (mt->type == THING_VertexFloorZ) { vertexes[l].z = mt->z*FRACUNIT; //I_Error("Z value: %i", vertexes[l].z/FRACUNIT); - + } - else + else { vertexes[l].z = mt->z*FRACUNIT; // celing floor } @@ -718,41 +719,41 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) } } //mt->type = 0; // VPHYSICS: Dynamic slopes - - - - - - + + + + + + if (vt_found) { for (k = 0; k < numsectors; k++) { sector_t *sec = §ors[k]; if (sec->linecount != 3) continue; // only works with triangular sectors - + v3float_t vt1, vt2, vt3; // cross = ret->normalf v3float_t vec1, vec2; - + int vi1, vi2, vi3; - + vi1 = (int)(sec->lines[0]->v1 - vertexes); vi2 = (int)(sec->lines[0]->v2 - vertexes); vi3 = (sec->lines[1]->v1 == sec->lines[0]->v1 || sec->lines[1]->v1 == sec->lines[0]->v2)? (int)(sec->lines[1]->v2 - vertexes) : (int)(sec->lines[1]->v1 - vertexes); - + //if (vertexes[vi1].z) // I_Error("OSNAP %i", vertexes[vi1].z/FRACUNIT); //if (vertexes[vi2].z) // I_Error("OSNAP %i", vertexes[vi2].z/FRACUNIT); //if (vertexes[vi3].z) // I_Error("OSNAP %i", vertexes[vi3].z/FRACUNIT); - + //I_Error("%i, %i", mt->z*FRACUNIT, vertexes[vi1].z); - + //I_Error("%i, %i, %i", mt->x, mt->y, mt->z); //P_SpawnMobj(mt->x*FRACUNIT, mt->y*FRACUNIT, mt->z*FRACUNIT, MT_RING); - + // TODO: Make sure not to spawn in the same place 2x! (we need an object in every vertex of the // triangle sector to setup the real vertex slopes // Check for the vertexes of all sectors @@ -780,31 +781,31 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) continue; } } - + vt1.x = FIXED_TO_FLOAT(vertexes[vi1].x); vt1.y = FIXED_TO_FLOAT(vertexes[vi1].y); vt2.x = FIXED_TO_FLOAT(vertexes[vi2].x); vt2.y = FIXED_TO_FLOAT(vertexes[vi2].y); vt3.x = FIXED_TO_FLOAT(vertexes[vi3].x); vt3.y = FIXED_TO_FLOAT(vertexes[vi3].y); - + for(j = 0; j < 2; j++) { - + fixed_t z3; //I_Error("Lo hicimos"); - + vt1.z = mt->z;//FIXED_TO_FLOAT(j==0 ? sec->floorheight : sec->ceilingheight); vt2.z = mt->z;//FIXED_TO_FLOAT(j==0? sec->floorheight : sec->ceilingheight); z3 = mt->z;//j==0? sec->floorheight : sec->ceilingheight; // Destination height vt3.z = FIXED_TO_FLOAT(z3); - + if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0) { vec1.x = vt2.x - vt3.x; vec1.y = vt2.y - vt3.y; vec1.z = vt2.z - vt3.z; - + vec2.x = vt1.x - vt3.x; vec2.y = vt1.y - vt3.y; vec2.z = vt1.z - vt3.z; @@ -814,24 +815,24 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) vec1.x = vt1.x - vt3.x; vec1.y = vt1.y - vt3.y; vec1.z = vt1.z - vt3.z; - + vec2.x = vt2.x - vt3.x; vec2.y = vt2.y - vt3.y; vec2.z = vt2.z - vt3.z; } - - + + pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); memset(ret, 0, sizeof(*ret)); - + { M_CrossProduct3f(&ret->normalf, &vec1, &vec2); - + // Cross product length float len = (float)sqrt(ret->normalf.x * ret->normalf.x + - ret->normalf.y * ret->normalf.y + + ret->normalf.y * ret->normalf.y + ret->normalf.z * ret->normalf.z); - + if (len == 0) { // Only happens when all vertices in this sector are on the same line. @@ -843,7 +844,7 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) ret->normalf.x /= len; ret->normalf.y /= len; ret->normalf.z /= len; - + // ZDoom cross = ret->normalf // Fix backward normals if ((ret->normalf.z < 0 && j == 0) || (ret->normalf.z > 0 && j == 1)) @@ -852,11 +853,11 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) ret->normalf.x = -ret->normalf.x; ret->normalf.y = -ret->normalf.x; ret->normalf.z = -ret->normalf.x; - } + } } - + secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - + srcplane->a = FLOAT_TO_FIXED (ret->normalf.x); srcplane->b = FLOAT_TO_FIXED (ret->normalf.y); srcplane->c = FLOAT_TO_FIXED (ret->normalf.z); @@ -864,7 +865,7 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x, srcplane->b, vertexes[vi3].y, srcplane->c, z3); - + if (j == 0) { sec->f_slope = ret; @@ -876,20 +877,20 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) sec->c_slope->secplane = *srcplane; } } - } + } } - - - - - - - - + + + + + + + + } } Z_Free(datastart); - + #if 0 // UDMF support for(i = 0; i < numvertexdatas; i++) { @@ -898,23 +899,23 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) vt_heights[1][i] = vertexdatas[i].zCeiling; vt_found = true; } - + if (vertexdatas[i].flags & VERTEXFLAG_ZFloorEnabled) { vt_heights[0][i] = vertexdatas[i].zFloor; vt_found = true; } } - + // If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed. delete[] vertexdatas; vertexdatas = NULL; numvertexdatas = 0; #endif - - - + + + } #include "p_maputl.h" @@ -923,13 +924,13 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, boolean slopeCeil) { int linenum = -1; - + while ((linenum = P_FindLineFromID (lineid, linenum)) != -1) { const line_t *line = &lines[linenum]; sector_t *sec; secplane_t *plane; - + if (P_PointOnLineSide (x, y, line) == 0) { sec = line->frontsector; @@ -950,9 +951,9 @@ static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, bo { plane = &sec->floorplane; } - + FVector3 p, v1, v2, cross; - + p[0] = FIXED2FLOAT (line->v1->x); p[1] = FIXED2FLOAT (line->v1->y); p[2] = FIXED2FLOAT (plane->ZatPoint (line->v1->x, line->v1->y)); @@ -962,7 +963,7 @@ static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, bo v2[0] = FIXED2FLOAT (x - line->v1->x); v2[1] = FIXED2FLOAT (y - line->v1->y); v2[2] = FIXED2FLOAT (z) - p[2]; - + cross = v1 ^ v2; double len = cross.Length(); if (len == 0) @@ -976,7 +977,7 @@ static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, bo { cross = -cross; } - + plane->a = FLOAT2FIXED (cross[0]); plane->b = FLOAT2FIXED (cross[1]); plane->c = FLOAT2FIXED (cross[2]); @@ -989,7 +990,7 @@ static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, bo } #else #if 0 -// P_SlopeLineToPoint, start from a specific linedef number(not tag) and slope to a mapthing with the angle of the linedef +// P_SlopeLineToPoint, start from a specific linedef number(not tag) and slope to a mapthing with the angle of the linedef static void P_SlopeLineToPoint(int linenum) { line_t *line = lines + linenum; @@ -998,73 +999,73 @@ static void P_SlopeLineToPoint(int linenum) v3float_t origin, point; v2float_t direction; float dz, extent; - + boolean frontfloor = (special == 386 || special == 388 || special == 393); boolean backfloor = (special == 389 || special == 391 || special == 392); boolean frontceil = (special == 387 || special == 388 || special == 392); boolean backceil = (special == 390 || special == 391 || special == 393); - + // SoM: We don't need the line to retain its special type line->special = 0; //SRB2CBTODO: ESLOPE: Maybe we do need it for another to check for a plane slope? - + if(!frontfloor && !backfloor && !frontceil && !backceil) { CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n"); return; } - + if(!line->frontsector || !line->backsector) { CONS_Printf("P_SpawnSlope_Line used on a line without two sides.\n"); return; } - + origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; - + if(frontfloor || frontceil) { // Do the front sector direction.x = line->nx; direction.y = line->ny; - + extent = P_GetExtent(line->frontsector, line, &origin, &direction); - + if(extent < 0.0f) { CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum); return; } - + // reposition the origin according to the extent point.x = origin.x + direction.x * extent; point.y = origin.y + direction.y * extent; direction.x = -direction.x; direction.y = -direction.y; - + // CONS_Printf("Test: X: %f, Y: %f\n", origin.x, origin.y); - + if(frontfloor) { point.z = FIXED_TO_FLOAT(line->frontsector->floorheight); // Startz dz = (FIXED_TO_FLOAT(line->backsector->floorheight) - point.z) / extent; // Destinationz - - fslope = line->frontsector->f_slope = + + fslope = line->frontsector->f_slope = P_MakeSlope(&point, &direction, dz, false); - + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? line->frontsector->f_slope->sourceline = line; - + // Remember the way the slope is formed - fixed_t highest = line->frontsector->floorheight > line->backsector->floorheight ? + fixed_t highest = line->frontsector->floorheight > line->backsector->floorheight ? line->frontsector->floorheight : line->backsector->floorheight; - fixed_t lowest = line->frontsector->floorheight < line->backsector->floorheight ? + fixed_t lowest = line->frontsector->floorheight < line->backsector->floorheight ? line->frontsector->floorheight : line->backsector->floorheight; // This line special sets extra clipping data for the frontsector's slope fslope->highz = line->frontsector->f_slope->highz = highest; fslope->lowz = line->frontsector->f_slope->lowz = lowest; - + // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: //fslope->zangle = line->frontsector->f_slope->zangle = P_GetSlopezangle(line->frontsector, highvert, lowvert); //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); @@ -1086,14 +1087,14 @@ static void P_SlopeLineToPoint(int linenum) //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz + // destheight takes the destination height used in dz srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, srcplane->b, line->v1->y, srcplane->c, line->backsector->floorheight); - + // Sync the secplane! fslope->secplane = line->frontsector->f_slope->secplane = *srcplane; - + } } } @@ -1111,7 +1112,7 @@ static void P_SlopeLineToPoint(int linenum) void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) { FMapThing *mt; - + for (mt = firstmt; mt < lastmt; ++mt) { if ((mt->type >= THING_SlopeFloorPointLine && @@ -1121,7 +1122,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) fixed_t x, y, z; secplane_t *refplane; sector_t *sec; - + x = mt->x; y = mt->y; sec = P_PointInSector (x, y); @@ -1136,7 +1137,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) z = refplane->ZatPoint (x, y) + (mt->z); if (mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling) { - P_VavoomSlope(sec, mt->thingid, x, y, mt->z, mt->type & 1); + P_VavoomSlope(sec, mt->thingid, x, y, mt->z, mt->type & 1); } else if (mt->type <= THING_SlopeCeilingPointLine) { @@ -1149,7 +1150,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) mt->type = 0; } } - + for (mt = firstmt; mt < lastmt; ++mt) { if (mt->type == THING_CopyFloorPlane || @@ -1159,7 +1160,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) mt->type = 0; } } - + P_SetSlopesFromVertexHeights(firstmt, lastmt); } #endif @@ -1194,7 +1195,7 @@ float P_GetZAtf(pslope_t *slope, float x, float y) { //if (!slope) // SRB2CBTODO: keep this when done with debugging // I_Error("P_GetZAtf: slope parameter is NULL"); - + float dist = (x - slope->of.x) * slope->df.x + (y - slope->of.y) * slope->df.y; return slope->of.z + (dist * slope->zdeltaf); } @@ -1202,10 +1203,10 @@ float P_GetZAtf(pslope_t *slope, float x, float y) // // P_DistFromPlanef // -float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, +float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, const v3float_t *pnormal) { - return (point->x - pori->x) * pnormal->x + + return (point->x - pori->x) * pnormal->x + (point->y - pori->y) * pnormal->y + (point->z - pori->z) * pnormal->z; } From f130a529b1e2c21b51dace958ca55b22e374a670 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Tue, 21 Apr 2015 10:01:51 -0500 Subject: [PATCH 009/364] make stupid slopes render on stupid unix stupids --- src/r_draw8.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 6a240c349..86b06089e 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -535,8 +535,7 @@ void R_DrawTiltedSpan_8(void) // x1, x2 = ds_x1, ds_x2 int width = ds_x2 - ds_x1; double iz, uz, vz; - BYTE *fb; - DWORD u, v; + UINT32 u, v; int i; UINT8 *source; From bac34d783e7238282bc9fcac06fc6796623efbc8 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 25 Apr 2015 20:39:18 -0500 Subject: [PATCH 010/364] Fix crash with ceiling slopes and line collisions --- src/p_maputl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 2f65ea8de..f0a08883c 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -357,7 +357,7 @@ void P_CameraLineOpening(line_t *linedef) if (sectors[front->camsec].c_slope) frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y); #endif - + } else if (front->heightsec >= 0) { @@ -463,7 +463,7 @@ void P_CameraLineOpening(line_t *linedef) /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); - + if (rover->b_slope) bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); #endif // ESLOPE*/ @@ -494,7 +494,7 @@ void P_CameraLineOpening(line_t *linedef) /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); - + if (rover->b_slope) bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); #endif // ESLOPE*/ @@ -642,7 +642,7 @@ void P_LineOpening(line_t *linedef) if (front->c_slope) highceiling = P_GetZAt(front->c_slope, tmthing->x, tmthing->y); } - if (front->c_slope && front->floorheight < back->floorheight) + if (front->f_slope && front->floorheight < back->floorheight) { openbottom = P_GetZAt(front->f_slope, tmthing->x, tmthing->y); if (back->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); @@ -683,11 +683,11 @@ void P_LineOpening(line_t *linedef) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; - + /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); - + if (rover->b_slope) bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); #endif*/ @@ -730,7 +730,7 @@ void P_LineOpening(line_t *linedef) /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, tmthing->x, tmthing->y); - + if (rover->b_slope) bottomheight = P_GetZAt(rover->b_slope, tmthing->x, tmthing->y); #endif*/ From 5070a964b962ac91361e9f7448a09f8900ae4e81 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 25 Apr 2015 22:22:50 -0500 Subject: [PATCH 011/364] Starting to clean up a bit of Kal's mess I still don't know why Git reacts so strangely to the new files' line breaks... --- src/m_fixed.h | 22 ---- src/m_vector.c | 262 ++++++++++++++++++++++----------------------- src/p_slopes.c | 285 +------------------------------------------------ 3 files changed, 135 insertions(+), 434 deletions(-) diff --git a/src/m_fixed.h b/src/m_fixed.h index 8bf160204..92b992632 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -357,28 +357,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x) return INT32_MAX; } -/*! - \brief convert a fixed_t number into double floating number - */ -#define FIXED_TO_DOUBLE(f) ((double)((f) / FRACUNIT)) - -/*! - \brief convert a double floating number into fixed_t number - */ -#define DOUBLE_TO_FIXED(f) ((fixed_t)((f) * FRACUNIT)) - -/*! - \brief convert a integer into fixed_t number - */ -#define INT_TO_FIXED(x) ((int)((x) * FRACUNIT)) - -/*! - \brief convert a fixed_t number into integer - */ -#define FIXED_TO_INT(x) (((int)(x)) / (FRACUNIT)) - -static inline int DivScale32 (fixed_t a, fixed_t b) { return (fixed_t)(((INT64)a << 32) / b); } - #ifdef NEED_FIXED_VECTOR diff --git a/src/m_vector.c b/src/m_vector.c index af5189853..53b869adc 100644 --- a/src/m_vector.c +++ b/src/m_vector.c @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright(C) 2004 Stephen McGranahan @@ -7,12 +7,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -87,32 +87,32 @@ v3float_t *M_MakeVec3f(const v3float_t *point1, const v3float_t *point2, v3float return a_o; } -// +// // M_TranslateVec3 // // Translates the given vector (in the game's coordinate system) to the camera // space (in right-handed coordinate system) This function is used for slopes. -// +// void M_TranslateVec3(v3fixed_t *vec) { fixed_t tx, ty, tz; - + tx = vec->x - viewx; ty = viewz - vec->y; tz = vec->z - viewy; - + // Just like wall projection. vec->x = (tx * viewcos) - (tz * viewsin); vec->z = (tz * viewcos) + (tx * viewsin); vec->y = ty; } -// +// // M_TranslateVec3f // // Translates the given vector (in the game's coordinate system) to the camera // space (in right-handed coordinate system) This function is used for slopes. -// +// void M_TranslateVec3f(v3float_t *vec) { float tx, ty, tz; @@ -128,20 +128,20 @@ void M_TranslateVec3f(v3float_t *vec) } #ifdef SESLOPE -// +// // M_TranslateVec3d // // Translates the given vector (in the game's coordinate system) to the camera // space (in right-handed coordinate system) This function is used for slopes. -// +// void M_TranslateVec3d(v3double_t *vec) { double tx, ty, tz; - + tx = vec->x - viewx; // SRB2CBTODO: This may need float viewxyz ty = viewz - vec->y; tz = vec->z - viewy; - + // Just like wall projection. vec->x = (tx * viewcos) - (tz * viewsin); vec->z = (tz * viewcos) + (tx * viewsin); @@ -185,7 +185,7 @@ void M_SubVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) // SRB dest->z = v1->z - v2->z; } -// +// // M_SubVec3f // // Subtracts v2 from v1 stores in dest @@ -197,7 +197,7 @@ void M_SubVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) dest->z = v1->z - v2->z; } -// +// // M_DotVec3 // // Returns the dot product of v1 and v2 @@ -207,7 +207,7 @@ fixed_t M_DotVec3(const v3fixed_t *v1, const v3fixed_t *v2) return FixedMul(v1->x, v2->x) + FixedMul(v1->y, v2->y) + FixedMul(v1->z, v2->z); } -// +// // M_DotVec3f // // Returns the dot product of v1 and v2 @@ -216,13 +216,11 @@ float M_DotVec3f(const v3float_t *v1, const v3float_t *v2) { if (!v1 || !v2) I_Error("M_DotVec3f: No vertexes!"); - if (!(v1 || v2 || v1->x || v1->y || v1->z || v2->x || v2->y || v2->z)) - I_Error("M_DotVec3f: No vertexes!"); - return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); + return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); } #ifdef SESLOPE -// +// // M_DotVec3d // // Returns the dot product of v1 and v2 @@ -236,7 +234,7 @@ double M_DotVec3d(const v3double_t *v1, const v3double_t *v2) // // M_CrossProduct3 // -// Gets the cross product of v1 and v2 and stores in dest +// Gets the cross product of v1 and v2 and stores in dest // void M_CrossProduct3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) { @@ -250,7 +248,7 @@ void M_CrossProduct3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) // // M_CrossProduct3f // -// Gets the cross product of v1 and v2 and stores in dest +// Gets the cross product of v1 and v2 and stores in dest // void M_CrossProduct3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) { @@ -316,7 +314,7 @@ v3float_t *FV_Midpointf(const v3float_t *a_1, const v3float_t *a_2, v3float_t *a // This checks to see if a point is inside the ranges of a polygon // angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector2) -{ +{ // Remember, above we said that the Dot Product of returns the cosine of the angle // between 2 vectors? Well, that is assuming they are unit vectors (normalize vectors). // So, if we don't have a unit vector, then instead of just saying arcCos(DotProduct(A, B)) @@ -324,19 +322,19 @@ angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector // Here is the equation: arc cosine of (V . W / || V || * || W || ) // the || V || means the magnitude of V. This then cancels out the magnitudes dot product magnitudes. // But basically, if you have normalize vectors already, you can forget about the magnitude part. - + // Get the dot product of the vectors fixed_t dotProduct = M_DotVec3(Vector1, Vector2); - + // Get the product of both of the vectors magnitudes fixed_t vectorsMagnitude = FixedMul(FV_Magnitude(Vector1), FV_Magnitude(Vector2)); - + // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. return FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); } float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2) -{ +{ // Remember, above we said that the Dot Product of returns the cosine of the angle // between 2 vectors? Well, that is assuming they are unit vectors (normalize vectors). // So, if we don't have a unit vector, then instead of just saying arcCos(DotProduct(A, B)) @@ -344,13 +342,13 @@ float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2 // Here is the equation: arc cosine of (V . W / || V || * || W || ) // the || V || means the magnitude of V. This then cancels out the magnitudes dot product magnitudes. // But basically, if you have normalize vectors already, you can forget about the magnitude part. - + // Get the dot product of the vectors float dotProduct = M_DotVec3f(Vector1, Vector2); - + // Get the product of both of the vectors magnitudes float vectorsMagnitude = FV_Magnitudef(Vector1)*FV_Magnitudef(Vector2); - + // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. return acos(dotProduct/vectorsMagnitude); } @@ -370,7 +368,7 @@ float M_VectorPitch(v3float_t v) #include "z_zone.h" -// Returns pitch roll and yaw values, allows objects to align to a slope +// Returns pitch roll and yaw values, allows objects to align to a slope angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byte AngleAxis, float Rate) { CONS_Printf("P %f\n", Pitch); @@ -380,7 +378,7 @@ angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byt { float DestYaw = (atan2(v.z,v.x)* 180 / M_PI); float DestRoll = (atan2(v.y,v.x)* 180 / M_PI); - + Yaw = Yaw+(DestYaw-Yaw)*Rate; Roll = Roll+(DestRoll-Roll)*Rate; } @@ -388,7 +386,7 @@ angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byt { float DestPitch = (atan2(v.z,v.y)* 180 / M_PI); float DestRoll = (-atan2(v.x,v.y)* 180 / M_PI); - + Pitch = Pitch+(DestPitch-Pitch)*Rate; Roll = Roll+(DestRoll-Roll)*Rate; } @@ -396,19 +394,19 @@ angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byt { float DestPitch = (-atan2(v.y,v.z)* 180 / M_PI); float DestYaw = (-atan2(v.x,v.z)* 180 / M_PI); - + Pitch = Pitch+(DestPitch-Pitch)*Rate; Yaw = Yaw+(DestYaw-Yaw)*Rate; } - + angles3d_t *returnangles = Z_Malloc(sizeof(angles3d_t), PU_LEVEL, NULL); memset(returnangles, 0, sizeof(*returnangles)); returnangles->yaw = Yaw; returnangles->pitch = Pitch; returnangles->roll = Roll; - + return returnangles; - + } @@ -427,28 +425,28 @@ v3fixed_t *FV_SubO(const v3fixed_t *a_i, const v3fixed_t *a_c, v3fixed_t *a_o) boolean FV_Equal(const v3fixed_t *a_1, const v3fixed_t *a_2) { fixed_t Epsilon = FRACUNIT/FRACUNIT; - + if ((abs(a_2->x - a_1->x) > Epsilon) || (abs(a_2->y - a_1->y) > Epsilon) || (abs(a_2->z - a_1->z) > Epsilon)) { return true; } - + return false; } boolean FV_Equalf(const v3float_t *a_1, const v3float_t *a_2) { float Epsilon = 1.0f/1.0f; - + if ((abs(a_2->x - a_1->x) > Epsilon) || (abs(a_2->y - a_1->y) > Epsilon) || (abs(a_2->z - a_1->z) > Epsilon)) { return true; } - + return false; } @@ -461,12 +459,12 @@ void FV_Normal (const v3fixed_t *a_triangle, v3fixed_t *a_normal) { v3fixed_t a_1; v3fixed_t a_2; - + FV_Point2Vec(&a_triangle[2], &a_triangle[0], &a_1); FV_Point2Vec(&a_triangle[1], &a_triangle[0], &a_2); - + FV_Cross(&a_1, &a_2, a_normal); - + FV_NormalizeO(a_normal, a_normal); } @@ -474,30 +472,30 @@ void FV_Normal (const v3fixed_t *a_triangle, v3fixed_t *a_normal) // PlaneDistance // // Calculates distance between a plane and the origin. -// +// fixed_t FV_PlaneDistance(const v3fixed_t *a_normal, const v3fixed_t *a_point) -{ +{ return -(FixedMul(a_normal->x, a_point->x) + FixedMul(a_normal->y, a_point->y) + FixedMul(a_normal->z, a_point->z)); } boolean FV_IntersectedPlane(const v3fixed_t *a_triangle, const v3fixed_t *a_line, v3fixed_t *a_normal, fixed_t *originDistance) { fixed_t distance1 = 0, distance2 = 0; - + FV_Normal(a_triangle, a_normal); - + *originDistance = FV_PlaneDistance(a_normal, &a_triangle[0]); - + distance1 = (FixedMul(a_normal->x, a_line[0].x) + FixedMul(a_normal->y, a_line[0].y) + FixedMul(a_normal->z, a_line[0].z)) + *originDistance; - + distance2 = (FixedMul(a_normal->x, a_line[1].x) + FixedMul(a_normal->y, a_line[1].y) + FixedMul(a_normal->z, a_line[1].z)) + *originDistance; - + // Positive or zero number means no intersection if (FixedMul(distance1, distance2) >= 0) return false; - + return true; } @@ -522,7 +520,7 @@ fixed_t FV_PlaneIntersection(const v3fixed_t *pOrigin, const v3fixed_t *pNormal, // IntersectRaySphere // Input : rO - origin of ray in world space // rV - vector describing direction of ray in world space -// sO - Origin of sphere +// sO - Origin of sphere // sR - radius of sphere // Notes : Normalized directional vectors expected // Return: distance to sphere in world units, -1 if no intersection. @@ -532,15 +530,15 @@ fixed_t FV_IntersectRaySphere(const v3fixed_t *rO, const v3fixed_t *rV, const v3 v3fixed_t Q; fixed_t c, v, d; FV_SubO(sO, rO, &Q); - + c = FV_Magnitude(&Q); v = FV_Dot(&Q, rV); d = FixedMul(sR, sR) - (FixedMul(c,c) - FixedMul(v,v)); - + // If there was no intersection, return -1 if (d < 0*FRACUNIT) return (-1*FRACUNIT); - + // Return the distance to the [first] intersecting point return (v - FixedSqrt(d)); } @@ -554,15 +552,15 @@ v3fixed_t *FV_IntersectionPoint(const v3fixed_t *vNormal, const v3fixed_t *vLine { v3fixed_t vLineDir; // Variables to hold the point and the line's direction fixed_t Numerator = 0, Denominator = 0, dist = 0; - + // Here comes the confusing part. We need to find the 3D point that is actually // on the plane. Here are some steps to do that: - + // 1) First we need to get the vector of our line, Then normalize it so it's a length of 1 FV_Point2Vec(&vLine[1], &vLine[0], &vLineDir); // Get the Vector of the line FV_NormalizeO(&vLineDir, &vLineDir); // Normalize the lines vector - - + + // 2) Use the plane equation (distance = Ax + By + Cz + D) to find the distance from one of our points to the plane. // Here I just chose a arbitrary point as the point to find that distance. You notice we negate that // distance. We negate the distance because we want to eventually go BACKWARDS from our point to the plane. @@ -570,17 +568,17 @@ v3fixed_t *FV_IntersectionPoint(const v3fixed_t *vNormal, const v3fixed_t *vLine Numerator = - (FixedMul(vNormal->x, vLine[0].x) + // Use the plane equation with the normal and the line FixedMul(vNormal->y, vLine[0].y) + FixedMul(vNormal->z, vLine[0].z) + distance); - + // 3) If we take the dot product between our line vector and the normal of the polygon, // this will give us the cosine of the angle between the 2 (since they are both normalized - length 1). // We will then divide our Numerator by this value to find the offset towards the plane from our arbitrary point. Denominator = FV_Dot(vNormal, &vLineDir); // Get the dot product of the line's vector and the normal of the plane - + // Since we are using division, we need to make sure we don't get a divide by zero error // If we do get a 0, that means that there are INFINITE points because the the line is - // on the plane (the normal is perpendicular to the line - (Normal.Vector = 0)). + // on the plane (the normal is perpendicular to the line - (Normal.Vector = 0)). // In this case, we should just return any point on the line. - + if( Denominator == 0*FRACUNIT) // Check so we don't divide by zero { ReturnVec->x = vLine[0].x; @@ -588,7 +586,7 @@ v3fixed_t *FV_IntersectionPoint(const v3fixed_t *vNormal, const v3fixed_t *vLine ReturnVec->z = vLine[0].z; return ReturnVec; // Return an arbitrary point on the line } - + // We divide the (distance from the point to the plane) by (the dot product) // to get the distance (dist) that we need to move from our arbitrary point. We need // to then times this distance (dist) by our line's vector (direction). When you times @@ -601,13 +599,13 @@ v3fixed_t *FV_IntersectionPoint(const v3fixed_t *vNormal, const v3fixed_t *vLine // way down the line's length. The distance from the plane is short, but the distance from // the actual intersection point is pretty long. If we divide the distance by the dot product // of our line vector and the normal of the plane, we get the correct length. Cool huh? - + dist = FixedDiv(Numerator, Denominator); // Divide to get the multiplying (percentage) factor - + // Now, like we said above, we times the dist by the vector, then add our arbitrary point. // This essentially moves the point along the vector to a certain distance. This now gives // us the intersection point. Yay! - + // Return the intersection point ReturnVec->x = vLine[0].x + FixedMul(vLineDir.x, dist); ReturnVec->y = vLine[0].y + FixedMul(vLineDir.y, dist); @@ -639,16 +637,16 @@ unsigned int FV_PointOnLineSide(const v3fixed_t *point, const v3fixed_t *line) boolean FV_PointInsideBox(const v3fixed_t *point, const v3fixed_t *box) { v3fixed_t lastLine[2]; - + FV_Load(&lastLine[0], box[3].x, box[3].y, box[3].z); FV_Load(&lastLine[1], box[0].x, box[0].y, box[0].z); - + if (FV_PointOnLineSide(point, &box[0]) || FV_PointOnLineSide(point, &box[1]) || FV_PointOnLineSide(point, &box[2]) || FV_PointOnLineSide(point, lastLine)) return false; - + return true; } // @@ -660,7 +658,7 @@ void FM_LoadIdentity(fmatrix_t* matrix) { #define M(row,col) matrix->m[col * 4 + row] memset(matrix, 0x00, sizeof(fmatrix_t)); - + M(0, 0) = FRACUNIT; M(1, 1) = FRACUNIT; M(2, 2) = FRACUNIT; @@ -679,29 +677,29 @@ void FM_CreateObjectMatrix(fmatrix_t *matrix, fixed_t x, fixed_t y, fixed_t z, f v3fixed_t upcross; v3fixed_t upvec; v3fixed_t basevec; - + FV_Load(&upvec, upx, upy, upz); FV_Load(&basevec, anglex, angley, anglez); FV_Cross(&upvec, &basevec, &upcross); FV_Normalize(&upcross); - + FM_LoadIdentity(matrix); - + matrix->m[0] = upcross.x; matrix->m[1] = upcross.y; matrix->m[2] = upcross.z; matrix->m[3] = 0*FRACUNIT; - + matrix->m[4] = upx; matrix->m[5] = upy; matrix->m[6] = upz; matrix->m[7] = 0; - + matrix->m[8] = anglex; matrix->m[9] = angley; matrix->m[10] = anglez; matrix->m[11] = 0; - + matrix->m[12] = x - FixedMul(upx,radius); matrix->m[13] = y - FixedMul(upy,radius); matrix->m[14] = z - FixedMul(upz,radius); @@ -720,12 +718,12 @@ void FM_MultMatrixVec(const fmatrix_t *matrix, const v3fixed_t *vec, v3fixed_t * + FixedMul(vec->y,M(0, 1)) + FixedMul(vec->z,M(0, 2)) + M(0, 3); - + out->y = FixedMul(vec->x,M(1, 0)) + FixedMul(vec->y,M(1, 1)) + FixedMul(vec->z,M(1, 2)) + M(1, 3); - + out->z = FixedMul(vec->x,M(2, 0)) + FixedMul(vec->y,M(2, 1)) + FixedMul(vec->z,M(2, 2)) @@ -745,15 +743,15 @@ void FM_MultMatrix(fmatrix_t *dest, const fmatrix_t *multme) #define M(row,col) multme->m[col * 4 + row] #define D(row,col) dest->m[col * 4 + row] #define R(row,col) result.m[col * 4 + row] - + for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) R(i, j) = FixedMul(D(i, 0),M(0, j)) + FixedMul(D(i, 1),M(1, j)) + FixedMul(D(i, 2),M(2, j)) + FixedMul(D(i, 3),M(3, j)); } - + M_Memcpy(dest, &result, sizeof(fmatrix_t)); - + #undef R #undef D #undef M @@ -768,14 +766,14 @@ void FM_Translate(fmatrix_t *dest, fixed_t x, fixed_t y, fixed_t z) { fmatrix_t trans; #define M(row,col) trans.m[col * 4 + row] - + memset(&trans, 0x00, sizeof(fmatrix_t)); - + M(0, 0) = M(1, 1) = M(2, 2) = M(3, 3) = FRACUNIT; M(0, 3) = x; M(1, 3) = y; M(2, 3) = z; - + FM_MultMatrix(dest, &trans); #undef M } @@ -789,14 +787,14 @@ void FM_Scale(fmatrix_t *dest, fixed_t x, fixed_t y, fixed_t z) { fmatrix_t scale; #define M(row,col) scale.m[col * 4 + row] - + memset(&scale, 0x00, sizeof(fmatrix_t)); - + M(3, 3) = FRACUNIT; M(0, 0) = x; M(1, 1) = y; M(2, 2) = z; - + FM_MultMatrix(dest, &scale); #undef M } @@ -824,10 +822,10 @@ v3fixed_t *FV_ClosestPointOnLine(const v3fixed_t *Line, const v3fixed_t *p, v3fi FV_SubO(p, &Line[0], &c); FV_SubO(&Line[1], &Line[0], &V); FV_NormalizeO(&V, &V); - + d = FV_Distance(&Line[0], &Line[1]); t = FV_Dot(&V, &c); - + // Check to see if √´t√≠ is beyond the extents of the line segment if (t < 0) { @@ -837,10 +835,10 @@ v3fixed_t *FV_ClosestPointOnLine(const v3fixed_t *Line, const v3fixed_t *p, v3fi { return FV_Copy(out, &Line[1]); } - + // Return the point between √´Line[0]√≠ and √´Line[1]√≠ FV_Mul(&V, t); - + return FV_AddO(&Line[0], &V, out); } @@ -857,33 +855,33 @@ void FV_ClosestPointOnTriangle (const v3fixed_t *tri, const v3fixed_t *point, v3 fixed_t dist, closestdist; v3fixed_t EdgePoints[3]; v3fixed_t Line[2]; - + FV_Copy(&Line[0], (v3fixed_t*)&tri[0]); FV_Copy(&Line[1], (v3fixed_t*)&tri[1]); FV_ClosestPointOnLine(Line, point, &EdgePoints[0]); - + FV_Copy(&Line[0], (v3fixed_t*)&tri[1]); FV_Copy(&Line[1], (v3fixed_t*)&tri[2]); FV_ClosestPointOnLine(Line, point, &EdgePoints[1]); - + FV_Copy(&Line[0], (v3fixed_t*)&tri[2]); FV_Copy(&Line[1], (v3fixed_t*)&tri[0]); FV_ClosestPointOnLine(Line, point, &EdgePoints[2]); - + // Find the closest one of the three FV_Copy(result, &EdgePoints[0]); closestdist = FV_Distance(point, &EdgePoints[0]); for (i = 1; i < 3; i++) { dist = FV_Distance(point, &EdgePoints[i]); - + if (dist < closestdist) { closestdist = dist; FV_Copy(result, &EdgePoints[i]); } } - + // We now have the closest point! Whee! } @@ -897,7 +895,7 @@ boolean FV_InsidePolygon(const fvector_t *vIntersection, const fvector_t *Poly, int i; UINT64 Angle = 0; // Initialize the angle fvector_t vA, vB; // Create temp vectors - + // Just because we intersected the plane, doesn't mean we were anywhere near the polygon. // This functions checks our intersection point to make sure it is inside of the polygon. // This is another tough function to grasp at first, but let me try and explain. @@ -911,26 +909,26 @@ boolean FV_InsidePolygon(const fvector_t *vIntersection, const fvector_t *Poly, // all of the angles in a triangle we get 360 right? Well, that is kinda what we are doing, // but the inverse of that. Say your triangle is an isosceles triangle, so add up the angles // and you will get 360 degree angles. 90 + 90 + 90 is 360. - + for (i = 0; i < vertexCount; i++) // Go in a circle to each vertex and get the angle between - { + { FV_Point2Vec(&Poly[i], vIntersection, &vA); // Subtract the intersection point from the current vertex // Subtract the point from the next vertex FV_Point2Vec(&Poly[(i + 1) % vertexCount], vIntersection, &vB); - + Angle += FV_AngleBetweenVectors(&vA, &vB); // Find the angle between the 2 vectors and add them all up as we go along } - + // Now that we have the total angles added up, we need to check if they add up to 360 degrees. // Since we are using the dot product, we are working in radians, so we check if the angles // equals 2*PI. We defined PI in 3DMath.h. You will notice that we use a MATCH_FACTOR // in conjunction with our desired degree. This is because of the inaccuracy when working // with floating point numbers. It usually won't always be perfectly 2 * PI, so we need // to use a little twiddling. I use .9999, but you can change this to fit your own desired accuracy. - + if(Angle >= ANGLE_MAX) // If the angle is greater than 2 PI, (360 degrees) return 1; // The point is inside of the polygon - + return 0; // If you get here, it obviously wasn't inside the polygon. } @@ -943,27 +941,27 @@ boolean FV_IntersectedPolygon(const fvector_t *vPoly, const fvector_t *vLine, co { fvector_t vNormal, vIntersection; fixed_t originDistance = 0*FRACUNIT; - - + + // First we check to see if our line intersected the plane. If this isn't true // there is no need to go on, so return false immediately. // We pass in address of vNormal and originDistance so we only calculate it once - + if(!FV_IntersectedPlane(vPoly, vLine, &vNormal, &originDistance)) return false; - - // Now that we have our normal and distance passed back from IntersectedPlane(), + + // Now that we have our normal and distance passed back from IntersectedPlane(), // we can use it to calculate the intersection point. The intersection point // is the point that actually is ON the plane. It is between the line. We need // this point test next, if we are inside the polygon. To get the I-Point, we // give our function the normal of the plane, the points of the line, and the originDistance. - + FV_IntersectionPoint(&vNormal, vLine, originDistance, &vIntersection); - + // Now that we have the intersection point, we need to test if it's inside the polygon. // To do this, we pass in : // (our intersection point, the polygon, and the number of vertices our polygon has) - + if(FV_InsidePolygon(&vIntersection, vPoly, vertexCount)) { if (collisionPoint != NULL) // Optional - load the collision point. @@ -974,7 +972,7 @@ boolean FV_IntersectedPolygon(const fvector_t *vPoly, const fvector_t *vLine, co } return true; // We collided! } - + // If we get here, we must have NOT collided return false; } @@ -1017,7 +1015,7 @@ void FV_Rotate(fvector_t *rotVec, const fvector_t *axisVec, const angle_t angle) fixed_t ex = FixedMul(vz-wy, sa); fixed_t ey = FixedMul(wx-uz, sa); fixed_t ez = FixedMul(uy-vx, sa); - + rotVec->x = ax+dx+ex; rotVec->y = ay+dy+ey; rotVec->z = az+dz+ez; @@ -1033,41 +1031,41 @@ void FM_Rotate(fmatrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z) fixed_t xSq, ySq, zSq; fixed_t sx, sy, sz; fixed_t sxy, sxz, syz; - + FV_Normalize(&nrm); - + x = nrm.x; y = nrm.y; z = nrm.z; - + xSq = FixedMul(x, FixedMul(invCosA,x)); ySq = FixedMul(y, FixedMul(invCosA,y)); zSq = FixedMul(z, FixedMul(invCosA,z)); - + sx = FixedMul(sinA, x); sy = FixedMul(sinA, y); sz = FixedMul(sinA, z); - + sxy = FixedMul(x, FixedMul(invCosA,y)); sxz = FixedMul(x, FixedMul(invCosA,z)); syz = FixedMul(y, FixedMul(invCosA,z)); - - + + M(0, 0) = xSq + cosA; M(1, 0) = sxy - sz; M(2, 0) = sxz + sy; M(3, 0) = 0; - + M(0, 1) = sxy + sz; M(1, 1) = ySq + cosA; M(2, 1) = syz - sx; M(3, 1) = 0; - + M(0, 2) = sxz - sy; M(1, 2) = syz + sx; M(2, 2) = zSq + cosA; M(3, 2) = 0; - + M(0, 3) = 0; M(1, 3) = 0; M(2, 3) = 0; @@ -1127,12 +1125,12 @@ void FV_Normal(const v3fixed_t *a_triangle, v3fixed_t *a_normal) { v3fixed_t a_1; v3fixed_t a_2; - + M_MakeVec3(&a_triangle[2], &a_triangle[0], &a_1); M_MakeVec3(&a_triangle[1], &a_triangle[0], &a_2); - + M_CrossProduct3(&a_1, &a_2, a_normal); - + FV_NormalizeO(a_normal, a_normal); } @@ -1145,12 +1143,12 @@ void FV_Normalf(const v3float_t *a_triangle, v3float_t *a_normal) { v3float_t a_1; v3float_t a_2; - + M_MakeVec3f(&a_triangle[2], &a_triangle[0], &a_1); M_MakeVec3f(&a_triangle[1], &a_triangle[0], &a_2); - + M_CrossProduct3f(&a_1, &a_2, a_normal); - + FV_NormalizeOf(a_normal, a_normal); } diff --git a/src/p_slopes.c b/src/p_slopes.c index 2c18d3611..15aa6d7fe 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -359,7 +359,7 @@ void P_SpawnSlope_Line(int linenum) srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] - srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) or FLOAT_TO_FIXED(1.0f/cross[2]); + srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) or FLOAT_TO_FIXED(1.0f/cross[2]); // destheight takes the destination height used in dz srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, // x @@ -414,7 +414,7 @@ void P_SpawnSlope_Line(int linenum) srcplane->b = FLOAT_TO_FIXED (cslope->normalf.y); // cross[1] srcplane->c = FLOAT_TO_FIXED (cslope->normalf.z); // cross[2] //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) + srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) #ifdef SLOPETHINGS // For setting thing-based slopes srcplane->d = -TMulScale16 (plane->a, x, plane->b, y, @@ -523,7 +523,7 @@ void P_SpawnSlope_Line(int linenum) srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) + srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) #ifdef SLOPETHINGS // For setting thing-based slopes srcplane->d = -TMulScale16 (plane->a, x, plane->b, y, @@ -585,7 +585,7 @@ void P_SpawnSlope_Line(int linenum) srcplane->b = FLOAT_TO_FIXED (cslope->normalf.y); // cross[1] srcplane->c = FLOAT_TO_FIXED (cslope->normalf.z); // cross[2] //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) + srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) #ifdef SLOPETHINGS // For setting thing-based slopes srcplane->d = -TMulScale16 (plane->a, x, plane->b, y, @@ -638,13 +638,6 @@ void P_CopySectorSlope(line_t *line) #include "byteptr.h" -/* -typedef struct -{ - fixed_t z1; - fixed_t z2; -} mapvert_t;*/ - #include "p_setup.h" #include "p_local.h" @@ -861,7 +854,7 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) srcplane->a = FLOAT_TO_FIXED (ret->normalf.x); srcplane->b = FLOAT_TO_FIXED (ret->normalf.y); srcplane->c = FLOAT_TO_FIXED (ret->normalf.z); - //srcplane->ic = DivScale32 (1, srcplane->c); + //srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x, srcplane->b, vertexes[vi3].y, srcplane->c, z3); @@ -891,279 +884,11 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) } Z_Free(datastart); -#if 0 // UDMF support - for(i = 0; i < numvertexdatas; i++) - { - if (vertexdatas[i].flags & VERTEXFLAG_ZCeilingEnabled) - { - vt_heights[1][i] = vertexdatas[i].zCeiling; - vt_found = true; - } - - if (vertexdatas[i].flags & VERTEXFLAG_ZFloorEnabled) - { - vt_heights[0][i] = vertexdatas[i].zFloor; - vt_found = true; - } - } - - // If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed. - delete[] vertexdatas; - vertexdatas = NULL; - numvertexdatas = 0; -#endif - } -#include "p_maputl.h" - -#if 0 -static void P_SlopeLineToPointo (int lineid, fixed_t x, fixed_t y, fixed_t z, boolean slopeCeil) -{ - int linenum = -1; - - while ((linenum = P_FindLineFromID (lineid, linenum)) != -1) - { - const line_t *line = &lines[linenum]; - sector_t *sec; - secplane_t *plane; - - if (P_PointOnLineSide (x, y, line) == 0) - { - sec = line->frontsector; - } - else - { - sec = line->backsector; - } - if (sec == NULL) - { - continue; - } - if (slopeCeil) - { - plane = &sec->ceilingplane; - } - else - { - plane = &sec->floorplane; - } - - FVector3 p, v1, v2, cross; - - p[0] = FIXED2FLOAT (line->v1->x); - p[1] = FIXED2FLOAT (line->v1->y); - p[2] = FIXED2FLOAT (plane->ZatPoint (line->v1->x, line->v1->y)); - v1[0] = FIXED2FLOAT (line->dx); - v1[1] = FIXED2FLOAT (line->dy); - v1[2] = FIXED2FLOAT (plane->ZatPoint (line->v2->x, line->v2->y)) - p[2]; - v2[0] = FIXED2FLOAT (x - line->v1->x); - v2[1] = FIXED2FLOAT (y - line->v1->y); - v2[2] = FIXED2FLOAT (z) - p[2]; - - cross = v1 ^ v2; - double len = cross.Length(); - if (len == 0) - { - Printf ("Slope thing at (%d,%d) lies directly on its target line.\n", int(x>>16), int(y>>16)); - return; - } - cross /= len; - // Fix backward normals - if ((cross.Z < 0 && !slopeCeil) || (cross.Z > 0 && slopeCeil)) - { - cross = -cross; - } - - plane->a = FLOAT2FIXED (cross[0]); - plane->b = FLOAT2FIXED (cross[1]); - plane->c = FLOAT2FIXED (cross[2]); - //plane->ic = FLOAT2FIXED (1.f/cross[2]); - plane->ic = DivScale32 (1, plane->c); - plane->d = -TMulScale16 (plane->a, x, - plane->b, y, - plane->c, z); - } -} -#else -#if 0 -// P_SlopeLineToPoint, start from a specific linedef number(not tag) and slope to a mapthing with the angle of the linedef -static void P_SlopeLineToPoint(int linenum) -{ - line_t *line = lines + linenum; - int special = line->special; - pslope_t *fslope = NULL, *cslope = NULL; - v3float_t origin, point; - v2float_t direction; - float dz, extent; - - boolean frontfloor = (special == 386 || special == 388 || special == 393); - boolean backfloor = (special == 389 || special == 391 || special == 392); - boolean frontceil = (special == 387 || special == 388 || special == 392); - boolean backceil = (special == 390 || special == 391 || special == 393); - - // SoM: We don't need the line to retain its special type - line->special = 0; //SRB2CBTODO: ESLOPE: Maybe we do need it for another to check for a plane slope? - - if(!frontfloor && !backfloor && !frontceil && !backceil) - { - CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n"); - return; - } - - if(!line->frontsector || !line->backsector) - { - CONS_Printf("P_SpawnSlope_Line used on a line without two sides.\n"); - return; - } - - origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; - origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; - - if(frontfloor || frontceil) - { - // Do the front sector - direction.x = line->nx; - direction.y = line->ny; - - extent = P_GetExtent(line->frontsector, line, &origin, &direction); - - if(extent < 0.0f) - { - CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum); - return; - } - - // reposition the origin according to the extent - point.x = origin.x + direction.x * extent; - point.y = origin.y + direction.y * extent; - direction.x = -direction.x; - direction.y = -direction.y; - - // CONS_Printf("Test: X: %f, Y: %f\n", origin.x, origin.y); - - if(frontfloor) - { - point.z = FIXED_TO_FLOAT(line->frontsector->floorheight); // Startz - dz = (FIXED_TO_FLOAT(line->backsector->floorheight) - point.z) / extent; // Destinationz - - fslope = line->frontsector->f_slope = - P_MakeSlope(&point, &direction, dz, false); - - // Sync the linedata of the line that started this slope - // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? - line->frontsector->f_slope->sourceline = line; - - // Remember the way the slope is formed - fixed_t highest = line->frontsector->floorheight > line->backsector->floorheight ? - line->frontsector->floorheight : line->backsector->floorheight; - fixed_t lowest = line->frontsector->floorheight < line->backsector->floorheight ? - line->frontsector->floorheight : line->backsector->floorheight; - // This line special sets extra clipping data for the frontsector's slope - fslope->highz = line->frontsector->f_slope->highz = highest; - fslope->lowz = line->frontsector->f_slope->lowz = lowest; - - // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: - //fslope->zangle = line->frontsector->f_slope->zangle = P_GetSlopezangle(line->frontsector, highvert, lowvert); - //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); - // Get slope XY angle with secplane_t - secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - // ZDoom secplane port! - // secplane_t! woot! - // ret = f_slope or c_slope - srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] - srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] - srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] - //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = DivScale32 (1, srcplane->c); // (1 << 32/srcplane->c) -#ifdef SLOPETHINGS // For setting thing-based slopes - srcplane->d = -TMulScale16 (plane->a, x, - plane->b, y, - plane->c, z); -#endif - //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); - //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); - //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz - srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, - srcplane->b, line->v1->y, - srcplane->c, line->backsector->floorheight); - - // Sync the secplane! - fslope->secplane = line->frontsector->f_slope->secplane = *srcplane; - - } - } -} -#endif -#endif - - - -//=========================================================================== -// -// P_SpawnSlopeMakers -// -//=========================================================================== -#if 0 -void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt) -{ - FMapThing *mt; - - for (mt = firstmt; mt < lastmt; ++mt) - { - if ((mt->type >= THING_SlopeFloorPointLine && - mt->type <= THING_SetCeilingSlope) || - mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling) - { - fixed_t x, y, z; - secplane_t *refplane; - sector_t *sec; - - x = mt->x; - y = mt->y; - sec = P_PointInSector (x, y); - if (mt->type & 1) - { - refplane = &sec->ceilingplane; - } - else - { - refplane = &sec->floorplane; - } - z = refplane->ZatPoint (x, y) + (mt->z); - if (mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling) - { - P_VavoomSlope(sec, mt->thingid, x, y, mt->z, mt->type & 1); - } - else if (mt->type <= THING_SlopeCeilingPointLine) - { - P_SlopeLineToPoint (mt->args[0], x, y, z, mt->type & 1); - } - else - { - P_SetSlope (refplane, mt->type & 1, mt->angle, mt->args[0], x, y, z); - } - mt->type = 0; - } - } - - for (mt = firstmt; mt < lastmt; ++mt) - { - if (mt->type == THING_CopyFloorPlane || - mt->type == THING_CopyCeilingPlane) - { - P_CopyPlane (mt->args[0], mt->x, mt->y, mt->type & 1); - mt->type = 0; - } - } - - P_SetSlopesFromVertexHeights(firstmt, lastmt); -} -#endif From aeef23e8164fae1fe05cf9a9559e76b9b40be21b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 26 Apr 2015 13:06:23 -0500 Subject: [PATCH 012/364] MakeSlope_Line cleanup/fixed-point conversion --- src/p_setup.c | 4 - src/p_slopes.c | 454 ++++++++++++------------------------------------- src/r_defs.h | 21 +-- 3 files changed, 117 insertions(+), 362 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 9ddd52b58..e2ce083f9 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1170,10 +1170,6 @@ static void P_LoadLineDefs(lumpnum_t lumpnum) #ifdef POLYOBJECTS ld->polyobj = NULL; #endif - -#ifdef ESLOPE - P_MakeLineNormal(ld); -#endif } Z_Free(data); diff --git a/src/p_slopes.c b/src/p_slopes.c index 15aa6d7fe..e75552f11 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -45,91 +45,20 @@ // // Alocates and fill the contents of a slope structure. // -static pslope_t *P_MakeSlope(const v3float_t *o, const v2float_t *d, - const float zdelta, boolean isceiling) +static pslope_t *P_MakeSlope(const v3fixed_t *o, const v2fixed_t *d, + const fixed_t zdelta, boolean isceiling) { pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); memset(ret, 0, sizeof(*ret)); - ret->o.x = FLOAT_TO_FIXED(ret->of.x = o->x); - ret->o.y = FLOAT_TO_FIXED(ret->of.y = o->y); - ret->o.z = FLOAT_TO_FIXED(ret->of.z = o->z); + ret->of.x = FIXED_TO_FLOAT(ret->o.x = o->x); + ret->of.y = FIXED_TO_FLOAT(ret->o.y = o->y); + ret->of.z = FIXED_TO_FLOAT(ret->o.z = o->z); - ret->d.x = FLOAT_TO_FIXED(ret->df.x = d->x); - ret->d.y = FLOAT_TO_FIXED(ret->df.y = d->y); + ret->df.x = FIXED_TO_FLOAT(ret->d.x = d->x); + ret->df.y = FIXED_TO_FLOAT(ret->d.y = d->y); - ret->zdelta = FLOAT_TO_FIXED(ret->zdeltaf = zdelta); - - // d = direction (v2float_t) - // - // direction.x = line->nx; - // direction.y = line->ny; - // - // o = origin (v3float_t) - // origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; - // origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; - - { - // Now calculate the normal of the plane! - v3float_t v1, v2, v3, d1, d2; - float len; - - v1.x = o->x; - v1.y = o->y; - v1.z = o->z; - - v2.x = v1.x; - v2.y = v1.y + 10.0f; - v2.z = P_GetZAtf(ret, v2.x, v2.y); - - v3.x = v1.x + 10.0f; - v3.y = v1.y; - v3.z = P_GetZAtf(ret, v3.x, v3.y); - - if (isceiling) - { - M_SubVec3f(&d1, &v1, &v3); - M_SubVec3f(&d2, &v2, &v3); - } - else - { - M_SubVec3f(&d1, &v1, &v2); - M_SubVec3f(&d2, &v3, &v2); - } - - M_CrossProduct3f(&ret->normalf, &d1, &d2); - - // Cross product length - len = (float)sqrt(ret->normalf.x * ret->normalf.x + - ret->normalf.y * ret->normalf.y + - ret->normalf.z * ret->normalf.z); - -#ifdef SLOPETHINGS - if (len == 0) - { - // Only happens when all vertices in this sector are on the same line. - // Let's just ignore this case. - CONS_Printf("Slope thing at (%d,%d) lies directly on its target line.\n", int(x>>16), int(y>>16)); - return; - } -#endif - - ret->normalf.x /= len; - ret->normalf.y /= len; - ret->normalf.z /= len; - - // ZDoom - // cross = ret->normalf - - // Fix backward normals - if ((ret->normalf.z < 0 && !isceiling) || (ret->normalf.z > 0 && isceiling)) - { - ret->normalf.x = -ret->normalf.x; - ret->normalf.y = -ret->normalf.x; - ret->normalf.z = -ret->normalf.x; - } - - } + ret->zdeltaf = FIXED_TO_FLOAT(ret->zdelta = zdelta); return ret; } @@ -147,65 +76,42 @@ static pslope_t *P_CopySlope(const pslope_t *src) return ret; } -// -// P_MakeLineNormal -// -// Calculates a 2D normal for the given line and stores it in the line -// -void P_MakeLineNormal(line_t *line) -{ - float linedx, linedy, length; - - // SRB2CBTODO: Give linedefs an fx+fy(float xy coords)? - // May cause slow downs since the float would always have to be converted/updated - linedx = FIXED_TO_FLOAT(line->v2->x) - FIXED_TO_FLOAT(line->v1->x); - linedy = FIXED_TO_FLOAT(line->v2->y) - FIXED_TO_FLOAT(line->v1->y); - - length = (float)sqrt(linedx * linedx + linedy * linedy); - line->nx = linedy / length; - line->ny = -linedx / length; - line->len = length; -} - // // P_GetExtent // // Returns the distance to the first line within the sector that // is intersected by a line parallel to the plane normal with the point (ox, oy) // -static float P_GetExtent(sector_t *sector, line_t *line, v3float_t *o, v2float_t *d) +static fixed_t P_GetExtent(sector_t *sector, line_t *line) { // ZDoom code reference: v3float_t = vertex_t - float fardist = -1.0f; - size_t i; + fixed_t fardist = -FRACUNIT; + size_t i; // Find furthest vertex from the reference line. It, along with the two ends // of the line, will define the plane. // SRB2CBTODO: Use a formula to get the slope to slide objects depending on how steep - for(i = 0; i < sector->linecount; i++) - { - line_t *li = sector->lines[i]; - vertex_t tempv; - float dist; + for(i = 0; i < sector->linecount; i++) + { + line_t *li = sector->lines[i]; + vertex_t tempv; + fixed_t dist; - // Don't compare to the slope line. - if(li == line) - continue; + // Don't compare to the slope line. + if(li == line) + continue; - // ZDoom code in P_AlignPlane - // dist = fabs((double(line->v1->y) - vert->y) * line->dx - (double(line->v1->x) - vert->x) * line->dy); - //dist = (float)fabs((FIXED_TO_FLOAT(li->v1->x) - o->x) * d->x + (FIXED_TO_FLOAT(li->v1->y) - o->y) * d->y); - P_ClosestPointOnLine(li->v1->x, li->v1->y, line, &tempv); - dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, li->v1->x, li->v1->y)); - if(dist > fardist) - fardist = dist; + P_ClosestPointOnLine(li->v1->x, li->v1->y, line, &tempv); + dist = R_PointToDist2(tempv.x, tempv.y, li->v1->x, li->v1->y); + if(dist > fardist) + fardist = dist; // Okay, maybe do it for v2 as well? - P_ClosestPointOnLine(li->v2->x, li->v2->y, line, &tempv); - dist = FIXED_TO_FLOAT(R_PointToDist2(tempv.x, tempv.y, li->v2->x, li->v2->y)); - if(dist > fardist) - fardist = dist; - } + P_ClosestPointOnLine(li->v2->x, li->v2->y, line, &tempv); + dist = R_PointToDist2(tempv.x, tempv.y, li->v2->x, li->v2->y); + if(dist > fardist) + fardist = dist; + } return fardist; } @@ -224,11 +130,11 @@ void P_SpawnSlope_Line(int linenum) // because checking to see if a slope had changed will waste more memory than // if the slope was just updated when called line_t *line = lines + linenum; - int special = line->special; + INT16 special = line->special; pslope_t *fslope = NULL, *cslope = NULL; - v3float_t origin, point; - v2float_t direction; - float dz, extent; + v3fixed_t origin, point; + v2fixed_t direction; + fixed_t nx, ny, dz, extent; boolean frontfloor = (special == 386 || special == 388 || special == 393); boolean backfloor = (special == 389 || special == 391 || special == 392); @@ -247,28 +153,34 @@ void P_SpawnSlope_Line(int linenum) return; } + { + fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy); + nx = FixedDiv(line->dy, len); + ny = -FixedDiv(line->dx, len); + } + // SRB2CBTODO: Transform origin relative to the bounds of an individual FOF - origin.x = (FIXED_TO_FLOAT(line->v2->x) + FIXED_TO_FLOAT(line->v1->x)) * 0.5f; - origin.y = (FIXED_TO_FLOAT(line->v2->y) + FIXED_TO_FLOAT(line->v1->y)) * 0.5f; + origin.x = line->v1->x + (line->v2->x - line->v1->x)/2; + origin.y = line->v1->y + (line->v2->y - line->v1->y)/2; // For FOF slopes, make a special function to copy to the xy origin & direction relative to the position of the FOF on the map! if(frontfloor || frontceil) { - origin.z = FIXED_TO_FLOAT(line->backsector->floorheight); - direction.x = line->nx; - direction.y = line->ny; + origin.z = line->backsector->floorheight; + direction.x = nx; + direction.y = ny; - extent = P_GetExtent(line->frontsector, line, &origin, &direction); + extent = P_GetExtent(line->frontsector, line); - if(extent < 0.0f) + if(extent < 0) { CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum); return; } // reposition the origin according to the extent - point.x = origin.x + direction.x * extent; - point.y = origin.y + direction.y * extent; + point.x = origin.x + FixedMul(direction.x, extent); + point.y = origin.y + FixedMul(direction.y, extent); direction.x = -direction.x; direction.y = -direction.y; @@ -277,39 +189,11 @@ void P_SpawnSlope_Line(int linenum) if(frontfloor) { - point.z = FIXED_TO_FLOAT(line->frontsector->floorheight); // Startz - dz = (FIXED_TO_FLOAT(line->backsector->floorheight) - point.z) / extent; // Destinationz + point.z = line->frontsector->floorheight; // Startz + dz = FixedDiv(line->backsector->floorheight - point.z, extent); // Destinationz // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef - int slopeangle = 0; // All floors by default have no slope (an angle of 0, completely flat) - - v3float_t A = origin; // = line source - v3float_t B = point; // destination's value - v3float_t C = origin; // Point used to make a right triangle from A & B - - C.z = point.z; - - // To find the "angle" of a slope, we make a right triangle out of the points we have, - // point A - is point 1 of the hypotenuse, - // point B - is point 2 of the hypotenuse - // point C - has the same Z value as point b, and the same XY value as A - // - // We want to find the angle accross from the right angle - // so we use some triginometry to find the angle(fun, right?) - // We want to find the tanjent of this angle, this is: - // Opposite - // ------- = tan(x) - // Adjecent - // But actually tan doesn't do want we really want, we have to use atan to find the actual angle of the triangle's corner - float triangopplength = abs(B.z - A.z); - float triangadjlength = sqrt((B.x-C.x)*(B.x-C.x) + (B.y - C.y)*(B.y - C.y)); - //float trianghyplength = sqrt(triangopplength*triangopplength + triangadjlength*triangadjlength); // This is the hypotenuse - - // So tanjent = opposite divided by adjecent - float tanrelat = triangopplength/ triangadjlength; // tanjent = opposite / adjecent - slopeangle = atan(tanrelat)* 180 / M_PI; // Now we use atan: *180 /M_PI is needed to convert the value into degrees - fslope = line->frontsector->f_slope = P_MakeSlope(&point, &direction, dz, false); @@ -320,7 +204,7 @@ void P_SpawnSlope_Line(int linenum) // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? - line->frontsector->f_slope->sourceline = line; + fslope->sourceline = line; // To find the real highz/lowz of a slope, you need to check all the vertexes // in the slope's sector with P_GetZAt to get the REAL lowz & highz @@ -331,276 +215,156 @@ void P_SpawnSlope_Line(int linenum) // Default points for high and low fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; - highest = FLOAT_TO_FIXED(highest); - lowest = FLOAT_TO_FIXED(lowest); // Now check to see what the REAL high and low points of the slope inside the sector + // TODO: Is this really needed outside of FOFs? -Red size_t l; for (l = 0; l < line->frontsector->linecount; l++) { - if (P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) > highest) - highest = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + fixed_t height = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); - if (P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) < lowest) - lowest = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + if (height > highest) + highest = height; + + if (height < lowest) + lowest = height; } // Sets extra clipping data for the frontsector's slope - fslope->highz = line->frontsector->f_slope->highz = highest; - fslope->lowz = line->frontsector->f_slope->lowz = lowest; - - fslope->zangle = slopeangle; - fslope->xydirection = R_PointToAngle2(FLOAT_TO_FIXED(A.x), FLOAT_TO_FIXED(A.y), FLOAT_TO_FIXED(B.x), FLOAT_TO_FIXED(B.y))/(ANGLE_45/45); - - secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - // ZDoom secplane port! YAY - // ret = f_slope or c_slope - srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] - srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] - srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] - srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) or FLOAT_TO_FIXED(1.0f/cross[2]); - - // destheight takes the destination height used in dz - srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, // x - srcplane->b, line->v1->y, // y - srcplane->c, line->backsector->floorheight); // z - - // Sync the secplane! - fslope->secplane = line->frontsector->f_slope->secplane = *srcplane; + fslope->highz = highest; + fslope->lowz = lowest; + fslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); } if(frontceil) { - point.z = FIXED_TO_FLOAT(line->frontsector->ceilingheight); - dz = (FIXED_TO_FLOAT(line->backsector->ceilingheight) - point.z) / extent; + point.z = line->frontsector->ceilingheight; + dz = FixedDiv(line->backsector->ceilingheight - point.z, extent); cslope = line->frontsector->c_slope = P_MakeSlope(&point, &direction, dz, true); // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? - line->frontsector->c_slope->sourceline = line; + cslope->sourceline = line; // Remember the way the slope is formed fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; - highest = FLOAT_TO_FIXED(highest); - lowest = FLOAT_TO_FIXED(lowest); size_t l; for (l = 0; l < line->frontsector->linecount; l++) { - if (P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) > highest) - highest = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + fixed_t height = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); - if (P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y) < lowest) - lowest = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y); + if (height > highest) + highest = height; + + if (height < lowest) + lowest = height; } // This line special sets extra clipping data for the frontsector's slope - cslope->highz = line->frontsector->c_slope->highz = highest; - cslope->lowz = line->frontsector->c_slope->lowz = lowest; + cslope->highz = highest; + cslope->lowz = lowest; - // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: - //cslope->zangle = line->frontsector->c_slope->zangle = P_GetSlopezangle(line->frontsector, highvert, lowvert); - //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); - // Get slope XY angle with secplane_t - secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - // ZDoom secplane port! - // secplane_t! woot! - // ret = f_slope or c_slope - srcplane->a = FLOAT_TO_FIXED (cslope->normalf.x); // cross[0] - srcplane->b = FLOAT_TO_FIXED (cslope->normalf.y); // cross[1] - srcplane->c = FLOAT_TO_FIXED (cslope->normalf.z); // cross[2] - //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) -#ifdef SLOPETHINGS // For setting thing-based slopes - srcplane->d = -TMulScale16 (plane->a, x, - plane->b, y, - plane->c, z); -#endif - //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); - //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); - //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz - srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, - srcplane->b, line->v1->y, - srcplane->c, line->backsector->ceilingheight); - - // Sync the secplane! - cslope->secplane = line->frontsector->c_slope->secplane = *srcplane; + cslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); } } if(backfloor || backceil) { - origin.z = FIXED_TO_FLOAT(line->frontsector->floorheight); + origin.z = line->frontsector->floorheight; // Backsector - direction.x = -line->nx; - direction.y = -line->ny; + direction.x = -nx; + direction.y = -ny; - extent = P_GetExtent(line->backsector, line, &origin, &direction); + extent = P_GetExtent(line->backsector, line); - if(extent < 0.0f) + if(extent < 0) { CONS_Printf("P_SpawnSlope_Line failed to get backsector extent on line number %i\n", linenum); return; } // reposition the origin according to the extent - point.x = origin.x + direction.x * extent; - point.y = origin.y + direction.y * extent; + point.x = origin.x + FixedMul(direction.x, extent); + point.y = origin.y + FixedMul(direction.y, extent); direction.x = -direction.x; direction.y = -direction.y; if(backfloor) { - point.z = FIXED_TO_FLOAT(line->backsector->floorheight); - dz = (FIXED_TO_FLOAT(line->frontsector->floorheight) - point.z) / extent; + point.z = line->backsector->floorheight; + dz = FixedDiv(line->frontsector->floorheight - point.z, extent); fslope = line->backsector->f_slope = P_MakeSlope(&point, &direction, dz, false); // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? - line->backsector->f_slope->sourceline = line; - - int slopeangle = 0; // All floors by default have no slope (an angle of 0) - - v3float_t A = origin; // = line source - v3float_t B = point; // destination's value - v3float_t C = origin; - - C.z = point.z; - - // To find the "angle" of a slope, we make a right triangle out of the points we have, - // point A - is point 1 of the hypotenuse, - // point B - is point 2 of the hypotenuse - // point C - has the same Z value as point b, and the same XY value as A - // - // We want to find the angle accross from the right angle - // so we use some triginometry to find the angle(fun, right?) - // We want to find the tanjent of this angle, this is: - // Opposite - // ------- = tan(x) - // Adjecent - // But actually tan doesn't do want we really want, we have to use atan to find the actual angle of the triangle's corner - float triangopplength = abs(B.z - A.z); - float triangadjlength = sqrt((B.x-C.x)*(B.x-C.x) + (B.y - C.y)*(B.y - C.y)); - //float trianghyplength = sqrt(triangopplength*triangopplength + triangadjlength*triangadjlength); // This is the hypotenuse - - // So tanjent = opposite divided by adjecent - float tanrelat = triangopplength/ triangadjlength; // tanjent = opposite / adjecent - slopeangle = atan(tanrelat)* 180 / M_PI; // Now we use atan - *180 /M_PI is needed to convert the value into degrees + fslope->sourceline = line; // Remember the way the slope is formed fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; - highest = FLOAT_TO_FIXED(highest); - lowest = FLOAT_TO_FIXED(lowest); size_t l; for (l = 0; l < line->backsector->linecount; l++) { - if (P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) > highest) - highest = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + fixed_t height = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); - if (P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) < lowest) - lowest = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + if (height > highest) + highest = height; + + if (height < lowest) + lowest = height; } // This line special sets extra clipping data for the frontsector's slope - fslope->highz = line->backsector->f_slope->highz = highest; - fslope->lowz = line->backsector->f_slope->lowz = lowest; + fslope->highz = highest; + fslope->lowz = lowest; - fslope->zangle = slopeangle; - // Get slope XY angle with secplane_t - secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - // ZDoom secplane port! - // secplane_t! woot! - // ret = f_slope or c_slope - srcplane->a = FLOAT_TO_FIXED (fslope->normalf.x); // cross[0] - srcplane->b = FLOAT_TO_FIXED (fslope->normalf.y); // cross[1] - srcplane->c = FLOAT_TO_FIXED (fslope->normalf.z); // cross[2] - //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) -#ifdef SLOPETHINGS // For setting thing-based slopes - srcplane->d = -TMulScale16 (plane->a, x, - plane->b, y, - plane->c, z); -#endif - //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); - //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); - //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz - srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, - srcplane->b, line->v1->y, - srcplane->c, line->frontsector->floorheight); - - // Sync the secplane! - fslope->secplane = line->backsector->f_slope->secplane = *srcplane; + cslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); } if(backceil) { - point.z = FIXED_TO_FLOAT(line->backsector->ceilingheight); - dz = (FIXED_TO_FLOAT(line->frontsector->ceilingheight) - point.z) / extent; + point.z = line->backsector->ceilingheight; + dz = FixedDiv(line->frontsector->ceilingheight - point.z, extent); cslope = line->backsector->c_slope = P_MakeSlope(&point, &direction, dz, true); // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? - line->backsector->c_slope->sourceline = line; + cslope->sourceline = line; // Remember the way the slope is formed fixed_t highest = point.z > origin.z ? point.z : origin.z; fixed_t lowest = point.z < origin.z ? point.z : origin.z; - highest = FLOAT_TO_FIXED(highest); - lowest = FLOAT_TO_FIXED(lowest); size_t l; for (l = 0; l < line->backsector->linecount; l++) { - if (P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) > highest) - highest = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + fixed_t height = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); - if (P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y) < lowest) - lowest = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y); + if (height > highest) + highest = height; + + if (height < lowest) + lowest = height; } // This line special sets extra clipping data for the backsector's slope - cslope->highz = line->backsector->c_slope->highz = highest; - cslope->lowz = line->backsector->c_slope->lowz = lowest; + cslope->highz = highest; + cslope->lowz = lowest; - // SRB2CBTODO: Get XY angle of a slope and then awesome physics! // ESLOPE: - //cslope->zangle = line->backsector->c_slope->zangle = P_GetSlopezangle(line->backsector, highvert, lowvert); - //100*(ANG45/45);//R_PointToAngle2(direction.x, direction.y, origin.x, origin.y); - // Get slope XY angle with secplane_t - secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL); - // ZDoom secplane port! - // secplane_t! woot! - // ret = f_slope or c_slope - srcplane->a = FLOAT_TO_FIXED (cslope->normalf.x); // cross[0] - srcplane->b = FLOAT_TO_FIXED (cslope->normalf.y); // cross[1] - srcplane->c = FLOAT_TO_FIXED (cslope->normalf.z); // cross[2] - //plane->ic = FLOAT_TO_FIXED (1.f/cross[2]); - srcplane->ic = FixedDiv(FRACUNIT, srcplane->c); // (1 << 32/srcplane->c) -#ifdef SLOPETHINGS // For setting thing-based slopes - srcplane->d = -TMulScale16 (plane->a, x, - plane->b, y, - plane->c, z); -#endif - //srcheight = isceiling ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling); - //destheight = isceiling ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling); - //P_GetZAtf(ret, v2.x, v2.y) - // destheight takes the destination height used in dz - srcplane->d = -TMulScale16 (srcplane->a, line->v1->x, - srcplane->b, line->v1->y, - srcplane->c, line->frontsector->ceilingheight); - - // Sync the secplane! - cslope->secplane = line->backsector->c_slope->secplane = *srcplane; + cslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); } } @@ -626,9 +390,9 @@ void P_CopySectorSlope(line_t *line) sector_t *srcsec = sectors + i; if((special - 393) & 1 && !fsec->f_slope && srcsec->f_slope) - fsec->f_slope = P_CopySlope(srcsec->f_slope); + fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope); if((special - 393) & 2 && !fsec->c_slope && srcsec->c_slope) - fsec->c_slope = P_CopySlope(srcsec->c_slope); + fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope); } //SRB2CBTODO: ESLOPE: Maybe we do need it for another to check for a plane slope? diff --git a/src/r_defs.h b/src/r_defs.h index 251140a3f..ac02b999c 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -239,29 +239,30 @@ typedef struct // and the one with the 'f' is floating point, for easier reference elsewhere in the code v3fixed_t o; v3float_t of; - + // The normal of the 3d plane the slope creates. + v3fixed_t normal; v3float_t normalf; - + // 2-Dimentional vector (x, y) normalized. Used to determine distance from // the origin in 2d mapspace. v2fixed_t d; v2float_t df; - + // The rate at which z changes based on distance from the origin plane. fixed_t zdelta; float zdeltaf; - + // For comparing when a slope should be rendered fixed_t lowz; fixed_t highz; - + // SRB2CBTODO: This could be used for something? // Determining the relative z values in a slope? struct line_s *sourceline; - + // This values only check and must be updated if the slope itself is modified - USHORT zangle; // Angle of the plane going up from the ground (not mesured in degrees) + angle_t zangle; // Angle of the plane going up from the ground (not mesured in degrees) angle_t xydirection; // The direction the slope is facing (north, west, south, etc.) secplane_t secplane; // Extra data for collision and stuff } pslope_t; @@ -444,12 +445,6 @@ typedef struct line_s char *text; // a concatination of all front and back texture names, for linedef specials that require a string. INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0 - -#ifdef ESLOPE - // SoM 05/11/09: Pre-calculated 2D normal for the line - float nx, ny; - float len; -#endif } line_t; // From d0a726c00ba57616aa6d71b257d10d93ed9d57aa Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 26 Apr 2015 13:06:45 -0500 Subject: [PATCH 013/364] Teeny optimization in renderer code?? --- src/r_plane.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index 44b65ad10..2839392d0 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -965,9 +965,7 @@ void R_DrawSinglePlane(visplane_t *pl) ang = pl->plangle>>ANGLETOFINESHIFT; m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; - ang += ANGLE_90>>ANGLETOFINESHIFT; - ang &= FINEMASK; - n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; + n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINECOSINE(ang), viewy - FINESINE(ang))) - zeroheight; M_CrossProduct3f(&ds_su, &p, &m); M_CrossProduct3f(&ds_sv, &p, &n); From 6fa1448f59d04fdf9f424324de9cdac7d4c4c771 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 26 Apr 2015 21:50:50 -0500 Subject: [PATCH 014/364] More cleanup, and made dynamic sloping more efficient/fixed memory leak --- src/p_setup.c | 1 + src/p_slopes.c | 112 +++++++++++++++++++++++++++++++++++++++++-------- src/p_slopes.h | 11 +++-- src/p_spec.c | 23 +++++++++- src/r_defs.h | 22 +++++----- 5 files changed, 134 insertions(+), 35 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index e2ce083f9..a75668b68 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2544,6 +2544,7 @@ boolean P_SetupLevel(boolean skipprecip) break; // set up world state + P_ResetDynamicSlopes(); P_SpawnSpecials(fromnetsave); if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame) diff --git a/src/p_slopes.c b/src/p_slopes.c index e75552f11..7dbb4b8db 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -40,27 +40,79 @@ #ifdef ESLOPE +static pslope_t *dynslopes = NULL; + +// Reset the dynamic slopes pointer +void P_ResetDynamicSlopes(void) { + dynslopes = NULL; +} + +// Calculate line normal +void P_CalculateSlopeNormal(pslope_t *slope) { + slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT); + slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x); + slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y); +} + +// Recalculate dynamic slopes +void P_RunDynamicSlopes(void) { + pslope_t *slope; + + for (slope = dynslopes; slope; slope = slope->next) { + fixed_t zdelta; + + switch(slope->refpos) { + case 1: // front floor + zdelta = slope->sourceline->backsector->floorheight - slope->sourceline->frontsector->floorheight; + break; + case 2: // front ceiling + zdelta = slope->sourceline->backsector->ceilingheight - slope->sourceline->frontsector->ceilingheight; + break; + case 3: // back floor + zdelta = slope->sourceline->frontsector->floorheight - slope->sourceline->backsector->floorheight; + break; + case 4: // back ceiling + zdelta = slope->sourceline->frontsector->ceilingheight - slope->sourceline->backsector->ceilingheight; + break; + + default: + I_Error("P_RunDynamicSlopes: slope has invalid type!"); + } + + if (slope->zdelta != FixedDiv(zdelta, slope->extent)) { + slope->zdeltaf = FIXED_TO_FLOAT(slope->zdelta = FixedDiv(zdelta, slope->extent)); + slope->zangle = R_PointToAngle2(0, 0, slope->extent, zdelta); + P_CalculateSlopeNormal(slope); + } + } +} + // // P_MakeSlope // // Alocates and fill the contents of a slope structure. // static pslope_t *P_MakeSlope(const v3fixed_t *o, const v2fixed_t *d, - const fixed_t zdelta, boolean isceiling) + const fixed_t zdelta, boolean dynamic) { - pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); - memset(ret, 0, sizeof(*ret)); + pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); + memset(ret, 0, sizeof(*ret)); - ret->of.x = FIXED_TO_FLOAT(ret->o.x = o->x); - ret->of.y = FIXED_TO_FLOAT(ret->o.y = o->y); - ret->of.z = FIXED_TO_FLOAT(ret->o.z = o->z); + ret->of.x = FIXED_TO_FLOAT(ret->o.x = o->x); + ret->of.y = FIXED_TO_FLOAT(ret->o.y = o->y); + ret->of.z = FIXED_TO_FLOAT(ret->o.z = o->z); - ret->df.x = FIXED_TO_FLOAT(ret->d.x = d->x); - ret->df.y = FIXED_TO_FLOAT(ret->d.y = d->y); + ret->df.x = FIXED_TO_FLOAT(ret->d.x = d->x); + ret->df.y = FIXED_TO_FLOAT(ret->d.y = d->y); - ret->zdeltaf = FIXED_TO_FLOAT(ret->zdelta = zdelta); + ret->zdeltaf = FIXED_TO_FLOAT(ret->zdelta = zdelta); - return ret; + if (dynamic) { // Add to the dynamic slopes list + ret->next = dynslopes; + dynslopes = ret; + } + + return ret; } // @@ -195,7 +247,11 @@ void P_SpawnSlope_Line(int linenum) // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef fslope = line->frontsector->f_slope = - P_MakeSlope(&point, &direction, dz, false); + P_MakeSlope(&point, &direction, dz, true); + + // Set up some shit + fslope->extent = extent; + fslope->refpos = 1; // Now remember that f_slope IS a vector // fslope->o = origin 3D point 1 of the vector @@ -235,8 +291,10 @@ void P_SpawnSlope_Line(int linenum) fslope->highz = highest; fslope->lowz = lowest; - fslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); + + P_CalculateSlopeNormal(fslope); } if(frontceil) { @@ -246,6 +304,10 @@ void P_SpawnSlope_Line(int linenum) cslope = line->frontsector->c_slope = P_MakeSlope(&point, &direction, dz, true); + // Set up some shit + cslope->extent = extent; + cslope->refpos = 2; + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? cslope->sourceline = line; @@ -270,8 +332,10 @@ void P_SpawnSlope_Line(int linenum) cslope->highz = highest; cslope->lowz = lowest; - cslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); + + P_CalculateSlopeNormal(cslope); } } if(backfloor || backceil) @@ -301,7 +365,11 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(line->frontsector->floorheight - point.z, extent); fslope = line->backsector->f_slope = - P_MakeSlope(&point, &direction, dz, false); + P_MakeSlope(&point, &direction, dz, true); + + // Set up some shit + fslope->extent = extent; + fslope->refpos = 3; // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? @@ -327,8 +395,10 @@ void P_SpawnSlope_Line(int linenum) fslope->highz = highest; fslope->lowz = lowest; - cslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); + + P_CalculateSlopeNormal(fslope); } if(backceil) { @@ -338,6 +408,10 @@ void P_SpawnSlope_Line(int linenum) cslope = line->backsector->c_slope = P_MakeSlope(&point, &direction, dz, true); + // Set up some shit + cslope->extent = extent; + cslope->refpos = 4; + // Sync the linedata of the line that started this slope // SRB2CBTODO: Anything special for remote(control sector)-based slopes later? cslope->sourceline = line; @@ -363,8 +437,10 @@ void P_SpawnSlope_Line(int linenum) cslope->highz = highest; cslope->lowz = lowest; - cslope->zangle = R_PointToAngle2(0, origin.z, R_PointToDist2(origin.x, origin.y, point.x, point.y), point.z); + cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); + + P_CalculateSlopeNormal(cslope); } } @@ -399,7 +475,7 @@ void P_CopySectorSlope(line_t *line) line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } - +#ifdef SPRINGCLEAN #include "byteptr.h" #include "p_setup.h" @@ -652,7 +728,7 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) } - +#endif diff --git a/src/p_slopes.h b/src/p_slopes.h index 8449c1020..e522d79ba 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright(C) 2004 Stephen McGranahan @@ -7,12 +7,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -29,6 +29,9 @@ #define P_SLOPES_H__ #ifdef ESLOPE +void P_ResetDynamicSlopes(void); +void P_RunDynamicSlopes(void); + // P_MakeLineNormal // Calculates a 2D normal for the given line and stores it in the line void P_MakeLineNormal(line_t *line); @@ -74,7 +77,7 @@ float P_GetZAtf(pslope_t *slope, float x, float y); // Returns the distance of the given point from the given origin and normal. -float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, +float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, const v3float_t *pnormal); #endif diff --git a/src/p_spec.c b/src/p_spec.c index a81905503..4ed668ce7 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4765,8 +4765,8 @@ void P_UpdateSpecials(void) // POINT LIMIT P_CheckPointLimit(); - // Kalaron: ...We...have dynamic slopes *YESSSS* - P_SpawnDeferredSpecials(); + // Dynamic slopeness + P_RunDynamicSlopes(); // ANIMATE TEXTURES for (anim = anims; anim < lastanim; anim++) @@ -6447,6 +6447,25 @@ void P_SpawnSpecials(INT32 fromnetsave) sectors[s].midmap = lines[i].frontsector->midmap; break; +#ifdef ESLOPE // Slope specials. TODO move these to a different spot, maybe? + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + P_SpawnSlope_Line(i); + break; + // SoM: Copy slopes + case 394: + case 395: + case 396: + P_CopySectorSlope(&lines[i]); + break; +#endif + default: break; } diff --git a/src/r_defs.h b/src/r_defs.h index ac02b999c..f2ae0ba8b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -229,7 +229,7 @@ typedef struct secplane_t #include "m_vector.h" -typedef struct +typedef struct pslope_s { // --- Information used in clipping/projection --- // Origin vector for the plane @@ -240,12 +240,8 @@ typedef struct v3fixed_t o; v3float_t of; - // The normal of the 3d plane the slope creates. - v3fixed_t normal; - v3float_t normalf; - // 2-Dimentional vector (x, y) normalized. Used to determine distance from - // the origin in 2d mapspace. + // the origin in 2d mapspace. (Basically a thrust of FRACUNIT in xydirection angle) v2fixed_t d; v2float_t df; @@ -253,18 +249,22 @@ typedef struct fixed_t zdelta; float zdeltaf; + // The normal of the slope; will always point upward, and thus be inverted on ceilings. I think it's only needed for physics? -Red + v3fixed_t normal; + // For comparing when a slope should be rendered fixed_t lowz; fixed_t highz; - // SRB2CBTODO: This could be used for something? - // Determining the relative z values in a slope? - struct line_s *sourceline; - // This values only check and must be updated if the slope itself is modified angle_t zangle; // Angle of the plane going up from the ground (not mesured in degrees) angle_t xydirection; // The direction the slope is facing (north, west, south, etc.) - secplane_t secplane; // Extra data for collision and stuff + + struct line_s *sourceline; // The line that generated the slope + fixed_t extent; // Distance value used for recalculating zdelta + UINT8 refpos; // 1=front floor 2=front ceiling 3=back floor 4=back ceiling (used for dynamic sloping) 0=disabled + + struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later } pslope_t; #endif From 0c477c685d4ce8394330d6d8f87e32c446d9f29b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 26 Apr 2015 22:20:03 -0500 Subject: [PATCH 015/364] Removing unused cruft --- src/p_slopes.c | 16 +------------- src/p_slopes.h | 10 +++------ src/p_spec.c | 57 -------------------------------------------------- src/p_spec.h | 5 ----- 4 files changed, 4 insertions(+), 84 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 7dbb4b8db..efa15aed4 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -115,19 +115,6 @@ static pslope_t *P_MakeSlope(const v3fixed_t *o, const v2fixed_t *d, return ret; } -// -// P_CopySlope -// -// Allocates and returns a copy of the given slope structure. -// -static pslope_t *P_CopySlope(const pslope_t *src) -{ - pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); - memcpy(ret, src, sizeof(*ret)); - - return ret; -} - // // P_GetExtent // @@ -471,7 +458,6 @@ void P_CopySectorSlope(line_t *line) fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope); } - //SRB2CBTODO: ESLOPE: Maybe we do need it for another to check for a plane slope? line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } @@ -765,7 +751,7 @@ float P_GetZAtf(pslope_t *slope, float x, float y) return slope->of.z + (dist * slope->zdeltaf); } -// +// Unused? -Red // P_DistFromPlanef // float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, diff --git a/src/p_slopes.h b/src/p_slopes.h index e522d79ba..8f408d6f0 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -31,18 +31,12 @@ #ifdef ESLOPE void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); - -// P_MakeLineNormal -// Calculates a 2D normal for the given line and stores it in the line -void P_MakeLineNormal(line_t *line); - - // P_SpawnSlope_Line // Creates one or more slopes based on the given line type and front/back // sectors. void P_SpawnSlope_Line(int linenum); - +#ifdef SPRINGCLEAN // Loads just map objects that make slopes, // terrain affecting objects have to be spawned first void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum); @@ -60,6 +54,7 @@ typedef enum THING_VertexFloorZ=1504, THING_VertexCeilingZ=1505, } slopething_e; +#endif // // P_CopySectorSlope @@ -76,6 +71,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); float P_GetZAtf(pslope_t *slope, float x, float y); +// Unused? -Red // Returns the distance of the given point from the given origin and normal. float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, const v3float_t *pnormal); diff --git a/src/p_spec.c b/src/p_spec.c index 4ed668ce7..e33dd474c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6500,63 +6500,6 @@ void P_SpawnSpecials(INT32 fromnetsave) P_RunLevelLoadExecutors(); } -#ifdef ESLOPE -// -// P_SpawnDeferredSpecials -// -// SoM: Specials that copy slopes, ect., need to be collected in a separate -// pass -// NOTE: SRB2CBTODO: A new function, P_SpawnDeferredSpecials is needed if objects -// are to be needed in this function, because this function currently needs to be -// done before 'things' are loaded, because slopes are part of this function, -// and slope height adjustments are needed for spawning objects -void P_SpawnDeferredSpecials(void) -{ - size_t i; - line_t *line; - - for(i = 0; i < numlines; i++) - { - line = lines + i; - - switch(line->special) - { - // Slopes, Eternity engine - /*{ 386, "Slope_FrontsectorFloor" }, - { 387, "Slope_FrontsectorCeiling" }, - { 388, "Slope_FrontsectorFloorAndCeiling" }, - { 389, "Slope_BacksectorFloor" }, - { 390, "Slope_BacksectorCeiling" }, - { 391, "Slope_BacksectorFloorAndCeiling" }, - { 392, "Slope_BackFloorAndFrontCeiling" }, - { 393, "Slope_BackCeilingAndFrontFloor" }, - - { 394, "Slope_FrontFloorToTaggedSlope" }, - { 395, "Slope_FrontCeilingToTaggedSlope" }, - { 396, "Slope_FrontFloorAndCeilingToTaggedSlope" },*/ - - // SoM 05/10/09: Slopes // SRB2CBTODO:! - case 386: - case 387: - case 388: - case 389: - case 390: - case 391: - case 392: - case 393: - P_SpawnSlope_Line(i); - break; - // SoM: Copy slopes - case 394: - case 395: - case 396: - P_CopySectorSlope(line); - break; - } - } -} -#endif - /** Adds 3Dfloors as appropriate based on a common control linedef. * * \param line Control linedef to use. diff --git a/src/p_spec.h b/src/p_spec.h index c8cfc76da..7b6a5655c 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -36,11 +36,6 @@ void P_SpawnSpecials(INT32 fromnetsave); // every tic void P_UpdateSpecials(void); - -#ifdef ESLOPE -void P_SpawnDeferredSpecials(void); -#endif - sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 number); void P_PlayerInSpecialSector(player_t *player); void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *roversector); From 58dd6d42afde5523e2ca2819f135512e413bc77d Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 27 Apr 2015 13:18:12 -0500 Subject: [PATCH 016/364] Add P_GetFloorZ and P_GetCeilingZ as boilerplate to facilitate better slope collision I have not used this anywhere in the code yet. --- src/p_local.h | 3 + src/p_mobj.c | 245 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 215 insertions(+), 33 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index eab78c785..53e5b18b4 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -232,6 +232,9 @@ boolean P_RailThinker(mobj_t *mobj); void P_PushableThinker(mobj_t *mobj); void P_SceneryThinker(mobj_t *mobj); +fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); +fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); + boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); diff --git a/src/p_mobj.c b/src/p_mobj.c index f660edff4..1be713bf4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -722,52 +722,231 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) return true; } -fixed_t P_GetMobjZAtSecF(mobj_t *mobj, sector_t *sector) // SRB2CBTODO: This needs to be over all the code +// P_GetFloorZ (and its ceiling counterpart) +// Gets the floor height (or ceiling height) of the mobj's contact point in sector, assuming object's center if moved to [x, y] +// If line is supplied, it's a divider line on the sector. Set it to NULL if you're not checking for collision with a line +fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code { I_Assert(mobj != NULL); + I_Assert(sector != NULL); #ifdef ESLOPE - if (sector->f_slope) - return P_GetZAt(sector->f_slope, mobj->x, mobj->y); - else + if (sector->f_slope) { + fixed_t testx, testy; + pslope_t *slope = sector->f_slope; + + // Get the corner of the object that should be the highest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta > 0) { + testx = -testx; + testx = -testy; + } + + testx += x; + testy += y; + + // If the highest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector + // The following line is a hack to fix a bug where an object pops down on the frame its highest corner re-enters the sloped sector. + || R_PointInSubsector(testx+mobj->momx, testy+mobj->momy)->sector == sector + ) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be lower than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + // Return the higher of the two points + return max( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the floor height #endif return sector->floorheight; } -fixed_t P_GetMobjZAtF(mobj_t *mobj) // SRB2CBTODO: This needs to be over all the code +fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code { I_Assert(mobj != NULL); - sector_t *sector; - sector = R_PointInSubsector(mobj->x, mobj->y)->sector; - + I_Assert(sector != NULL); #ifdef ESLOPE - if (sector->f_slope) - return P_GetZAt(sector->f_slope, mobj->x, mobj->y); - else -#endif - return sector->floorheight; -} + if (sector->c_slope) { + fixed_t testx, testy; + pslope_t *slope = sector->c_slope; -fixed_t P_GetMobjZAtSecC(mobj_t *mobj, sector_t *sector) // SRB2CBTODO: This needs to be over all the code -{ - I_Assert(mobj != NULL); -#ifdef ESLOPE - if (sector->c_slope) - return P_GetZAt(sector->c_slope, mobj->x, mobj->y); - else -#endif - return sector->ceilingheight; -} + // Get the corner of the object that should be the lowest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; -fixed_t P_GetMobjZAtC(mobj_t *mobj) // SRB2CBTODO: This needs to be over all the code -{ - I_Assert(mobj != NULL); - sector_t *sector; - sector = R_PointInSubsector(mobj->x, mobj->y)->sector; + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; -#ifdef ESLOPE - if (sector->c_slope) - return P_GetZAt(sector->c_slope, mobj->x, mobj->y); - else + if (slope->zdelta < 0) { + testx = -testx; + testx = -testy; + } + + testx += x; + testy += y; + + // If the lowest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector + // The following line is a hack to fix a bug where an object pops down on the frame its highest corner re-enters the sloped sector. + || R_PointInSubsector(testx+mobj->momx, testy+mobj->momy)->sector == sector + ) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be higher than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + // Return the lower of the two points + return min( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the ceiling height #endif return sector->ceilingheight; } From 6694480f68c21c442a5081ed9ba87682fe834872 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 27 Apr 2015 13:20:50 -0500 Subject: [PATCH 017/364] Overhaul slope collision (NOT PHYSICS) to work almost perfectly --- src/p_enemy.c | 10 ++---- src/p_floor.c | 13 +++----- src/p_map.c | 70 ++++++++-------------------------------- src/p_maputl.c | 87 +++++++++++++++++++------------------------------- src/p_spec.c | 12 ++----- 5 files changed, 56 insertions(+), 136 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 1271c875d..43c0f5057 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -28,7 +28,7 @@ #include "hardware/hw3sound.h" #endif -#ifdef ESLOPE +#ifdef SPRINGCLEAN// ESLOPE #include "p_slopes.h" #endif @@ -5611,12 +5611,8 @@ void A_MixUp(mobj_t *actor) P_SetThingPosition(players[i].mo); #ifdef ESLOPE - players[i].mo->floorz = (players[i].mo->subsector->sector->f_slope ? - P_GetZAt(players[i].mo->subsector->sector->f_slope, players[i].mo->x, players[i].mo->y) : - players[i].mo->subsector->sector->floorheight); - players[i].mo->ceilingz = (players[i].mo->subsector->sector->c_slope ? - P_GetZAt(players[i].mo->subsector->sector->c_slope, players[i].mo->x, players[i].mo->y) : - players[i].mo->subsector->sector->ceilingheight); + players[i].mo->floorz = P_GetFloorZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL); + players[i].mo->ceilingz = P_GetCeilingZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL); #else players[i].mo->floorz = players[i].mo->subsector->sector->floorheight; players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight; diff --git a/src/p_floor.c b/src/p_floor.c index 23c460244..0d68becbf 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -19,7 +19,7 @@ #include "z_zone.h" #include "g_game.h" #include "r_main.h" -#ifdef ESLOPE +#ifdef SPRINGCLEAN// ESLOPE #include "p_slopes.h" #endif @@ -1177,18 +1177,15 @@ void T_SpikeSector(levelspecthink_t *spikes) if (affectsec == spikes->sector) // Applied to an actual sector { - fixed_t affectpoint = affectsec->floorheight; + fixed_t affectfloor = P_GetFloorZ(thing, affectsec, thing->x, thing->y, NULL); + fixed_t affectceil = P_GetCeilingZ(thing, affectsec, thing->x, thing->y, NULL); -#ifdef ESLOPE - if (affectsec->f_slope) - affectpoint = P_GetZAt(affectsec->f_slope, thing->x, thing->y); -#endif if (affectsec->flags & SF_FLIPSPECIAL_FLOOR) { if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0) continue; - if (thing->z == affectpoint) + if (thing->z == affectfloor) dothepain = true; } @@ -1197,7 +1194,7 @@ void T_SpikeSector(levelspecthink_t *spikes) if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0) continue; - if (thing->z + thing->height == affectsec->ceilingheight) + if (thing->z + thing->height == affectceil) dothepain = true; } } diff --git a/src/p_map.c b/src/p_map.c index 565569844..50f172798 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -27,7 +27,7 @@ #include "r_splats.h" -#ifdef ESLOPE +#ifdef SPRINGCLEAN// ESLOPE #include "p_slopes.h" #endif @@ -125,7 +125,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) /*Someone want to make these work like bumpers?*/ return; } - + object->eflags |= MFE_SPRUNG; // apply this flag asap! spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify @@ -1208,21 +1208,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // that contains the point. // Any contacted lines the step closer together // will adjust them. -#ifdef ESLOPE - if (newsubsec->sector->f_slope) - { - tmfloorz = tmdropoffz = P_GetZAt(newsubsec->sector->f_slope, thing->x, thing->y); - } - else -#endif - tmfloorz = tmdropoffz = newsubsec->sector->floorheight; - -#ifdef ESLOPE - if (newsubsec->sector->c_slope) - tmceilingz = P_GetZAt(newsubsec->sector->c_slope, thing->x, thing->y); - else -#endif - tmceilingz = newsubsec->sector->ceilingheight; + tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->floorheight; + tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->ceilingheight; // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) @@ -1535,7 +1522,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; - + /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, thiscam->x, thiscam->y); @@ -2033,7 +2020,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Link the thing into its new position P_UnsetThingPosition(thing); -#ifdef ESLOPE +#ifdef SRPINGCLEAN// ESLOPE // By virtue of being derived from SRB2 code, Kalaron's physics are GPL. if (P_IsObjectOnSlope(thing, false)) { @@ -2112,32 +2099,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } #endif - // P_CheckPosition sets the tmfloorz with slopes, but after P_UnsetThingPosition, recheck the function here - // TODO: Make a function for floor/ceilingz auto check with slopes? -#ifdef ESLOPE - if (thing->subsector->sector->f_slope) - { - // TODO: Support a mobj's gravity for this too - if (P_GetZAt(thing->subsector->sector->f_slope, thing->x+thing->momx, thing->y+thing->momy) > P_GetZAt(thing->subsector->sector->f_slope, thing->x, thing->y)) - thing->floorz = P_GetZAt(thing->subsector->sector->f_slope, thing->x+thing->momx, thing->y+thing->momy); - else - thing->floorz = P_GetZAt(thing->subsector->sector->f_slope, thing->x, thing->y); - } - else -#endif - thing->floorz = tmfloorz; -#ifdef ESLOPE - if (thing->subsector->sector->c_slope) - { - // SRB2CBTODO: Support a mobj's gravity for this too - if (P_GetZAt(thing->subsector->sector->c_slope, thing->x+thing->momx, thing->y+thing->momy) < P_GetZAt(thing->subsector->sector->c_slope, thing->x, thing->y)) - thing->ceilingz = P_GetZAt(thing->subsector->sector->c_slope, thing->x, thing->y); - else - thing->ceilingz = P_GetZAt(thing->subsector->sector->c_slope, thing->x+thing->momx, thing->y+thing->momy); - } - else -#endif - thing->ceilingz = tmceilingz; + thing->floorz = tmfloorz; + thing->ceilingz = tmceilingz; + thing->x = x; thing->y = y; @@ -2494,16 +2458,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy); - floorz = glidesector->sector->floorheight; -#ifdef ESLOPE - if (glidesector->sector->f_slope) - floorz = P_GetZAt(glidesector->sector->f_slope, player->mo->x + platx, player->mo->y + platy); -#endif - ceilingz = glidesector->sector->ceilingheight; -#ifdef ESLOPE - if (glidesector->sector->c_slope) - ceilingz = P_GetZAt(glidesector->sector->c_slope, player->mo->x + platx, player->mo->y + platy); -#endif + floorz = P_GetFloorZ(player->mo, glidesector->sector, player->mo->x + platx, player->mo->y + platy, NULL); + ceilingz = P_GetCeilingZ(player->mo, glidesector->sector, player->mo->x + platx, player->mo->y + platy, NULL); if (glidesector->sector != player->mo->subsector->sector) { @@ -2519,7 +2475,7 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; - + /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, player->mo->x, player->mo->y); @@ -4046,7 +4002,7 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; - + /*#ifdef ESLOPE if (rover->t_slope) topheight = P_GetZAt(rover->t_slope, x, y); diff --git a/src/p_maputl.c b/src/p_maputl.c index f0a08883c..7641dd1eb 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -21,7 +21,7 @@ #include "p_maputl.h" #include "p_polyobj.h" #include "z_zone.h" -#ifdef ESLOPE +#ifdef SPRINGCLEAN// ESLOPE #include "p_slopes.h" #endif @@ -557,26 +557,36 @@ void P_LineOpening(line_t *linedef) I_Assert(front != NULL); I_Assert(back != NULL); - if (front->ceilingheight < back->ceilingheight) - { - opentop = front->ceilingheight; - highceiling = back->ceilingheight; - } - else - { - opentop = back->ceilingheight; - highceiling = front->ceilingheight; - } + { // Set open and high/low values here + fixed_t frontheight, backheight; - if (front->floorheight > back->floorheight) - { - openbottom = front->floorheight; - lowfloor = back->floorheight; - } - else - { - openbottom = back->floorheight; - lowfloor = front->floorheight; + frontheight = P_GetCeilingZ(tmthing, front, tmthing->x, tmthing->y, linedef); + backheight = P_GetCeilingZ(tmthing, back, tmthing->x, tmthing->y, linedef); + + if (frontheight < backheight) + { + opentop = frontheight; + highceiling = backheight; + } + else + { + opentop = backheight; + highceiling = frontheight; + } + + frontheight = P_GetFloorZ(tmthing, front, tmthing->x, tmthing->y, linedef); + backheight = P_GetFloorZ(tmthing, back, tmthing->x, tmthing->y, linedef); + + if (frontheight > backheight) + { + openbottom = frontheight; + lowfloor = backheight; + } + else + { + openbottom = backheight; + lowfloor = frontheight; + } } if (tmthing) @@ -627,32 +637,6 @@ void P_LineOpening(line_t *linedef) openbottom = textop; } } -#ifdef ESLOPE - // I suspect the math here is wrong and we should be comparing the slope Zs - // if either are slopes. - // -- Fury - if (front->c_slope && front->ceilingheight < back->ceilingheight) - { - opentop = P_GetZAt(front->c_slope, tmthing->x, tmthing->y); - if (back->c_slope) highceiling = P_GetZAt(back->c_slope, tmthing->x, tmthing->y); - } - else if (back->c_slope && front->ceilingheight >= back->ceilingheight) - { - opentop = P_GetZAt(back->c_slope, tmthing->x, tmthing->y); - if (front->c_slope) highceiling = P_GetZAt(front->c_slope, tmthing->x, tmthing->y); - } - - if (front->f_slope && front->floorheight < back->floorheight) - { - openbottom = P_GetZAt(front->f_slope, tmthing->x, tmthing->y); - if (back->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); - } - if (back->f_slope && front->floorheight >= back->floorheight) - { - openbottom = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); - if (front->f_slope) lowfloor = P_GetZAt(back->f_slope, tmthing->x, tmthing->y); - } -#endif // Check for fake floors in the sector. if (front->ffloors || back->ffloors @@ -889,14 +873,9 @@ void P_SetThingPosition(mobj_t *thing) ss = thing->subsector = R_PointInSubsector(thing->x, thing->y); fixed_t tfloorz, tceilz; - tfloorz = ss->sector->floorheight; - tceilz = ss->sector->ceilingheight; -#ifdef ESLOPE - if (ss->sector->f_slope) - tfloorz = P_GetZAt(ss->sector->f_slope, thing->x, thing->y); - if (ss->sector->c_slope) - tceilz = P_GetZAt(ss->sector->c_slope, thing->x, thing->y); -#endif + + tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); + tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); if (!(thing->flags & MF_NOSECTOR)) { diff --git a/src/p_spec.c b/src/p_spec.c index e33dd474c..fe3deba30 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4584,16 +4584,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) return; } - fixed_t f_affectpoint = sector->floorheight; - fixed_t c_affectpoint = sector->ceilingheight; - -#ifdef ESLOPE - if (sector->f_slope) - f_affectpoint = P_GetZAt(sector->f_slope, player->mo->x, player->mo->y); - - if (sector->c_slope) - c_affectpoint = P_GetZAt(sector->c_slope, player->mo->x, player->mo->y); -#endif + fixed_t f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->floorheight; + fixed_t c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->ceilingheight; // Only go further if on the ground if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint) From 10ba85087174a59c76b4934b61d21493caa50808 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 27 Apr 2015 14:07:04 -0500 Subject: [PATCH 018/364] Fix dynamic slopes not working right in some cases --- src/p_slopes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p_slopes.c b/src/p_slopes.c index efa15aed4..0a10901fc 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -64,15 +64,19 @@ void P_RunDynamicSlopes(void) { switch(slope->refpos) { case 1: // front floor zdelta = slope->sourceline->backsector->floorheight - slope->sourceline->frontsector->floorheight; + slope->o.z = slope->sourceline->frontsector->floorheight; break; case 2: // front ceiling zdelta = slope->sourceline->backsector->ceilingheight - slope->sourceline->frontsector->ceilingheight; + slope->o.z = slope->sourceline->frontsector->ceilingheight; break; case 3: // back floor zdelta = slope->sourceline->frontsector->floorheight - slope->sourceline->backsector->floorheight; + slope->o.z = slope->sourceline->backsector->floorheight; break; case 4: // back ceiling zdelta = slope->sourceline->frontsector->ceilingheight - slope->sourceline->backsector->ceilingheight; + slope->o.z = slope->sourceline->backsector->ceilingheight; break; default: From 776b5254e689e362276c815c7daad5d11f979c5c Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 29 Apr 2015 00:29:51 -0500 Subject: [PATCH 019/364] Slope collision fixes --- src/p_local.h | 2 ++ src/p_map.c | 22 ++++++++++++++++------ src/p_maputl.c | 8 ++++---- src/p_mobj.c | 26 ++++++++++++++++++++++++-- 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 53e5b18b4..c3e21dbe9 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -296,6 +296,8 @@ extern fixed_t tmfloorz; extern fixed_t tmceilingz; extern mobj_t *tmfloorthing, *tmthing; extern camera_t *mapcampointer; +extern fixed_t tmx; +extern fixed_t tmy; /* cphipps 2004/08/30 */ extern void P_MapStart(void); diff --git a/src/p_map.c b/src/p_map.c index 50f172798..31f0acc62 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -38,8 +38,8 @@ fixed_t tmbbox[4]; mobj_t *tmthing; static INT32 tmflags; -static fixed_t tmx; -static fixed_t tmy; +fixed_t tmx; +fixed_t tmy; static precipmobj_t *tmprecipthing; static fixed_t preciptmbbox[4]; @@ -1208,8 +1208,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // that contains the point. // Any contacted lines the step closer together // will adjust them. - tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->floorheight; - tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, thing->x, thing->y, NULL); //newsubsec->sector->ceilingheight; + tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight; + tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight; // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) @@ -1945,13 +1945,23 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { - thing->z = tmceilingz - thing->height; + thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; + thing->eflags |= MFE_JUSTSTEPPEDDOWN; + } + else if (thingtop == thing->ceilingz && tmceilingz , thingtop && thingtop - tmceilingz <= maxstep) + { + thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } } else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) { - thing->z = tmfloorz; + thing->z = thing->floorz = tmfloorz; + thing->eflags |= MFE_JUSTSTEPPEDDOWN; + } + else if (thing->z == thing->floorz && tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) + { + thing->z = thing->floorz = tmfloorz; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } } diff --git a/src/p_maputl.c b/src/p_maputl.c index 7641dd1eb..e9e0bb776 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -560,8 +560,8 @@ void P_LineOpening(line_t *linedef) { // Set open and high/low values here fixed_t frontheight, backheight; - frontheight = P_GetCeilingZ(tmthing, front, tmthing->x, tmthing->y, linedef); - backheight = P_GetCeilingZ(tmthing, back, tmthing->x, tmthing->y, linedef); + frontheight = P_GetCeilingZ(tmthing, front, tmx, tmy, linedef); + backheight = P_GetCeilingZ(tmthing, back, tmx, tmy, linedef); if (frontheight < backheight) { @@ -574,8 +574,8 @@ void P_LineOpening(line_t *linedef) highceiling = frontheight; } - frontheight = P_GetFloorZ(tmthing, front, tmthing->x, tmthing->y, linedef); - backheight = P_GetFloorZ(tmthing, back, tmthing->x, tmthing->y, linedef); + frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef); + backheight = P_GetFloorZ(tmthing, back, tmx, tmy, linedef); if (frontheight > backheight) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 1be713bf4..d57e398ec 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -747,7 +747,7 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t if (slope->zdelta > 0) { testx = -testx; - testx = -testy; + testy = -testy; } testx += x; @@ -775,6 +775,17 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t v2.x = line->v2->x; v2.y = line->v2->y; + /*CONS_Printf("BEFORE: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + if (abs(v1.x-x) > mobj->radius) { // v1's x is out of range, so rein it in fixed_t diff = abs(v1.x-x) - mobj->radius; @@ -827,6 +838,17 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t } } + /*CONS_Printf("AFTER: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + // Return the higher of the two points return max( P_GetZAt(slope, v1.x, v1.y), @@ -860,7 +882,7 @@ fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line if (slope->zdelta < 0) { testx = -testx; - testx = -testy; + testy = -testy; } testx += x; From de81d01fbc700afd115479faeb77bb4d648190fa Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 29 Apr 2015 00:30:39 -0500 Subject: [PATCH 020/364] Fixes to slope generation (backfloor crash and wrong zdelta/zangle) --- src/p_slopes.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 0a10901fc..518599849 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -85,7 +85,7 @@ void P_RunDynamicSlopes(void) { if (slope->zdelta != FixedDiv(zdelta, slope->extent)) { slope->zdeltaf = FIXED_TO_FLOAT(slope->zdelta = FixedDiv(zdelta, slope->extent)); - slope->zangle = R_PointToAngle2(0, 0, slope->extent, zdelta); + slope->zangle = R_PointToAngle2(0, 0, slope->extent, -zdelta); P_CalculateSlopeNormal(slope); } } @@ -233,7 +233,7 @@ void P_SpawnSlope_Line(int linenum) { point.z = line->frontsector->floorheight; // Startz - dz = FixedDiv(line->backsector->floorheight - point.z, extent); // Destinationz + dz = FixedDiv(origin.z - point.z, extent); // Destinationz // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef @@ -289,8 +289,9 @@ void P_SpawnSlope_Line(int linenum) } if(frontceil) { + origin.z = line->backsector->ceilingheight; point.z = line->frontsector->ceilingheight; - dz = FixedDiv(line->backsector->ceilingheight - point.z, extent); + dz = FixedDiv(origin.z - point.z, extent); cslope = line->frontsector->c_slope = P_MakeSlope(&point, &direction, dz, true); @@ -353,7 +354,7 @@ void P_SpawnSlope_Line(int linenum) if(backfloor) { point.z = line->backsector->floorheight; - dz = FixedDiv(line->frontsector->floorheight - point.z, extent); + dz = FixedDiv(origin.z - point.z, extent); fslope = line->backsector->f_slope = P_MakeSlope(&point, &direction, dz, true); @@ -386,15 +387,16 @@ void P_SpawnSlope_Line(int linenum) fslope->highz = highest; fslope->lowz = lowest; - cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); - cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); + fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); + fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y); P_CalculateSlopeNormal(fslope); } if(backceil) { + origin.z = line->frontsector->ceilingheight; point.z = line->backsector->ceilingheight; - dz = FixedDiv(line->frontsector->ceilingheight - point.z, extent); + dz = FixedDiv(origin.z - point.z, extent); cslope = line->backsector->c_slope = P_MakeSlope(&point, &direction, dz, true); From 1f0f6b64c177904f8f5f284ceab1399707e3d067 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 29 Apr 2015 00:33:04 -0500 Subject: [PATCH 021/364] Store the slope an object is resting on (if applicable) --- src/p_local.h | 3 + src/p_map.c | 154 ++++++++++++++++++++++--------------------------- src/p_maputl.c | 19 +++++- src/p_maputl.h | 3 + src/p_mobj.h | 5 +- 5 files changed, 94 insertions(+), 90 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index c3e21dbe9..2fd7bcbe2 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -298,6 +298,9 @@ extern mobj_t *tmfloorthing, *tmthing; extern camera_t *mapcampointer; extern fixed_t tmx; extern fixed_t tmy; +#ifdef ESLOPE +extern pslope_t *tmfloorslope, *tmceilingslope; +#endif /* cphipps 2004/08/30 */ extern void P_MapStart(void); diff --git a/src/p_map.c b/src/p_map.c index 31f0acc62..72b17473f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -27,7 +27,7 @@ #include "r_splats.h" -#ifdef SPRINGCLEAN// ESLOPE +#ifdef ESLOPE #include "p_slopes.h" #endif @@ -52,6 +52,9 @@ fixed_t tmfloorz, tmceilingz; static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector static mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) +#ifdef ESLOPE +pslope_t *tmfloorslope, *tmceilingslope; +#endif // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls @@ -957,6 +960,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->z + thing->height > tmfloorz) { tmfloorz = thing->z + thing->height; +#ifdef ESLOPE + tmfloorslope = NULL; +#endif } return true; } @@ -975,6 +981,9 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height) { tmceilingz = topz; +#ifdef ESLOPE + tmceilingslope = NULL; +#endif tmfloorthing = thing; // thing we may stand on } } @@ -988,6 +997,9 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->z < tmceilingz) { tmceilingz = thing->z; +#ifdef ESLOPE + tmceilingslope = NULL; +#endif } return true; } @@ -1005,6 +1017,9 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (topz > tmfloorz && tmthing->z >= thing->z) { tmfloorz = topz; +#ifdef ESLOPE + tmfloorslope = NULL; +#endif tmfloorthing = thing; // thing we may stand on } } @@ -1127,11 +1142,13 @@ static boolean PIT_CheckLine(line_t *ld) { tmceilingz = opentop; ceilingline = ld; + tmceilingslope = opentopslope; } if (openbottom > tmfloorz) { tmfloorz = openbottom; + tmfloorslope = openbottomslope; } if (highceiling > tmdrpoffceilz) @@ -1210,6 +1227,10 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // will adjust them. tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight; tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight; +#ifdef ESLOPE + tmfloorslope = newsubsec->sector->f_slope; + tmceilingslope = newsubsec->sector->c_slope; +#endif // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) @@ -1252,13 +1273,21 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // Land on the top or the bottom, depending on gravity flip. if (!(thing->eflags & MFE_VERTICALFLIP) && thing->z >= topheight - sinklevel && thing->momz <= 0) { - if (tmfloorz < topheight - sinklevel) + if (tmfloorz < topheight - sinklevel) { tmfloorz = topheight - sinklevel; +#ifdef ESLOPE + tmfloorslope = NULL; +#endif + } } else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0) { - if (tmceilingz > bottomheight + sinklevel) + if (tmceilingz > bottomheight + sinklevel) { tmceilingz = bottomheight + sinklevel; +#ifdef ESLOPE + tmceilingslope = NULL; +#endif + } } } continue; @@ -1277,8 +1306,12 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { if (thing->z < topheight && bottomheight < thingtop) { - if (tmfloorz < thing->z) + if (tmfloorz < thing->z) { tmfloorz = thing->z; +#ifdef ESLOPE + tmfloorslope = NULL; +#endif + } } // Quicksand blocks never change heights otherwise. continue; @@ -1293,12 +1326,18 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) && !(rover->flags & FF_REVERSEPLATFORM)) { tmfloorz = tmdropoffz = topheight; +#ifdef ESLOPE + tmfloorslope = NULL; +#endif } if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2) && !(rover->flags & FF_PLATFORM) && !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))) { tmceilingz = tmdrpoffceilz = bottomheight; +#ifdef ESLOPE + tmceilingslope = NULL; +#endif } } } @@ -1371,11 +1410,19 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) delta1 = thing->z - (polybottom + ((polytop - polybottom)/2)); delta2 = thingtop - (polybottom + ((polytop - polybottom)/2)); - if (polytop > tmfloorz && abs(delta1) < abs(delta2)) + if (polytop > tmfloorz && abs(delta1) < abs(delta2)) { tmfloorz = tmdropoffz = polytop; +#ifdef ESLOPE + tmfloorslope = NULL; +#endif + } - if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) + if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) { tmceilingz = tmdrpoffceilz = polybottom; +#ifdef ESLOPE + tmceilingslope = NULL; +#endif + } } plink = (polymaplink_t *)(plink->link.next); } @@ -1824,6 +1871,10 @@ boolean PIT_PushableMoved(mobj_t *thing) mobj_t *oldthing = tmthing; line_t *oldceilline = ceilingline; line_t *oldblockline = blockingline; +#ifdef ESLOPE + pslope_t *oldfslope = tmfloorslope; + pslope_t *oldcslope = tmceilingslope; +#endif // Move the player P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true); @@ -1836,6 +1887,10 @@ boolean PIT_PushableMoved(mobj_t *thing) P_SetTarget(&tmthing, oldthing); ceilingline = oldceilline; blockingline = oldblockline; +#ifdef ESLOPE + tmfloorslope = oldfslope; + tmceilingslope = oldcslope; +#endif thing->momz = stand->momz; } else @@ -2030,88 +2085,17 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Link the thing into its new position P_UnsetThingPosition(thing); -#ifdef SRPINGCLEAN// ESLOPE - // By virtue of being derived from SRB2 code, Kalaron's physics are GPL. - if (P_IsObjectOnSlope(thing, false)) - { - fixed_t thingspeed = P_AproxDistance(thing->momx, thing->momy); - fixed_t predictmomx = x+(thing->momx/2); - fixed_t predictmomy = y+(thing->momy/2); - sector_t *nextsector = R_PointInSubsector(predictmomx, predictmomy)->sector; - sector_t *currentsector = R_PointInSubsector(thing->x, thing->y)->sector; - fixed_t zthrust = 0; - fixed_t slopeang = currentsector->f_slope->zangle; - fixed_t nextz = nextsector->floorheight; - if (nextsector->f_slope) - nextz = P_GetZAt(nextsector->f_slope, thing->x+predictmomx+thing->momx, thing->y+predictmomy+thing->momy); - - if (nextsector != currentsector) - { - // Give a boost up from the slope you came if the next sector is lower than the first - // If your next sector does not have a slope and you're comming off of one - if (currentsector->f_slope) - if (P_GetZAt(currentsector->f_slope, thing->x, thing->y)/FRACUNIT > (nextz/FRACUNIT)+(slopeang*3)) - //&& !nextsector->f_slope // TODO: VPHYSICS height check, not this hacky check? Or is this good enough? - if (currentsector->f_slope->zangle > 9) - { - fixed_t currentz = P_GetZAt(currentsector->f_slope, thing->x, thing->y); - fixed_t predictz = P_GetZAt(currentsector->f_slope, thing->x+thing->momx, thing->y+thing->momy); - - predictz += (((thing->pitchangle/(ANGLE_45/45))+90)/70.0f)+thingspeed/9; - - // Make sure that the z doesn't go too high for steep slopes - - predictz -= ((currentsector->f_slope->zangle)/4)*FRACUNIT; - if (currentsector->f_slope->zangle > 60) // really steep - { - predictz -= ((currentsector->f_slope->zangle)/2)*FRACUNIT; - } - - zthrust = (predictz - currentz)/2; - - if (zthrust > (30*thing->scale/100)*FRACUNIT) - zthrust = (30*thing->scale/100)*FRACUNIT; - - if (zthrust < -(30*thing->scale/100)*FRACUNIT) - zthrust = -(30*thing->scale/100)*FRACUNIT; - - if (currentz/FRACUNIT > (nextz/FRACUNIT)+(slopeang*3)) - { - // Now even out the momx/momy when catapulting off a steep slope - if (currentsector->f_slope->zangle > 65) - { - thing->momx /= 4.0f; - thing->momy /= 4.0f; - } - else if (currentsector->f_slope->zangle > 60) - { - thing->momx /= 3.5f; - thing->momy /= 3.5f; - } - else if (currentsector->f_slope->zangle > 50) - { - thing->momx /= 3.4f; - thing->momy /= 3.4f; - } - else if (currentsector->f_slope->zangle > 40) - { - thing->momx /= 3.3f; - thing->momy /= 3.3f; - } - } - - thing->momz += zthrust; // VPHYSICS TODO: Make a real formula for z trajectory going off a slope - /*CONS_Printf("CurZ %i, PredictZ %i\n", currentz/FRACUNIT, predictz/FRACUNIT); - CONS_Printf("Pitch: %i\n", thing->pitchangle/(ANG45/45)+90); - CONS_Printf("ZThrust: %i\n", zthrust/FRACUNIT);*/ - } - } - } -#endif - thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; +#ifdef ESLOPE + // Assign thing's standingslope if needed + if (thing->z <= tmfloorz && thing->momz <= 0 && !(thing->eflags & MFE_VERTICALFLIP)) + thing->standingslope = tmfloorslope; + else if (thing->z+thing->height >= tmceilingz && thing->momz >= 0 && (thing->eflags & MFE_VERTICALFLIP)) + thing->standingslope = tmceilingslope; +#endif + thing->x = x; thing->y = y; diff --git a/src/p_maputl.c b/src/p_maputl.c index e9e0bb776..b5ac29507 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -325,6 +325,9 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) // OPTIMIZE: keep this precalculated // fixed_t opentop, openbottom, openrange, lowfloor, highceiling; +#ifdef ESLOPE +pslope_t *opentopslope, *openbottomslope; +#endif // P_CameraLineOpening // P_LineOpening, but for camera @@ -567,11 +570,13 @@ void P_LineOpening(line_t *linedef) { opentop = frontheight; highceiling = backheight; + opentopslope = front->c_slope; } else { opentop = backheight; highceiling = frontheight; + opentopslope = back->c_slope; } frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef); @@ -581,11 +586,13 @@ void P_LineOpening(line_t *linedef) { openbottom = frontheight; lowfloor = backheight; + openbottomslope = front->f_slope; } else { openbottom = backheight; lowfloor = frontheight; + openbottomslope = back->f_slope; } } @@ -761,11 +768,19 @@ void P_LineOpening(line_t *linedef) if (highestceiling < highceiling) highceiling = highestceiling; - if (highestfloor > openbottom) + if (highestfloor > openbottom) { openbottom = highestfloor; +#ifdef ESLOPE + openbottomslope = NULL; +#endif + } - if (lowestceiling < opentop) + if (lowestceiling < opentop) { opentop = lowestceiling; +#ifdef ESLOPE + opentopslope = NULL; +#endif + } if (lowestfloor > lowfloor) lowfloor = lowestfloor; diff --git a/src/p_maputl.h b/src/p_maputl.h index 66f7db2db..7471899cc 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -55,6 +55,9 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y); boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y); extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; +#ifdef ESLOPE +extern pslope_t *opentopslope, *openbottomslope; +#endif void P_LineOpening(line_t *plinedef); diff --git a/src/p_mobj.h b/src/p_mobj.h index a9edc5047..0dc323d73 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -30,7 +30,7 @@ // For slope code, we need v3float_t #ifdef ESLOPE -#include "m_vector.h" +//#include "r_defs.h" #endif // @@ -358,8 +358,7 @@ typedef struct mobj_s INT32 cvmem; #ifdef ESLOPE - angle_t pitchangle; - v3float_t vector; + struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?) #endif // WARNING: New fields must be added separately to savegame and Lua. From db883f6a23c9354d1f15e118d9b54fea7353ea7a Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 29 Apr 2015 00:35:54 -0500 Subject: [PATCH 022/364] Add a bunch of slope physics I know giant commits all at once like this are a bad thing, but too bad I worked without staging commits and now it's all here at once :) --- src/m_vector.c | 88 +++++++++++++++++++++++++------------------------- src/m_vector.h | 8 +++-- src/p_mobj.c | 71 +++++++++++++++++++++++++++++++++++++++- src/p_slopes.c | 63 ++++++++++++++++++++++++++++++++++++ src/p_slopes.h | 5 +++ 5 files changed, 187 insertions(+), 48 deletions(-) diff --git a/src/m_vector.c b/src/m_vector.c index 53b869adc..274a806a6 100644 --- a/src/m_vector.c +++ b/src/m_vector.c @@ -409,6 +409,50 @@ angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byt } +// +// RotateVector +// +// Rotates a vector around another vector +// +void M_VecRotate(v3fixed_t *rotVec, const v3fixed_t *axisVec, const angle_t angle) +{ + // Rotate the point (x,y,z) around the vector (u,v,w) + fixed_t ux = FixedMul(axisVec->x, rotVec->x); + fixed_t uy = FixedMul(axisVec->x, rotVec->y); + fixed_t uz = FixedMul(axisVec->x, rotVec->z); + fixed_t vx = FixedMul(axisVec->y, rotVec->x); + fixed_t vy = FixedMul(axisVec->y, rotVec->y); + fixed_t vz = FixedMul(axisVec->y, rotVec->z); + fixed_t wx = FixedMul(axisVec->z, rotVec->x); + fixed_t wy = FixedMul(axisVec->z, rotVec->y); + fixed_t wz = FixedMul(axisVec->z, rotVec->z); + fixed_t sa = FINESINE(angle>>ANGLETOFINESHIFT); + fixed_t ca = FINECOSINE(angle>>ANGLETOFINESHIFT); + fixed_t ua = ux+vy+wz; + fixed_t ax = FixedMul(axisVec->x,ua); + fixed_t ay = FixedMul(axisVec->y,ua); + fixed_t az = FixedMul(axisVec->z,ua); + fixed_t xs = FixedMul(axisVec->x,axisVec->x); + fixed_t ys = FixedMul(axisVec->y,axisVec->y); + fixed_t zs = FixedMul(axisVec->z,axisVec->z); + fixed_t bx = FixedMul(rotVec->x,ys+zs); + fixed_t by = FixedMul(rotVec->y,xs+zs); + fixed_t bz = FixedMul(rotVec->z,xs+ys); + fixed_t cx = FixedMul(axisVec->x,vy+wz); + fixed_t cy = FixedMul(axisVec->y,ux+wz); + fixed_t cz = FixedMul(axisVec->z,ux+vy); + fixed_t dx = FixedMul(bx-cx, ca); + fixed_t dy = FixedMul(by-cy, ca); + fixed_t dz = FixedMul(bz-cz, ca); + fixed_t ex = FixedMul(vz-wy, sa); + fixed_t ey = FixedMul(wx-uz, sa); + fixed_t ez = FixedMul(uy-vx, sa); + + rotVec->x = ax+dx+ex; + rotVec->y = ay+dy+ey; + rotVec->z = az+dz+ez; +} + @@ -977,50 +1021,6 @@ boolean FV_IntersectedPolygon(const fvector_t *vPoly, const fvector_t *vLine, co return false; } -// -// RotateVector -// -// Rotates a vector around another vector -// -void FV_Rotate(fvector_t *rotVec, const fvector_t *axisVec, const angle_t angle) -{ - // Rotate the point (x,y,z) around the vector (u,v,w) - fixed_t ux = FixedMul(axisVec->x, rotVec->x); - fixed_t uy = FixedMul(axisVec->x, rotVec->y); - fixed_t uz = FixedMul(axisVec->x, rotVec->z); - fixed_t vx = FixedMul(axisVec->y, rotVec->x); - fixed_t vy = FixedMul(axisVec->y, rotVec->y); - fixed_t vz = FixedMul(axisVec->y, rotVec->z); - fixed_t wx = FixedMul(axisVec->z, rotVec->x); - fixed_t wy = FixedMul(axisVec->z, rotVec->y); - fixed_t wz = FixedMul(axisVec->z, rotVec->z); - fixed_t sa = FINESINE(angle); - fixed_t ca = FINECOSINE(angle); - fixed_t ua = ux+vy+wz; - fixed_t ax = FixedMul(axisVec->x,ua); - fixed_t ay = FixedMul(axisVec->y,ua); - fixed_t az = FixedMul(axisVec->z,ua); - fixed_t xs = FixedMul(axisVec->x,axisVec->x); - fixed_t ys = FixedMul(axisVec->y,axisVec->y); - fixed_t zs = FixedMul(axisVec->z,axisVec->z); - fixed_t bx = FixedMul(rotVec->x,ys+zs); - fixed_t by = FixedMul(rotVec->y,xs+zs); - fixed_t bz = FixedMul(rotVec->z,xs+ys); - fixed_t cx = FixedMul(axisVec->x,vy+wz); - fixed_t cy = FixedMul(axisVec->y,ux+wz); - fixed_t cz = FixedMul(axisVec->z,ux+vy); - fixed_t dx = FixedMul(bx-cx, ca); - fixed_t dy = FixedMul(by-cy, ca); - fixed_t dz = FixedMul(bz-cz, ca); - fixed_t ex = FixedMul(vz-wy, sa); - fixed_t ey = FixedMul(wx-uz, sa); - fixed_t ez = FixedMul(uy-vx, sa); - - rotVec->x = ax+dx+ex; - rotVec->y = ay+dy+ey; - rotVec->z = az+dz+ez; -} - void FM_Rotate(fmatrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z) { #define M(row,col) dest->m[row * 4 + col] diff --git a/src/m_vector.h b/src/m_vector.h index 743a26023..37d30c746 100644 --- a/src/m_vector.h +++ b/src/m_vector.h @@ -1,4 +1,4 @@ -// Emacs style mode select -*- C++ -*- +// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright(C) 2004 Stephen McGranahan @@ -7,12 +7,12 @@ // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -114,6 +114,8 @@ float M_VectorYaw(v3float_t v); float M_VectorPitch(v3float_t v); angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byte AngleAxis, float Rate); +void M_VecRotate(v3fixed_t *rotVec, const v3fixed_t *axisVec, const angle_t angle); + #endif diff --git a/src/p_mobj.c b/src/p_mobj.c index d57e398ec..e0e5cc9e9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1239,7 +1239,11 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) } else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale) && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) - && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))) + && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING)) +#ifdef ESLOPE + && !(player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2) +#endif + ) { // if in a walking frame, stop moving if (player->panim == PA_WALK) @@ -1383,6 +1387,11 @@ void P_XYMovement(mobj_t *mo) fixed_t xmove, ymove; fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls boolean moved; +#ifdef ESLOPE + pslope_t *oldslope = NULL; + v3fixed_t slopemom; + fixed_t predictedz; +#endif I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); @@ -1414,6 +1423,29 @@ void P_XYMovement(mobj_t *mo) oldx = mo->x; oldy = mo->y; +#ifdef ESLOPE + // adjust various things based on slope + if (mo->standingslope) { + if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing! + P_SlopeLaunch(mo); + xmove = mo->momx; + ymove = mo->momy; + } else { // Still on the ground. + slopemom.x = xmove; + slopemom.y = ymove; + slopemom.z = 0; + P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); + + xmove = slopemom.x; + ymove = slopemom.y; + + predictedz = mo->z + slopemom.z; // We'll use this later... + + oldslope = mo->standingslope; + } + } +#endif + // Pushables can break some blocks if (CheckForBustableBlocks && mo->flags & MF_PUSHABLE) P_PushableCheckBustables(mo); @@ -1534,6 +1566,29 @@ void P_XYMovement(mobj_t *mo) if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;; return; +#ifdef ESLOPE + if (moved && oldslope) { // Check to see if we ran off + if (oldslope != mo->standingslope) { // First, compare different slopes + // Start by quantizing momentum on this slope + v3fixed_t test; + test.x = mo->momx; + test.y = mo->momy; + test.z = 0; + if (mo->standingslope) // Don't fuss with the rotation if we don't HAVE a slope + P_QuantizeMomentumToSlope(&test, mo->standingslope); + + // Now compare the Zs of the different quantizations + if (slopemom.z - test.z > 2*FRACUNIT) { // Allow for a bit of sticking - this value can be adjusted later + mo->standingslope = oldslope; + P_SlopeLaunch(mo); + } + } else if (predictedz-mo->z > 2*FRACUNIT) { // Now check if we were supposed to stick to this slope + mo->standingslope = oldslope; + P_SlopeLaunch(mo); + } + } +#endif + // Check the gravity status. P_CheckGravity(mo, false); @@ -1819,6 +1874,11 @@ static boolean P_ZMovement(mobj_t *mo) I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); +#ifdef ESLOPE + if (mo->standingslope && !P_IsObjectOnGround(mo)) + P_SlopeLaunch(mo); +#endif + // Intercept the stupid 'fall through 3dfloors' bug if (mo->subsector->sector->ffloors) P_AdjustMobjFloorZ_FFloors(mo, mo->subsector->sector, 0); @@ -2231,6 +2291,11 @@ static void P_PlayerZMovement(mobj_t *mo) if (!mo->player) return; +#ifdef ESLOPE + if (mo->standingslope && !P_IsObjectOnGround(mo)) + P_SlopeLaunch(mo); +#endif + // Intercept the stupid 'fall through 3dfloors' bug if (mo->subsector->sector->ffloors) P_AdjustMobjFloorZ_FFloors(mo, mo->subsector->sector, 0); @@ -3183,6 +3248,10 @@ static void P_PlayerMobjThinker(mobj_t *mobj) P_MobjCheckWater(mobj); +#ifdef ESLOPE + P_ButteredSlope(mobj); +#endif + // momentum movement mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN; diff --git a/src/p_slopes.c b/src/p_slopes.c index 518599849..6b6f147d9 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -768,6 +768,69 @@ float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, (point->z - pori->z) * pnormal->z; } +// +// P_QuantizeMomentumToSlope +// +// When given a vector, rotates it and aligns it to a slope +void P_QuantizeMomentumToSlope(v3fixed_t *momentum, pslope_t *slope) +{ + v3fixed_t axis; + axis.x = -slope->d.y; + axis.y = slope->d.x; + axis.z = 0; + + M_VecRotate(momentum, &axis, slope->zangle); +} + +// +// P_SlopeLaunch +// +// Handles slope ejection for objects +void P_SlopeLaunch(mobj_t *mo) +{ + // Double the pre-rotation Z, then halve the post-rotation Z. This reduces the + // vertical launch given from slopes while increasing the horizontal launch + // given. Good for SRB2's gravity and horizontal speeds. + v3fixed_t slopemom; + slopemom.x = mo->momx; + slopemom.y = mo->momy; + slopemom.z = mo->momz*2; + P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); + + mo->momx = slopemom.x; + mo->momy = slopemom.y; + mo->momz = slopemom.z/2; + + CONS_Printf("Launched off of slope.\n"); + mo->standingslope = NULL; +} + +// https://yourlogicalfallacyis.com/slippery-slope +// Handles sliding down slopes, like if they were made of butter :) +void P_ButteredSlope(mobj_t *mo) +{ + fixed_t thrust; + + if (!mo->standingslope) + return; + + if (abs(mo->standingslope->zdelta) < FRACUNIT/2) + return; // Don't apply physics to slopes that aren't steep enough + + thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); + + if (!(mo->player && (mo->player->pflags & PF_SPINNING))) { + if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed parallel to the slope direction + thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/4); + // This solves the issue of being able to zigzag up steep slopes + } + + // Multiply by gravity + thrust = FixedMul(thrust, FRACUNIT/2); // TODO actually get this + + P_Thrust(mo, mo->standingslope->xydirection, thrust); +} + // EOF #endif // #ifdef ESLOPE diff --git a/src/p_slopes.h b/src/p_slopes.h index 8f408d6f0..f82d8a83d 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -76,6 +76,11 @@ float P_GetZAtf(pslope_t *slope, float x, float y); float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, const v3float_t *pnormal); +// Lots of physics-based bullshit +void P_QuantizeMomentumToSlope(v3fixed_t *momentum, pslope_t *slope); +void P_SlopeLaunch(mobj_t *mo); +void P_ButteredSlope(mobj_t *mo); + #endif // EOF From ae935a09554c3aac3a577ea7a628270d727179f1 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 29 Apr 2015 00:36:24 -0500 Subject: [PATCH 023/364] Stop rubbing my ass on the code long enough to fix reverse gravity --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 72b17473f..468e2530a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2003,7 +2003,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (thingtop == thing->ceilingz && tmceilingz , thingtop && thingtop - tmceilingz <= maxstep) + else if (thingtop == thing->ceilingz && tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; From c4306b624d00499c148a69a8aa55b7d3c4381d94 Mon Sep 17 00:00:00 2001 From: "chi.miru" Date: Wed, 29 Apr 2015 02:36:18 -0400 Subject: [PATCH 024/364] Optimized R_DrawTiltedSpan_8 --- src/r_draw8.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 86b06089e..25ca8f3bd 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -551,8 +551,8 @@ void R_DrawTiltedSpan_8(void) source = ds_source; colormap = ds_colormap; - // The "perfect" reference version of this routine. Pretty slow. - // Use it only to see how things are supposed to look. +#if 0 // The "perfect" reference version of this routine. Pretty slow. + // Use it only to see how things are supposed to look. i = 0; do { @@ -566,6 +566,81 @@ void R_DrawTiltedSpan_8(void) vz += ds_sv.x; } while (--width >= 0); } +#else +#define SPANSIZE 16 +#define INVSPAN 0.0625f + + double startz = 1.f/iz; + double startu = uz*startz; + double startv = vz*startz; + double izstep, uzstep, vzstep; + + izstep = ds_sz.x * SPANSIZE; + uzstep = ds_su.x * SPANSIZE; + vzstep = ds_sv.x * SPANSIZE; + //x1 = 0; + width++; + + while (width >= SPANSIZE) + { + iz += izstep; + uz += uzstep; + vz += vzstep; + + double endz = 1.f/iz; + double endu = uz*endz; + double endv = vz*endz; + UINT32 stepu = (INT64)((endu - startu) * INVSPAN); + UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; + + for (i = SPANSIZE-1; i >= 0; i--) + { + *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + dest++; + u += stepu; + v += stepv; + } + startu = endu; + startv = endv; + width -= SPANSIZE; + } + if (width > 0) + { + if (width == 1) + { + u = (INT64)(startu); + v = (INT64)(startv); + *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + } + else + { + double left = width; + iz += ds_sz.x * left; + uz += ds_su.x * left; + vz += ds_sv.x * left; + + double endz = 1.f/iz; + double endu = uz*endz; + double endv = vz*endz; + left = 1.f/left; + UINT32 stepu = (INT64)((endu - startu) * left); + UINT32 stepv = (INT64)((endv - startv) * left); + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; + + for (; width != 0; width--) + { + *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + dest++; + u += stepu; + v += stepv; + } + } + } +#endif +} #endif // ESLOPE /** \brief The R_DrawSplat_8 function From fe8a2ae6805727ad2660618e92c55a5a8c20b98f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 29 Apr 2015 01:45:39 -0500 Subject: [PATCH 025/364] Fix compile error --- src/r_draw8.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 25ca8f3bd..fe218f3ba 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -565,7 +565,6 @@ void R_DrawTiltedSpan_8(void) uz += ds_su.x; vz += ds_sv.x; } while (--width >= 0); -} #else #define SPANSIZE 16 #define INVSPAN 0.0625f From 02d63aa011dbefa631ea0747b801f4732cfa3361 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 30 Apr 2015 00:32:44 -0500 Subject: [PATCH 026/364] Tweaks to slope physics + add accel rules for slopes Your acceleration vector parallel to the slope is reduced based on slope angle if it's going up the slope. The pull physics' momentum increase was toned down a bit to go along with this. Also, I removed the ifdefs for OLD_MOVEMENT_CODE because why should that be kept around? --- src/p_slopes.c | 14 +++--- src/p_user.c | 113 +++++++++++++++++-------------------------------- 2 files changed, 46 insertions(+), 81 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 6b6f147d9..5891756e8 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -801,7 +801,7 @@ void P_SlopeLaunch(mobj_t *mo) mo->momy = slopemom.y; mo->momz = slopemom.z/2; - CONS_Printf("Launched off of slope.\n"); + //CONS_Printf("Launched off of slope.\n"); mo->standingslope = NULL; } @@ -814,16 +814,14 @@ void P_ButteredSlope(mobj_t *mo) if (!mo->standingslope) return; - if (abs(mo->standingslope->zdelta) < FRACUNIT/2) + if (abs(mo->standingslope->zdelta) < FRACUNIT/3) return; // Don't apply physics to slopes that aren't steep enough - thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); + thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 3 / 2 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); - if (!(mo->player && (mo->player->pflags & PF_SPINNING))) { - if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed parallel to the slope direction - thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/4); - // This solves the issue of being able to zigzag up steep slopes - } + if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed + thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); + // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down // Multiply by gravity thrust = FixedMul(thrust, FRACUNIT/2); // TODO actually get this diff --git a/src/p_user.c b/src/p_user.c index 66cdb5562..62022fccf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4503,12 +4503,16 @@ static void P_3dMovement(player_t *player) angle_t dangle; // replaces old quadrants bits fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale); boolean analogmove = false; -#ifndef OLD_MOVEMENT_CODE fixed_t oldMagnitude, newMagnitude; +#ifdef ESLOPE + v3fixed_t totalthrust; + + totalthrust.x = totalthrust.y = 0; // I forget if this is needed + totalthrust.z = FRACUNIT*P_MobjFlip(player->mo); // A bit of extra push-back on slopes +#endif // ESLOPE // Get the old momentum; this will be needed at the end of the function! -SH oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0); -#endif analogmove = P_AnalogMove(player); @@ -4685,17 +4689,10 @@ static void P_3dMovement(player_t *player) } movepushforward = FixedMul(movepushforward, player->mo->scale); -#ifdef OLD_MOVEMENT_CODE - if (player->speed < topspeed && mforward && cmd->forwardmove > 0) // Sonic's Speed - P_Thrust(player->mo, movepushangle, movepushforward); - else if (mforward && cmd->forwardmove < 0) - P_Thrust(player->mo, movepushangle, movepushforward); - else if (player->speed < topspeed && mbackward && cmd->forwardmove < 0) - P_Thrust(player->mo, movepushangle, movepushforward); - else if (mbackward && cmd->forwardmove > 0) - P_Thrust(player->mo, movepushangle, movepushforward); - else if (!mforward && !mbackward) - P_Thrust(player->mo, movepushangle, movepushforward); + +#ifdef ESLOPE + totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward); + totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward); #else P_Thrust(player->mo, movepushangle, movepushforward); #endif @@ -4714,33 +4711,12 @@ static void P_3dMovement(player_t *player) if (!(player->pflags & PF_GLIDING || player->exiting || P_PlayerInPain(player))) { angle_t controldirection; -#ifdef OLD_MOVEMENT_CODE - angle_t controlplayerdirection; - boolean cforward; // controls pointing forward from the player - boolean cbackward; // controls pointing backward from the player - angle_t dangle; - cforward = cbackward = false; -#endif // Calculate the angle at which the controls are pointing // to figure out the proper mforward and mbackward. // (Why was it so complicated before? ~Red) controldirection = R_PointToAngle2(0, 0, cmd->forwardmove*FRACUNIT, -cmd->sidemove*FRACUNIT)+movepushangle; -#ifdef OLD_MOVEMENT_CODE - controlplayerdirection = player->mo->angle; - - dangle = controldirection - controlplayerdirection; - - if (dangle > ANGLE_180) //flip to keep to one side - dangle = InvAngle(dangle); - - if (dangle > ANGLE_90) - cbackward = true; // Controls pointing backwards from player - else - cforward = true; // Controls pointing in player's general direction -#endif - movepushforward = max(abs(cmd->sidemove), abs(cmd->forwardmove)) * (thrustfactor * acceleration); // allow very small movement while in air for gameplay @@ -4763,13 +4739,10 @@ static void P_3dMovement(player_t *player) movepushsideangle = controldirection; movepushforward = FixedMul(movepushforward, player->mo->scale); -#ifdef OLD_MOVEMENT_CODE - if (player->speed < topspeed) - P_Thrust(player->mo, controldirection, movepushforward); - else if ((mforward) && (cbackward)) - P_Thrust(player->mo, controldirection, movepushforward); - else if ((mbackward) && (cforward)) - P_Thrust(player->mo, controldirection, movepushforward); + +#ifdef ESLOPE + totalthrust.x += P_ReturnThrustX(player->mo, controldirection, movepushforward); + totalthrust.y += P_ReturnThrustY(player->mo, controldirection, movepushforward); #else P_Thrust(player->mo, controldirection, movepushforward); #endif @@ -4777,29 +4750,6 @@ static void P_3dMovement(player_t *player) } else if (cmd->sidemove && !(player->pflags & PF_GLIDING) && !player->exiting && !P_PlayerInPain(player)) { -#ifdef OLD_MOVEMENT_CODE - boolean mright = 0; - boolean mleft = 0; - angle_t sideangle; - - sideangle = player->mo->angle - ANGLE_90; - - // Monster Iestyn - 04-11-13 - // Quadrants are stupid, excessive and broken, let's do this a much simpler way! - // Get delta angle from rmom angle and player angle first - dangle = R_PointToAngle2(0,0, player->rmomx, player->rmomy) - sideangle; - if (dangle > ANGLE_180) - dangle = InvAngle(dangle); - - // now use it to determine direction! - if (dangle <= ANGLE_45) // angles 0-45 or 315-360 - mright = 1; // going right - else if (dangle >= ANGLE_135) // angles 135-225 - mleft = 1; // going left - - // anything else will leave both at 0, so no need to do anything else -#endif - movepushside = cmd->sidemove * (thrustfactor * acceleration); if (!onground) @@ -4822,19 +4772,37 @@ static void P_3dMovement(player_t *player) // Finally move the player now that his speed/direction has been decided. movepushside = FixedMul(movepushside, player->mo->scale); -#ifdef OLD_MOVEMENT_CODE - if (player->speed < topspeed) - P_Thrust(player->mo, movepushsideangle, movepushside); - else if (mright && cmd->sidemove < 0) - P_Thrust(player->mo, movepushsideangle, movepushside); - else if (mleft && cmd->sidemove > 0) - P_Thrust(player->mo, movepushsideangle, movepushside); + +#ifdef ESLOPE + totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside); + totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside); #else P_Thrust(player->mo, movepushsideangle, movepushside); #endif } -#ifndef OLD_MOVEMENT_CODE +#ifdef ESLOPE + if ((totalthrust.x || totalthrust.y) + && player->mo->standingslope && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { + // Factor thrust to slope, but only for the part pushing up it! + // The rest is unaffected. + angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection; + + if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward + if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) { + P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); + } + } else { // Direction goes up, so thrustangle needs to face away + if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) { + P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); + } + } + } + + player->mo->momx += totalthrust.x; + player->mo->momy += totalthrust.y; +#endif + // Time to ask three questions: // 1) Are we over topspeed? // 2) If "yes" to 1, were we moving over topspeed to begin with? @@ -4868,7 +4836,6 @@ static void P_3dMovement(player_t *player) player->mo->momy = tempmomy + player->cmomy; } } -#endif } // From 234f734fe56529fd1ba8b33da11b94d5a6ae5e12 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 30 Apr 2015 00:38:51 -0500 Subject: [PATCH 027/364] Fix sprite clipping and some blocking walls being rendered around slopes --- src/r_bsp.c | 5 ++ src/r_segs.c | 157 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 102 insertions(+), 60 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 01d2be671..ae4e8ac67 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -459,6 +459,11 @@ static void R_AddLine(seg_t *line) doorclosed = 0; // Closed door. +#ifdef ESLOPE + // Just don't bother checking this if one side is sloped. This is probably inefficient, but it's better than + // random renderer stopping around slopes... + if (!(frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)) +#endif if (backsector->ceilingheight <= frontsector->floorheight || backsector->floorheight >= frontsector->ceilingheight) { diff --git a/src/r_segs.c b/src/r_segs.c index c313c955c..6c8c95c49 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1659,64 +1659,6 @@ void R_StoreWallRange(INT32 start, INT32 stop) else { // two sided line - ds_p->sprtopclip = ds_p->sprbottomclip = NULL; - ds_p->silhouette = 0; - - if (frontsector->floorheight > backsector->floorheight) - { - ds_p->silhouette = SIL_BOTTOM; - ds_p->bsilheight = frontsector->floorheight; - } - else if (backsector->floorheight > viewz) - { - ds_p->silhouette = SIL_BOTTOM; - ds_p->bsilheight = INT32_MAX; - // ds_p->sprbottomclip = negonearray; - } - - if (frontsector->ceilingheight < backsector->ceilingheight) - { - ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = frontsector->ceilingheight; - } - else if (backsector->ceilingheight < viewz) - { - ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = INT32_MIN; - // ds_p->sprtopclip = screenheightarray; - } - - if (backsector->ceilingheight <= frontsector->floorheight) - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - - if (backsector->floorheight >= frontsector->ceilingheight) - { - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - - //SoM: 3/25/2000: This code fixes an automap bug that didn't check - // frontsector->ceiling and backsector->floor to see if a door was closed. - // Without the following code, sprites get displayed behind closed doors. - { - if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) - { // killough 1/17/98, 2/8/98 - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - } #ifdef ESLOPE if (backsector->c_slope) { @@ -1754,6 +1696,101 @@ void R_StoreWallRange(INT32 start, INT32 stop) worldtop = worldhigh; } + ds_p->sprtopclip = ds_p->sprbottomclip = NULL; + ds_p->silhouette = 0; + + if ( +#ifdef ESLOPE + worldbottomslope > worldlowslope || +#endif + worldbottom > worldlow) + { + ds_p->silhouette = SIL_BOTTOM; +#ifdef ESLOPE + ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight); +#else + ds_p->bsilheight = frontsector->floorheight; +#endif + } +#ifdef ESLOPE + else if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz) +#else + else if (backsector->floorheight > viewz) +#endif + { + ds_p->silhouette = SIL_BOTTOM; + ds_p->bsilheight = INT32_MAX; + // ds_p->sprbottomclip = negonearray; + } + + if ( +#ifdef ESLOPE + worldtopslope < worldhighslope || +#endif + worldtop < worldhigh) + { + ds_p->silhouette |= SIL_TOP; +#ifdef ESLOPE + ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight); +#else + ds_p->tsilheight = frontsector->ceilingheight; +#endif + } +#ifdef ESLOPE + else if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz) +#else + else if (backsector->ceilingheight < viewz) +#endif + { + ds_p->silhouette |= SIL_TOP; + ds_p->tsilheight = INT32_MIN; + // ds_p->sprtopclip = screenheightarray; + } + +#ifdef ESLOPE + if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) +#else + if (worldhigh <= worldbottom) +#endif + { + ds_p->sprbottomclip = negonearray; + ds_p->bsilheight = INT32_MAX; + ds_p->silhouette |= SIL_BOTTOM; + } + +#ifdef ESLOPE + if (worldlow >= worldtop && worldlowslope >= worldtopslope) +#else + if (worldlow >= worldtop) +#endif + { + ds_p->sprtopclip = screenheightarray; + ds_p->tsilheight = INT32_MIN; + ds_p->silhouette |= SIL_TOP; + } + +#ifdef ESLOPE + // This causes issues with slopes. + if (!(frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)) +#endif + //SoM: 3/25/2000: This code fixes an automap bug that didn't check + // frontsector->ceiling and backsector->floor to see if a door was closed. + // Without the following code, sprites get displayed behind closed doors. + { + if (doorclosed || backsector->ceilingheight <= frontsector->floorheight) + { + ds_p->sprbottomclip = negonearray; + ds_p->bsilheight = INT32_MAX; + ds_p->silhouette |= SIL_BOTTOM; + } + if (doorclosed || backsector->floorheight >= frontsector->ceilingheight) + { // killough 1/17/98, 2/8/98 + ds_p->sprtopclip = screenheightarray; + ds_p->tsilheight = INT32_MIN; + ds_p->silhouette |= SIL_TOP; + } + } + if (worldlow != worldbottom #ifdef ESLOPE || worldlowslope != worldbottomslope @@ -1816,7 +1853,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // check TOP TEXTURE if (worldhigh < worldtop #ifdef ESLOPE - || worldhighslope < worldtopslope + /*-(FRACUNIT>>8)*/|| worldhighslope < worldtopslope/*-(FRACUNIT>>8)*/ #endif ) { @@ -1863,7 +1900,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // check BOTTOM TEXTURE if (worldlow > worldbottom #ifdef ESLOPE - || worldlowslope > worldbottomslope + /*+(FRACUNIT>>8)*/ || worldlowslope > worldbottomslope/*+(FRACUNIT>>8)*/ // The leeway works around a weird rendering bug with slopes... #endif ) //seulement si VISIBLE!!! { From 3644d4d883a3ee787546f439617ced579722a811 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 30 Apr 2015 00:41:29 -0500 Subject: [PATCH 028/364] Minor code cleanup around renderer gunk (Who let that silhouette == 1/etc thing sit there all those years? :V) --- src/r_segs.c | 33 ++++----------------------------- src/r_things.c | 6 +++--- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 6c8c95c49..5465e0d07 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1512,27 +1512,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) // Figure out map coordinates of where start and end are mapping to on seg, so we can clip right for slope bullshit if (frontsector->c_slope || frontsector->f_slope || (backsector && (backsector->c_slope || backsector->f_slope))) { angle_t temp; - fixed_t tan; // left temp = xtoviewangle[start]+viewangle; - /*if (curline->v1->x == curline->v2->x) { - // Line seg is vertical, so no line-slope form for it - tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); - - segleft.x = curline->v1->x; - - segleft.y = curline->v1->y-FixedMul(viewx-segleft.x, tan); - } else if (temp>>ANGLETOFINESHIFT == ANGLE_90>>ANGLETOFINESHIFT || temp>>ANGLETOFINESHIFT == ANGLE_270>>ANGLETOFINESHIFT) { - // Same problem as above, except this time with the view angle - tan = FixedDiv(curline->v2->y-curline->v1->y, curline->v2->x-curline->v1->x); - - segleft.x = viewx; - segleft.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); - } else */{ + { // Both lines can be written in slope-intercept form, so figure out line intersection float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + ///TODO: convert to FPU a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); @@ -1551,22 +1538,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) // right temp = xtoviewangle[stop]+viewangle; - /*if (curline->v1->x == curline->v2->x) { - // Line seg is vertical, so no line-slope form for it - tan = FINETANGENT((temp+ANGLE_90)>>ANGLETOFINESHIFT); - - segright.x = curline->v1->x; - - segright.y = curline->v1->y-FixedMul(viewx-segright.x, tan); - } else if (temp>>ANGLETOFINESHIFT == ANGLE_90>>ANGLETOFINESHIFT || temp>>ANGLETOFINESHIFT == ANGLE_270>>ANGLETOFINESHIFT) { - // Same problem as above, except this time with the view angle - tan = FixedDiv(curline->v2->y-curline->v1->y, curline->v2->x-curline->v1->x); - - segright.x = viewx; - segright.y = curline->v1->y-FixedMul(viewx-curline->v1->x, tan); - } else */{ + { // Both lines can be written in slope-intercept form, so figure out line intersection float a1, b1, c1, a2, b2, c2, det; // 1 is the seg, 2 is the view angle vector... + ///TODO: convert to FPU a1 = FIXED_TO_FLOAT(curline->v2->y-curline->v1->y); b1 = FIXED_TO_FLOAT(curline->v1->x-curline->v2->x); diff --git a/src/r_things.c b/src/r_things.c index f1b2e7199..a759dd1d0 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2030,21 +2030,21 @@ void R_ClipSprites(void) if (spr->gzt <= ds->tsilheight) silhouette &= ~SIL_TOP; - if (silhouette == 1) + if (silhouette == SIL_BOTTOM) { // bottom sil for (x = r1; x <= r2; x++) if (spr->clipbot[x] == -2) spr->clipbot[x] = ds->sprbottomclip[x]; } - else if (silhouette == 2) + else if (silhouette == SIL_TOP) { // top sil for (x = r1; x <= r2; x++) if (spr->cliptop[x] == -2) spr->cliptop[x] = ds->sprtopclip[x]; } - else if (silhouette == 3) + else if (silhouette == (SIL_TOP|SIL_BOTTOM)) { // both for (x = r1; x <= r2; x++) From 79fedf91a0e2592d0ffdfe5c9a5ffc0d5627093c Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 30 Apr 2015 18:36:21 -0500 Subject: [PATCH 029/364] Fix occasionally running into an invisible wall around slopes --- src/p_mobj.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e0e5cc9e9..5af7b99a6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -754,10 +754,7 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector - // The following line is a hack to fix a bug where an object pops down on the frame its highest corner re-enters the sloped sector. - || R_PointInSubsector(testx+mobj->momx, testy+mobj->momy)->sector == sector - ) + if (R_PointInSubsector(testx, testy)->sector == sector) return P_GetZAt(slope, testx, testy); // If we're just testing for base sector location (no collision line), just go for the center's spot... @@ -889,10 +886,7 @@ fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line testy += y; // If the lowest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector - // The following line is a hack to fix a bug where an object pops down on the frame its highest corner re-enters the sloped sector. - || R_PointInSubsector(testx+mobj->momx, testy+mobj->momy)->sector == sector - ) + if (R_PointInSubsector(testx, testy)->sector == sector) return P_GetZAt(slope, testx, testy); // If we're just testing for base sector location (no collision line), just go for the center's spot... From c66bb1c330d15d8ac6fba0c8b564319d42e3a24b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 3 May 2015 15:47:40 -0500 Subject: [PATCH 030/364] Make textures skew according to slope (midtextures not fixed yet) --- src/r_segs.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index 5465e0d07..490051eea 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -52,6 +52,7 @@ static fixed_t rw_midtexturemid, rw_toptexturemid, rw_bottomtexturemid; static INT32 worldtop, worldbottom, worldhigh, worldlow; #ifdef ESLOPE static INT32 worldtopslope, worldbottomslope, worldhighslope, worldlowslope; // worldtop/bottom at end of slope +static fixed_t rw_toptextureslide, rw_midtextureslide, rw_bottomtextureslide; // Defines how to adjust Y offsets along the wall for slopes #endif static fixed_t pixhigh, pixlow, pixhighstep, pixlowstep; static fixed_t topfrac, topstep; @@ -1064,6 +1065,7 @@ static void R_RenderSegLoop (void) INT32 mid; fixed_t texturecolumn = 0; + fixed_t oldtexturecolumn = -1; INT32 top; INT32 bottom; INT32 i; @@ -1200,6 +1202,16 @@ static void R_RenderSegLoop (void) // calculate texture offset angle = (rw_centerangle + xtoviewangle[rw_x])>>ANGLETOFINESHIFT; texturecolumn = rw_offset-FixedMul(FINETANGENT(angle),rw_distance); + +#ifdef ESLOPE + if (oldtexturecolumn != -1) { + rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn-texturecolumn); + rw_midtexturemid += FixedMul(rw_midtextureslide, oldtexturecolumn-texturecolumn); + rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn-texturecolumn); + } + oldtexturecolumn = texturecolumn; +#endif + texturecolumn >>= FRACBITS; // texturecolumn and lighting are independent of wall tiers @@ -1407,6 +1419,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) r_lightlist_t *rlight; #ifdef ESLOPE vertex_t segleft, segright; + fixed_t ceilingfrontslide, floorfrontslide, ceilingbackslide, floorbackslide; #endif static size_t maxdrawsegs = 0; @@ -1605,6 +1618,28 @@ void R_StoreWallRange(INT32 start, INT32 stop) } } +#ifdef ESLOPE + // Set up texture Y offset slides for sloped walls + rw_toptextureslide = rw_midtextureslide = rw_bottomtextureslide = 0; + ceilingfrontslide = floorfrontslide = ceilingbackslide = floorbackslide = 0; + + { + angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y); + + if (frontsector->f_slope) + floorfrontslide = FixedMul(frontsector->f_slope->zdelta, FINECOSINE((lineangle-frontsector->f_slope->xydirection)>>ANGLETOFINESHIFT)); + + if (frontsector->c_slope) + ceilingfrontslide = FixedMul(frontsector->c_slope->zdelta, FINECOSINE((lineangle-frontsector->c_slope->xydirection)>>ANGLETOFINESHIFT)); + + if (backsector && backsector->f_slope) + floorbackslide = FixedMul(backsector->f_slope->zdelta, FINECOSINE((lineangle-backsector->f_slope->xydirection)>>ANGLETOFINESHIFT)); + + if (backsector && backsector->c_slope) + ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT)); + } +#endif + if (!backsector) { // single sided line @@ -1614,14 +1649,22 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (linedef->flags & ML_DONTPEGBOTTOM) { +#ifdef ESLOPE + rw_midtexturemid = worldbottom + textureheight[sidedef->midtexture]; + rw_midtextureslide = floorfrontslide; +#else vtop = frontsector->floorheight + textureheight[sidedef->midtexture]; // bottom of texture at bottom rw_midtexturemid = vtop - viewz; +#endif } else { // top of texture at top rw_midtexturemid = worldtop; +#ifdef ESLOPE + rw_midtextureslide = ceilingfrontslide; +#endif } rw_midtexturemid += sidedef->rowoffset; @@ -1847,12 +1890,20 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // top of texture at top rw_toptexturemid = worldtop; +#ifdef ESLOPE + rw_toptextureslide = ceilingfrontslide; +#endif } else { +#ifdef ESLOPE + rw_toptexturemid = worldhigh + textureheight[def->toptexture]; + rw_toptextureslide = ceilingbackslide; +#else vtop = backsector->ceilingheight + textureheight[def->toptexture]; // bottom of texture rw_toptexturemid = vtop - viewz; +#endif } } else @@ -1863,12 +1914,20 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // top of texture at top rw_toptexturemid = worldtop; +#ifdef ESLOPE + rw_toptextureslide = ceilingfrontslide; +#endif } else { +#ifdef ESLOPE + rw_toptexturemid = worldhigh + textureheight[sidedef->toptexture]; + rw_toptextureslide = ceilingbackslide; +#else vtop = backsector->ceilingheight + textureheight[sidedef->toptexture]; // bottom of texture rw_toptexturemid = vtop - viewz; +#endif } } } @@ -1887,9 +1946,16 @@ void R_StoreWallRange(INT32 start, INT32 stop) // bottom of texture at bottom // top of texture at top rw_bottomtexturemid = worldtop; +#ifdef ESLOPE + rw_bottomtextureslide = floorfrontslide; +#endif } - else // top of texture at top + else { // top of texture at top rw_bottomtexturemid = worldlow; +#ifdef ESLOPE + rw_bottomtextureslide = floorbackslide; +#endif + } } rw_toptexturemid += sidedef->rowoffset; From 1b9180111ce60986902ad622672174e06d035627 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 4 May 2015 15:15:57 -0500 Subject: [PATCH 031/364] Pin midtextures based on slopes, including bending on wall crossing --- src/r_defs.h | 3 +++ src/r_segs.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index f2ae0ba8b..9a9679d4a 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -661,6 +661,9 @@ typedef struct drawseg_s INT16 *thicksidecol; INT32 numthicksides; fixed_t frontscale[MAXVIDWIDTH]; +#ifdef ESLOPE + fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures +#endif } drawseg_t; typedef enum diff --git a/src/r_segs.c b/src/r_segs.c index 490051eea..b96731c95 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -53,6 +53,7 @@ static INT32 worldtop, worldbottom, worldhigh, worldlow; #ifdef ESLOPE static INT32 worldtopslope, worldbottomslope, worldhighslope, worldlowslope; // worldtop/bottom at end of slope static fixed_t rw_toptextureslide, rw_midtextureslide, rw_bottomtextureslide; // Defines how to adjust Y offsets along the wall for slopes +static fixed_t rw_midtextureback, rw_midtexturebackslide; // Values for masked midtexture height calculation #endif static fixed_t pixhigh, pixlow, pixhighstep, pixlowstep; static fixed_t topfrac, topstep; @@ -60,6 +61,9 @@ static fixed_t bottomfrac, bottomstep; static lighttable_t **walllights; static INT16 *maskedtexturecol; +#ifdef ESLOPE +static fixed_t *maskedtextureheight = NULL; +#endif // ========================================================================== // R_Splats Wall Splats Drawer @@ -478,6 +482,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; } + +#ifndef ESLOPE if (curline->linedef->flags & ML_DONTPEGBOTTOM) { dc_texturemid = front->floorheight > back->floorheight @@ -496,12 +502,21 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) dc_texturemid += (textureheight[texnum])*times; else dc_texturemid -= (textureheight[texnum])*times; +#endif dc_texheight = textureheight[texnum]>>FRACBITS; // draw the columns for (dc_x = x1; dc_x <= x2; dc_x++) { +#ifdef ESLOPE + dc_texturemid = ds->maskedtextureheight[dc_x]; + + if (curline->linedef->flags & ML_DONTPEGBOTTOM) + dc_texturemid += (textureheight[texnum])*times + textureheight[texnum]; + else + dc_texturemid -= (textureheight[texnum])*times; +#endif // calculate lighting if (maskedtexturecol[dc_x] != INT16_MAX) { @@ -1205,9 +1220,10 @@ static void R_RenderSegLoop (void) #ifdef ESLOPE if (oldtexturecolumn != -1) { - rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn-texturecolumn); - rw_midtexturemid += FixedMul(rw_midtextureslide, oldtexturecolumn-texturecolumn); - rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn-texturecolumn); + rw_bottomtexturemid += FixedMul(rw_bottomtextureslide, oldtexturecolumn-texturecolumn); + rw_midtexturemid += FixedMul(rw_midtextureslide, oldtexturecolumn-texturecolumn); + rw_toptexturemid += FixedMul(rw_toptextureslide, oldtexturecolumn-texturecolumn); + rw_midtextureback += FixedMul(rw_midtexturebackslide, oldtexturecolumn-texturecolumn); } oldtexturecolumn = texturecolumn; #endif @@ -1360,6 +1376,14 @@ static void R_RenderSegLoop (void) // save texturecol // for backdrawing of masked mid texture maskedtexturecol[rw_x] = (INT16)texturecolumn; + +#ifdef ESLOPE + if (maskedtexture) { + maskedtextureheight[rw_x] = (curline->linedef->flags & ML_DONTPEGBOTTOM ? + max(rw_midtexturemid, rw_midtextureback) : + min(rw_midtexturemid, rw_midtextureback)); + } +#endif } if (dc_numlights) @@ -2120,6 +2144,23 @@ void R_StoreWallRange(INT32 start, INT32 stop) else ds_p->maskedtexturecol = ds_p->thicksidecol; +#ifdef ESLOPE + maskedtextureheight = &(ds_p->maskedtextureheight[0]); // ???? + + // Set midtexture starting height + if (linedef->flags & ML_DONTPEGBOTTOM) { + rw_midtexturemid = worldbottom; + rw_midtextureslide = floorfrontslide; + rw_midtextureback = worldlow; + rw_midtexturebackslide = floorbackslide; + } else { + rw_midtexturemid = worldtop; + rw_midtextureslide = ceilingfrontslide; + rw_midtextureback = worldhigh; + rw_midtexturebackslide = ceilingbackslide; + } +#endif + maskedtexture = true; } } From 7e13cb8b471e25358b9db126bde91d4e6cd1836d Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 4 May 2015 16:40:02 -0500 Subject: [PATCH 032/364] Fix various issues/crashes with texture alignments --- src/r_segs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index b96731c95..425cc4a3c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1378,7 +1378,7 @@ static void R_RenderSegLoop (void) maskedtexturecol[rw_x] = (INT16)texturecolumn; #ifdef ESLOPE - if (maskedtexture) { + if (maskedtextureheight != NULL) { maskedtextureheight[rw_x] = (curline->linedef->flags & ML_DONTPEGBOTTOM ? max(rw_midtexturemid, rw_midtextureback) : min(rw_midtexturemid, rw_midtextureback)); @@ -1447,6 +1447,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) #endif static size_t maxdrawsegs = 0; + maskedtextureheight = NULL; + if (ds_p == drawsegs+maxdrawsegs) { size_t pos = ds_p - drawsegs; @@ -1969,7 +1971,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) { // bottom of texture at bottom // top of texture at top - rw_bottomtexturemid = worldtop; + rw_bottomtexturemid = worldbottom; #ifdef ESLOPE rw_bottomtextureslide = floorfrontslide; #endif @@ -2159,6 +2161,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) rw_midtextureback = worldhigh; rw_midtexturebackslide = ceilingbackslide; } + rw_midtexturemid += sidedef->rowoffset; + rw_midtextureback += sidedef->rowoffset; #endif maskedtexture = true; From 2183912100cf32e41b39eae5e97695c6df0ff4d1 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 4 May 2015 17:45:02 -0500 Subject: [PATCH 033/364] Change upper/lower textures to not skew by default, add new linedef flags on normal linedefs: Effect 1: Restore skewing on upper/lower textures Effect 2: Disable skewing on midtextures Effect 3: Flips effect of Lower Unpegged for midtextures only (Effect 3 w/o LU: midtexture sticks to bottom, bottom texture sticks to upper edge. Effect 3 w/ LU: midtexture sticks to top, bottom texture sticks to lower edge.) --- src/r_segs.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 425cc4a3c..8db5fa73a 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -512,7 +512,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) #ifdef ESLOPE dc_texturemid = ds->maskedtextureheight[dc_x]; - if (curline->linedef->flags & ML_DONTPEGBOTTOM) + if (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3)) dc_texturemid += (textureheight[texnum])*times + textureheight[texnum]; else dc_texturemid -= (textureheight[texnum])*times; @@ -1379,7 +1379,7 @@ static void R_RenderSegLoop (void) #ifdef ESLOPE if (maskedtextureheight != NULL) { - maskedtextureheight[rw_x] = (curline->linedef->flags & ML_DONTPEGBOTTOM ? + maskedtextureheight[rw_x] = (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3) ? max(rw_midtexturemid, rw_midtextureback) : min(rw_midtexturemid, rw_midtextureback)); } @@ -1672,7 +1672,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) midtexture = texturetranslation[sidedef->midtexture]; // a single sided line is terminal, so it must mark ends markfloor = markceiling = true; - +#ifdef ESLOPE + if (!(linedef->flags & ML_EFFECT1)) { + if (linedef->flags & ML_DONTPEGBOTTOM) + rw_midtexturemid = frontsector->floorheight + textureheight[sidedef->midtexture] - viewz; + else + rw_midtexturemid = frontsector->ceilingheight; + } +#endif if (linedef->flags & ML_DONTPEGBOTTOM) { #ifdef ESLOPE @@ -1912,6 +1919,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (!toptexture) //Second side has no texture, use the first side's instead. toptexture = texturetranslation[sidedef->toptexture]; +#ifdef ESLOPE + if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + if (linedef->flags & ML_DONTPEGTOP) + rw_toptexturemid = frontsector->ceilingheight - viewz; + else + rw_toptexturemid = backsector->ceilingheight - viewz; + } else +#endif if (linedef->flags & ML_DONTPEGTOP) { // top of texture at top @@ -1936,6 +1951,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) { toptexture = texturetranslation[sidedef->toptexture]; +#ifdef ESLOPE + if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + if (linedef->flags & ML_DONTPEGTOP) + rw_toptexturemid = frontsector->ceilingheight - viewz; + else + rw_toptexturemid = backsector->ceilingheight - viewz; + } else +#endif if (linedef->flags & ML_DONTPEGTOP) { // top of texture at top @@ -1967,6 +1990,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) // bottom texture bottomtexture = texturetranslation[sidedef->bottomtexture]; +#ifdef ESLOPE + if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + if (linedef->flags & ML_DONTPEGBOTTOM) + rw_bottomtexturemid = frontsector->floorheight - viewz; + else + rw_bottomtexturemid = backsector->floorheight - viewz; + } else +#endif if (linedef->flags & ML_DONTPEGBOTTOM) { // bottom of texture at bottom @@ -2150,7 +2181,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) maskedtextureheight = &(ds_p->maskedtextureheight[0]); // ???? // Set midtexture starting height - if (linedef->flags & ML_DONTPEGBOTTOM) { + if (linedef->flags & ML_EFFECT2) { // Ignore slopes when texturing + rw_midtextureslide = rw_midtexturebackslide = 0; + if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + rw_midtexturemid = rw_midtextureback = max(frontsector->floorheight, backsector->floorheight) - viewz; + else + rw_midtexturemid = rw_midtextureback = min(frontsector->ceilingheight, backsector->ceilingheight) - viewz; + + } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { rw_midtexturemid = worldbottom; rw_midtextureslide = floorfrontslide; rw_midtextureback = worldlow; From 371e23d55d0965d4fbdb55c0a6f1566e57fd7b98 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 13 May 2015 16:02:19 -0500 Subject: [PATCH 034/364] Reduce acceleration pushback to less absurd levels --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 62022fccf..0f2bd19b9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4508,7 +4508,7 @@ static void P_3dMovement(player_t *player) v3fixed_t totalthrust; totalthrust.x = totalthrust.y = 0; // I forget if this is needed - totalthrust.z = FRACUNIT*P_MobjFlip(player->mo); // A bit of extra push-back on slopes + totalthrust.z = FRACUNIT*P_MobjFlip(player->mo)/3; // A bit of extra push-back on slopes #endif // ESLOPE // Get the old momentum; this will be needed at the end of the function! -SH From a3358479f0bc942df043c8fbff24f6efba62ad91 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 13 May 2015 16:15:32 -0500 Subject: [PATCH 035/364] Improvements related to slope collision, and quantize momentum properly for landing --- src/p_map.c | 25 +++++++++++++++++++------ src/p_mobj.c | 6 ++++++ src/p_slopes.c | 20 ++++++++++++++++++++ src/p_slopes.h | 1 + 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 468e2530a..4b74b0f02 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1912,6 +1912,9 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) fixed_t tryy = thing->y; fixed_t radius = thing->radius; fixed_t thingtop = thing->z + thing->height; +#ifdef ESLOPE + fixed_t startingonground = P_IsObjectOnGround(thing); +#endif floatok = false; if (radius < MAXRADIUS/2) @@ -2003,7 +2006,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (thingtop == thing->ceilingz && tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) + else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2014,7 +2017,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->z = thing->floorz = tmfloorz; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (thing->z == thing->floorz && tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) + else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) { thing->z = thing->floorz = tmfloorz; thing->eflags |= MFE_JUSTSTEPPEDDOWN; @@ -2090,10 +2093,20 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) #ifdef ESLOPE // Assign thing's standingslope if needed - if (thing->z <= tmfloorz && thing->momz <= 0 && !(thing->eflags & MFE_VERTICALFLIP)) - thing->standingslope = tmfloorslope; - else if (thing->z+thing->height >= tmceilingz && thing->momz >= 0 && (thing->eflags & MFE_VERTICALFLIP)) - thing->standingslope = tmceilingslope; + if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) { + if (!startingonground && tmfloorslope) + P_HandleSlopeLanding(thing, tmfloorslope); + + if (thing->momz <= 0) + thing->standingslope = tmfloorslope; + } + else if (thing->z+thing->height >= tmceilingz /*&& thing->momz >= 0*/ && (thing->eflags & MFE_VERTICALFLIP)) { + if (!startingonground && tmceilingslope) + P_HandleSlopeLanding(thing, tmceilingslope); + + if (thing->momz >= 0) + thing->standingslope = tmceilingslope; + } #endif thing->x = x; diff --git a/src/p_mobj.c b/src/p_mobj.c index 5af7b99a6..ac193b73e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2344,6 +2344,12 @@ static void P_PlayerZMovement(mobj_t *mo) if (mo->state == &states[mo->info->painstate] || mo->state == &states[S_PLAY_SUPERHIT]) P_SetPlayerMobjState(mo, S_PLAY_STND); +#ifdef ESLOPE + if (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope) + // Handle landing on slope during Z movement + P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)); +#endif + if (P_MobjFlip(mo)*mo->momz < 0) // falling { // Squat down. Decrease viewheight for a moment after hitting the ground (hard), diff --git a/src/p_slopes.c b/src/p_slopes.c index 5891756e8..cf786f1bb 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -805,6 +805,26 @@ void P_SlopeLaunch(mobj_t *mo) mo->standingslope = NULL; } +// Function to help handle landing on slopes +void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) +{ + v3fixed_t mom; + mom.x = thing->momx; + mom.y = thing->momy; + mom.z = thing->momz*2; + + // Reverse quantizing might could use its own function later + slope->zangle = ANGLE_MAX-slope->zangle; + P_QuantizeMomentumToSlope(&mom, slope); + slope->zangle = ANGLE_MAX-slope->zangle; + + if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope + thing->momx = mom.x; + thing->momy = mom.y; + thing->momz = -P_MobjFlip(thing); + } +} + // https://yourlogicalfallacyis.com/slippery-slope // Handles sliding down slopes, like if they were made of butter :) void P_ButteredSlope(mobj_t *mo) diff --git a/src/p_slopes.h b/src/p_slopes.h index f82d8a83d..4281d5796 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -79,6 +79,7 @@ float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, // Lots of physics-based bullshit void P_QuantizeMomentumToSlope(v3fixed_t *momentum, pslope_t *slope); void P_SlopeLaunch(mobj_t *mo); +void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope); void P_ButteredSlope(mobj_t *mo); #endif From 2187dac49bdf2f3075e4a97879c738ad9f674459 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 13 May 2015 16:48:34 -0500 Subject: [PATCH 036/364] Fix random texture triangles rendering on lines with slopes????? --- src/r_segs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 8db5fa73a..73e0a8696 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2371,7 +2371,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldhigh < worldtop #ifdef ESLOPE - || worldhighslope < worldtopslope + || worldhighslope <= worldtopslope #endif ) { @@ -2388,7 +2388,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (worldlow > worldbottom #ifdef ESLOPE - || worldlowslope > worldbottomslope + || worldlowslope >= worldbottomslope #endif ) { From 0cc917a0ff18af54051975db730b7313f8a49a23 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 13 May 2015 21:41:54 -0500 Subject: [PATCH 037/364] Plane lighting for slopes now actually acts like it should --- src/r_draw.c | 2 +- src/r_draw.h | 2 +- src/r_draw8.c | 44 +++++++++++++++++++++++++++++++++++++++++++- src/r_plane.c | 44 ++++++++++++++++++++------------------------ src/r_plane.h | 2 ++ 5 files changed, 67 insertions(+), 27 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index f4886d262..e63aa5a2b 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -106,7 +106,7 @@ UINT8 *ds_transmap; // one of the translucency tables #ifdef ESLOPE pslope_t *ds_slope; // Current slope being used v3float_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? -float focallengthf; +float focallengthf, zeroheight; #endif /** \brief Variable flat sizes diff --git a/src/r_draw.h b/src/r_draw.h index 179887536..fa2cb22d0 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -63,7 +63,7 @@ extern UINT8 *ds_transmap; #ifdef ESLOPE pslope_t *ds_slope; // Current slope being used v3float_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? -float focallengthf; +float focallengthf, zeroheight; #endif // Variable flat sizes diff --git a/src/r_draw8.c b/src/r_draw8.c index fe218f3ba..71e6458bb 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -527,6 +527,30 @@ void R_DrawSpan_8 (void) } #ifdef ESLOPE +// R_CalcTiltedLighting +// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly. +static size_t tiltlighting[MAXVIDWIDTH]; +void R_CalcTiltedLighting(fixed_t start, fixed_t end) +{ + // ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version + // of this function. Here's my own. + INT32 left = ds_x1, right = ds_x2; + fixed_t step = (end-start)/(ds_x2-ds_x1+1); + size_t i; + + // I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once, + // but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now... + + for (i = left; i <= right; i++) { + tiltlighting[i] = (start += step) >> FRACBITS; + if (tiltlighting[i] < 0) + tiltlighting[i] = 0; + else if (tiltlighting[i] >= MAXLIGHTSCALE) + tiltlighting[i] = MAXLIGHTSCALE-1; + } +} + + /** \brief The R_DrawTiltedSpan_8 function Draw slopes! Holy sheit! */ @@ -544,12 +568,24 @@ void R_DrawTiltedSpan_8(void) iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); + // Lighting is simple. It's just linear interpolation from start to end + { + float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (fabs(zeroheight - FIXED_TO_FLOAT(viewz))) / -21.0f; + float lightstart, lightend; + + lightend = (iz + ds_sz.x*width) * planelightfloat; + lightstart = iz * planelightfloat; + + R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend)); + //CONS_Printf("tilted lighting %f to %f (foc %f)\n", vz, uz, focallengthf); + } + uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx); dest = ylookup[ds_y] + columnofs[ds_x1]; source = ds_source; - colormap = ds_colormap; + //colormap = ds_colormap; #if 0 // The "perfect" reference version of this routine. Pretty slow. // Use it only to see how things are supposed to look. @@ -559,6 +595,9 @@ void R_DrawTiltedSpan_8(void) double z = 1.f/iz; u = (INT64)(uz*z) + viewx; v = (INT64)(vz*z) + viewy; + + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; dest++; iz += ds_sz.x; @@ -596,6 +635,7 @@ void R_DrawTiltedSpan_8(void) for (i = SPANSIZE-1; i >= 0; i--) { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; dest++; u += stepu; @@ -611,6 +651,7 @@ void R_DrawTiltedSpan_8(void) { u = (INT64)(startu); v = (INT64)(startv); + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; } else @@ -631,6 +672,7 @@ void R_DrawTiltedSpan_8(void) for (; width != 0; width--) { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; dest++; u += stepu; diff --git a/src/r_plane.c b/src/r_plane.c index 2839392d0..c0d26811d 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -74,7 +74,7 @@ static INT32 spanstart[MAXVIDHEIGHT]; // // texture mapping // -static lighttable_t **planezlight; +lighttable_t **planezlight; static fixed_t planeheight; //added : 10-02-98: yslopetab is what yslope used to be, @@ -327,6 +327,11 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2) if (pindex >= MAXLIGHTZ) pindex = MAXLIGHTZ - 1; +#ifdef ESLOPE + if (currentplane->slope) + ds_colormap = colormaps; + else +#endif ds_colormap = planezlight[pindex]; if (currentplane->extra_colormap) @@ -919,24 +924,23 @@ void R_DrawSinglePlane(visplane_t *pl) break; } + xoffs = pl->xoffs; + yoffs = pl->yoffs; + planeheight = abs(pl->height - pl->viewz); + + if (light >= LIGHTLEVELS) + light = LIGHTLEVELS-1; + + if (light < 0) + light = 0; + #ifdef ESLOPE if (pl->slope) { // Potentially override other stuff for now cus we're mean. :< But draw a slope plane! // I copied ZDoom's code and adapted it to SRB2... -Red - static const float ifloatpow2[16] = - { - // ifloatpow2[i] = 1 / (1 << i) - 64.f, 32.f, 16.f, 8.f, 4.f, 2.f, 1.f, 0.5f, - 0.25f, 0.125f, 0.0625f, 0.03125f, 0.015625f, 0.0078125f, - 0.00390625f, 0.001953125f - /*, 0.0009765625f, 0.00048828125f, 0.000244140625f, - 1.220703125e-4f, 6.103515625e-5, 3.0517578125e-5*/ - }; - double lxscale, lyscale; - double xscale, yscale; v3float_t p, m, n; angle_t ang; - double zeroheight; + //double zeroheight; double vx = FIXED_TO_FLOAT(viewx); double vy = FIXED_TO_FLOAT(viewy); @@ -986,19 +990,11 @@ void R_DrawSinglePlane(visplane_t *pl) #undef SFMULT spanfunc = R_DrawTiltedSpan_8; - } + + planezlight = scalelight[light]; + } else #endif // ESLOPE - xoffs = pl->xoffs; - yoffs = pl->yoffs; - planeheight = abs(pl->height - pl->viewz); - - if (light >= LIGHTLEVELS) - light = LIGHTLEVELS-1; - - if (light < 0) - light = 0; - planezlight = zlight[light]; // set the maximum value for unsigned diff --git a/src/r_plane.h b/src/r_plane.h index b2346636b..2ef49cb39 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -82,6 +82,8 @@ extern fixed_t cachedxstep[MAXVIDHEIGHT]; extern fixed_t cachedystep[MAXVIDHEIGHT]; extern fixed_t basexscale, baseyscale; +extern lighttable_t **planezlight; + extern fixed_t *yslope; extern fixed_t distscale[MAXVIDWIDTH]; From e39c8aa62e76ecaa91aa3cf594de36578d94ea92 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 13 May 2015 21:57:47 -0500 Subject: [PATCH 038/364] Fix ceiling slopes lol --- src/r_draw8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 71e6458bb..b292f4617 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -570,14 +570,14 @@ void R_DrawTiltedSpan_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (fabs(zeroheight - FIXED_TO_FLOAT(viewz))) / -21.0f; + float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; float lightstart, lightend; lightend = (iz + ds_sz.x*width) * planelightfloat; lightstart = iz * planelightfloat; R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend)); - //CONS_Printf("tilted lighting %f to %f (foc %f)\n", vz, uz, focallengthf); + //CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf); } uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); From bd0b7829bb53319ac10fdc7a115a95585ab9f852 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 14 May 2015 10:55:43 -0500 Subject: [PATCH 039/364] Fix rotated flats on slopes --- src/r_plane.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index c0d26811d..c39be11a9 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -861,6 +861,9 @@ void R_DrawSinglePlane(visplane_t *pl) } else light = (pl->lightlevel >> LIGHTSEGSHIFT); +#ifdef ESLOPE + if (!pl->slope) // Don't mess with angle on slopes! We'll handle this ourselves later +#endif if (viewangle != pl->viewangle) { memset(cachedheight, 0, sizeof (cachedheight)); @@ -962,10 +965,8 @@ void R_DrawSinglePlane(visplane_t *pl) m.z = FIXED_TO_FLOAT(FINESINE(ang)); // n is the u direction vector in view space - ang += ANGLE_90>>ANGLETOFINESHIFT; - ang &= FINEMASK; - n.x = -FIXED_TO_FLOAT(FINECOSINE(ang)); - n.z = -FIXED_TO_FLOAT(FINESINE(ang)); + n.x = FIXED_TO_FLOAT(FINESINE(ang)); + n.z = -FIXED_TO_FLOAT(FINECOSINE(ang)); ang = pl->plangle>>ANGLETOFINESHIFT; m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; From b69678f1a6d265061d89b2199ae703b8b96a8db1 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 15 May 2015 10:23:53 -0500 Subject: [PATCH 040/364] PLACEHOLDER, DO NOT PUSH THIS COMMIT --- src/p_mobj.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index ac193b73e..837c0c3a4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1437,7 +1437,8 @@ void P_XYMovement(mobj_t *mo) oldslope = mo->standingslope; } - } + } else if (P_IsObjectOnGround(mo)) + predictedz = mo->z; #endif // Pushables can break some blocks @@ -1447,7 +1448,6 @@ void P_XYMovement(mobj_t *mo) if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true) && !(mo->eflags & MFE_SPRUNG)) { // blocked move - if (player) { moved = false; if (player->bot) @@ -1562,6 +1562,8 @@ void P_XYMovement(mobj_t *mo) #ifdef ESLOPE if (moved && oldslope) { // Check to see if we ran off + //angle_t moveangle = R_PointToAngle2(mo->momx, mo->momy); + if (oldslope != mo->standingslope) { // First, compare different slopes // Start by quantizing momentum on this slope v3fixed_t test; @@ -1572,14 +1574,27 @@ void P_XYMovement(mobj_t *mo) P_QuantizeMomentumToSlope(&test, mo->standingslope); // Now compare the Zs of the different quantizations - if (slopemom.z - test.z > 2*FRACUNIT) { // Allow for a bit of sticking - this value can be adjusted later + if (slopemom.z - test.z > P_AproxDistance(slopemom.x, slopemom.y/3) { // Allow for a bit of sticking - this value can be adjusted later mo->standingslope = oldslope; P_SlopeLaunch(mo); } - } else if (predictedz-mo->z > 2*FRACUNIT) { // Now check if we were supposed to stick to this slope + } else if (predictedz-mo->z > P_AproxDistance(slopemom.x, slopemom.y)/3) { // Now check if we were supposed to stick to this slope mo->standingslope = oldslope; P_SlopeLaunch(mo); } + } else if (moved && mo->standingslope && predictedz) { + slopemom.x = mo->momx; + slopemom.y = mo->momy; + slopemom.z = 0; + + P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); + + if (-slopemom.z > P_AproxDistance(mo->momx, mo->momy)/3) { + mo->momz = P_MobjFlip(mo)*FRACUNIT/2; + mo->z = predictedz + P_MobjFlip(mo); + mo->standingslope = NULL; + CONS_Printf("Launched off of flat surface running into downward slope\n"); + } } #endif From 445e778309e84d80095085defc3742dd464f55de Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 15 May 2015 12:35:54 -0500 Subject: [PATCH 041/364] Improvements to slope collision/landing/ejecting/fajitas --- src/p_mobj.c | 63 +++++++++++++++++++++++++++++--------------------- src/p_slopes.c | 4 ++++ 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 837c0c3a4..855e9355c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1384,7 +1384,7 @@ void P_XYMovement(mobj_t *mo) #ifdef ESLOPE pslope_t *oldslope = NULL; v3fixed_t slopemom; - fixed_t predictedz; + fixed_t predictedz = 0; #endif I_Assert(mo != NULL); @@ -1437,7 +1437,7 @@ void P_XYMovement(mobj_t *mo) oldslope = mo->standingslope; } - } else if (P_IsObjectOnGround(mo)) + } else if (P_IsObjectOnGround(mo) && !mo->momz) predictedz = mo->z; #endif @@ -1562,38 +1562,48 @@ void P_XYMovement(mobj_t *mo) #ifdef ESLOPE if (moved && oldslope) { // Check to see if we ran off - //angle_t moveangle = R_PointToAngle2(mo->momx, mo->momy); if (oldslope != mo->standingslope) { // First, compare different slopes - // Start by quantizing momentum on this slope - v3fixed_t test; - test.x = mo->momx; - test.y = mo->momy; - test.z = 0; - if (mo->standingslope) // Don't fuss with the rotation if we don't HAVE a slope - P_QuantizeMomentumToSlope(&test, mo->standingslope); + angle_t oldangle, newangle; + angle_t moveangle = R_PointToAngle2(0, 0, mo->momx, mo->momy); + + oldangle = FixedMul((signed)oldslope->zangle, FINECOSINE((moveangle - oldslope->xydirection) >> ANGLETOFINESHIFT)); + + if (mo->standingslope) + newangle = FixedMul((signed)mo->standingslope->zangle, FINECOSINE((moveangle - mo->standingslope->xydirection) >> ANGLETOFINESHIFT)); + else + newangle = 0; // Now compare the Zs of the different quantizations - if (slopemom.z - test.z > P_AproxDistance(slopemom.x, slopemom.y/3) { // Allow for a bit of sticking - this value can be adjusted later + if (oldangle-newangle > ANG30 && oldangle-newangle < ANGLE_180) { // Allow for a bit of sticking - this value can be adjusted later mo->standingslope = oldslope; P_SlopeLaunch(mo); + + //CONS_Printf("launched off of slope - "); } - } else if (predictedz-mo->z > P_AproxDistance(slopemom.x, slopemom.y)/3) { // Now check if we were supposed to stick to this slope - mo->standingslope = oldslope; + + /*CONS_Printf("old angle %f - new angle %f = %f\n", + FIXED_TO_FLOAT(AngleFixed(oldangle)), + FIXED_TO_FLOAT(AngleFixed(newangle)), + FIXED_TO_FLOAT(AngleFixed(oldangle-newangle)) + );*/ + } else if (predictedz-mo->z > abs(slopemom.z/2)) { // Now check if we were supposed to stick to this slope + //CONS_Printf("%d-%d > %d\n", (predictedz), (mo->z), (slopemom.z/2)); P_SlopeLaunch(mo); } } else if (moved && mo->standingslope && predictedz) { - slopemom.x = mo->momx; - slopemom.y = mo->momy; - slopemom.z = 0; + angle_t moveangle = R_PointToAngle2(0, 0, mo->momx, mo->momy); + angle_t newangle = FixedMul((signed)mo->standingslope->zangle, FINECOSINE((moveangle - mo->standingslope->xydirection) >> ANGLETOFINESHIFT)); - P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); - - if (-slopemom.z > P_AproxDistance(mo->momx, mo->momy)/3) { + /*CONS_Printf("flat to angle %f - predicted z of %f\n", + FIXED_TO_FLOAT(AngleFixed(ANGLE_MAX-newangle)), + FIXED_TO_FLOAT(predictedz) + );*/ + if (ANGLE_MAX-newangle > ANG30 && newangle > ANGLE_180) { mo->momz = P_MobjFlip(mo)*FRACUNIT/2; mo->z = predictedz + P_MobjFlip(mo); mo->standingslope = NULL; - CONS_Printf("Launched off of flat surface running into downward slope\n"); + //CONS_Printf("Launched off of flat surface running into downward slope\n"); } } #endif @@ -2300,11 +2310,6 @@ static void P_PlayerZMovement(mobj_t *mo) if (!mo->player) return; -#ifdef ESLOPE - if (mo->standingslope && !P_IsObjectOnGround(mo)) - P_SlopeLaunch(mo); -#endif - // Intercept the stupid 'fall through 3dfloors' bug if (mo->subsector->sector->ffloors) P_AdjustMobjFloorZ_FFloors(mo, mo->subsector->sector, 0); @@ -2338,6 +2343,11 @@ static void P_PlayerZMovement(mobj_t *mo) || mo->player->playerstate == PST_REBORN) return; +#ifdef ESLOPE + if (mo->standingslope && !P_IsObjectOnGround(mo)) + P_SlopeLaunch(mo); +#endif + // clip movement if (P_IsObjectOnGround(mo) && !(mo->flags & MF_NOCLIPHEIGHT)) { @@ -2360,9 +2370,10 @@ static void P_PlayerZMovement(mobj_t *mo) P_SetPlayerMobjState(mo, S_PLAY_STND); #ifdef ESLOPE - if (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope) + if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) { // Handle landing on slope during Z movement P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)); + } #endif if (P_MobjFlip(mo)*mo->momz < 0) // falling diff --git a/src/p_slopes.c b/src/p_slopes.c index cf786f1bb..39eac6db7 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -813,6 +813,8 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) mom.y = thing->momy; mom.z = thing->momz*2; + //CONS_Printf("langing on slope\n"); + // Reverse quantizing might could use its own function later slope->zangle = ANGLE_MAX-slope->zangle; P_QuantizeMomentumToSlope(&mom, slope); @@ -822,6 +824,8 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) thing->momx = mom.x; thing->momy = mom.y; thing->momz = -P_MobjFlip(thing); + + thing->standingslope = slope; } } From 36d576adf44eb7c7a6708f6365b7601faf8fac0b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 15 May 2015 12:36:16 -0500 Subject: [PATCH 042/364] I think those were being cast wrong --- src/r_draw8.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index b292f4617..b8b23b1b3 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -593,8 +593,8 @@ void R_DrawTiltedSpan_8(void) do { double z = 1.f/iz; - u = (INT64)(uz*z) + viewx; - v = (INT64)(vz*z) + viewy; + u = (UINT32)(uz*z) + viewx; + v = (UINT32)(vz*z) + viewy; colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); @@ -628,10 +628,10 @@ void R_DrawTiltedSpan_8(void) double endz = 1.f/iz; double endu = uz*endz; double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); - u = (INT64)(startu) + viewx; - v = (INT64)(startv) + viewy; + UINT32 stepu = (UINT32)((endu - startu) * INVSPAN); + UINT32 stepv = (UINT32)((endv - startv) * INVSPAN); + u = (UINT32)(startu) + viewx; + v = (UINT32)(startv) + viewy; for (i = SPANSIZE-1; i >= 0; i--) { @@ -649,8 +649,8 @@ void R_DrawTiltedSpan_8(void) { if (width == 1) { - u = (INT64)(startu); - v = (INT64)(startv); + u = (UINT32)(startu); + v = (UINT32)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; } @@ -665,10 +665,10 @@ void R_DrawTiltedSpan_8(void) double endu = uz*endz; double endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); - u = (INT64)(startu) + viewx; - v = (INT64)(startv) + viewy; + UINT32 stepu = (UINT32)((endu - startu) * left); + UINT32 stepv = (UINT32)((endv - startv) * left); + u = (UINT32)(startu) + viewx; + v = (UINT32)(startv) + viewy; for (; width != 0; width--) { From 6fcdac494fc27b75503b1f47b9b772d252c5d12f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 16 May 2015 00:02:01 -0500 Subject: [PATCH 043/364] Spawned things spawn relative to slope floor/ceiling heights now This was a headache. :< --- src/p_mobj.c | 108 ++++++++++++++++++++++++++++++++++++++++--------- src/p_setup.c | 14 +++++-- src/p_slopes.c | 34 +++++++++++++--- src/p_spec.c | 13 +----- 4 files changed, 131 insertions(+), 38 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 855e9355c..af832d585 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7306,8 +7306,16 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // Make sure scale matches destscale immediately when spawned P_SetScale(mobj, mobj->destscale); - mobj->floorz = mobj->subsector->sector->floorheight; - mobj->ceilingz = mobj->subsector->sector->ceilingheight; + mobj->floorz = +#ifdef ESLOPE + mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) : +#endif + mobj->subsector->sector->floorheight; + mobj->ceilingz = +#ifdef ESLOPE + mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) : +#endif + mobj->subsector->sector->ceilingheight; // Tells MobjCheckWater that the water height was not set. mobj->watertop = INT32_MAX; @@ -8364,7 +8372,11 @@ void P_SpawnMapThing(mapthing_t *mthing) return; ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS); - mthing->z = (INT16)((ss->sector->floorheight>>FRACBITS) + (mthing->options >> ZSHIFT)); + mthing->z = (INT16)((( +#ifdef ESLOPE + ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) : +#endif + ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT)); if (numhuntemeralds < MAXHUNTEMERALDS) huntemeralds[numhuntemeralds++] = mthing; @@ -8482,14 +8494,22 @@ void P_SpawnMapThing(mapthing_t *mthing) ss = R_PointInSubsector(x, y); if (i == MT_NIGHTSBUMPER) - z = ss->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS); + z = ( +#ifdef ESLOPE + ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : +#endif + ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS); else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE) z = ONFLOORZ; else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_EMMY) { if (mthing->options & MTF_OBJECTFLIP) { - z = ss->sector->ceilingheight; + z = ( +#ifdef ESLOPE + ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : +#endif + ss->sector->ceilingheight); if (mthing->options & MTF_AMBUSH) // Special flag for rings z -= 24*FRACUNIT; @@ -8500,7 +8520,11 @@ void P_SpawnMapThing(mapthing_t *mthing) } else { - z = ss->sector->floorheight; + z = ( +#ifdef ESLOPE + ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : +#endif + ss->sector->floorheight); if (mthing->options & MTF_AMBUSH) // Special flag for rings z += 24*FRACUNIT; @@ -8520,9 +8544,17 @@ void P_SpawnMapThing(mapthing_t *mthing) // base positions if (flip) - z = ss->sector->ceilingheight - mobjinfo[i].height; + z = ( +#ifdef ESLOPE + ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : +#endif + ss->sector->ceilingheight) - mobjinfo[i].height; else - z = ss->sector->floorheight; + z = ( +#ifdef ESLOPE + ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : +#endif + ss->sector->floorheight); // offsetting if (mthing->options >> ZSHIFT) @@ -9036,7 +9068,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Screw these damn hoops, I need this thinker. //hoopcenter->flags |= MF_NOTHINK; - z += sec->floorheight; + z += +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight; hoopcenter->z = z - hoopcenter->height/2; @@ -9169,7 +9205,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER); hoopcenter->spawnpoint = mthing; - z += sec->floorheight; + z += +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight; hoopcenter->z = z - hoopcenter->height/2; P_UnsetThingPosition(hoopcenter); @@ -9281,7 +9321,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Wing logo item. else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum) { - z = sec->floorheight; + z = +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); @@ -9333,13 +9377,21 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Set proper height if (mthing->options & MTF_OBJECTFLIP) { - z = sec->ceilingheight - mobjinfo[ringthing].height; + z = ( +#ifdef ESLOPE + sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : +#endif + sec->ceilingheight) - mobjinfo[ringthing].height; if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - z = sec->floorheight; + z = +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); } @@ -9393,13 +9445,21 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) { if (mthing->options & MTF_OBJECTFLIP) { - z = sec->ceilingheight - mobjinfo[ringthing].height - dist*r; + z = ( +#ifdef ESLOPE + sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : +#endif + sec->ceilingheight) - mobjinfo[ringthing].height - dist*r; if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - z = sec->floorheight + dist*r; + z = ( +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight) + dist*r; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); } @@ -9445,13 +9505,21 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) if (mthing->options & MTF_OBJECTFLIP) { - z = sec->ceilingheight - mobjinfo[ringthing].height - 64*FRACUNIT*r; + z = ( +#ifdef ESLOPE + sec->c_slope ? P_GetZAt(sec->c_slope, x, y) : +#endif + sec->ceilingheight) - mobjinfo[ringthing].height - 64*FRACUNIT*r; if (mthing->options >> ZSHIFT) z -= ((mthing->options >> ZSHIFT) << FRACBITS); } else { - z = sec->floorheight + 64*FRACUNIT*r; + z = ( +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight) + 64*FRACUNIT*r; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); } @@ -9482,7 +9550,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) size = 192*FRACUNIT; } - z = sec->floorheight; + z = +#ifdef ESLOPE + sec->f_slope ? P_GetZAt(sec->f_slope, x, y) : +#endif + sec->floorheight; if (mthing->options >> ZSHIFT) z += ((mthing->options >> ZSHIFT) << FRACBITS); diff --git a/src/p_setup.c b/src/p_setup.c index a75668b68..c836d601c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -892,9 +892,14 @@ static void P_LoadThings(lumpnum_t lumpnum) numhuntemeralds = 0; for (i = 0; i < nummapthings; i++, mt++) { + sector_t *mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector; + // Z for objects - mt->z = (INT16)(R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS) - ->sector->floorheight>>FRACBITS); + mt->z = (INT16)( +#ifdef ESLOPE + mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : +#endif + mtsector->floorheight)>>FRACBITS; if (mt->type == 1700 // MT_AXIS || mt->type == 1701 // MT_AXISTRANSFER @@ -2535,6 +2540,10 @@ boolean P_SetupLevel(boolean skipprecip) P_MapStart(); +#ifdef ESLOPE + P_ResetDynamicSlopes(); +#endif + P_LoadThings(lastloadedmaplumpnum + ML_THINGS); P_SpawnSecretItems(loademblems); @@ -2544,7 +2553,6 @@ boolean P_SetupLevel(boolean skipprecip) break; // set up world state - P_ResetDynamicSlopes(); P_SpawnSpecials(fromnetsave); if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame) diff --git a/src/p_slopes.c b/src/p_slopes.c index 39eac6db7..e7d05768c 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -42,11 +42,6 @@ static pslope_t *dynslopes = NULL; -// Reset the dynamic slopes pointer -void P_ResetDynamicSlopes(void) { - dynslopes = NULL; -} - // Calculate line normal void P_CalculateSlopeNormal(pslope_t *slope) { slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT); @@ -722,6 +717,35 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) } #endif +// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes +void P_ResetDynamicSlopes(void) { + size_t i; + + dynslopes = NULL; + + // We'll handle copy slopes later, after all the tag lists have been made. + // Yes, this means copied slopes won't affect things' spawning heights. Too bad for you. + for (i = 0; i < numlines; i++) + { + switch (lines[i].special) + { + case 386: + case 387: + case 388: + case 389: + case 390: + case 391: + case 392: + case 393: + P_SpawnSlope_Line(i); + break; + + default: + break; + } + } +} + diff --git a/src/p_spec.c b/src/p_spec.c index fe3deba30..b276d1c17 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6439,18 +6439,7 @@ void P_SpawnSpecials(INT32 fromnetsave) sectors[s].midmap = lines[i].frontsector->midmap; break; -#ifdef ESLOPE // Slope specials. TODO move these to a different spot, maybe? - case 386: - case 387: - case 388: - case 389: - case 390: - case 391: - case 392: - case 393: - P_SpawnSlope_Line(i); - break; - // SoM: Copy slopes +#ifdef ESLOPE // Slope copy specials. Handled here for sanity. case 394: case 395: case 396: From 09f8dec7d14214494516bb727f44d11f57ff4379 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 16 May 2015 00:04:19 -0500 Subject: [PATCH 044/364] Optimization/configuration option: No Tails on a slope line makes a slope non-dynamic --- src/p_slopes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index e7d05768c..9cd22f35b 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -233,7 +233,7 @@ void P_SpawnSlope_Line(int linenum) // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef fslope = line->frontsector->f_slope = - P_MakeSlope(&point, &direction, dz, true); + P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); // Set up some shit fslope->extent = extent; @@ -289,7 +289,7 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(origin.z - point.z, extent); cslope = line->frontsector->c_slope = - P_MakeSlope(&point, &direction, dz, true); + P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); // Set up some shit cslope->extent = extent; @@ -352,7 +352,7 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(origin.z - point.z, extent); fslope = line->backsector->f_slope = - P_MakeSlope(&point, &direction, dz, true); + P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); // Set up some shit fslope->extent = extent; @@ -394,7 +394,7 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(origin.z - point.z, extent); cslope = line->backsector->c_slope = - P_MakeSlope(&point, &direction, dz, true); + P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); // Set up some shit cslope->extent = extent; From d81cecdac9d058d7509f9bf1bd86bb33eda41866 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 16 May 2015 19:59:52 -0500 Subject: [PATCH 045/364] Minor cleanup so it stops bugging me --- src/r_segs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 73e0a8696..a4b57d39d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1904,7 +1904,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // check TOP TEXTURE if (worldhigh < worldtop #ifdef ESLOPE - /*-(FRACUNIT>>8)*/|| worldhighslope < worldtopslope/*-(FRACUNIT>>8)*/ + || worldhighslope < worldtopslope #endif ) { @@ -1983,7 +1983,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // check BOTTOM TEXTURE if (worldlow > worldbottom #ifdef ESLOPE - /*+(FRACUNIT>>8)*/ || worldlowslope > worldbottomslope/*+(FRACUNIT>>8)*/ // The leeway works around a weird rendering bug with slopes... + || worldlowslope > worldbottomslope #endif ) //seulement si VISIBLE!!! { From 4e11d6d6152f13ad4d33e9a46cb5650139f61353 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 16 May 2015 22:32:12 -0500 Subject: [PATCH 046/364] Make FOF planes render slopedly if set --- src/p_spec.c | 6 ++ src/r_bsp.c | 48 +++++++++-- src/r_defs.h | 6 ++ src/r_plane.h | 8 ++ src/r_segs.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 282 insertions(+), 21 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index b276d1c17..3126413b5 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4903,6 +4903,12 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f ffloor->topyoffs = &sec2->ceiling_yoffs; ffloor->topangle = &sec2->ceilingpic_angle; +#ifdef ESLOPE + // Add slopes + ffloor->t_slope = &sec2->c_slope; + ffloor->b_slope = &sec2->f_slope; +#endif + if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only flags &= ~FF_BLOCKOTHERS; diff --git a/src/r_bsp.c b/src/r_bsp.c index ae4e8ac67..283029ca5 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -905,6 +905,7 @@ static void R_Subsector(size_t num) if (frontsector->ffloors) { ffloor_t *rover; + fixed_t heightcheck; for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next) { @@ -922,10 +923,16 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; + + heightcheck = +#ifdef ESLOPE + *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : +#endif + *rover->bottomheight; if (*rover->bottomheight <= frontsector->ceilingheight && *rover->bottomheight >= frontsector->floorheight - && ((viewz < *rover->bottomheight && !(rover->flags & FF_INVERTPLANES)) - || (viewz > *rover->bottomheight && (rover->flags & FF_BOTHPLANES)))) + && ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES)) + || (viewz > heightcheck && (rover->flags & FF_BOTHPLANES)))) { light = R_GetPlaneLight(frontsector, *rover->bottomheight, viewz < *rover->bottomheight); @@ -933,11 +940,20 @@ static void R_Subsector(size_t num) *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover #ifdef ESLOPE - , NULL // will ffloors be slopable eventually? + , *rover->b_slope #endif ); - ffloor[numffloors].height = *rover->bottomheight; +#ifdef ESLOPE + ffloor[numffloors].slope = *rover->b_slope; +#endif + + ffloor[numffloors].height = +#ifdef ESLOPE + *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : +#endif + *rover->bottomheight; + ffloor[numffloors].ffloor = rover; numffloors++; } @@ -945,20 +961,36 @@ static void R_Subsector(size_t num) break; ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; + + heightcheck = +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : +#endif + *rover->topheight; if (*rover->topheight >= frontsector->floorheight && *rover->topheight <= frontsector->ceilingheight - && ((viewz > *rover->topheight && !(rover->flags & FF_INVERTPLANES)) - || (viewz < *rover->topheight && (rover->flags & FF_BOTHPLANES)))) + && ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES)) + || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { light = R_GetPlaneLight(frontsector, *rover->topheight, viewz < *rover->topheight); ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover #ifdef ESLOPE - , NULL // will ffloors be slopable eventually? + , *rover->t_slope #endif ); - ffloor[numffloors].height = *rover->topheight; + +#ifdef ESLOPE + ffloor[numffloors].slope = *rover->t_slope; +#endif + + ffloor[numffloors].height = +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : +#endif + *rover->topheight; + ffloor[numffloors].ffloor = rover; numffloors++; } diff --git a/src/r_defs.h b/src/r_defs.h index 9a9679d4a..1f0f2a62d 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -155,6 +155,12 @@ typedef struct ffloor_s fixed_t *bottomyoffs; angle_t *bottomangle; +#ifdef ESLOPE + // Pointers to pointers. Yup. + struct pslope_s **t_slope; + struct pslope_s **b_slope; +#endif + size_t secnum; ffloortype_e flags; struct line_s *master; diff --git a/src/r_plane.h b/src/r_plane.h index 2ef49cb39..239723ed1 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -119,6 +119,14 @@ typedef struct planemgr_s INT16 f_clip[MAXVIDWIDTH]; INT16 c_clip[MAXVIDWIDTH]; +#ifdef ESLOPE + // For slope rendering; the height at the other end + fixed_t f_pos_slope; + fixed_t b_pos_slope; + + struct pslope_s *slope; +#endif + struct ffloor_s *ffloor; #ifdef POLYOBJECTS_PLANES polyobj_t *polyobj; diff --git a/src/r_segs.c b/src/r_segs.c index a4b57d39d..a8f956a85 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1549,7 +1549,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) // and decide if floor / ceiling marks are needed #ifdef ESLOPE // Figure out map coordinates of where start and end are mapping to on seg, so we can clip right for slope bullshit - if (frontsector->c_slope || frontsector->f_slope || (backsector && (backsector->c_slope || backsector->f_slope))) { + //if (frontsector->c_slope || frontsector->f_slope || (backsector && (backsector->c_slope || backsector->f_slope))) // Commenting this out for FOFslop. -Red + { angle_t temp; // left @@ -1640,6 +1641,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (ffloor[i].polyobj && (!ds_p->curline->polyseg || ffloor[i].polyobj != ds_p->curline->polyseg)) continue; #endif + +#ifdef ESLOPE + if (ffloor[i].slope) { + ffloor[i].f_pos = P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) - viewz; + ffloor[i].f_pos_slope = P_GetZAt(ffloor[i].slope, segright.x, segright.y) - viewz; + } else + ffloor[i].f_pos_slope = +#endif ffloor[i].f_pos = ffloor[i].height - viewz; } } @@ -2024,6 +2033,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor_t *rover; ffloor_t *r2; fixed_t lowcut, highcut; +#ifdef ESLOPE + fixed_t lowcutslope, highcutslope; + + // Used for height comparisons and etc across FOFs and slopes + fixed_t high1, highslope1, low1, lowslope1, high2, highslope2, low2, lowslope2; +#endif //markceiling = markfloor = true; maskedtexture = true; @@ -2031,8 +2046,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) ds_p->thicksidecol = maskedtexturecol = lastopening - rw_x; lastopening += rw_stopx - rw_x; - lowcut = frontsector->floorheight > backsector->floorheight ? frontsector->floorheight : backsector->floorheight; - highcut = frontsector->ceilingheight < backsector->ceilingheight ? frontsector->ceilingheight : backsector->ceilingheight; + lowcut = max(worldbottom, worldlow) + viewz; + highcut = min(worldtop, worldhigh) + viewz; +#ifdef ESLOPE + lowcutslope = max(worldbottomslope, worldlowslope) + viewz; + highcutslope = min(worldtopslope, worldhighslope) + viewz; +#endif if (frontsector->ffloors && backsector->ffloors) { @@ -2043,16 +2062,33 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; if (rover->flags & FF_INVERTSIDES) continue; - if (*rover->topheight < lowcut || *rover->bottomheight > highcut) - continue; if (rover->norender == leveltime) continue; +#ifdef ESLOPE + if (*rover->t_slope) { + high1 = P_GetZAt(*rover->t_slope, segleft.x, segleft.y); + highslope1 = P_GetZAt(*rover->t_slope, segright.x, segright.y); + } else + high1 = highslope1 = *rover->topheight; + if (*rover->b_slope) { + low1 = P_GetZAt(*rover->b_slope, segleft.x, segleft.y); + lowslope1 = P_GetZAt(*rover->b_slope, segright.x, segright.y); + } else + low1 = lowslope1 = *rover->bottomheight; + + if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) + continue; +#else + if (*rover->topheight < lowcut || *rover->bottomheight > highcut) + continue; +#endif + for (r2 = frontsector->ffloors; r2; r2 = r2->next) { if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES) - || *r2->topheight < lowcut || *r2->bottomheight > highcut) + || *r2->topheight < lowcut || *r2->bottomheight > highcut) ///TODO: make these account for slopes -Red continue; if (r2->norender == leveltime) @@ -2072,8 +2108,24 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; } +#ifdef ESLOPE + if (*r2->t_slope) { + high2 = P_GetZAt(*r2->t_slope, segleft.x, segleft.y); + highslope2 = P_GetZAt(*r2->t_slope, segright.x, segright.y); + } else + high2 = highslope2 = *r2->topheight; + if (*r2->b_slope) { + low2 = P_GetZAt(*r2->b_slope, segleft.x, segleft.y); + lowslope2 = P_GetZAt(*r2->b_slope, segright.x, segright.y); + } else + low2 = lowslope2 = *r2->bottomheight; + + if ((high1 > high2 && highslope1 > highslope2) || (low1 < low2 && lowslope1 < lowslope2)) + continue; +#else if (*rover->topheight > *r2->topheight || *rover->bottomheight < *r2->bottomheight) continue; +#endif break; } @@ -2090,16 +2142,33 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; if (!(rover->flags & FF_ALLSIDES)) continue; - if (*rover->topheight < lowcut || *rover->bottomheight > highcut) - continue; if (rover->norender == leveltime) continue; +#ifdef ESLOPE + if (*rover->t_slope) { + high1 = P_GetZAt(*rover->t_slope, segleft.x, segleft.y); + highslope1 = P_GetZAt(*rover->t_slope, segright.x, segright.y); + } else + high1 = highslope1 = *rover->topheight; + if (*rover->b_slope) { + low1 = P_GetZAt(*rover->b_slope, segleft.x, segleft.y); + lowslope1 = P_GetZAt(*rover->b_slope, segright.x, segright.y); + } else + low1 = lowslope1 = *rover->bottomheight; + + if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) + continue; +#else + if (*rover->topheight < lowcut || *rover->bottomheight > highcut) + continue; +#endif + for (r2 = backsector->ffloors; r2; r2 = r2->next) { if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES) - || *r2->topheight < lowcut || *r2->bottomheight > highcut) + || *r2->topheight < lowcut || *r2->bottomheight > highcut) ///TODO: make these account for slopes -Red continue; if (r2->norender == leveltime) @@ -2119,8 +2188,24 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; } +#ifdef ESLOPE + if (*r2->t_slope) { + high2 = P_GetZAt(*r2->t_slope, segleft.x, segleft.y); + highslope2 = P_GetZAt(*r2->t_slope, segright.x, segright.y); + } else + high2 = highslope2 = *r2->topheight; + if (*r2->b_slope) { + low2 = P_GetZAt(*r2->b_slope, segleft.x, segleft.y); + lowslope2 = P_GetZAt(*r2->b_slope, segright.x, segright.y); + } else + low2 = lowslope2 = *r2->bottomheight; + + if ((high1 > high2 && highslope1 > highslope2) || (low1 < low2 && lowslope1 < lowslope2)) + continue; +#else if (*rover->topheight > *r2->topheight || *rover->bottomheight < *r2->bottomheight) continue; +#endif break; } @@ -2137,11 +2222,21 @@ void R_StoreWallRange(INT32 start, INT32 stop) { if (!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS) || rover->flags & FF_INVERTSIDES) continue; - if (*rover->topheight <= frontsector->floorheight || *rover->bottomheight >= frontsector->ceilingheight) - continue; if (rover->norender == leveltime) continue; +#ifdef ESLOPE + // Oy vey. + if (( (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) <= worldbottom+viewz + && (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) <= worldbottomslope+viewz) + ||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) >= worldtop+viewz + && (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldtopslope+viewz)) + continue; +#else + if (*rover->topheight <= frontsector->floorheight || *rover->bottomheight >= frontsector->ceilingheight) + continue; +#endif + ds_p->thicksides[i] = rover; i++; } @@ -2152,12 +2247,27 @@ void R_StoreWallRange(INT32 start, INT32 stop) { if (!(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_ALLSIDES)) continue; + if (rover->norender == leveltime) + continue; +#ifdef ESLOPE + // Oy vey. + if (( (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) <= worldbottom+viewz + && (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) <= worldbottomslope+viewz) + ||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) >= worldtop+viewz + && (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldtopslope+viewz)) + continue; + + if (( (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) <= worldlow+viewz + && (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) <= worldlowslope+viewz) + ||((*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) >= worldhigh+viewz + && (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) >= worldhighslope+viewz)) + continue; +#else if (*rover->topheight <= frontsector->floorheight || *rover->bottomheight >= frontsector->ceilingheight) continue; if (*rover->topheight <= backsector->floorheight || *rover->bottomheight >= backsector->ceilingheight) continue; - if (rover->norender == leveltime) - continue; +#endif ds_p->thicksides[i] = rover; i++; @@ -2355,8 +2465,14 @@ void R_StoreWallRange(INT32 start, INT32 stop) #endif ffloor[i].f_pos >>= 4; +#ifdef ESLOPE + ffloor[i].f_pos_slope >>= 4; + ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); + ffloor[i].f_step = ((centeryfrac>>4) - FixedMul(ffloor[i].f_pos_slope, ds_p->scale2) - ffloor[i].f_frac)/(stop-start+1); +#else ffloor[i].f_step = FixedMul(-rw_scalestep, ffloor[i].f_pos); ffloor[i].f_frac = (centeryfrac>>4) - FixedMul(ffloor[i].f_pos, rw_scale); +#endif } } @@ -2405,6 +2521,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ffloor_t * rover; i = 0; +#ifdef ESLOPE + fixed_t rovertest; + fixed_t planevistest; +#endif if (backsector->ffloors) { @@ -2415,6 +2535,48 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (rover->norender == leveltime) continue; +#ifdef ESLOPE + rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); + + if (rovertest>>4 <= worldhigh && + rovertest>>4 >= worldlow && + ((viewz < planevistest && !(rover->flags & FF_INVERTPLANES)) || + (viewz > planevistest && (rover->flags & FF_BOTHPLANES)))) + { + ffloor[i].slope = *rover->b_slope; + ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos >>= 4; + ffloor[i].b_pos_slope >>= 4; + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + i++; + } + + if (i >= MAXFFLOORS) + break; + + rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); + + if (rovertest>>4 <= worldhigh && + rovertest>>4 >= worldlow && + ((viewz > planevistest && !(rover->flags & FF_INVERTPLANES)) || + (viewz < planevistest && (rover->flags & FF_BOTHPLANES)))) + { + ffloor[i].slope = *rover->t_slope; + ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->topheight) - viewz; + ffloor[i].b_pos >>= 4; + ffloor[i].b_pos_slope >>= 4; + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + i++; + } +#else if (*rover->bottomheight <= backsector->ceilingheight && *rover->bottomheight >= backsector->floorheight && ((viewz < *rover->bottomheight && !(rover->flags & FF_INVERTPLANES)) || @@ -2426,8 +2588,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); i++; } + if (i >= MAXFFLOORS) break; + if (*rover->topheight >= backsector->floorheight && *rover->topheight <= backsector->ceilingheight && ((viewz > *rover->topheight && !(rover->flags & FF_INVERTPLANES)) || @@ -2439,6 +2603,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); i++; } +#endif } } else if (frontsector && frontsector->ffloors) @@ -2450,6 +2615,49 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (rover->norender == leveltime) continue; + +#ifdef ESLOPE + rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); + + if (rovertest>>4 <= worldtop && + rovertest>>4 >= worldbottom && + ((viewz < planevistest && !(rover->flags & FF_INVERTPLANES)) || + (viewz > planevistest && (rover->flags & FF_BOTHPLANES)))) + { + ffloor[i].slope = *rover->b_slope; + ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos >>= 4; + ffloor[i].b_pos_slope >>= 4; + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + i++; + } + + if (i >= MAXFFLOORS) + break; + + rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); + + if (rovertest>>4 <= worldtop && + rovertest>>4 >= worldbottom && + ((viewz > planevistest && !(rover->flags & FF_INVERTPLANES)) || + (viewz < planevistest && (rover->flags & FF_BOTHPLANES)))) + { + ffloor[i].slope = *rover->t_slope; + ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->topheight) - viewz; + ffloor[i].b_pos >>= 4; + ffloor[i].b_pos_slope >>= 4; + ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); + ffloor[i].b_step = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos_slope, ds_p->scale2); + ffloor[i].b_step = (ffloor[i].b_step-ffloor[i].b_frac)/(stop-start+1); + i++; + } +#else if (*rover->bottomheight <= frontsector->ceilingheight && *rover->bottomheight >= frontsector->floorheight && ((viewz < *rover->bottomheight && !(rover->flags & FF_INVERTPLANES)) || @@ -2474,6 +2682,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); i++; } +#endif } } #ifdef POLYOBJECTS_PLANES From c08253d796fcb146a8e3081db88b626598b9a77e Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 16 May 2015 23:04:54 -0500 Subject: [PATCH 047/364] FOF sides now render slopified too! --- src/r_defs.h | 3 +++ src/r_segs.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index 1f0f2a62d..b3667c05a 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -667,8 +667,11 @@ typedef struct drawseg_s INT16 *thicksidecol; INT32 numthicksides; fixed_t frontscale[MAXVIDWIDTH]; + #ifdef ESLOPE fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures + + vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes #endif } drawseg_t; diff --git a/src/r_segs.c b/src/r_segs.c index a8f956a85..5d434b9a9 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -698,6 +698,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) r_lightlist_t *rlight; fixed_t lheight; line_t *newline = NULL; +#ifdef ESLOPE + // Render FOF sides kinda like normal sides, with the frac and step and everything + fixed_t top_frac, top_step, bottom_frac, bottom_step; +#endif void (*colfunc_2s) (column_t *); @@ -872,6 +876,34 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) column2s_length = textures[texnum]->height; } +#ifdef ESLOPE + // Set heights according to plane, or slope, whichever + { + fixed_t left_top, right_top, left_bottom, right_bottom; + + left_top = *pfloor->t_slope ? P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y) : *pfloor->topheight; + right_top = *pfloor->t_slope ? P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y) : *pfloor->topheight; + left_bottom = *pfloor->b_slope ? P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y) : *pfloor->bottomheight; + right_bottom = *pfloor->b_slope ? P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y) : *pfloor->bottomheight; + + left_top -= viewz; + right_top -= viewz; + left_bottom -= viewz; + right_bottom -= viewz; + + top_frac = centeryfrac - FixedMul(left_top, ds->scale1); + bottom_frac = centeryfrac - FixedMul(left_bottom, ds->scale1); + top_step = centeryfrac - FixedMul(right_top, ds->scale2); + bottom_step = centeryfrac - FixedMul(right_bottom, ds->scale2); + + top_step = (top_step-top_frac)/(ds->x2-ds->x1+1); + bottom_step = (bottom_step-bottom_frac)/(ds->x2-ds->x1+1); + + top_frac += top_step * (x1 - ds->x1); + bottom_frac += bottom_step * (x1 - ds->x1); + } +#endif + // draw the columns for (dc_x = x1; dc_x <= x2; dc_x++) { @@ -887,8 +919,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) INT32 solid = 0; INT32 lighteffect = 0; +#ifdef ESLOPE + sprtopscreen = windowtop = top_frac; + sprbotscreen = windowbottom = bottom_frac; + + top_frac += top_step; + bottom_frac += bottom_step; +#else sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale)); sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen; +#endif // SoM: If column is out of range, why bother with it?? if (windowbottom < topbounds || windowtop > bottombounds) @@ -1030,11 +1070,24 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) || ((signed)dc_texturemid < 0 && (spryscale) && (signed)(dc_texturemid)>>FRACBITS < (INT32_MIN / spryscale))) { spryscale += rw_scalestep; +#ifdef ESLOPE + top_frac += top_step; + bottom_frac += bottom_step; +#endif continue; } +#ifdef ESLOPE + sprtopscreen = windowtop = top_frac; + sprbotscreen = windowbottom = bottom_frac; + + top_frac += top_step; + bottom_frac += bottom_step; +#else sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale)); sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen; +#endif + dc_iscale = 0xffffffffu / (unsigned)spryscale; // draw the texture @@ -1571,8 +1624,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) det = a1*b2 - a2*b1; - segleft.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); - segleft.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); + ds_p->leftpos.x = segleft.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); + ds_p->leftpos.y = segleft.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); } // right @@ -1593,8 +1646,8 @@ void R_StoreWallRange(INT32 start, INT32 stop) det = a1*b2 - a2*b1; - segright.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); - segright.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); + ds_p->rightpos.x = segright.x = FLOAT_TO_FIXED((b2*c1 - b1*c2)/det); + ds_p->rightpos.y = segright.y = FLOAT_TO_FIXED((a1*c2 - a2*c1)/det); } } From 8ba5b668531366686e8483ec1a82dca69795ddb0 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 16 May 2015 23:55:49 -0500 Subject: [PATCH 048/364] Slight optimization (don't get seg ends for slopes if there are no slopes) --- src/p_slopes.c | 6 ++++++ src/r_bsp.c | 8 ++++++++ src/r_defs.h | 2 ++ src/r_segs.c | 10 +++++++++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 9cd22f35b..60bd1087b 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -204,6 +204,8 @@ void P_SpawnSlope_Line(int linenum) // For FOF slopes, make a special function to copy to the xy origin & direction relative to the position of the FOF on the map! if(frontfloor || frontceil) { + line->frontsector->hasslope = true; // Tell the software renderer that we're sloped + origin.z = line->backsector->floorheight; direction.x = nx; direction.y = ny; @@ -327,6 +329,8 @@ void P_SpawnSlope_Line(int linenum) } if(backfloor || backceil) { + line->backsector->hasslope = true; // Tell the software renderer that we're sloped + origin.z = line->frontsector->floorheight; // Backsector direction.x = -nx; @@ -459,6 +463,8 @@ void P_CopySectorSlope(line_t *line) fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope); } + fsec->hasslope = true; + line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } diff --git a/src/r_bsp.c b/src/r_bsp.c index 283029ca5..8907ff42f 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -946,6 +946,10 @@ static void R_Subsector(size_t num) #ifdef ESLOPE ffloor[numffloors].slope = *rover->b_slope; + + // Tell the renderer this sector has slopes in it. + if (ffloor[numffloors].slope) + frontsector->hasslope = true; #endif ffloor[numffloors].height = @@ -983,6 +987,10 @@ static void R_Subsector(size_t num) #ifdef ESLOPE ffloor[numffloors].slope = *rover->t_slope; + + // Tell the renderer this sector has slopes in it. + if (ffloor[numffloors].slope) + frontsector->hasslope = true; #endif ffloor[numffloors].height = diff --git a/src/r_defs.h b/src/r_defs.h index b3667c05a..b5b589e77 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -391,7 +391,9 @@ typedef struct sector_s // Eternity engine slope pslope_t *f_slope; // floor slope pslope_t *c_slope; // ceiling slope + boolean hasslope; // The sector, or one of its visible FOFs, contains a slope #endif + // these are saved for netgames, so do not let Lua touch these! // offsets sector spawned with (via linedef type 7) diff --git a/src/r_segs.c b/src/r_segs.c index 5d434b9a9..a9d6c3024 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1602,7 +1602,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // and decide if floor / ceiling marks are needed #ifdef ESLOPE // Figure out map coordinates of where start and end are mapping to on seg, so we can clip right for slope bullshit - //if (frontsector->c_slope || frontsector->f_slope || (backsector && (backsector->c_slope || backsector->f_slope))) // Commenting this out for FOFslop. -Red + if (frontsector->hasslope || (backsector && backsector->hasslope)) // Commenting this out for FOFslop. -Red { angle_t temp; @@ -2589,6 +2589,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) continue; #ifdef ESLOPE + // Let the renderer know this sector is sloped. + if (*rover->b_slope || *rover->t_slope) + backsector->hasslope = true; + rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); @@ -2670,6 +2674,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) #ifdef ESLOPE + // Let the renderer know this sector is sloped. + if (*rover->b_slope || *rover->t_slope) + frontsector->hasslope = true; + rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); From d138f7e14fc0aba6cc878eb1532f5e4987b2ac90 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 11:53:28 -0500 Subject: [PATCH 049/364] Collision with FOF slopes (might be unfinished, idk) --- src/p_local.h | 2 + src/p_map.c | 31 ++---- src/p_maputl.c | 68 +++++++----- src/p_mobj.c | 289 +++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 323 insertions(+), 67 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 2fd7bcbe2..472c0706e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -234,6 +234,8 @@ void P_SceneryThinker(mobj_t *mobj); fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); +fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); +fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); diff --git a/src/p_map.c b/src/p_map.c index 4b74b0f02..6257ede1b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1244,15 +1244,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (!(rover->flags & FF_EXISTS)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; - -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, thing->x, thing->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y); -#endif*/ + fixed_t topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); + fixed_t bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY)) { @@ -1276,7 +1269,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (tmfloorz < topheight - sinklevel) { tmfloorz = topheight - sinklevel; #ifdef ESLOPE - tmfloorslope = NULL; + tmfloorslope = *rover->t_slope; #endif } } @@ -1285,7 +1278,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (tmceilingz > bottomheight + sinklevel) { tmceilingz = bottomheight + sinklevel; #ifdef ESLOPE - tmceilingslope = NULL; + tmceilingslope = *rover->b_slope; #endif } } @@ -1327,7 +1320,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { tmfloorz = tmdropoffz = topheight; #ifdef ESLOPE - tmfloorslope = NULL; + tmfloorslope = *rover->t_slope; #endif } if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2) @@ -1336,7 +1329,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { tmceilingz = tmdrpoffceilz = bottomheight; #ifdef ESLOPE - tmceilingslope = NULL; + tmceilingslope = *rover->b_slope; #endif } } @@ -4010,12 +4003,12 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, x, y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, x, y); -#endif*/ +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, x, y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, x, y); +#endif if (rover->flags & FF_QUICKSAND) { diff --git a/src/p_maputl.c b/src/p_maputl.c index b5ac29507..4037d769b 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -659,6 +659,10 @@ void P_LineOpening(line_t *linedef) fixed_t highestfloor = openbottom; fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; +#ifdef ESLOPE + pslope_t *ceilingslope = opentopslope; + pslope_t *floorslope = openbottomslope; +#endif // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) @@ -672,32 +676,32 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; - -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); - - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); -#endif*/ + fixed_t topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); + fixed_t bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) + if (bottomheight < lowestceiling) { lowestceiling = bottomheight; +#ifdef ESLOPE + ceilingslope = *rover->b_slope; +#endif + } else if (bottomheight < highestceiling) highestceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) + if (topheight > highestfloor) { highestfloor = topheight; +#ifdef ESLOPE + floorslope = *rover->t_slope; +#endif + } else if (topheight > lowestfloor) lowestfloor = topheight; } @@ -715,32 +719,32 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; - -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, tmthing->x, tmthing->y); - - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, tmthing->x, tmthing->y); -#endif*/ + fixed_t topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); + fixed_t bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) + if (bottomheight < lowestceiling) { lowestceiling = bottomheight; +#ifdef ESLOPE + ceilingslope = *rover->b_slope; +#endif + } else if (bottomheight < highestceiling) highestceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) + if (topheight > highestfloor) { highestfloor = topheight; +#ifdef ESLOPE + floorslope = *rover->t_slope; +#endif + } else if (topheight > lowestfloor) lowestfloor = topheight; } @@ -754,13 +758,21 @@ void P_LineOpening(line_t *linedef) delta1 = abs(tmthing->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - if (polysec->floorheight < lowestceiling && delta1 >= delta2) + if (polysec->floorheight < lowestceiling && delta1 >= delta2) { lowestceiling = polysec->floorheight; +#ifdef ESLOPE + ceilingslope = NULL; +#endif + } else if (polysec->floorheight < highestceiling && delta1 >= delta2) highestceiling = polysec->floorheight; - if (polysec->ceilingheight > highestfloor && delta1 < delta2) + if (polysec->ceilingheight > highestfloor && delta1 < delta2) { highestfloor = polysec->ceilingheight; +#ifdef ESLOPE + floorslope = NULL; +#endif + } else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) lowestfloor = polysec->ceilingheight; } @@ -771,14 +783,14 @@ void P_LineOpening(line_t *linedef) if (highestfloor > openbottom) { openbottom = highestfloor; #ifdef ESLOPE - openbottomslope = NULL; + openbottomslope = floorslope; #endif } if (lowestceiling < opentop) { opentop = lowestceiling; #ifdef ESLOPE - opentopslope = NULL; + opentopslope = ceilingslope; #endif } diff --git a/src/p_mobj.c b/src/p_mobj.c index af832d585..421ec400a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -706,12 +706,12 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, mobj->x, mobj->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, mobj->x, mobj->y); -#endif*/ +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); +#endif if (mobj->z > topheight) return false; @@ -967,6 +967,251 @@ fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line return sector->ceilingheight; } +// Do the same as above, but for FOFs! +fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + I_Assert(sector != NULL); + I_Assert(fof != NULL); +#ifdef ESLOPE + if (*fof->t_slope) { + fixed_t testx, testy; + pslope_t *slope = *fof->t_slope; + + // Get the corner of the object that should be the highest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta > 0) { + testx = -testx; + testy = -testy; + } + + testx += x; + testy += y; + + // If the highest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be lower than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + /*CONS_Printf("BEFORE: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + /*CONS_Printf("AFTER: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + // Return the higher of the two points + return max( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the top height +#endif + return *fof->topheight; +} + +fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + I_Assert(sector != NULL); + I_Assert(fof != NULL); +#ifdef ESLOPE + if (*fof->t_slope) { + fixed_t testx, testy; + pslope_t *slope = *fof->t_slope; + + // Get the corner of the object that should be the lowest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta < 0) { + testx = -testx; + testy = -testy; + } + + testx += x; + testy += y; + + // If the lowest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be higher than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + // Return the lower of the two points + return min( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the bottom height +#endif + return *fof->bottomheight; +} + static void P_PlayerFlip(mobj_t *mo) { if (!mo->player) @@ -1710,6 +1955,7 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp { ffloor_t *rover; fixed_t delta1, delta2, thingtop; + fixed_t topheight, bottomheight; I_Assert(mo != NULL); I_Assert(!P_MobjWasRemoved(mo)); @@ -1721,6 +1967,9 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp if (!(rover->flags & FF_EXISTS)) continue; + topheight = P_GetFOFTopZ(mo, sector, rover, mo->x, mo->y, NULL); + bottomheight = P_GetFOFBottomZ(mo, sector, rover, mo->x, mo->y, NULL); + if (mo->player && (P_CheckSolidLava(mo, rover) || P_CanRunOnWater(mo->player, rover))) // only the player should be affected ; else if (motype != 0 && rover->flags & FF_SWIMMABLE) // "scenery" only @@ -1735,14 +1984,14 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp switch (motype) { case 2: // scenery does things differently for some reason - if (mo->z < *rover->topheight && *rover->bottomheight < thingtop) + if (mo->z < topheight && bottomheight < thingtop) { mo->floorz = mo->z; continue; } break; default: - if (mo->z < *rover->topheight && *rover->bottomheight < thingtop) + if (mo->z < topheight && bottomheight < thingtop) { if (mo->floorz < mo->z) mo->floorz = mo->z; @@ -1751,17 +2000,17 @@ static void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motyp } } - delta1 = mo->z - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)); - delta2 = thingtop - (*rover->bottomheight + ((*rover->topheight - *rover->bottomheight)/2)); - if (*rover->topheight > mo->floorz && abs(delta1) < abs(delta2) + delta1 = mo->z - (bottomheight + ((topheight - bottomheight)/2)); + delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2)); + if (topheight > mo->floorz && abs(delta1) < abs(delta2) && !(rover->flags & FF_REVERSEPLATFORM)) { - mo->floorz = *rover->topheight; + mo->floorz = topheight; } - if (*rover->bottomheight < mo->ceilingz && abs(delta1) >= abs(delta2) + if (bottomheight < mo->ceilingz && abs(delta1) >= abs(delta2) && !(rover->flags & FF_PLATFORM)) { - mo->ceilingz = *rover->bottomheight; + mo->ceilingz = bottomheight; } } } @@ -2804,13 +3053,13 @@ void P_MobjCheckWater(mobj_t *mobj) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, mobj->x, mobj->y); +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, mobj->x, mobj->y); -#endif*/ + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); +#endif if (mobj->eflags & MFE_VERTICALFLIP) { From 780c568aafd0dcaaf5105d2b0c5ea3f7f3a93d1f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 12:03:52 -0500 Subject: [PATCH 050/364] Fix sprite-to-plane sorting on sloped FOFs --- src/r_things.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index a759dd1d0..0de6a1282 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1752,24 +1752,32 @@ static void R_CreateDrawNodes(void) { if (r2->plane) { + fixed_t planeobjectz; if (r2->plane->minx > rover->x2 || r2->plane->maxx < rover->x1) continue; if (rover->szt > r2->plane->low || rover->sz < r2->plane->high) continue; + // Gotta get the plane's height AT THE OBJECT POSITION if we're using slopes -Red + planeobjectz = +#ifdef ESLOPE + r2->plane->slope ? P_GetZAt(r2->plane->slope, rover->gx, rover->gy) : +#endif + r2->plane->height; + if (rover->mobjflags & MF_NOCLIPHEIGHT) { //Objects with NOCLIPHEIGHT can appear halfway in. - if (r2->plane->height < viewz && rover->pz+(rover->thingheight/2) >= r2->plane->height) + if (r2->plane->height < viewz && rover->pz+(rover->thingheight/2) >= planeobjectz) continue; - if (r2->plane->height > viewz && rover->pzt-(rover->thingheight/2) <= r2->plane->height) + if (r2->plane->height > viewz && rover->pzt-(rover->thingheight/2) <= planeobjectz) continue; } else { - if (r2->plane->height < viewz && rover->pz >= r2->plane->height) + if (r2->plane->height < viewz && rover->pz >= planeobjectz) continue; - if (r2->plane->height > viewz && rover->pzt <= r2->plane->height) + if (r2->plane->height > viewz && rover->pzt <= planeobjectz) continue; } From 0af3852273c0252dbc46a2783d5319869113f2fd Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 12:24:20 -0500 Subject: [PATCH 051/364] Add translucent slope renderer --- src/r_draw.h | 1 + src/r_draw8.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/r_plane.c | 5 +- 3 files changed, 138 insertions(+), 1 deletion(-) diff --git a/src/r_draw.h b/src/r_draw.h index fa2cb22d0..1116e1c25 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -149,6 +149,7 @@ void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawSpan_8(void); #ifdef ESLOPE void R_DrawTiltedSpan_8(void); +void R_DrawTiltedTranslucentSpan_8(void); #endif void R_DrawSplat_8(void); void R_DrawTranslucentSplat_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index b8b23b1b3..a028b9c12 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -682,6 +682,139 @@ void R_DrawTiltedSpan_8(void) } #endif } + + +/** \brief The R_DrawTiltedTranslucentSpan_8 function + Like DrawTiltedSpan, but translucent +*/ +void R_DrawTiltedTranslucentSpan_8(void) +{ + // x1, x2 = ds_x1, ds_x2 + int width = ds_x2 - ds_x1; + double iz, uz, vz; + UINT32 u, v; + int i; + + UINT8 *source; + UINT8 *colormap; + UINT8 *dest; + + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); + + // Lighting is simple. It's just linear interpolation from start to end + { + float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float lightstart, lightend; + + lightend = (iz + ds_sz.x*width) * planelightfloat; + lightstart = iz * planelightfloat; + + R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend)); + //CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf); + } + + uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); + vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx); + + dest = ylookup[ds_y] + columnofs[ds_x1]; + source = ds_source; + //colormap = ds_colormap; + +#if 0 // The "perfect" reference version of this routine. Pretty slow. + // Use it only to see how things are supposed to look. + i = 0; + do + { + double z = 1.f/iz; + u = (UINT32)(uz*z) + viewx; + v = (UINT32)(vz*z) + viewy; + + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + + *dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])]; + dest++; + iz += ds_sz.x; + uz += ds_su.x; + vz += ds_sv.x; + } while (--width >= 0); +#else +#define SPANSIZE 16 +#define INVSPAN 0.0625f + + double startz = 1.f/iz; + double startu = uz*startz; + double startv = vz*startz; + double izstep, uzstep, vzstep; + + izstep = ds_sz.x * SPANSIZE; + uzstep = ds_su.x * SPANSIZE; + vzstep = ds_sv.x * SPANSIZE; + //x1 = 0; + width++; + + while (width >= SPANSIZE) + { + iz += izstep; + uz += uzstep; + vz += vzstep; + + double endz = 1.f/iz; + double endu = uz*endz; + double endv = vz*endz; + UINT32 stepu = (UINT32)((endu - startu) * INVSPAN); + UINT32 stepv = (UINT32)((endv - startv) * INVSPAN); + u = (UINT32)(startu) + viewx; + v = (UINT32)(startv) + viewy; + + for (i = SPANSIZE-1; i >= 0; i--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + *dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])]; + dest++; + u += stepu; + v += stepv; + } + startu = endu; + startv = endv; + width -= SPANSIZE; + } + if (width > 0) + { + if (width == 1) + { + u = (UINT32)(startu); + v = (UINT32)(startv); + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + *dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])]; + } + else + { + double left = width; + iz += ds_sz.x * left; + uz += ds_su.x * left; + vz += ds_sv.x * left; + + double endz = 1.f/iz; + double endu = uz*endz; + double endv = vz*endz; + left = 1.f/left; + UINT32 stepu = (UINT32)((endu - startu) * left); + UINT32 stepv = (UINT32)((endv - startv) * left); + u = (UINT32)(startu) + viewx; + v = (UINT32)(startv) + viewy; + + for (; width != 0; width--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + *dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])]; + dest++; + u += stepu; + v += stepv; + } + } + } +#endif +} #endif // ESLOPE /** \brief The R_DrawSplat_8 function diff --git a/src/r_plane.c b/src/r_plane.c index c39be11a9..b0768539b 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -990,7 +990,10 @@ void R_DrawSinglePlane(visplane_t *pl) ds_sv.z *= SFMULT; #undef SFMULT - spanfunc = R_DrawTiltedSpan_8; + if (spanfunc == R_DrawTranslucentSpan_8) + spanfunc = R_DrawTiltedTranslucentSpan_8; + else + spanfunc = R_DrawTiltedSpan_8; planezlight = scalelight[light]; } else From 41573b118c42f4457f6dc6f5dac08785a87d4d16 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 12:36:06 -0500 Subject: [PATCH 052/364] I'm a dumbass --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 421ec400a..013f523c6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1107,9 +1107,9 @@ fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x I_Assert(sector != NULL); I_Assert(fof != NULL); #ifdef ESLOPE - if (*fof->t_slope) { + if (*fof->b_slope) { fixed_t testx, testy; - pslope_t *slope = *fof->t_slope; + pslope_t *slope = *fof->b_slope; // Get the corner of the object that should be the lowest on the slope if (slope->d.x < 0) From e83844796e5dd4af6c5c7205c708364d0fad502b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 21:49:13 -0500 Subject: [PATCH 053/364] Proper sorting fix for sloped FOFs and sprites --- src/r_things.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 0de6a1282..c83fdf03e 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1752,32 +1752,34 @@ static void R_CreateDrawNodes(void) { if (r2->plane) { - fixed_t planeobjectz; + fixed_t planeobjectz, planecameraz; if (r2->plane->minx > rover->x2 || r2->plane->maxx < rover->x1) continue; if (rover->szt > r2->plane->low || rover->sz < r2->plane->high) continue; - // Gotta get the plane's height AT THE OBJECT POSITION if we're using slopes -Red - planeobjectz = #ifdef ESLOPE - r2->plane->slope ? P_GetZAt(r2->plane->slope, rover->gx, rover->gy) : + // Effective height may be different for each comparison in the case of slopes + if (r2->plane->slope) { + planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy); + planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy); + } else #endif - r2->plane->height; + planeobjectz = planecameraz = r2->plane->height; if (rover->mobjflags & MF_NOCLIPHEIGHT) { //Objects with NOCLIPHEIGHT can appear halfway in. - if (r2->plane->height < viewz && rover->pz+(rover->thingheight/2) >= planeobjectz) + if (planecameraz < viewz && rover->pz+(rover->thingheight/2) >= planeobjectz) continue; - if (r2->plane->height > viewz && rover->pzt-(rover->thingheight/2) <= planeobjectz) + if (planecameraz > viewz && rover->pzt-(rover->thingheight/2) <= planeobjectz) continue; } else { - if (r2->plane->height < viewz && rover->pz >= planeobjectz) + if (planecameraz < viewz && rover->pz >= planeobjectz) continue; - if (r2->plane->height > viewz && rover->pzt <= planeobjectz) + if (planecameraz > viewz && rover->pzt <= planeobjectz) continue; } @@ -1807,6 +1809,7 @@ static void R_CreateDrawNodes(void) } else if (r2->thickseg) { + fixed_t topplaneobjectz, topplanecameraz, botplaneobjectz, botplanecameraz; if (rover->x1 > r2->thickseg->x2 || rover->x2 < r2->thickseg->x1) continue; @@ -1817,9 +1820,25 @@ static void R_CreateDrawNodes(void) if (scale <= rover->scale) continue; - if ((*r2->ffloor->topheight > viewz && *r2->ffloor->bottomheight < viewz) || - (*r2->ffloor->topheight < viewz && rover->gzt < *r2->ffloor->topheight) || - (*r2->ffloor->bottomheight > viewz && rover->gz > *r2->ffloor->bottomheight)) +#ifdef ESLOPE + if (*r2->ffloor->t_slope) { + topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy); + topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy); + } else +#endif + topplaneobjectz = topplanecameraz = *r2->ffloor->topheight; + +#ifdef ESLOPE + if (*r2->ffloor->b_slope) { + botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy); + botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy); + } else +#endif + botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight; + + if ((topplanecameraz > viewz && botplanecameraz < viewz) || + (topplanecameraz < viewz && rover->gzt < topplaneobjectz) || + (botplanecameraz > viewz && rover->gz > botplaneobjectz)) { entry = R_CreateDrawNode(NULL); (entry->prev = r2->prev)->next = entry; From e7bc004bbf19cac95825eef47a8def3175b3592d Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 17 May 2015 23:51:38 -0500 Subject: [PATCH 054/364] Sloped lights n shit --- src/r_bsp.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++-- src/r_defs.h | 3 +++ src/r_segs.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 2 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 8907ff42f..35f82f01c 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -851,11 +851,19 @@ static void R_Subsector(size_t num) sub->sector->moved = frontsector->moved = false; } - light = R_GetPlaneLight(frontsector, frontsector->floorheight, false); + light = R_GetPlaneLight(frontsector, +#ifdef ESLOPE + frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + frontsector->floorheight, false); if (frontsector->floorlightsec == -1) floorlightlevel = *frontsector->lightlist[light].lightlevel; floorcolormap = frontsector->lightlist[light].extra_colormap; - light = R_GetPlaneLight(frontsector, frontsector->ceilingheight, false); + light = R_GetPlaneLight(frontsector, +#ifdef ESLOPE + frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + frontsector->ceilingheight, false); if (frontsector->ceilinglightsec == -1) ceilinglightlevel = *frontsector->lightlist[light].lightlevel; ceilingcolormap = frontsector->lightlist[light].extra_colormap; @@ -934,8 +942,14 @@ static void R_Subsector(size_t num) && ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES)) || (viewz > heightcheck && (rover->flags & FF_BOTHPLANES)))) { +#ifdef ESLOPE + light = R_GetPlaneLight(frontsector, + *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->bottomheight, + viewz < (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight)); +#else light = R_GetPlaneLight(frontsector, *rover->bottomheight, viewz < *rover->bottomheight); +#endif ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover @@ -976,7 +990,13 @@ static void R_Subsector(size_t num) && ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES)) || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { +#ifdef ESLOPE + light = R_GetPlaneLight(frontsector, + *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->topheight, + viewz < (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight)); +#else light = R_GetPlaneLight(frontsector, *rover->topheight, viewz < *rover->topheight); +#endif ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover @@ -1158,6 +1178,11 @@ void R_Prep3DFloors(sector_t *sector) fixed_t bestheight, maxheight; INT32 count, i, mapnum; sector_t *sec; +#ifdef ESLOPE + pslope_t *bestslope; + fixed_t heighttest; // I think it's better to check the Z height at the sector's center + // than assume unsloped heights are accurate indicators of order in sloped sectors. -Red +#endif count = 1; for (rover = sector->ffloors; rover; rover = rover->next) @@ -1180,7 +1205,13 @@ void R_Prep3DFloors(sector_t *sector) else memset(sector->lightlist, 0, sizeof (lightlist_t) * count); +#ifdef ESLOPE + heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight; + + sector->lightlist[0].height = heighttest + 1; +#else sector->lightlist[0].height = sector->ceilingheight + 1; +#endif sector->lightlist[0].lightlevel = §or->lightlevel; sector->lightlist[0].caster = NULL; sector->lightlist[0].extra_colormap = sector->extra_colormap; @@ -1198,6 +1229,29 @@ void R_Prep3DFloors(sector_t *sector) && !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES))) continue; +#ifdef ESLOPE + heighttest = *rover->t_slope ? P_GetZAt(*rover->t_slope, sector->soundorg.x, sector->soundorg.y) : *rover->topheight; + + if (heighttest > bestheight && heighttest < maxheight) + { + best = rover; + bestheight = heighttest; + bestslope = *rover->t_slope; + continue; + } + if (rover->flags & FF_DOUBLESHADOW) { + heighttest = *rover->b_slope ? P_GetZAt(*rover->b_slope, sector->soundorg.x, sector->soundorg.y) : *rover->bottomheight; + + if (heighttest > bestheight + && heighttest < maxheight) + { + best = rover; + bestheight = heighttest; + bestslope = *rover->b_slope; + continue; + } + } +#else if (*rover->topheight > bestheight && *rover->topheight < maxheight) { best = rover; @@ -1211,6 +1265,7 @@ void R_Prep3DFloors(sector_t *sector) bestheight = *rover->bottomheight; continue; } +#endif } if (!best) { @@ -1221,6 +1276,9 @@ void R_Prep3DFloors(sector_t *sector) sector->lightlist[i].height = maxheight = bestheight; sector->lightlist[i].caster = best; sector->lightlist[i].flags = best->flags; +#ifdef ESLOPE + sector->lightlist[i].slope = bestslope; +#endif sec = §ors[best->secnum]; mapnum = sec->midmap; if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps) @@ -1246,7 +1304,12 @@ void R_Prep3DFloors(sector_t *sector) if (best->flags & FF_DOUBLESHADOW) { +#ifdef ESLOPE + heighttest = *best->b_slope ? P_GetZAt(*best->b_slope, sector->soundorg.x, sector->soundorg.y) : *best->bottomheight; + if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red +#else if (bestheight == *best->bottomheight) +#endif { sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel; sector->lightlist[i].extra_colormap = diff --git a/src/r_defs.h b/src/r_defs.h index b5b589e77..27e4b9170 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -190,6 +190,9 @@ typedef struct lightlist_s extracolormap_t *extra_colormap; INT32 flags; ffloor_t *caster; +#ifdef ESLOPE + struct pslope_s *slope; // FF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh. +#endif } lightlist_t; diff --git a/src/r_segs.c b/src/r_segs.c index a9d6c3024..ce0260a63 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2478,26 +2478,83 @@ void R_StoreWallRange(INT32 start, INT32 stop) for (i = p = 0; i < dc_numlights; i++) { +#ifdef ESLOPE + fixed_t leftheight, rightheight; +#endif + light = &frontsector->lightlist[i]; rlight = &dc_lightlist[p]; +#ifdef ESLOPE + if (light->slope) { + leftheight = P_GetZAt(light->slope, segleft.x, segleft.y); + rightheight = P_GetZAt(light->slope, segright.x, segright.y); + + // Flag sector as having slopes + frontsector->hasslope = true; + } else + leftheight = rightheight = light->height; + + leftheight -= viewz; + rightheight -= viewz; + + leftheight >>= 4; + rightheight >>= 4; +#endif + if (i != 0) { +#ifdef ESLOPE + if (leftheight < worldbottom && rightheight < worldbottomslope) + continue; + + if (leftheight > worldtop && rightheight > worldtopslope && i+1 < dc_numlights && frontsector->lightlist[i+1].height > frontsector->ceilingheight) + continue; +#else if (light->height < frontsector->floorheight) continue; if (light->height > frontsector->ceilingheight && i+1 < dc_numlights && frontsector->lightlist[i+1].height > frontsector->ceilingheight) continue; +#endif } +#ifdef ESLOPE + rlight->height = (centeryfrac>>4) - FixedMul(leftheight, rw_scale); + rlight->heightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2); + rlight->heightstep = (rlight->heightstep-rlight->height)/(stop-start+1); +#else rlight->height = (centeryfrac>>4) - FixedMul((light->height - viewz) >> 4, rw_scale); rlight->heightstep = -FixedMul (rw_scalestep, (light->height - viewz) >> 4); +#endif rlight->flags = light->flags; if (light->caster && light->caster->flags & FF_SOLID) { +#ifdef ESLOPE + if (*light->caster->b_slope) { + leftheight = P_GetZAt(*light->caster->b_slope, segleft.x, segleft.y); + rightheight = P_GetZAt(*light->caster->b_slope, segright.x, segright.y); + + // Flag sector as having slopes + frontsector->hasslope = true; + } else + leftheight = rightheight = *light->caster->bottomheight; + + leftheight -= viewz; + rightheight -= viewz; + + leftheight >>= 4; + rightheight >>= 4; + + rlight->botheight = (centeryfrac>>4) - FixedMul(leftheight, rw_scale); + rlight->botheightstep = (centeryfrac>>4) - FixedMul(rightheight, ds_p->scale2); + rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(stop-start+1); + +#else rlight->botheight = (centeryfrac >> 4) - FixedMul((*light->caster->bottomheight - viewz) >> 4, rw_scale); rlight->botheightstep = -FixedMul (rw_scalestep, (*light->caster->bottomheight - viewz) >> 4); +#endif } rlight->lightlevel = *light->lightlevel; From 1376f399d3f8053e4090121995e627b13d6ed571 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 18 May 2015 00:23:44 -0500 Subject: [PATCH 055/364] Sprite lighting obeys the slope overlords now --- src/r_things.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index c83fdf03e..3a38eb482 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -950,12 +950,22 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing) for (i = 1; i < sector->numlights; i++) { - if (sector->lightlist[i].height >= sprite->gzt || !(sector->lightlist[i].caster->flags & FF_CUTSPRITES)) + fixed_t testheight = sector->lightlist[i].height; + + if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES)) continue; - if (sector->lightlist[i].height <= sprite->gz) + +#ifdef ESLOPE + if (sector->lightlist[i].slope) + testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy); +#endif + + if (testheight >= sprite->gzt) + continue; + if (testheight <= sprite->gz) return; - cutfrac = (INT16)((centeryfrac - FixedMul(sector->lightlist[i].height - viewz, sprite->scale))>>FRACBITS); + cutfrac = (INT16)((centeryfrac - FixedMul(testheight - viewz, sprite->scale))>>FRACBITS); if (cutfrac < 0) continue; if (cutfrac > vid.height) @@ -966,15 +976,15 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing) newsprite = M_Memcpy(R_NewVisSprite(), sprite, sizeof (vissprite_t)); sprite->cut |= SC_BOTTOM; - sprite->gz = sector->lightlist[i].height; + sprite->gz = testheight; newsprite->gzt = sprite->gz; sprite->sz = cutfrac; newsprite->szt = (INT16)(sprite->sz - 1); - if (sector->lightlist[i].height < sprite->pzt && sector->lightlist[i].height > sprite->pz) - sprite->pz = newsprite->pzt = sector->lightlist[i].height; + if (testheight < sprite->pzt && testheight > sprite->pz) + sprite->pz = newsprite->pzt = testheight; else { newsprite->pz = newsprite->gz; @@ -1191,7 +1201,20 @@ static void R_ProjectSprite(mobj_t *thing) if (thing->subsector->sector->numlights) { INT32 lightnum; +#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights! + light = thing->subsector->sector->numlights - 1; + + for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) { + fixed_t h = thing->subsector->sector->lightlist[lightnum].slope ? P_GetZAt(thing->subsector->sector->lightlist[lightnum].slope, thing->x, thing->y) + : thing->subsector->sector->lightlist[lightnum].height; + if (h <= gzt) { + light = lightnum - 1; + break; + } + } +#else light = R_GetPlaneLight(thing->subsector->sector, gzt, false); +#endif lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT); if (lightnum < 0) From 7b0e98ef35ce756060dba5e23f41591a0da09fb0 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 20 May 2015 13:18:41 -0500 Subject: [PATCH 056/364] Change sliding physics and standing/rolling rules on slopes --- src/p_slopes.c | 25 +++++++++++++++++++++++-- src/p_user.c | 18 +++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 60bd1087b..c5798707e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -868,11 +868,32 @@ void P_ButteredSlope(mobj_t *mo) if (!mo->standingslope) return; - if (abs(mo->standingslope->zdelta) < FRACUNIT/3) - return; // Don't apply physics to slopes that aren't steep enough + if (mo->player) { + if (abs(mo->standingslope->zdelta) < FRACUNIT/4 && !(mo->player->pflags & PF_SPINNING)) + return; // Don't slide on non-steep slopes unless spinning + + if (abs(mo->standingslope->zdelta) < FRACUNIT/2 && !(mo->player->rmomx || mo->player->rmomy)) + return; // Allow the player to stand still on slopes below a certain steepness + } thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 3 / 2 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); + if (mo->player && (mo->player->pflags & PF_SPINNING)) { + fixed_t mult = 0; + if (mo->momx || mo->momy) { + angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; + + if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) + angle ^= ANGLE_180; + + mult = FINECOSINE(angle >> ANGLETOFINESHIFT); + } + + CONS_Printf("%d\n", mult); + + thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8); + } + if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16); // This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down diff --git a/src/p_user.c b/src/p_user.c index 0f2bd19b9..c0ff792cc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3758,7 +3758,11 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SLIDING) && !player->exiting && !P_PlayerInPain(player)) // subsequent revs { - if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)) + if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING) +#ifdef ESLOPE + && (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) +#endif + ) { player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; @@ -3787,7 +3791,11 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // down the spin button and not spinning. // AKA Just go into a spin on the ground, you idiot. ;) else if ((cmd->buttons & BT_USE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20)) - && !player->climbing && !player->mo->momz && onground && player->speed > FixedMul(5<mo->scale) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)) + && !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<mo->scale) +#ifdef ESLOPE + || (player->mo->standingslope && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2) +#endif + ) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)) { player->pflags |= PF_SPINNING; P_SetPlayerMobjState(player->mo, S_PLAY_ATK1); @@ -3799,7 +3807,11 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // Rolling normally if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH) - && player->speed < FixedMul(5*FRACUNIT,player->mo->scale)) + && player->speed < FixedMul(5*FRACUNIT,player->mo->scale) +#ifdef ESLOPE + && (!player->mo->standingslope || abs(player->mo->standingslope->zdelta) < FRACUNIT/2) +#endif + ) { if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player))) P_InstaThrust(player->mo, player->mo->angle, FixedMul(10*FRACUNIT, player->mo->scale)); From 0e94cc66ff7fb837c56bfa6e7486ac12db5b9552 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 20 May 2015 19:08:49 -0500 Subject: [PATCH 057/364] 2-in-1! Fixed slide movement AND climbing when around slopes --- src/p_map.c | 41 ++++++++++------------ src/p_slopes.c | 2 +- src/p_user.c | 94 ++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 88 insertions(+), 49 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 6257ede1b..4bf032056 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2458,8 +2458,13 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy); - floorz = P_GetFloorZ(player->mo, glidesector->sector, player->mo->x + platx, player->mo->y + platy, NULL); - ceilingz = P_GetCeilingZ(player->mo, glidesector->sector, player->mo->x + platx, player->mo->y + platy, NULL); +#ifdef ESLOPE + floorz = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) : glidesector->sector->floorheight; + ceilingz = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) : glidesector->sector->ceilingheight; +#else + floorz = glidesector->sector->floorheight; + ceilingz = glidesector->sector->ceilingheight; +#endif if (glidesector->sector != player->mo->subsector->sector) { @@ -2476,12 +2481,12 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, player->mo->x, player->mo->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, player->mo->x, player->mo->y); -#endif*/ +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); +#endif floorclimb = true; @@ -2600,14 +2605,6 @@ static boolean PTR_SlideTraverse(intercept_t *in) maxstep = FixedMul(MAXSTEPMOVE, slidemo->scale); -#ifdef ESLOPE // TODO: Make this collosion better - // Maxstepmove = 0 means the object bounces like a nut while going down a slope - if (slidemo->subsector->sector->f_slope) - { - maxstep *= slidemo->subsector->sector->f_slope->zangle; - } -#endif - if (openbottom - slidemo->z > maxstep) goto isblocking; // too big a step up @@ -2647,12 +2644,12 @@ isblocking: fixed_t topheight = *rover->topheight; fixed_t bottomheight = *rover->bottomheight; -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, slidemo->x, slidemo->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, slidemo->x, slidemo->y); -#endif*/ +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y); + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y); +#endif if (topheight < slidemo->z) continue; diff --git a/src/p_slopes.c b/src/p_slopes.c index c5798707e..a4f334caf 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -889,7 +889,7 @@ void P_ButteredSlope(mobj_t *mo) mult = FINECOSINE(angle >> ANGLETOFINESHIFT); } - CONS_Printf("%d\n", mult); + //CONS_Printf("%d\n", mult); thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8); } diff --git a/src/p_user.c b/src/p_user.c index c0ff792cc..6898ee910 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2361,10 +2361,23 @@ static void P_DoClimbing(player_t *player) floorclimb = false; boostup = false; skyclimber = false; + fixed_t floorheight, ceilingheight; // ESLOPE + +#ifdef ESLOPE + floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) + : glidesector->sector->floorheight; + ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) + : glidesector->sector->ceilingheight; +#else + floorheight = glidesector->sector->floorheight; + ceilingheight = glidesector->sector->ceilingheight; +#endif if (glidesector->sector->ffloors) { ffloor_t *rover; + fixed_t topheight, bottomheight; // ESLOPE + for (rover = glidesector->sector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) @@ -2372,13 +2385,21 @@ static void P_DoClimbing(player_t *player) floorclimb = true; +#ifdef ESLOPE + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; + topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; +#else + bottomheight = *rover->bottomheight; + topheight = *rover->topheight; +#endif + // Only supports rovers that are moving like an 'elevator', not just the top or bottom. if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42) { - if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (*rover->bottomheight < player->mo->z+player->mo->height) - && (*rover->topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))) - || ((player->mo->eflags & MFE_VERTICALFLIP) && (*rover->topheight > player->mo->z) - && (*rover->bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)))) + if ((!(player->mo->eflags & MFE_VERTICALFLIP) && (bottomheight < player->mo->z+player->mo->height) + && (topheight >= player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale))) + || ((player->mo->eflags & MFE_VERTICALFLIP) && (topheight > player->mo->z) + && (bottomheight <= player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)))) { if (cmd->forwardmove != 0) player->mo->momz += rover->master->frontsector->floorspeed; @@ -2394,8 +2415,9 @@ static void P_DoClimbing(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { // Trying to climb down past the bottom of the FOF - if ((*rover->topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= *rover->topheight)) + if ((topheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= topheight)) { + fixed_t bottomheight2; ffloor_t *roverbelow; boolean foundfof = false; floorclimb = true; @@ -2410,7 +2432,13 @@ static void P_DoClimbing(player_t *player) if (roverbelow == rover) continue; - if (*roverbelow->bottomheight < *rover->topheight + FixedMul(16*FRACUNIT, player->mo->scale)) +#ifdef ESLOPE + bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight; +#else + bottomheight2 = *roverbelow->bottomheight; +#endif + + if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale)) foundfof = true; } @@ -2419,7 +2447,7 @@ static void P_DoClimbing(player_t *player) } // Below the FOF - if (*rover->topheight <= player->mo->z) + if (topheight <= player->mo->z) { floorclimb = false; boostup = false; @@ -2427,7 +2455,7 @@ static void P_DoClimbing(player_t *player) } // Above the FOF - if (*rover->bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)) + if (bottomheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale)) { floorclimb = false; thrust = true; @@ -2437,8 +2465,9 @@ static void P_DoClimbing(player_t *player) else { // Trying to climb down past the bottom of a FOF - if ((*rover->bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= *rover->bottomheight)) + if ((bottomheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= bottomheight)) { + fixed_t topheight2; ffloor_t *roverbelow; boolean foundfof = false; floorclimb = true; @@ -2453,7 +2482,13 @@ static void P_DoClimbing(player_t *player) if (roverbelow == rover) continue; - if (*roverbelow->topheight > *rover->bottomheight - FixedMul(16*FRACUNIT, player->mo->scale)) +#ifdef ESLOPE + topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight; +#else + topheight2 = *roverbelow->topheight; +#endif + + if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale)) foundfof = true; } @@ -2462,7 +2497,7 @@ static void P_DoClimbing(player_t *player) } // Below the FOF - if (*rover->bottomheight >= player->mo->z + player->mo->height) + if (bottomheight >= player->mo->z + player->mo->height) { floorclimb = false; boostup = false; @@ -2470,7 +2505,7 @@ static void P_DoClimbing(player_t *player) } // Above the FOF - if (*rover->topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)) + if (topheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale)) { floorclimb = false; thrust = true; @@ -2491,7 +2526,7 @@ static void P_DoClimbing(player_t *player) if (player->mo->eflags & MFE_VERTICALFLIP) { // Trying to climb down past the upper texture area - if ((glidesector->sector->floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= glidesector->sector->floorheight)) + if ((floorheight >= player->mo->z + player->mo->height) && ((player->mo->z + player->mo->height + player->mo->momz) >= floorheight)) { boolean foundfof = false; floorclimb = true; @@ -2499,13 +2534,20 @@ static void P_DoClimbing(player_t *player) // Is there a FOF directly below that we can move onto? if (glidesector->sector->ffloors) { + fixed_t bottomheight; ffloor_t *rover; for (rover = glidesector->sector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) continue; - if (*rover->bottomheight < glidesector->sector->floorheight + FixedMul(16*FRACUNIT, player->mo->scale)) +#ifdef ESLOPE + bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; +#else + bottomheight = *rover->bottomheight; +#endif + + if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale)) { foundfof = true; break; @@ -2518,8 +2560,8 @@ static void P_DoClimbing(player_t *player) } // Reached the top of the lower texture area - if (!floorclimb && glidesector->sector->ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) - && (glidesector->sector->ceilingpic == skyflatnum || glidesector->sector->floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale)))) + if (!floorclimb && ceilingheight > player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) + && (glidesector->sector->ceilingpic == skyflatnum || floorheight < (player->mo->z - FixedMul(8*FRACUNIT, player->mo->scale)))) { thrust = true; boostup = true; @@ -2529,7 +2571,7 @@ static void P_DoClimbing(player_t *player) else { // Trying to climb down past the upper texture area - if ((glidesector->sector->ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= glidesector->sector->ceilingheight)) + if ((ceilingheight <= player->mo->z) && ((player->mo->z + player->mo->momz) <= ceilingheight)) { boolean foundfof = false; floorclimb = true; @@ -2543,7 +2585,7 @@ static void P_DoClimbing(player_t *player) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) continue; - if (*rover->topheight > glidesector->sector->ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) + if (*rover->topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) { foundfof = true; break; @@ -2556,7 +2598,7 @@ static void P_DoClimbing(player_t *player) } // Allow climbing from a FOF or lower texture onto the upper texture and vice versa. - if (player->mo->z > glidesector->sector->ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) + if (player->mo->z > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale)) { floorclimb = true; thrust = false; @@ -2564,8 +2606,8 @@ static void P_DoClimbing(player_t *player) } // Reached the top of the lower texture area - if (!floorclimb && glidesector->sector->floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) - && (glidesector->sector->ceilingpic == skyflatnum || glidesector->sector->ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale)))) + if (!floorclimb && floorheight < player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) + && (glidesector->sector->ceilingpic == skyflatnum || ceilingheight > (player->mo->z + player->mo->height + FixedMul(8*FRACUNIT, player->mo->scale)))) { thrust = true; boostup = true; @@ -2574,14 +2616,14 @@ static void P_DoClimbing(player_t *player) } // Trying to climb on the sky - if ((glidesector->sector->ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum) + if ((ceilingheight < player->mo->z) && glidesector->sector->ceilingpic == skyflatnum) { skyclimber = true; } // Climbing on the lower texture area? - if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < glidesector->sector->floorheight) - || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= glidesector->sector->floorheight)) + if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + FixedMul(16*FRACUNIT, player->mo->scale) < floorheight) + || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height <= floorheight)) { floorclimb = true; @@ -2597,8 +2639,8 @@ static void P_DoClimbing(player_t *player) } } // Climbing on the upper texture area? - else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= glidesector->sector->ceilingheight) - || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > glidesector->sector->ceilingheight)) + else if ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z >= ceilingheight) + || ((player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height - FixedMul(16*FRACUNIT, player->mo->scale) > ceilingheight)) { floorclimb = true; From 7a3c5b3dd9a76c2378029a1699d2a7f97b86f3e6 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Wed, 20 May 2015 19:21:44 -0500 Subject: [PATCH 058/364] Scenery objects (notably, bubbles) now use slope when finding water surfaces --- src/p_mobj.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 013f523c6..33dc1cbb0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3033,12 +3033,7 @@ void P_MobjCheckWater(mobj_t *mobj) player_t *p = mobj->player; // Will just be null if not a player. // Default if no water exists. - mobj->watertop = mobj->waterbottom = mobj->subsector->sector->floorheight - 1000*FRACUNIT; - -#ifdef ESLOPE // Set the correct waterbottom/top to be below the lowest point of the slope - if (mobj->subsector->sector->f_slope) - mobj->watertop = mobj->waterbottom = mobj->subsector->sector->f_slope->lowz - 1000*FRACUNIT; -#endif + mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT; // Reset water state. mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER|MFE_GOOWATER); @@ -3267,7 +3262,7 @@ static void P_SceneryCheckWater(mobj_t *mobj) sector_t *sector; // Default if no water exists. - mobj->watertop = mobj->waterbottom = mobj->subsector->sector->floorheight - 1000*FRACUNIT; + mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT; // see if we are in water, and set some flags for later sector = mobj->subsector->sector; @@ -3275,6 +3270,7 @@ static void P_SceneryCheckWater(mobj_t *mobj) if (sector->ffloors) { ffloor_t *rover; + fixed_t topheight, bottomheight; mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER); @@ -3282,20 +3278,32 @@ static void P_SceneryCheckWater(mobj_t *mobj) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) continue; - if (*rover->topheight <= mobj->z - || *rover->bottomheight > (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale))) + + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; + +#ifdef ESLOPE + if (*rover->t_slope) + topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); + + if (*rover->b_slope) + bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); +#endif + + if (topheight <= mobj->z + || bottomheight > (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale))) continue; - if (mobj->z + FixedMul(mobj->info->height, mobj->scale) > *rover->topheight) + if (mobj->z + FixedMul(mobj->info->height, mobj->scale) > topheight) mobj->eflags |= MFE_TOUCHWATER; else mobj->eflags &= ~MFE_TOUCHWATER; // Set the watertop and waterbottom - mobj->watertop = *rover->topheight; - mobj->waterbottom = *rover->bottomheight; + mobj->watertop = topheight; + mobj->waterbottom = bottomheight; - if (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale) < *rover->topheight) + if (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale) < topheight) mobj->eflags |= MFE_UNDERWATER; else mobj->eflags &= ~MFE_UNDERWATER; From 3d2b71b24c4bacd2bda771e9ce9db779e0997720 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 21 May 2015 09:36:20 -0500 Subject: [PATCH 059/364] Make cameras properly collide with slopes --- src/p_local.h | 5 + src/p_map.c | 27 +-- src/p_maputl.c | 44 +---- src/p_mobj.c | 508 ++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 523 insertions(+), 61 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 472c0706e..f2376494a 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -237,6 +237,11 @@ fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); +fixed_t P_CameraGetFloorZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); +fixed_t P_CameraGetCeilingZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); +fixed_t P_CameraGetFOFTopZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); +fixed_t P_CameraGetFOFBottomZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); + boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); diff --git a/src/p_map.c b/src/p_map.c index 4bf032056..e2ea76b88 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1517,21 +1517,9 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) // that contains the point. // Any contacted lines the step closer together // will adjust them. -#ifdef ESLOPE - if (newsubsec->sector->f_slope) - { - tmfloorz = tmdropoffz = P_GetZAt(newsubsec->sector->f_slope, thiscam->x, thiscam->y); - } - else -#endif - tmfloorz = tmdropoffz = newsubsec->sector->floorheight; + tmfloorz = tmdropoffz = P_CameraGetFloorZ(thiscam, newsubsec->sector, x, y, NULL); -#ifdef ESLOPE - if (newsubsec->sector->c_slope) - tmceilingz = P_GetZAt(newsubsec->sector->c_slope, thiscam->x, thiscam->y); - else -#endif - tmceilingz = newsubsec->sector->ceilingheight; + tmceilingz = P_CameraGetCeilingZ(thiscam, newsubsec->sector, x, y, NULL); // Cameras use the heightsec's heights rather then the actual sector heights. // If you can see through it, why not move the camera through it too? @@ -1560,15 +1548,8 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; - -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, thiscam->x, thiscam->y); - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, thiscam->x, thiscam->y); -#endif*/ + fixed_t topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); + fixed_t bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); delta1 = thiscam->z - (bottomheight + ((topheight - bottomheight)/2)); diff --git a/src/p_maputl.c b/src/p_maputl.c index 4037d769b..a60d9232d 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -375,14 +375,8 @@ void P_CameraLineOpening(line_t *linedef) } else { - frontfloor = front->floorheight; - frontceiling = front->ceilingheight; -#ifdef ESLOPE - if (front->f_slope) - frontfloor = P_GetZAt(front->f_slope, camera.x, camera.y); - if (front->c_slope) - frontceiling = P_GetZAt(front->c_slope, camera.x, camera.y); -#endif + frontfloor = P_CameraGetFloorZ(mapcampointer, front, tmx, tmy, linedef); + frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef); } if (back->camsec >= 0) { @@ -408,14 +402,8 @@ void P_CameraLineOpening(line_t *linedef) } else { - backfloor = back->floorheight; - backceiling = back->ceilingheight; -#ifdef ESLOPE - if (back->f_slope) - frontfloor = P_GetZAt(back->f_slope, camera.x, camera.y); - if (back->c_slope) - frontceiling = P_GetZAt(back->c_slope, camera.x, camera.y); -#endif + backfloor = P_CameraGetFloorZ(mapcampointer, back, tmx, tmy, linedef); + backceiling = P_CameraGetCeilingZ(mapcampointer, back, tmx, tmy, linedef); } { @@ -460,16 +448,8 @@ void P_CameraLineOpening(line_t *linedef) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; - -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); - - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); -#endif // ESLOPE*/ + fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); + fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -491,16 +471,8 @@ void P_CameraLineOpening(line_t *linedef) if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; - -/*#ifdef ESLOPE - if (rover->t_slope) - topheight = P_GetZAt(rover->t_slope, camera.x, camera.y); - - if (rover->b_slope) - bottomheight = P_GetZAt(rover->b_slope, camera.x, camera.y); -#endif // ESLOPE*/ + fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); + fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); diff --git a/src/p_mobj.c b/src/p_mobj.c index 33dc1cbb0..4fe59bfab 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1212,6 +1212,494 @@ fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x return *fof->bottomheight; } +// Now do the same as all above, but for cameras because apparently cameras are special? +fixed_t P_CameraGetFloorZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + I_Assert(sector != NULL); +#ifdef ESLOPE + if (sector->f_slope) { + fixed_t testx, testy; + pslope_t *slope = sector->f_slope; + + // Get the corner of the object that should be the highest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta > 0) { + testx = -testx; + testy = -testy; + } + + testx += x; + testy += y; + + // If the highest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be lower than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + /*CONS_Printf("BEFORE: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + /*CONS_Printf("AFTER: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + // Return the higher of the two points + return max( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the floor height +#endif + return sector->floorheight; +} + +fixed_t P_CameraGetCeilingZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + I_Assert(sector != NULL); +#ifdef ESLOPE + if (sector->c_slope) { + fixed_t testx, testy; + pslope_t *slope = sector->c_slope; + + // Get the corner of the object that should be the lowest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta < 0) { + testx = -testx; + testy = -testy; + } + + testx += x; + testy += y; + + // If the lowest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be higher than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + // Return the lower of the two points + return min( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the ceiling height +#endif + return sector->ceilingheight; +} + +// Do the same as above, but for FOFs! +fixed_t P_CameraGetFOFTopZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + I_Assert(sector != NULL); + I_Assert(fof != NULL); +#ifdef ESLOPE + if (*fof->t_slope) { + fixed_t testx, testy; + pslope_t *slope = *fof->t_slope; + + // Get the corner of the object that should be the highest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta > 0) { + testx = -testx; + testy = -testy; + } + + testx += x; + testy += y; + + // If the highest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be lower than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + /*CONS_Printf("BEFORE: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + /*CONS_Printf("AFTER: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + // Return the higher of the two points + return max( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the top height +#endif + return *fof->topheight; +} + +fixed_t P_CameraGetFOFBottomZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +{ + I_Assert(mobj != NULL); + I_Assert(sector != NULL); + I_Assert(fof != NULL); +#ifdef ESLOPE + if (*fof->b_slope) { + fixed_t testx, testy; + pslope_t *slope = *fof->b_slope; + + // Get the corner of the object that should be the lowest on the slope + if (slope->d.x < 0) + testx = mobj->radius; + else + testx = -mobj->radius; + + if (slope->d.y < 0) + testy = mobj->radius; + else + testy = -mobj->radius; + + if (slope->zdelta < 0) { + testx = -testx; + testy = -testy; + } + + testx += x; + testy += y; + + // If the lowest point is in the sector, then we have it easy! Just get the Z at that point + if (R_PointInSubsector(testx, testy)->sector == sector) + return P_GetZAt(slope, testx, testy); + + // If we're just testing for base sector location (no collision line), just go for the center's spot... + // It'll get fixed when we test for collision anyway, and the final result can't be higher than this + if (line == NULL) + return P_GetZAt(slope, x, y); + + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. + { + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + if (abs(v1.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - mobj->radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > mobj->radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - mobj->radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > mobj->radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - mobj->radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > mobj->radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - mobj->radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + // Return the lower of the two points + return min( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + } + } else // Well, that makes it easy. Just get the bottom height +#endif + return *fof->bottomheight; +} + static void P_PlayerFlip(mobj_t *mo) { if (!mo->player) @@ -3333,7 +3821,15 @@ static boolean P_CameraCheckHeat(camera_t *thiscam) if (!(rover->flags & FF_EXISTS)) continue; - if (halfheight >= *rover->topheight || halfheight <= *rover->bottomheight) + if (halfheight >= ( +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) : +#endif + *rover->topheight) || halfheight <= ( +#ifdef ESLOPE + *rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) : +#endif + *rover->bottomheight)) continue; if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1) @@ -3361,7 +3857,15 @@ static boolean P_CameraCheckWater(camera_t *thiscam) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS) continue; - if (halfheight >= *rover->topheight || halfheight <= *rover->bottomheight) + if (halfheight >= ( +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) : +#endif + *rover->topheight) || halfheight <= ( +#ifdef ESLOPE + *rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) : +#endif + *rover->bottomheight)) continue; return true; From e24595ed52d011a3e640bedaca5e13af102839f7 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 21 May 2015 10:17:53 -0500 Subject: [PATCH 060/364] Make the crumble check account for slopes for... some reason --- src/p_mobj.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4fe59bfab..cd9d36089 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4077,6 +4077,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) // Crumbling platforms for (node = mobj->touching_sectorlist; node; node = node->m_snext) { + fixed_t topheight, bottomheight; ffloor_t *rover; for (rover = node->m_sector->ffloors; rover; rover = rover->next) @@ -4084,8 +4085,11 @@ static void P_PlayerMobjThinker(mobj_t *mobj) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_CRUMBLE)) continue; - if ((*rover->topheight == mobj->z && !(mobj->eflags & MFE_VERTICALFLIP)) - || (*rover->bottomheight == mobj->z + mobj->height && mobj->eflags & MFE_VERTICALFLIP)) // You nut. + topheight = P_GetFOFTopZ(mobj, node->m_sector, rover, mobj->x, mobj->y, NULL); + bottomheight = P_GetFOFBottomZ(mobj, node->m_sector, rover, mobj->x, mobj->y, NULL); + + if ((topheight <= mobj->z + 16*mobj->scale && topheight >= mobj->z && !(mobj->eflags & MFE_VERTICALFLIP)) + || (bottomheight >= mobj->z + mobj->height && bottomheight <= mobj->z + mobj->height - 16*mobj->scale && mobj->eflags & MFE_VERTICALFLIP)) // You nut. EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), mobj->player, rover->alpha, !(rover->flags & FF_NORETURN)); } } From f23f5d4379bc92f402854568a3b8453e18e22c74 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 21 May 2015 15:49:26 -0500 Subject: [PATCH 061/364] Fix flat slopes eating jumps --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index cd9d36089..6b2df9727 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2152,7 +2152,7 @@ void P_XYMovement(mobj_t *mo) #ifdef ESLOPE // adjust various things based on slope - if (mo->standingslope) { + if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) { if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing! P_SlopeLaunch(mo); xmove = mo->momx; From 0d9f8028b7045b349935923e169e31c2017504b4 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 21 May 2015 15:49:49 -0500 Subject: [PATCH 062/364] Players now bounce off of slopes on bouncy FOFs --- src/p_user.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 6898ee910..450ebca76 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1870,6 +1870,9 @@ static void P_CheckBouncySectors(player_t *player) fixed_t oldx; fixed_t oldy; fixed_t oldz; +#ifdef ESLOPE + v3fixed_t momentum; +#endif oldx = player->mo->x; oldy = player->mo->y; @@ -1890,16 +1893,21 @@ static void P_CheckBouncySectors(player_t *player) { ffloor_t *rover; boolean top = true; + fixed_t topheight, bottomheight; for (rover = node->m_sector->ffloors; rover; rover = rover->next) { - if (player->mo->z > *rover->topheight) + topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); + bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); + + if (player->mo->z > topheight) continue; - if (player->mo->z + player->mo->height < *rover->bottomheight) + if (player->mo->z + player->mo->height < bottomheight) continue; - if (oldz < *rover->topheight && oldz > *rover->bottomheight) + if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL) + && oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)) top = false; if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 15) @@ -1914,7 +1922,29 @@ static void P_CheckBouncySectors(player_t *player) { fixed_t newmom; +#ifdef ESLOPE + pslope_t *slope; + if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top + slope = *rover->t_slope; + } else { // Hit bottom + slope = *rover->b_slope; + } + + momentum.x = player->mo->momx; + momentum.y = player->mo->momy; + momentum.z = player->mo->momz*2; + + if (slope) { + // Reverse quantizing might could use its own function later + slope->zangle = ANGLE_MAX-slope->zangle; + P_QuantizeMomentumToSlope(&momentum, slope); + slope->zangle = ANGLE_MAX-slope->zangle; + } + + newmom = momentum.z = -FixedMul(momentum.z,linedist)/2; +#else newmom = -FixedMul(player->mo->momz,linedist); +#endif if (abs(newmom) < (linedist*2)) { @@ -1937,7 +1967,18 @@ static void P_CheckBouncySectors(player_t *player) else if (newmom < -P_GetPlayerHeight(player)/2) newmom = -P_GetPlayerHeight(player)/2; +#ifdef ESLOPE + momentum.z = newmom*2; + + if (slope) + P_QuantizeMomentumToSlope(&momentum, slope); + + player->mo->momx = momentum.x; + player->mo->momy = momentum.y; + player->mo->momz = momentum.z/2; +#else player->mo->momz = newmom; +#endif if (player->pflags & PF_SPINNING) { From fb9d07b8ba7955af94c6325536c5e8549bb07953 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 21 May 2015 22:13:51 -0500 Subject: [PATCH 063/364] Bugfixes to sloped FOF plane clipping --- src/r_bsp.c | 13 +++++++++++-- src/r_segs.c | 38 ++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 35f82f01c..5474a4345 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -908,6 +908,9 @@ static void R_Subsector(size_t num) ceilingplane = NULL; numffloors = 0; +#ifdef ESLOPE + ffloor[numffloors].slope = NULL; +#endif ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; if (frontsector->ffloors) @@ -945,7 +948,7 @@ static void R_Subsector(size_t num) #ifdef ESLOPE light = R_GetPlaneLight(frontsector, *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->bottomheight, - viewz < (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight)); + viewz < heightcheck); #else light = R_GetPlaneLight(frontsector, *rover->bottomheight, viewz < *rover->bottomheight); @@ -993,7 +996,7 @@ static void R_Subsector(size_t num) #ifdef ESLOPE light = R_GetPlaneLight(frontsector, *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->topheight, - viewz < (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight)); + viewz < heightcheck); #else light = R_GetPlaneLight(frontsector, *rover->topheight, viewz < *rover->topheight); #endif @@ -1079,6 +1082,9 @@ static void R_Subsector(size_t num) ffloor[numffloors].height = polysec->floorheight; ffloor[numffloors].polyobj = po; +#ifdef ESLOPE + ffloor[numffloors].slope = NULL; +#endif // ffloor[numffloors].ffloor = rover; po->visplane = ffloor[numffloors].plane; numffloors++; @@ -1120,6 +1126,9 @@ static void R_Subsector(size_t num) ffloor[numffloors].polyobj = po; ffloor[numffloors].height = polysec->ceilingheight; +#ifdef ESLOPE + ffloor[numffloors].slope = NULL; +#endif // ffloor[numffloors].ffloor = rover; po->visplane = ffloor[numffloors].plane; numffloors++; diff --git a/src/r_segs.c b/src/r_segs.c index ce0260a63..2d41d702c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2650,7 +2650,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (*rover->b_slope || *rover->t_slope) backsector->hasslope = true; - rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, backsector->soundorg.x, backsector->soundorg.y) : *rover->bottomheight) - viewz; planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); if (rovertest>>4 <= worldhigh && @@ -2658,9 +2658,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) ((viewz < planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz > planevistest && (rover->flags & FF_BOTHPLANES)))) { - ffloor[i].slope = *rover->b_slope; - ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; - ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->bottomheight) - viewz; + //ffloor[i].slope = *rover->b_slope; + ffloor[i].b_pos = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos_slope = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2672,7 +2672,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (i >= MAXFFLOORS) break; - rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, backsector->soundorg.x, backsector->soundorg.y) : *rover->topheight) - viewz; planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); if (rovertest>>4 <= worldhigh && @@ -2680,9 +2680,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) ((viewz > planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz < planevistest && (rover->flags & FF_BOTHPLANES)))) { - ffloor[i].slope = *rover->t_slope; - ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->topheight) - viewz; - ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->topheight) - viewz; + //ffloor[i].slope = *rover->t_slope; + ffloor[i].b_pos = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + ffloor[i].b_pos_slope = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2735,7 +2735,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (*rover->b_slope || *rover->t_slope) frontsector->hasslope = true; - rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + rovertest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->bottomheight) - viewz; planevistest = (*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : *rover->bottomheight); if (rovertest>>4 <= worldtop && @@ -2743,9 +2743,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) ((viewz < planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz > planevistest && (rover->flags & FF_BOTHPLANES)))) { - ffloor[i].slope = *rover->b_slope; - ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; - ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->bottomheight) - viewz; + //ffloor[i].slope = *rover->b_slope; + ffloor[i].b_pos = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segleft.x, segleft.y) : *rover->bottomheight) - viewz; + ffloor[i].b_pos_slope = (*rover->b_slope ? P_GetZAt(*rover->b_slope, segright.x, segright.y) : *rover->bottomheight) - viewz; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2757,7 +2757,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (i >= MAXFFLOORS) break; - rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + rovertest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->topheight) - viewz; planevistest = (*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : *rover->topheight); if (rovertest>>4 <= worldtop && @@ -2765,9 +2765,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) ((viewz > planevistest && !(rover->flags & FF_INVERTPLANES)) || (viewz < planevistest && (rover->flags & FF_BOTHPLANES)))) { - ffloor[i].slope = *rover->t_slope; - ffloor[i].b_pos = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segleft.x, segleft.y) : *rover->topheight) - viewz; - ffloor[i].b_pos_slope = (ffloor[i].slope ? P_GetZAt(ffloor[i].slope, segright.x, segright.y) : *rover->topheight) - viewz; + //ffloor[i].slope = *rover->t_slope; + ffloor[i].b_pos = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segleft.x, segleft.y) : *rover->topheight) - viewz; + ffloor[i].b_pos_slope = (*rover->t_slope ? P_GetZAt(*rover->t_slope, segright.x, segright.y) : *rover->topheight) - viewz; ffloor[i].b_pos >>= 4; ffloor[i].b_pos_slope >>= 4; ffloor[i].b_frac = (centeryfrac >> 4) - FixedMul(ffloor[i].b_pos, rw_scale); @@ -2817,6 +2817,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (ffloor[i].plane->maxx < ds_p->x2) ffloor[i].plane->maxx = ds_p->x2; +#ifdef ESLOPE + ffloor[i].slope = NULL; +#endif ffloor[i].b_pos = backsector->floorheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); @@ -2833,6 +2836,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (ffloor[i].plane->maxx < ds_p->x2) ffloor[i].plane->maxx = ds_p->x2; +#ifdef ESLOPE + ffloor[i].slope = NULL; +#endif ffloor[i].b_pos = backsector->ceilingheight; ffloor[i].b_pos = (ffloor[i].b_pos - viewz) >> 4; ffloor[i].b_step = FixedMul(-rw_scalestep, ffloor[i].b_pos); From 8c54ee44e776b87f9a7c32eca611ffdc30a25bb8 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 22 May 2015 12:33:12 -0500 Subject: [PATCH 064/364] Slopey physics for some things that aren't players This is incredibly messy and probably needs redone differently at some point, but... fuck it. --- src/p_mobj.c | 121 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 87 insertions(+), 34 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 6b2df9727..2564a842e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2387,6 +2387,12 @@ void P_XYMovement(mobj_t *mo) if (player && player->homing) // no friction for homing return; +#ifdef ESLOPE + if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED) + && (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes + return; +#endif + if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz)) && !(player && player->pflags & PF_SLIDING)) return; // no friction when airborne @@ -2822,6 +2828,21 @@ static boolean P_ZMovement(mobj_t *mo) || (mo->z + mo->height >= mo->ceilingz && mo->eflags & MFE_VERTICALFLIP)) && !(mo->flags & MF_NOCLIPHEIGHT)) { + v3fixed_t mom; + mom.x = mo->momx; + mom.y = mo->momy; + mom.z = mo->momz; + +#ifdef ESLOPE + P_TryMove(mo, mo->x, mo->y, true); // Sets mo->standingslope correctly + if (mo->standingslope) { + // Reverse quantizing might could use its own function later + mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle; + P_QuantizeMomentumToSlope(&mom, mo->standingslope); + mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle; + } +#endif + if (mo->eflags & MFE_VERTICALFLIP) mo->z = mo->ceilingz - mo->height; else @@ -2829,7 +2850,7 @@ static boolean P_ZMovement(mobj_t *mo) // hit the floor if (mo->type == MT_FIREBALL) // special case for the fireball - mo->momz = P_MobjFlip(mo)*FixedMul(5*FRACUNIT, mo->scale); + mom.z = P_MobjFlip(mo)*FixedMul(5*FRACUNIT, mo->scale); else if (mo->type == MT_SPINFIRE) // elemental shield fire is another exception here ; else if (mo->flags & MF_MISSILE) @@ -2844,12 +2865,12 @@ static boolean P_ZMovement(mobj_t *mo) if (mo->flags & MF_GRENADEBOUNCE) { // Going down? (Or up in reverse gravity?) - if (P_MobjFlip(mo)*mo->momz < 0) + if (P_MobjFlip(mo)*mom.z < 0) { // If going slower than a fracunit, just stop. - if (abs(mo->momz) < FixedMul(FRACUNIT, mo->scale)) + if (abs(mom.z) < FixedMul(FRACUNIT, mo->scale)) { - mo->momx = mo->momy = mo->momz = 0; + mom.x = mom.y = mom.z = 0; // Napalm hack if (mo->type == MT_CYBRAKDEMON_NAPALM_BOMB_LARGE && mo->fuse) @@ -2857,7 +2878,7 @@ static boolean P_ZMovement(mobj_t *mo) } // Otherwise bounce up at half speed. else - mo->momz = -mo->momz/2; + mom.z = -mom.z/2; S_StartSound(mo, mo->info->activesound); } } @@ -2880,14 +2901,14 @@ static boolean P_ZMovement(mobj_t *mo) } } - if (P_MobjFlip(mo)*mo->momz < 0) // falling + if (P_MobjFlip(mo)*mom.z < 0) // falling { if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) mo->eflags |= MFE_JUSTHITFLOOR; if (mo->flags2 & MF2_SKULLFLY) // the skull slammed into something - mo->momz = -mo->momz; + mom.z = -mom.z; else // Flingrings bounce if (mo->type == MT_FLINGRING @@ -2900,35 +2921,42 @@ static boolean P_ZMovement(mobj_t *mo) || mo->type == MT_FALLINGROCK) { if (maptol & TOL_NIGHTS) - mo->momz = -FixedDiv(mo->momz, 10*FRACUNIT); + mom.z = -FixedDiv(mom.z, 10*FRACUNIT); else - mo->momz = -FixedMul(mo->momz, FixedDiv(17*FRACUNIT,20*FRACUNIT)); + mom.z = -FixedMul(mom.z, FixedDiv(17*FRACUNIT,20*FRACUNIT)); if (mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED) { - if (abs(mo->momx) < FixedMul(STOPSPEED, mo->scale) - && abs(mo->momy) < FixedMul(STOPSPEED, mo->scale) - && abs(mo->momz) < FixedMul(STOPSPEED*3, mo->scale)) + if (abs(mom.x) < FixedMul(STOPSPEED, mo->scale) + && abs(mom.y) < FixedMul(STOPSPEED, mo->scale) + && abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale)) { - if (!(mo->flags & MF_AMBUSH)) - { - mo->momx = mo->momy = mo->momz = 0; - P_SetMobjState(mo, mo->info->spawnstate); - } - else + if (mo->flags & MF_AMBUSH) { // If deafed, give the tumbleweed another random kick if it runs out of steam. - mo->momz += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); + mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); if (P_Random() & 1) - mo->momx += FixedMul(6*FRACUNIT, mo->scale); + mom.x += FixedMul(6*FRACUNIT, mo->scale); else - mo->momx -= FixedMul(6*FRACUNIT, mo->scale); + mom.x -= FixedMul(6*FRACUNIT, mo->scale); if (P_Random() & 1) - mo->momy += FixedMul(6*FRACUNIT, mo->scale); + mom.y += FixedMul(6*FRACUNIT, mo->scale); else - mo->momy -= FixedMul(6*FRACUNIT, mo->scale); + mom.y -= FixedMul(6*FRACUNIT, mo->scale); + } +#ifdef ESLOPE + else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) + { + // Pop the object up a bit to encourage bounciness + //mom.z = P_MobjFlip(mo)*mo->scale; + } +#endif + else + { + mom.x = mom.y = mom.z = 0; + P_SetMobjState(mo, mo->info->spawnstate); } } @@ -2938,14 +2966,14 @@ static boolean P_ZMovement(mobj_t *mo) } else if (mo->type == MT_FALLINGROCK) { - if (P_MobjFlip(mo)*mo->momz > FixedMul(2*FRACUNIT, mo->scale)) + if (P_MobjFlip(mo)*mom.z > FixedMul(2*FRACUNIT, mo->scale)) S_StartSound(mo, mo->info->activesound + P_RandomKey(mo->info->mass)); - mo->momz /= 2; // Rocks not so bouncy + mom.z /= 2; // Rocks not so bouncy - if (abs(mo->momx) < FixedMul(STOPSPEED, mo->scale) - && abs(mo->momy) < FixedMul(STOPSPEED, mo->scale) - && abs(mo->momz) < FixedMul(STOPSPEED*3, mo->scale)) + if (abs(mom.x) < FixedMul(STOPSPEED, mo->scale) + && abs(mom.y) < FixedMul(STOPSPEED, mo->scale) + && abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale)) { P_RemoveMobj(mo); return false; @@ -2953,20 +2981,30 @@ static boolean P_ZMovement(mobj_t *mo) } else if (mo->type == MT_CANNONBALLDECOR) { - mo->momz /= 2; - if (abs(mo->momz) < FixedMul(STOPSPEED*3, mo->scale)) - mo->momz = 0; + mom.z /= 2; + if (abs(mom.z) < FixedMul(STOPSPEED*3, mo->scale)) + mom.z = 0; } } else if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) - mo->momz = tmfloorthing->momz; + mom.z = tmfloorthing->momz; else if (!tmfloorthing) - mo->momz = 0; + mom.z = 0; } else if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR) || tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER)) - mo->momz = tmfloorthing->momz; + mom.z = tmfloorthing->momz; + +#ifdef ESLOPE + if (mo->standingslope) { + P_QuantizeMomentumToSlope(&mom, mo->standingslope); + } +#endif + + mo->momx = mom.x; + mo->momy = mom.y; + mo->momz = mom.z; if (mo->type == MT_STEAM) return true; @@ -7798,6 +7836,21 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s mobj->eflags &= ~MFE_JUSTHITFLOOR; } +#ifdef ESLOPE // Sliding physics for slidey mobjs! + if (mobj->type == MT_FLINGRING + || mobj->type == MT_FLINGCOIN + || P_WeaponOrPanel(mobj->type) + || mobj->type == MT_FLINGEMERALD + || mobj->type == MT_BIGTUMBLEWEED + || mobj->type == MT_LITTLETUMBLEWEED + || mobj->type == MT_CANNONBALLDECOR + || mobj->type == MT_FALLINGROCK) { + P_TryMove(mobj, mobj->x, mobj->y, true); // Sets mo->standingslope correctly + //if (mobj->standingslope) CONS_Printf("slope physics on mobj\n"); + P_ButteredSlope(mobj); + } +#endif + if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health && P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz { From 3f8e7b173952c04fcc82e9e1ee856c0c280dce8b Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 22 May 2015 20:57:58 -0500 Subject: [PATCH 065/364] Revert/remove unused/broken junk from original slopes port m_vector removal to come later. The little thing commented out in it is so I could revert the weird tables.c change. --- src/m_vector.c | 2 +- src/p_enemy.c | 4 --- src/p_floor.c | 3 -- src/p_local.h | 15 ---------- src/p_map.c | 58 +++++++++--------------------------- src/p_maputl.c | 12 +++----- src/p_mobj.c | 1 + src/p_mobj.h | 5 ---- src/p_spec.c | 16 ++++------ src/p_user.c | 81 -------------------------------------------------- src/tables.c | 5 ++-- src/tables.h | 5 ++-- 12 files changed, 31 insertions(+), 176 deletions(-) diff --git a/src/m_vector.c b/src/m_vector.c index 274a806a6..96ed7cae0 100644 --- a/src/m_vector.c +++ b/src/m_vector.c @@ -330,7 +330,7 @@ angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector fixed_t vectorsMagnitude = FixedMul(FV_Magnitude(Vector1), FV_Magnitude(Vector2)); // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. - return FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); + return 0;//ALFALFA FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); } float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2) diff --git a/src/p_enemy.c b/src/p_enemy.c index 43c0f5057..369b6f0c8 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -28,10 +28,6 @@ #include "hardware/hw3sound.h" #endif -#ifdef SPRINGCLEAN// ESLOPE -#include "p_slopes.h" -#endif - #ifdef HAVE_BLUA boolean LUA_CallAction(const char *action, mobj_t *actor); #endif diff --git a/src/p_floor.c b/src/p_floor.c index 0d68becbf..4e289c8d5 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -19,9 +19,6 @@ #include "z_zone.h" #include "g_game.h" #include "r_main.h" -#ifdef SPRINGCLEAN// ESLOPE -#include "p_slopes.h" -#endif // ========================================================================== // FLOORS diff --git a/src/p_local.h b/src/p_local.h index f2376494a..1c5874b93 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -53,15 +53,6 @@ // above this, a height difference is considered as a 'dropoff' #define MAXSTEPMOVE (24*FRACUNIT) -#ifdef ESLOPE -// [RH] Minimum floorplane.c value for walking -// The lower the value, the steeper the slope is -#define SECPLANESTEEPSLOPE 46000 -// ESLOPE stuff - a slope of 4 or lower is so level, treat it as flat -#define LEVELSLOPE 4 -#define STEEPSLOPE 65 -#endif - #define USERANGE (64*FRACUNIT) #define MELEERANGE (64*FRACUNIT) #define MISSILERANGE (32*64*FRACUNIT) @@ -147,12 +138,6 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec); boolean P_InSpaceSector(mobj_t *mo); boolean P_InQuicksand(mobj_t *mo); -#ifdef ESLOPE -boolean P_IsObjectOnSlope(mobj_t *mo, boolean ceiling); -boolean P_SlopeGreaterThan(mobj_t *mo, boolean ceiling, int value); -boolean P_SlopeLessThan(mobj_t *mo, boolean ceiling, int value); -#endif - void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative); void P_RestoreMusic(player_t *player); void P_SpawnShieldOrb(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index e2ea76b88..eeff412d8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1756,30 +1756,8 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) } else { -#ifdef ESLOPE // SRB2CBTODO: Checking the things momx/y help with collision issues, but makes going done slopes not as smooth - if (thiscam->subsector->sector && thiscam->subsector->sector->f_slope) - { - // SRB2CBTODO: Support a mobj's gravity for this too - if (P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy) > P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x, thiscam->y)) - thiscam->floorz = P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy); - else - thiscam->floorz = P_GetZAt(thiscam->subsector->sector->f_slope, thiscam->x, thiscam->y); - } - else -#endif - tmfloorz = thiscam->subsector->sector->floorheight; -#ifdef ESLOPE - if (thiscam->subsector->sector && thiscam->subsector->sector->c_slope) - { - // SRB2CBTODO: Support a mobj's gravity for this too - if (P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy) < P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x, thiscam->y)) - thiscam->ceilingz = P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x, thiscam->y); - else - thiscam->ceilingz = P_GetZAt(thiscam->subsector->sector->c_slope, thiscam->x+thiscam->momx, thiscam->y+thiscam->momy); - } - else -#endif - tmceilingz = thiscam->subsector->sector->ceilingheight; + tmfloorz = P_CameraGetFloorZ(thiscam, thiscam->subsector->sector, x, y, NULL); + tmceilingz = P_CameraGetCeilingZ(thiscam, thiscam->subsector->sector, x, y, NULL); } // the move is ok, @@ -2074,7 +2052,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->momz <= 0) thing->standingslope = tmfloorslope; } - else if (thing->z+thing->height >= tmceilingz /*&& thing->momz >= 0*/ && (thing->eflags & MFE_VERTICALFLIP)) { + else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { if (!startingonground && tmceilingslope) P_HandleSlopeLanding(thing, tmceilingslope); @@ -2120,15 +2098,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) if (!(thing->flags & MF_NOCLIP)) { - fixed_t maxstep = MAXSTEPMOVE; - -#ifdef ESLOPE // TODO: Make this collosion better - // Maxstepmove = 0 means the object bounces like a nut while going down a slope - if (thing->subsector->sector->f_slope) - { - maxstep *= thing->subsector->sector->f_slope->zangle; - } -#endif + const fixed_t maxstep = MAXSTEPMOVE; if (tmceilingz - tmfloorz < thing->height) return false; // doesn't fit @@ -2450,6 +2420,7 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) if (glidesector->sector != player->mo->subsector->sector) { boolean floorclimb = false; + fixed_t topheight, bottomheight; if (glidesector->sector->ffloors) { @@ -2459,8 +2430,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -2551,7 +2522,6 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle) static boolean PTR_SlideTraverse(intercept_t *in) { line_t *li; - fixed_t maxstep; I_Assert(in->isaline); @@ -2584,9 +2554,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) if (opentop - slidemo->z < slidemo->height) goto isblocking; // mobj is too high - maxstep = FixedMul(MAXSTEPMOVE, slidemo->scale); - - if (openbottom - slidemo->z > maxstep) + if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale)) goto isblocking; // too big a step up // this line doesn't block movement @@ -2607,6 +2575,7 @@ isblocking: line_t *checkline = li; sector_t *checksector; ffloor_t *rover; + fixed_t topheight, bottomheight; boolean fofline = false; INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li); @@ -2622,8 +2591,8 @@ isblocking: if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -3258,6 +3227,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) if (thing->subsector->sector->ffloors && (realcrush || thing->flags & MF_PUSHABLE)) { ffloor_t *rover; + fixed_t topheight, bottomheight; fixed_t delta1, delta2; INT32 thingtop = thing->z + thing->height; @@ -3267,8 +3237,8 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush) || ((rover->flags & FF_BLOCKOTHERS) && !thing->player)) || !(rover->flags & FF_EXISTS)) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; /*#ifdef ESLOPE if (rover->t_slope) diff --git a/src/p_maputl.c b/src/p_maputl.c index a60d9232d..c9a42bd43 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -21,9 +21,6 @@ #include "p_maputl.h" #include "p_polyobj.h" #include "z_zone.h" -#ifdef SPRINGCLEAN// ESLOPE -#include "p_slopes.h" -#endif // // P_AproxDistance @@ -862,6 +859,7 @@ void P_SetThingPosition(mobj_t *thing) { // link into subsector subsector_t *ss; sector_t *oldsec = NULL; + fixed_t tfloorz, tceilz; I_Assert(thing != NULL); I_Assert(!P_MobjWasRemoved(thing)); @@ -871,11 +869,6 @@ void P_SetThingPosition(mobj_t *thing) ss = thing->subsector = R_PointInSubsector(thing->x, thing->y); - fixed_t tfloorz, tceilz; - - tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); - tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); - if (!(thing->flags & MF_NOSECTOR)) { // invisible things don't go into the sector links @@ -936,6 +929,9 @@ void P_SetThingPosition(mobj_t *thing) // sector's floor is the same height. if (thing->player && oldsec != NULL && thing->subsector && oldsec != thing->subsector->sector) { + tfloorz = P_GetFloorZ(thing, ss->sector, thing->x, thing->y, NULL); + tceilz = P_GetCeilingZ(thing, ss->sector, thing->x, thing->y, NULL); + if (thing->eflags & MFE_VERTICALFLIP) { if (thing->z + thing->height >= tceilz) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2564a842e..7a3ee0bbd 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2181,6 +2181,7 @@ void P_XYMovement(mobj_t *mo) if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true) && !(mo->eflags & MFE_SPRUNG)) { // blocked move + if (player) { moved = false; if (player->bot) diff --git a/src/p_mobj.h b/src/p_mobj.h index 0dc323d73..d7a370c38 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -28,11 +28,6 @@ // Needs precompiled tables/data structures. #include "info.h" -// For slope code, we need v3float_t -#ifdef ESLOPE -//#include "r_defs.h" -#endif - // // NOTES: mobj_t // diff --git a/src/p_spec.c b/src/p_spec.c index 3126413b5..914e008d9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -33,9 +33,6 @@ #include "m_misc.h" #include "m_cond.h" //unlock triggers #include "lua_hook.h" // LUAh_LinedefExecute -#ifdef ESLOPE -#include "p_slopes.h" -#endif #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -4522,6 +4519,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) { boolean nofloorneeded = false; + fixed_t f_affectpoint, c_affectpoint; if (!sector->special) // nothing special, exit return; @@ -4584,8 +4582,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) return; } - fixed_t f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->floorheight; - fixed_t c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL);//sector->ceilingheight; + f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL); + c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL); // Only go further if on the ground if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint) @@ -7386,12 +7384,8 @@ void T_Pusher(pusher_t *p) || GETSECSPECIAL(referrer->special, 3) == 3) foundfloor = true; } - else if ( -#ifdef ESLOPE - (!sec->f_slope) && -#endif - (!(GETSECSPECIAL(sec->special, 3) == 2 - || GETSECSPECIAL(sec->special, 3) == 3))) + else if (!(GETSECSPECIAL(sec->special, 3) == 2 + || GETSECSPECIAL(sec->special, 3) == 3)) return; if (p->roverpusher && foundfloor == false) // Not even a 3d floor has the PUSH_MASK. diff --git a/src/p_user.c b/src/p_user.c index 450ebca76..b389985b6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1197,87 +1197,6 @@ boolean P_IsObjectOnGround(mobj_t *mo) return false; } -#ifdef ESLOPE -// -// P_IsObjectOnSlope -// -// Returns true if the player is -// on a slope. Takes reverse -// gravity into account. -// -boolean P_IsObjectOnSlope(mobj_t *mo, boolean ceiling) -{ - if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) - { - if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) // SRB2CBTODO: allow being on underside of mobj too? - return true; - } - else - { - if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) - return true; - } - - return false; -} - -// -// P_SlopeGreaterThan -// -// Returns true if the object is on a slope -// that has an angle greater than the value -// -boolean P_SlopeGreaterThan(mobj_t *mo, boolean ceiling, int value) -{ - if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) - { - if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) - { - if (value < mo->subsector->sector->c_slope->zangle) - return true; - } - } - else - { - if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) - { - if (value < mo->subsector->sector->f_slope->zangle) - return true; - } - } - - return false; -} - -// -// P_SlopeLessThan -// -// Returns true if the object is on a slope -// that has an angle less than the value -// -boolean P_SlopeLessThan(mobj_t *mo, boolean ceiling, int value) -{ - if (ceiling && (mo->eflags & MFE_VERTICALFLIP)) - { - if ((mo->z + mo->height >= mo->ceilingz) && mo->subsector->sector->c_slope) - { - if (value < mo->subsector->sector->c_slope->zangle) - return true; - } - } - else - { - if (mo->z <= mo->floorz && mo->subsector->sector->f_slope) - { - if (value < mo->subsector->sector->f_slope->zangle) - return true; - } - } - - return false; -} -#endif - // // P_IsObjectOnGroundIn // diff --git a/src/tables.c b/src/tables.c index cfc17c9c9..fa71effef 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2225,6 +2225,9 @@ angle_t tantoangle[2049] = 536870912 }; + +#ifdef NEED_FIXED_VECTOR + static angle_t fineacon[65536*2] = { ANGLE_MAX, 2143707442, 2142143280, 2140943052, 2139931208, 2139039753, 2138233813, 2137492672, 2136802831, 2136154917, 2135542102, 2134959233, 2134402306, 2133868139, 2133354148, 2132858208, 2132378539, 2131913638, 2131462220, 2131023174, 2130595537, 2130178462, 2129771202, 2129373097, 2128983555, 2128602046, 2128228092, 2127861261, 2127501162, 2127147436, 2126799757, 2126457825, @@ -10426,8 +10429,6 @@ FUNCMATH angle_t FixedAcos(fixed_t x) return fineacon[((x<<(FINE_FRACBITS-FRACBITS)))+FRACUNIT]; } -#ifdef NEED_FIXED_VECTOR - // // AngleBetweenVectors // diff --git a/src/tables.h b/src/tables.h index cd6a17ff5..219d668b9 100644 --- a/src/tables.h +++ b/src/tables.h @@ -96,11 +96,12 @@ FUNCMATH angle_t FixedAngle(fixed_t fa); // and with a factor, with +factor for (fa/factor) and -factor for (fa*factor) FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor); -/// The FixedAcos function -FUNCMATH angle_t FixedAcos(fixed_t x); #ifdef NEED_FIXED_VECTOR +/// The FixedAcos function +FUNCMATH angle_t FixedAcos(fixed_t x); + /// Fixed Point Vector functions angle_t FV2_AngleBetweenVectors(const vector2_t *Vector1, const vector2_t *Vector2); angle_t FV3_AngleBetweenVectors(const vector3_t *Vector1, const vector3_t *Vector2); From 89319b1c2a27c4a2fee5dca9caae1ebc12866e37 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 22 May 2015 22:07:07 -0500 Subject: [PATCH 066/364] Dummy out m_vector and use m_fixed's functions instead These functions were already here before, and I /swear/ the slope physics became slightly less glitchy after switching to them... Only issue is the slope plane mapping code hasn't been properly converted yet, so they don't render properly for now. --- src/doomdef.h | 1 - src/m_fixed.c | 2 +- src/m_fixed.h | 2 +- src/m_vector.c | 3 ++- src/m_vector.h | 2 +- src/p_mobj.c | 4 ++-- src/p_slopes.c | 44 +++++++++++++++++--------------------------- src/p_slopes.h | 7 +------ src/p_user.c | 4 ++-- src/r_defs.h | 15 +++------------ src/r_draw.c | 2 +- src/r_draw.h | 5 ++++- src/r_plane.c | 9 +++++---- src/tables.c | 2 +- src/tables.h | 2 +- 15 files changed, 42 insertions(+), 62 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index c150b46b9..bfa5ee0ce 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -441,7 +441,6 @@ extern const char *compdate, *comptime, *comprevision; /// Kalaron/Eternity Engine slope code (SRB2CB ported) /// Depends on NEED_FIXED_VECTORS? for a few functions. -/// However, uses own vector types for math. #define ESLOPE /// Fixed and float point types diff --git a/src/m_fixed.c b/src/m_fixed.c index 25a25a966..739265aa2 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -119,7 +119,7 @@ fixed_t FixedHypot(fixed_t x, fixed_t y) return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) } -#ifdef NEED_FIXED_VECTOR +#if 1 //#ifdef NEED_FIXED_VECTOR vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) { diff --git a/src/m_fixed.h b/src/m_fixed.h index 92b992632..53962269b 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -358,7 +358,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x) } -#ifdef NEED_FIXED_VECTOR +#if 1//#ifdef NEED_FIXED_VECTOR typedef struct { diff --git a/src/m_vector.c b/src/m_vector.c index 96ed7cae0..b417fd980 100644 --- a/src/m_vector.c +++ b/src/m_vector.c @@ -24,7 +24,7 @@ // SoM created 05/18/09 // //----------------------------------------------------------------------------- - +#if 0 // GET THIS SHEIT OUTTA HEEEEEEEEEEEEEEEEEEEEEEERE #include "doomdef.h" #include "m_vector.h" #include "r_main.h" @@ -1156,3 +1156,4 @@ void FV_Normalf(const v3float_t *a_triangle, v3float_t *a_normal) // EOF #endif // #ifdef ESLOPE +#endif diff --git a/src/m_vector.h b/src/m_vector.h index 37d30c746..a2be3a7de 100644 --- a/src/m_vector.h +++ b/src/m_vector.h @@ -28,7 +28,7 @@ #ifndef M_VECTOR_H__ #define M_VECTOR_H__ -#ifdef ESLOPE +#if 0 //#ifdef ESLOPE #include "m_fixed.h" #include "tables.h" diff --git a/src/p_mobj.c b/src/p_mobj.c index 7a3ee0bbd..270220f82 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2116,7 +2116,7 @@ void P_XYMovement(mobj_t *mo) boolean moved; #ifdef ESLOPE pslope_t *oldslope = NULL; - v3fixed_t slopemom; + vector3_t slopemom; fixed_t predictedz = 0; #endif @@ -2829,7 +2829,7 @@ static boolean P_ZMovement(mobj_t *mo) || (mo->z + mo->height >= mo->ceilingz && mo->eflags & MFE_VERTICALFLIP)) && !(mo->flags & MF_NOCLIPHEIGHT)) { - v3fixed_t mom; + vector3_t mom; mom.x = mo->momx; mom.y = mo->momy; mom.z = mo->momz; diff --git a/src/p_slopes.c b/src/p_slopes.c index a4f334caf..a1bfb01c3 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -79,7 +79,7 @@ void P_RunDynamicSlopes(void) { } if (slope->zdelta != FixedDiv(zdelta, slope->extent)) { - slope->zdeltaf = FIXED_TO_FLOAT(slope->zdelta = FixedDiv(zdelta, slope->extent)); + slope->zdelta = FixedDiv(zdelta, slope->extent); slope->zangle = R_PointToAngle2(0, 0, slope->extent, -zdelta); P_CalculateSlopeNormal(slope); } @@ -91,20 +91,20 @@ void P_RunDynamicSlopes(void) { // // Alocates and fill the contents of a slope structure. // -static pslope_t *P_MakeSlope(const v3fixed_t *o, const v2fixed_t *d, +static pslope_t *P_MakeSlope(const vector3_t *o, const vector2_t *d, const fixed_t zdelta, boolean dynamic) { pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); memset(ret, 0, sizeof(*ret)); - ret->of.x = FIXED_TO_FLOAT(ret->o.x = o->x); - ret->of.y = FIXED_TO_FLOAT(ret->o.y = o->y); - ret->of.z = FIXED_TO_FLOAT(ret->o.z = o->z); + ret->o.x = o->x; + ret->o.y = o->y; + ret->o.z = o->z; - ret->df.x = FIXED_TO_FLOAT(ret->d.x = d->x); - ret->df.y = FIXED_TO_FLOAT(ret->d.y = d->y); + ret->d.x = d->x; + ret->d.y = d->y; - ret->zdeltaf = FIXED_TO_FLOAT(ret->zdelta = zdelta); + ret->zdelta = zdelta; if (dynamic) { // Add to the dynamic slopes list ret->next = dynslopes; @@ -170,8 +170,8 @@ void P_SpawnSlope_Line(int linenum) line_t *line = lines + linenum; INT16 special = line->special; pslope_t *fslope = NULL, *cslope = NULL; - v3fixed_t origin, point; - v2fixed_t direction; + vector3_t origin, point; + vector2_t direction; fixed_t nx, ny, dz, extent; boolean frontfloor = (special == 386 || special == 388 || special == 393); @@ -772,7 +772,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y) return slope->o.z + FixedMul(dist, slope->zdelta); } - +#ifdef SPRINGCLEAN // // P_GetZAtf // @@ -786,30 +786,20 @@ float P_GetZAtf(pslope_t *slope, float x, float y) float dist = (x - slope->of.x) * slope->df.x + (y - slope->of.y) * slope->df.y; return slope->of.z + (dist * slope->zdeltaf); } - -// Unused? -Red -// P_DistFromPlanef -// -float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, - const v3float_t *pnormal) -{ - return (point->x - pori->x) * pnormal->x + - (point->y - pori->y) * pnormal->y + - (point->z - pori->z) * pnormal->z; -} +#endif // // P_QuantizeMomentumToSlope // // When given a vector, rotates it and aligns it to a slope -void P_QuantizeMomentumToSlope(v3fixed_t *momentum, pslope_t *slope) +void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { - v3fixed_t axis; + vector3_t axis; axis.x = -slope->d.y; axis.y = slope->d.x; axis.z = 0; - M_VecRotate(momentum, &axis, slope->zangle); + FV3_Rotate(momentum, &axis, slope->zangle >> ANGLETOFINESHIFT); } // @@ -821,7 +811,7 @@ void P_SlopeLaunch(mobj_t *mo) // Double the pre-rotation Z, then halve the post-rotation Z. This reduces the // vertical launch given from slopes while increasing the horizontal launch // given. Good for SRB2's gravity and horizontal speeds. - v3fixed_t slopemom; + vector3_t slopemom; slopemom.x = mo->momx; slopemom.y = mo->momy; slopemom.z = mo->momz*2; @@ -838,7 +828,7 @@ void P_SlopeLaunch(mobj_t *mo) // Function to help handle landing on slopes void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) { - v3fixed_t mom; + vector3_t mom; mom.x = thing->momx; mom.y = thing->momy; mom.z = thing->momz*2; diff --git a/src/p_slopes.h b/src/p_slopes.h index 4281d5796..916690fe7 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -71,13 +71,8 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); float P_GetZAtf(pslope_t *slope, float x, float y); -// Unused? -Red -// Returns the distance of the given point from the given origin and normal. -float P_DistFromPlanef(const v3float_t *point, const v3float_t *pori, - const v3float_t *pnormal); - // Lots of physics-based bullshit -void P_QuantizeMomentumToSlope(v3fixed_t *momentum, pslope_t *slope); +void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); void P_SlopeLaunch(mobj_t *mo); void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope); void P_ButteredSlope(mobj_t *mo); diff --git a/src/p_user.c b/src/p_user.c index b389985b6..115c79638 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1790,7 +1790,7 @@ static void P_CheckBouncySectors(player_t *player) fixed_t oldy; fixed_t oldz; #ifdef ESLOPE - v3fixed_t momentum; + vector3_t momentum; #endif oldx = player->mo->x; @@ -4519,7 +4519,7 @@ static void P_3dMovement(player_t *player) boolean analogmove = false; fixed_t oldMagnitude, newMagnitude; #ifdef ESLOPE - v3fixed_t totalthrust; + vector3_t totalthrust; totalthrust.x = totalthrust.y = 0; // I forget if this is needed totalthrust.z = FRACUNIT*P_MobjFlip(player->mo)/3; // A bit of extra push-back on slopes diff --git a/src/r_defs.h b/src/r_defs.h index 27e4b9170..9f35af7e5 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -236,30 +236,21 @@ typedef struct secplane_t // Kalaron Slopes #ifdef ESLOPE -#include "m_vector.h" - typedef struct pslope_s { // --- Information used in clipping/projection --- // Origin vector for the plane - // NOTE: All similarly named entries in this struct do the same thing, - // differing with just 'f' in the name for float: - // o = of, d = df, zdelta = zdeltaf; the only difference is that one's fixed, - // and the one with the 'f' is floating point, for easier reference elsewhere in the code - v3fixed_t o; - v3float_t of; + vector3_t o; // 2-Dimentional vector (x, y) normalized. Used to determine distance from // the origin in 2d mapspace. (Basically a thrust of FRACUNIT in xydirection angle) - v2fixed_t d; - v2float_t df; + vector2_t d; // The rate at which z changes based on distance from the origin plane. fixed_t zdelta; - float zdeltaf; // The normal of the slope; will always point upward, and thus be inverted on ceilings. I think it's only needed for physics? -Red - v3fixed_t normal; + vector3_t normal; // For comparing when a slope should be rendered fixed_t lowz; diff --git a/src/r_draw.c b/src/r_draw.c index e63aa5a2b..f25ecfa04 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -105,7 +105,7 @@ UINT8 *ds_transmap; // one of the translucency tables #ifdef ESLOPE pslope_t *ds_slope; // Current slope being used -v3float_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +FVector ds_su, ds_sv, ds_sz; // Vectors for... stuff? float focallengthf, zeroheight; #endif diff --git a/src/r_draw.h b/src/r_draw.h index 1116e1c25..b29791cc4 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -61,8 +61,11 @@ extern UINT8 *ds_source; // start of a 64*64 tile image extern UINT8 *ds_transmap; #ifdef ESLOPE +///TODO: either convert ds_su, etc to FPU or declare a floating-point vector type somewhere +#include "hardware/hw_defs.h" + pslope_t *ds_slope; // Current slope being used -v3float_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +FVector ds_su, ds_sv, ds_sz; // Vectors for... stuff? float focallengthf, zeroheight; #endif diff --git a/src/r_plane.c b/src/r_plane.c index b0768539b..839f2fa38 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -941,7 +941,7 @@ void R_DrawSinglePlane(visplane_t *pl) if (pl->slope) { // Potentially override other stuff for now cus we're mean. :< But draw a slope plane! // I copied ZDoom's code and adapted it to SRB2... -Red - v3float_t p, m, n; + FVector p, m, n; angle_t ang; //double zeroheight; @@ -972,9 +972,10 @@ void R_DrawSinglePlane(visplane_t *pl) m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINECOSINE(ang), viewy - FINESINE(ang))) - zeroheight; - M_CrossProduct3f(&ds_su, &p, &m); - M_CrossProduct3f(&ds_sv, &p, &n); - M_CrossProduct3f(&ds_sz, &m, &n); + ///TODO: slope FPU conversion stuff + //M_CrossProduct3f(&ds_su, &p, &m); + //M_CrossProduct3f(&ds_sv, &p, &n); + //M_CrossProduct3f(&ds_sz, &m, &n); ds_su.z *= focallengthf; ds_sv.z *= focallengthf; diff --git a/src/tables.c b/src/tables.c index fa71effef..3ee2685c8 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2226,7 +2226,7 @@ angle_t tantoangle[2049] = }; -#ifdef NEED_FIXED_VECTOR +#if 1 //#ifdef NEED_FIXED_VECTOR static angle_t fineacon[65536*2] = { ANGLE_MAX, 2143707442, 2142143280, 2140943052, 2139931208, 2139039753, 2138233813, 2137492672, 2136802831, 2136154917, 2135542102, 2134959233, 2134402306, 2133868139, 2133354148, 2132858208, diff --git a/src/tables.h b/src/tables.h index 219d668b9..b1de1a428 100644 --- a/src/tables.h +++ b/src/tables.h @@ -97,7 +97,7 @@ FUNCMATH angle_t FixedAngle(fixed_t fa); FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor); -#ifdef NEED_FIXED_VECTOR +#if 1 //#ifdef NEED_FIXED_VECTOR /// The FixedAcos function FUNCMATH angle_t FixedAcos(fixed_t x); From 3629a2141b47e53fefd3803188f6d6d36c3d831d Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 23 May 2015 01:19:38 -0500 Subject: [PATCH 067/364] Slope planes work again. I hacked an alignment fix in too. --- src/r_draw.c | 2 +- src/r_draw.h | 7 +++--- src/r_plane.c | 59 ++++++++++++++++++++++++++++++++++----------------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index f25ecfa04..766e0428e 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -105,7 +105,7 @@ UINT8 *ds_transmap; // one of the translucency tables #ifdef ESLOPE pslope_t *ds_slope; // Current slope being used -FVector ds_su, ds_sv, ds_sz; // Vectors for... stuff? +floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? float focallengthf, zeroheight; #endif diff --git a/src/r_draw.h b/src/r_draw.h index b29791cc4..e1818545b 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -61,11 +61,12 @@ extern UINT8 *ds_source; // start of a 64*64 tile image extern UINT8 *ds_transmap; #ifdef ESLOPE -///TODO: either convert ds_su, etc to FPU or declare a floating-point vector type somewhere -#include "hardware/hw_defs.h" +typedef struct { + float x, y, z; +} floatv3_t; pslope_t *ds_slope; // Current slope being used -FVector ds_su, ds_sv, ds_sz; // Vectors for... stuff? +floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? float focallengthf, zeroheight; #endif diff --git a/src/r_plane.c b/src/r_plane.c index 839f2fa38..1c4abc8c5 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -941,41 +941,60 @@ void R_DrawSinglePlane(visplane_t *pl) if (pl->slope) { // Potentially override other stuff for now cus we're mean. :< But draw a slope plane! // I copied ZDoom's code and adapted it to SRB2... -Red - FVector p, m, n; - angle_t ang; + floatv3_t p, m, n; + float ang; //double zeroheight; + float fudge; - double vx = FIXED_TO_FLOAT(viewx); - double vy = FIXED_TO_FLOAT(viewy); - double vz = FIXED_TO_FLOAT(viewz); + float vx = FIXED_TO_FLOAT(viewx); + float vy = FIXED_TO_FLOAT(viewy); + float vz = FIXED_TO_FLOAT(viewz); zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); +#define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180) + // p is the texture origin in view space // Don't add in the offsets at this stage, because doing so can result in // errors if the flat is rotated. - ang = (ANGLE_270 - viewangle)>>ANGLETOFINESHIFT; - p.x = vx * FIXED_TO_FLOAT(FINECOSINE(ang)) - vy * FIXED_TO_FLOAT(FINESINE(ang)); - p.z = vx * FIXED_TO_FLOAT(FINESINE(ang)) + vy * FIXED_TO_FLOAT(FINECOSINE(ang)); + ang = ANG2RAD(ANGLE_270 - viewangle); + p.x = vx * cos(ang) - vy * sin(ang); + p.z = vx * sin(ang) + vy * cos(ang); p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, 0, 0)) - vz; // m is the v direction vector in view space - ang = (ANGLE_180 - viewangle - pl->plangle) >> ANGLETOFINESHIFT; - m.x = FIXED_TO_FLOAT(FINECOSINE(ang)); - m.z = FIXED_TO_FLOAT(FINESINE(ang)); + ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle); + m.x = cos(ang); + m.z = sin(ang); // n is the u direction vector in view space - n.x = FIXED_TO_FLOAT(FINESINE(ang)); - n.z = -FIXED_TO_FLOAT(FINECOSINE(ang)); + n.x = sin(ang); + n.z = -cos(ang); - ang = pl->plangle>>ANGLETOFINESHIFT; - m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINESINE(ang), viewy + FINECOSINE(ang))) - zeroheight; - n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FINECOSINE(ang), viewy - FINESINE(ang))) - zeroheight; + ang = ANG2RAD(pl->plangle); + m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)))) - zeroheight; + n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)))) - zeroheight; - ///TODO: slope FPU conversion stuff - //M_CrossProduct3f(&ds_su, &p, &m); - //M_CrossProduct3f(&ds_sv, &p, &n); - //M_CrossProduct3f(&ds_sz, &m, &n); + // Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red + fudge = ((1< Date: Sat, 23 May 2015 01:32:28 -0500 Subject: [PATCH 068/364] Sayonara, m_vector.c --- src/CMakeLists.txt | 2 - src/Makefile | 1 - src/m_vector.c | 1159 -------------------------------------------- src/m_vector.h | 125 ----- 4 files changed, 1287 deletions(-) delete mode 100644 src/m_vector.c delete mode 100644 src/m_vector.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f319523b9..bb4f9a4a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,7 +32,6 @@ set(SRB2_CORE_SOURCES m_misc.c m_queue.c m_random.c - m_vector.c md5.c mserv.c s_sound.c @@ -96,7 +95,6 @@ set(SRB2_CORE_HEADERS m_queue.h m_random.h m_swap.h - m_vector.h md5.h mserv.h p5prof.h diff --git a/src/Makefile b/src/Makefile index 49785b9e9..bee608047 100644 --- a/src/Makefile +++ b/src/Makefile @@ -436,7 +436,6 @@ OBJS:=$(i_main_o) \ $(OBJDIR)/m_misc.o \ $(OBJDIR)/m_random.o \ $(OBJDIR)/m_queue.o \ - $(OBJDIR)/m_vector.o \ $(OBJDIR)/info.o \ $(OBJDIR)/p_ceilng.o \ $(OBJDIR)/p_enemy.o \ diff --git a/src/m_vector.c b/src/m_vector.c deleted file mode 100644 index b417fd980..000000000 --- a/src/m_vector.c +++ /dev/null @@ -1,1159 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2004 Stephen McGranahan -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//-------------------------------------------------------------------------- -// -// DESCRIPTION: -// Vectors -// SoM created 05/18/09 -// -//----------------------------------------------------------------------------- -#if 0 // GET THIS SHEIT OUTTA HEEEEEEEEEEEEEEEEEEEEEEERE -#include "doomdef.h" -#include "m_vector.h" -#include "r_main.h" -#include "m_fixed.h" -#include "m_misc.h" -#include "tables.h" - -#ifdef ESLOPE - -v3fixed_t *M_LoadVec(v3fixed_t *vec, fixed_t x, fixed_t y, fixed_t z) -{ - vec->x = x; - vec->y = y; - vec->z = z; - return vec; -} - -v3fixed_t *M_CopyVec(v3fixed_t *a_o, const v3fixed_t *a_i) -{ - return M_Memcpy(a_o, a_i, sizeof(v3fixed_t)); -} - -v3float_t *M_LoadVecf(v3float_t *vec, float x, float y, float z) -{ - vec->x = x; - vec->y = y; - vec->z = z; - return vec; -} - -v3float_t *M_CopyVecf(v3float_t *a_o, const v3float_t *a_i) -{ - return M_Memcpy(a_o, a_i, sizeof(v3float_t)); -} - -// -// M_MakeVec3 -// -// Given two points, create a vector between them. -// -v3fixed_t *M_MakeVec3(const v3fixed_t *point1, const v3fixed_t *point2, v3fixed_t *a_o) -{ - a_o->x = point1->x - point2->x; - a_o->y = point1->y - point2->y; - a_o->z = point1->z - point2->z; - return a_o; -} - - -// -// M_MakeVec3f -// -// Given two points, create a vector between them. -// -v3float_t *M_MakeVec3f(const v3float_t *point1, const v3float_t *point2, v3float_t *a_o) -{ - a_o->x = point1->x - point2->x; - a_o->y = point1->y - point2->y; - a_o->z = point1->z - point2->z; - return a_o; -} - -// -// M_TranslateVec3 -// -// Translates the given vector (in the game's coordinate system) to the camera -// space (in right-handed coordinate system) This function is used for slopes. -// -void M_TranslateVec3(v3fixed_t *vec) -{ - fixed_t tx, ty, tz; - - tx = vec->x - viewx; - ty = viewz - vec->y; - tz = vec->z - viewy; - - // Just like wall projection. - vec->x = (tx * viewcos) - (tz * viewsin); - vec->z = (tz * viewcos) + (tx * viewsin); - vec->y = ty; -} - -// -// M_TranslateVec3f -// -// Translates the given vector (in the game's coordinate system) to the camera -// space (in right-handed coordinate system) This function is used for slopes. -// -void M_TranslateVec3f(v3float_t *vec) -{ - float tx, ty, tz; - - tx = vec->x - viewx; // SRB2CBTODO: This may need float viewxyz - ty = viewz - vec->y; - tz = vec->z - viewy; - - // Just like wall projection. - vec->x = (tx * viewcos) - (tz * viewsin); - vec->z = (tz * viewcos) + (tx * viewsin); - vec->y = ty; -} - -#ifdef SESLOPE -// -// M_TranslateVec3d -// -// Translates the given vector (in the game's coordinate system) to the camera -// space (in right-handed coordinate system) This function is used for slopes. -// -void M_TranslateVec3d(v3double_t *vec) -{ - double tx, ty, tz; - - tx = vec->x - viewx; // SRB2CBTODO: This may need float viewxyz - ty = viewz - vec->y; - tz = vec->z - viewy; - - // Just like wall projection. - vec->x = (tx * viewcos) - (tz * viewsin); - vec->z = (tz * viewcos) + (tx * viewsin); - vec->y = ty; -} -#endif - -// -// M_AddVec3 -// -// Adds v2 to v1 stores in dest -// -void M_AddVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) -{ - dest->x = v1->x + v2->x; - dest->y = v1->y + v2->y; - dest->z = v1->z + v2->z; -} - -// -// M_AddVec3f -// -// Adds v2 to v1 stores in dest -// -void M_AddVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) -{ - dest->x = v1->x + v2->x; - dest->y = v1->y + v2->y; - dest->z = v1->z + v2->z; -} - -// -// M_SubVec3 -// -// Adds v2 to v1 stores in dest -// -void M_SubVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) // SRB2CBTODO: Make a function that allows the destxyz to equal the change of 2 args -{ - dest->x = v1->x - v2->x; - dest->y = v1->y - v2->y; - dest->z = v1->z - v2->z; -} - -// -// M_SubVec3f -// -// Subtracts v2 from v1 stores in dest -// -void M_SubVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) -{ - dest->x = v1->x - v2->x; - dest->y = v1->y - v2->y; - dest->z = v1->z - v2->z; -} - -// -// M_DotVec3 -// -// Returns the dot product of v1 and v2 -// -fixed_t M_DotVec3(const v3fixed_t *v1, const v3fixed_t *v2) -{ - return FixedMul(v1->x, v2->x) + FixedMul(v1->y, v2->y) + FixedMul(v1->z, v2->z); -} - -// -// M_DotVec3f -// -// Returns the dot product of v1 and v2 -// -float M_DotVec3f(const v3float_t *v1, const v3float_t *v2) -{ - if (!v1 || !v2) - I_Error("M_DotVec3f: No vertexes!"); - return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); -} - -#ifdef SESLOPE -// -// M_DotVec3d -// -// Returns the dot product of v1 and v2 -// -double M_DotVec3d(const v3double_t *v1, const v3double_t *v2) -{ - return (v1->x * v2->x) + (v1->y * v2->y) + (v1->z * v2->z); -} -#endif - -// -// M_CrossProduct3 -// -// Gets the cross product of v1 and v2 and stores in dest -// -void M_CrossProduct3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2) -{ - v3fixed_t tmp; - tmp.x = (v1->y * v2->z) - (v1->z * v2->y); - tmp.y = (v1->z * v2->x) - (v1->x * v2->z); - tmp.z = (v1->x * v2->y) - (v1->y * v2->x); - memcpy(dest, &tmp, sizeof(v3fixed_t)); -} - -// -// M_CrossProduct3f -// -// Gets the cross product of v1 and v2 and stores in dest -// -void M_CrossProduct3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2) -{ - v3float_t tmp; - tmp.x = (v1->y * v2->z) - (v1->z * v2->y); - tmp.y = (v1->z * v2->x) - (v1->x * v2->z); - tmp.z = (v1->x * v2->y) - (v1->y * v2->x); - memcpy(dest, &tmp, sizeof(v3float_t)); -} - -fixed_t FV_Magnitude(const v3fixed_t *a_normal) -{ - fixed_t xs = FixedMul(a_normal->x,a_normal->x); - fixed_t ys = FixedMul(a_normal->y,a_normal->y); - fixed_t zs = FixedMul(a_normal->z,a_normal->z); - return FixedSqrt(xs+ys+zs); -} - -float FV_Magnitudef(const v3float_t *a_normal) -{ - float xs = (a_normal->x * a_normal->x); - float ys = (a_normal->y * a_normal->y); - float zs = (a_normal->z * a_normal->z); - return (float)sqrt(xs+ys+zs); -} - -// Vector Complex Math -v3fixed_t *FV_Midpoint(const v3fixed_t *a_1, const v3fixed_t *a_2, v3fixed_t *a_o) -{ - a_o->x = FixedDiv(a_2->x - a_1->x, 2*FRACUNIT); - a_o->y = FixedDiv(a_2->y - a_1->y, 2*FRACUNIT); - a_o->z = FixedDiv(a_2->z - a_1->z, 2*FRACUNIT); - a_o->x = a_1->x + a_o->x; - a_o->y = a_1->y + a_o->y; - a_o->z = a_1->z + a_o->z; - return a_o; -} - -fixed_t FV_Distance(const v3fixed_t *p1, const v3fixed_t *p2) -{ - fixed_t xs = FixedMul(p2->x-p1->x,p2->x-p1->x); - fixed_t ys = FixedMul(p2->y-p1->y,p2->y-p1->y); - fixed_t zs = FixedMul(p2->z-p1->z,p2->z-p1->z); - return FixedSqrt(xs+ys+zs); -} - -v3float_t *FV_Midpointf(const v3float_t *a_1, const v3float_t *a_2, v3float_t *a_o) -{ - a_o->x = (a_2->x - a_1->x / 2.0f); - a_o->y = (a_2->y - a_1->y / 2.0f); - a_o->z = (a_2->z - a_1->z / 2.0f); - a_o->x = a_1->x + a_o->x; - a_o->y = a_1->y + a_o->y; - a_o->z = a_1->z + a_o->z; - return a_o; -} - - - -// -// AngleBetweenVectors -// -// This checks to see if a point is inside the ranges of a polygon -// -angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector2) -{ - // Remember, above we said that the Dot Product of returns the cosine of the angle - // between 2 vectors? Well, that is assuming they are unit vectors (normalize vectors). - // So, if we don't have a unit vector, then instead of just saying arcCos(DotProduct(A, B)) - // We need to divide the dot product by the magnitude of the 2 vectors multiplied by each other. - // Here is the equation: arc cosine of (V . W / || V || * || W || ) - // the || V || means the magnitude of V. This then cancels out the magnitudes dot product magnitudes. - // But basically, if you have normalize vectors already, you can forget about the magnitude part. - - // Get the dot product of the vectors - fixed_t dotProduct = M_DotVec3(Vector1, Vector2); - - // Get the product of both of the vectors magnitudes - fixed_t vectorsMagnitude = FixedMul(FV_Magnitude(Vector1), FV_Magnitude(Vector2)); - - // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. - return 0;//ALFALFA FixedAcos(FixedDiv(dotProduct, vectorsMagnitude)); -} - -float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2) -{ - // Remember, above we said that the Dot Product of returns the cosine of the angle - // between 2 vectors? Well, that is assuming they are unit vectors (normalize vectors). - // So, if we don't have a unit vector, then instead of just saying arcCos(DotProduct(A, B)) - // We need to divide the dot product by the magnitude of the 2 vectors multiplied by each other. - // Here is the equation: arc cosine of (V . W / || V || * || W || ) - // the || V || means the magnitude of V. This then cancels out the magnitudes dot product magnitudes. - // But basically, if you have normalize vectors already, you can forget about the magnitude part. - - // Get the dot product of the vectors - float dotProduct = M_DotVec3f(Vector1, Vector2); - - // Get the product of both of the vectors magnitudes - float vectorsMagnitude = FV_Magnitudef(Vector1)*FV_Magnitudef(Vector2); - - // Return the arc cosine of the (dotProduct / vectorsMagnitude) which is the angle in RADIANS. - return acos(dotProduct/vectorsMagnitude); -} - - - -// Crazy physics code - -float M_VectorYaw(v3float_t v) -{ - return atan2(v.x, v.z); -} -float M_VectorPitch(v3float_t v) -{ - return -atan2(v.y, sqrt(v.x*v.x+v.z*v.z)); -} - -#include "z_zone.h" - -// Returns pitch roll and yaw values, allows objects to align to a slope -angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byte AngleAxis, float Rate) -{ - CONS_Printf("P %f\n", Pitch); - CONS_Printf("R %f\n", Roll); - CONS_Printf("Y %f\n", Yaw); - if (AngleAxis == 1) - { - float DestYaw = (atan2(v.z,v.x)* 180 / M_PI); - float DestRoll = (atan2(v.y,v.x)* 180 / M_PI); - - Yaw = Yaw+(DestYaw-Yaw)*Rate; - Roll = Roll+(DestRoll-Roll)*Rate; - } - else if (AngleAxis == 2) - { - float DestPitch = (atan2(v.z,v.y)* 180 / M_PI); - float DestRoll = (-atan2(v.x,v.y)* 180 / M_PI); - - Pitch = Pitch+(DestPitch-Pitch)*Rate; - Roll = Roll+(DestRoll-Roll)*Rate; - } - else if (AngleAxis == 3) - { - float DestPitch = (-atan2(v.y,v.z)* 180 / M_PI); - float DestYaw = (-atan2(v.x,v.z)* 180 / M_PI); - - Pitch = Pitch+(DestPitch-Pitch)*Rate; - Yaw = Yaw+(DestYaw-Yaw)*Rate; - } - - angles3d_t *returnangles = Z_Malloc(sizeof(angles3d_t), PU_LEVEL, NULL); - memset(returnangles, 0, sizeof(*returnangles)); - returnangles->yaw = Yaw; - returnangles->pitch = Pitch; - returnangles->roll = Roll; - - return returnangles; - -} - -// -// RotateVector -// -// Rotates a vector around another vector -// -void M_VecRotate(v3fixed_t *rotVec, const v3fixed_t *axisVec, const angle_t angle) -{ - // Rotate the point (x,y,z) around the vector (u,v,w) - fixed_t ux = FixedMul(axisVec->x, rotVec->x); - fixed_t uy = FixedMul(axisVec->x, rotVec->y); - fixed_t uz = FixedMul(axisVec->x, rotVec->z); - fixed_t vx = FixedMul(axisVec->y, rotVec->x); - fixed_t vy = FixedMul(axisVec->y, rotVec->y); - fixed_t vz = FixedMul(axisVec->y, rotVec->z); - fixed_t wx = FixedMul(axisVec->z, rotVec->x); - fixed_t wy = FixedMul(axisVec->z, rotVec->y); - fixed_t wz = FixedMul(axisVec->z, rotVec->z); - fixed_t sa = FINESINE(angle>>ANGLETOFINESHIFT); - fixed_t ca = FINECOSINE(angle>>ANGLETOFINESHIFT); - fixed_t ua = ux+vy+wz; - fixed_t ax = FixedMul(axisVec->x,ua); - fixed_t ay = FixedMul(axisVec->y,ua); - fixed_t az = FixedMul(axisVec->z,ua); - fixed_t xs = FixedMul(axisVec->x,axisVec->x); - fixed_t ys = FixedMul(axisVec->y,axisVec->y); - fixed_t zs = FixedMul(axisVec->z,axisVec->z); - fixed_t bx = FixedMul(rotVec->x,ys+zs); - fixed_t by = FixedMul(rotVec->y,xs+zs); - fixed_t bz = FixedMul(rotVec->z,xs+ys); - fixed_t cx = FixedMul(axisVec->x,vy+wz); - fixed_t cy = FixedMul(axisVec->y,ux+wz); - fixed_t cz = FixedMul(axisVec->z,ux+vy); - fixed_t dx = FixedMul(bx-cx, ca); - fixed_t dy = FixedMul(by-cy, ca); - fixed_t dz = FixedMul(bz-cz, ca); - fixed_t ex = FixedMul(vz-wy, sa); - fixed_t ey = FixedMul(wx-uz, sa); - fixed_t ez = FixedMul(uy-vx, sa); - - rotVec->x = ax+dx+ex; - rotVec->y = ay+dy+ey; - rotVec->z = az+dz+ez; -} - - - - - -#if 0 // Backport -v3fixed_t *FV_SubO(const v3fixed_t *a_i, const v3fixed_t *a_c, v3fixed_t *a_o) -{ - a_o->x = a_i->x - a_c->x; - a_o->y = a_i->y - a_c->y; - a_o->z = a_i->z - a_c->z; - return a_o; -} - -boolean FV_Equal(const v3fixed_t *a_1, const v3fixed_t *a_2) -{ - fixed_t Epsilon = FRACUNIT/FRACUNIT; - - if ((abs(a_2->x - a_1->x) > Epsilon) || - (abs(a_2->y - a_1->y) > Epsilon) || - (abs(a_2->z - a_1->z) > Epsilon)) - { - return true; - } - - return false; -} - -boolean FV_Equalf(const v3float_t *a_1, const v3float_t *a_2) -{ - float Epsilon = 1.0f/1.0f; - - if ((abs(a_2->x - a_1->x) > Epsilon) || - (abs(a_2->y - a_1->y) > Epsilon) || - (abs(a_2->z - a_1->z) > Epsilon)) - { - return true; - } - - return false; -} - -// -// Normal -// -// Calculates the normal of a polygon. -// -void FV_Normal (const v3fixed_t *a_triangle, v3fixed_t *a_normal) -{ - v3fixed_t a_1; - v3fixed_t a_2; - - FV_Point2Vec(&a_triangle[2], &a_triangle[0], &a_1); - FV_Point2Vec(&a_triangle[1], &a_triangle[0], &a_2); - - FV_Cross(&a_1, &a_2, a_normal); - - FV_NormalizeO(a_normal, a_normal); -} - -// -// PlaneDistance -// -// Calculates distance between a plane and the origin. -// -fixed_t FV_PlaneDistance(const v3fixed_t *a_normal, const v3fixed_t *a_point) -{ - return -(FixedMul(a_normal->x, a_point->x) + FixedMul(a_normal->y, a_point->y) + FixedMul(a_normal->z, a_point->z)); -} - -boolean FV_IntersectedPlane(const v3fixed_t *a_triangle, const v3fixed_t *a_line, v3fixed_t *a_normal, fixed_t *originDistance) -{ - fixed_t distance1 = 0, distance2 = 0; - - FV_Normal(a_triangle, a_normal); - - *originDistance = FV_PlaneDistance(a_normal, &a_triangle[0]); - - distance1 = (FixedMul(a_normal->x, a_line[0].x) + FixedMul(a_normal->y, a_line[0].y) - + FixedMul(a_normal->z, a_line[0].z)) + *originDistance; - - distance2 = (FixedMul(a_normal->x, a_line[1].x) + FixedMul(a_normal->y, a_line[1].y) - + FixedMul(a_normal->z, a_line[1].z)) + *originDistance; - - // Positive or zero number means no intersection - if (FixedMul(distance1, distance2) >= 0) - return false; - - return true; -} - -// -// PlaneIntersection -// -// Returns the distance from -// rOrigin to where the ray -// intersects the plane. Assumes -// you already know it intersects -// the plane. -// -fixed_t FV_PlaneIntersection(const v3fixed_t *pOrigin, const v3fixed_t *pNormal, const v3fixed_t *rOrigin, const v3fixed_t *rVector) -{ - fixed_t d = -(FV_Dot(pNormal, pOrigin)); - fixed_t number = FV_Dot(pNormal,rOrigin) + d; - fixed_t denom = FV_Dot(pNormal,rVector); - return -FixedDiv(number, denom); -} - -// -// IntersectRaySphere -// Input : rO - origin of ray in world space -// rV - vector describing direction of ray in world space -// sO - Origin of sphere -// sR - radius of sphere -// Notes : Normalized directional vectors expected -// Return: distance to sphere in world units, -1 if no intersection. -// -fixed_t FV_IntersectRaySphere(const v3fixed_t *rO, const v3fixed_t *rV, const v3fixed_t *sO, fixed_t sR) -{ - v3fixed_t Q; - fixed_t c, v, d; - FV_SubO(sO, rO, &Q); - - c = FV_Magnitude(&Q); - v = FV_Dot(&Q, rV); - d = FixedMul(sR, sR) - (FixedMul(c,c) - FixedMul(v,v)); - - // If there was no intersection, return -1 - if (d < 0*FRACUNIT) - return (-1*FRACUNIT); - - // Return the distance to the [first] intersecting point - return (v - FixedSqrt(d)); -} - -// -// IntersectionPoint -// -// This returns the intersection point of the line that intersects the plane -// -v3fixed_t *FV_IntersectionPoint(const v3fixed_t *vNormal, const v3fixed_t *vLine, fixed_t distance, v3fixed_t *ReturnVec) -{ - v3fixed_t vLineDir; // Variables to hold the point and the line's direction - fixed_t Numerator = 0, Denominator = 0, dist = 0; - - // Here comes the confusing part. We need to find the 3D point that is actually - // on the plane. Here are some steps to do that: - - // 1) First we need to get the vector of our line, Then normalize it so it's a length of 1 - FV_Point2Vec(&vLine[1], &vLine[0], &vLineDir); // Get the Vector of the line - FV_NormalizeO(&vLineDir, &vLineDir); // Normalize the lines vector - - - // 2) Use the plane equation (distance = Ax + By + Cz + D) to find the distance from one of our points to the plane. - // Here I just chose a arbitrary point as the point to find that distance. You notice we negate that - // distance. We negate the distance because we want to eventually go BACKWARDS from our point to the plane. - // By doing this is will basically bring us back to the plane to find our intersection point. - Numerator = - (FixedMul(vNormal->x, vLine[0].x) + // Use the plane equation with the normal and the line - FixedMul(vNormal->y, vLine[0].y) + - FixedMul(vNormal->z, vLine[0].z) + distance); - - // 3) If we take the dot product between our line vector and the normal of the polygon, - // this will give us the cosine of the angle between the 2 (since they are both normalized - length 1). - // We will then divide our Numerator by this value to find the offset towards the plane from our arbitrary point. - Denominator = FV_Dot(vNormal, &vLineDir); // Get the dot product of the line's vector and the normal of the plane - - // Since we are using division, we need to make sure we don't get a divide by zero error - // If we do get a 0, that means that there are INFINITE points because the the line is - // on the plane (the normal is perpendicular to the line - (Normal.Vector = 0)). - // In this case, we should just return any point on the line. - - if( Denominator == 0*FRACUNIT) // Check so we don't divide by zero - { - ReturnVec->x = vLine[0].x; - ReturnVec->y = vLine[0].y; - ReturnVec->z = vLine[0].z; - return ReturnVec; // Return an arbitrary point on the line - } - - // We divide the (distance from the point to the plane) by (the dot product) - // to get the distance (dist) that we need to move from our arbitrary point. We need - // to then times this distance (dist) by our line's vector (direction). When you times - // a scalar (single number) by a vector you move along that vector. That is what we are - // doing. We are moving from our arbitrary point we chose from the line BACK to the plane - // along the lines vector. It seems logical to just get the numerator, which is the distance - // from the point to the line, and then just move back that much along the line's vector. - // Well, the distance from the plane means the SHORTEST distance. What about in the case that - // the line is almost parallel with the polygon, but doesn't actually intersect it until half - // way down the line's length. The distance from the plane is short, but the distance from - // the actual intersection point is pretty long. If we divide the distance by the dot product - // of our line vector and the normal of the plane, we get the correct length. Cool huh? - - dist = FixedDiv(Numerator, Denominator); // Divide to get the multiplying (percentage) factor - - // Now, like we said above, we times the dist by the vector, then add our arbitrary point. - // This essentially moves the point along the vector to a certain distance. This now gives - // us the intersection point. Yay! - - // Return the intersection point - ReturnVec->x = vLine[0].x + FixedMul(vLineDir.x, dist); - ReturnVec->y = vLine[0].y + FixedMul(vLineDir.y, dist); - ReturnVec->z = vLine[0].z + FixedMul(vLineDir.z, dist); - return ReturnVec; -} - -// -// PointOnLineSide -// -// If on the front side of the line, returns 1. -// If on the back side of the line, returns 0. -// 2D only. -// -unsigned int FV_PointOnLineSide(const v3fixed_t *point, const v3fixed_t *line) -{ - fixed_t s1 = FixedMul((point->y - line[0].y),(line[1].x - line[0].x)); - fixed_t s2 = FixedMul((point->x - line[0].x),(line[1].y - line[0].y)); - return s1 - s2 < 0; -} - -// -// PointInsideBox -// -// Given four points of a box, -// determines if the supplied point is -// inside the box or not. -// -boolean FV_PointInsideBox(const v3fixed_t *point, const v3fixed_t *box) -{ - v3fixed_t lastLine[2]; - - FV_Load(&lastLine[0], box[3].x, box[3].y, box[3].z); - FV_Load(&lastLine[1], box[0].x, box[0].y, box[0].z); - - if (FV_PointOnLineSide(point, &box[0]) - || FV_PointOnLineSide(point, &box[1]) - || FV_PointOnLineSide(point, &box[2]) - || FV_PointOnLineSide(point, lastLine)) - return false; - - return true; -} -// -// LoadIdentity -// -// Loads the identity matrix into a matrix -// -void FM_LoadIdentity(fmatrix_t* matrix) -{ -#define M(row,col) matrix->m[col * 4 + row] - memset(matrix, 0x00, sizeof(fmatrix_t)); - - M(0, 0) = FRACUNIT; - M(1, 1) = FRACUNIT; - M(2, 2) = FRACUNIT; - M(3, 3) = FRACUNIT; -#undef M -} - -// -// CreateObjectMatrix -// -// Creates a matrix that can be used for -// adjusting the position of an object -// -void FM_CreateObjectMatrix(fmatrix_t *matrix, fixed_t x, fixed_t y, fixed_t z, fixed_t anglex, fixed_t angley, fixed_t anglez, fixed_t upx, fixed_t upy, fixed_t upz, fixed_t radius) -{ - v3fixed_t upcross; - v3fixed_t upvec; - v3fixed_t basevec; - - FV_Load(&upvec, upx, upy, upz); - FV_Load(&basevec, anglex, angley, anglez); - FV_Cross(&upvec, &basevec, &upcross); - FV_Normalize(&upcross); - - FM_LoadIdentity(matrix); - - matrix->m[0] = upcross.x; - matrix->m[1] = upcross.y; - matrix->m[2] = upcross.z; - matrix->m[3] = 0*FRACUNIT; - - matrix->m[4] = upx; - matrix->m[5] = upy; - matrix->m[6] = upz; - matrix->m[7] = 0; - - matrix->m[8] = anglex; - matrix->m[9] = angley; - matrix->m[10] = anglez; - matrix->m[11] = 0; - - matrix->m[12] = x - FixedMul(upx,radius); - matrix->m[13] = y - FixedMul(upy,radius); - matrix->m[14] = z - FixedMul(upz,radius); - matrix->m[15] = FRACUNIT; -} - -// -// MultMatrixVec -// -// Multiplies a vector by the specified matrix -// -void FM_MultMatrixVec(const fmatrix_t *matrix, const v3fixed_t *vec, v3fixed_t *out) -{ -#define M(row,col) matrix->m[col * 4 + row] - out->x = FixedMul(vec->x,M(0, 0)) - + FixedMul(vec->y,M(0, 1)) - + FixedMul(vec->z,M(0, 2)) - + M(0, 3); - - out->y = FixedMul(vec->x,M(1, 0)) - + FixedMul(vec->y,M(1, 1)) - + FixedMul(vec->z,M(1, 2)) - + M(1, 3); - - out->z = FixedMul(vec->x,M(2, 0)) - + FixedMul(vec->y,M(2, 1)) - + FixedMul(vec->z,M(2, 2)) - + M(2, 3); -#undef M -} - -// -// MultMatrix -// -// Multiples one matrix into another -// -void FM_MultMatrix(fmatrix_t *dest, const fmatrix_t *multme) -{ - fmatrix_t result; - unsigned int i, j; -#define M(row,col) multme->m[col * 4 + row] -#define D(row,col) dest->m[col * 4 + row] -#define R(row,col) result.m[col * 4 + row] - - for (i = 0; i < 4; i++) - { - for (j = 0; j < 4; j++) - R(i, j) = FixedMul(D(i, 0),M(0, j)) + FixedMul(D(i, 1),M(1, j)) + FixedMul(D(i, 2),M(2, j)) + FixedMul(D(i, 3),M(3, j)); - } - - M_Memcpy(dest, &result, sizeof(fmatrix_t)); - -#undef R -#undef D -#undef M -} - -// -// Translate -// -// Translates a matrix -// -void FM_Translate(fmatrix_t *dest, fixed_t x, fixed_t y, fixed_t z) -{ - fmatrix_t trans; -#define M(row,col) trans.m[col * 4 + row] - - memset(&trans, 0x00, sizeof(fmatrix_t)); - - M(0, 0) = M(1, 1) = M(2, 2) = M(3, 3) = FRACUNIT; - M(0, 3) = x; - M(1, 3) = y; - M(2, 3) = z; - - FM_MultMatrix(dest, &trans); -#undef M -} - -// -// Scale -// -// Scales a matrix -// -void FM_Scale(fmatrix_t *dest, fixed_t x, fixed_t y, fixed_t z) -{ - fmatrix_t scale; -#define M(row,col) scale.m[col * 4 + row] - - memset(&scale, 0x00, sizeof(fmatrix_t)); - - M(3, 3) = FRACUNIT; - M(0, 0) = x; - M(1, 1) = y; - M(2, 2) = z; - - FM_MultMatrix(dest, &scale); -#undef M -} - - -v3fixed_t *FV_Cross(const v3fixed_t *a_1, const v3fixed_t *a_2, v3fixed_t *a_o) -{ - a_o->x = FixedMul(a_1->y, a_2->z) - FixedMul(a_1->z, a_2->y); - a_o->y = FixedMul(a_1->z, a_2->x) - FixedMul(a_1->x, a_2->z); - a_o->z = FixedMul(a_1->x, a_2->y) - FixedMul(a_1->y, a_2->x); - return a_o; -} - -// -// ClosestPointOnLine -// -// Finds the point on a line closest -// to the specified point. -// -v3fixed_t *FV_ClosestPointOnLine(const v3fixed_t *Line, const v3fixed_t *p, v3fixed_t *out) -{ - // Determine t (the length of the vector from √´Line[0]√≠ to √´p√≠) - v3fixed_t c, V; - fixed_t t, d = 0; - FV_SubO(p, &Line[0], &c); - FV_SubO(&Line[1], &Line[0], &V); - FV_NormalizeO(&V, &V); - - d = FV_Distance(&Line[0], &Line[1]); - t = FV_Dot(&V, &c); - - // Check to see if √´t√≠ is beyond the extents of the line segment - if (t < 0) - { - return FV_Copy(out, &Line[0]); - } - if (t > d) - { - return FV_Copy(out, &Line[1]); - } - - // Return the point between √´Line[0]√≠ and √´Line[1]√≠ - FV_Mul(&V, t); - - return FV_AddO(&Line[0], &V, out); -} - -// -// ClosestPointOnTriangle -// -// Given a triangle and a point, -// the closest point on the edge of -// the triangle is returned. -// -void FV_ClosestPointOnTriangle (const v3fixed_t *tri, const v3fixed_t *point, v3fixed_t *result) -{ - unsigned int i; - fixed_t dist, closestdist; - v3fixed_t EdgePoints[3]; - v3fixed_t Line[2]; - - FV_Copy(&Line[0], (v3fixed_t*)&tri[0]); - FV_Copy(&Line[1], (v3fixed_t*)&tri[1]); - FV_ClosestPointOnLine(Line, point, &EdgePoints[0]); - - FV_Copy(&Line[0], (v3fixed_t*)&tri[1]); - FV_Copy(&Line[1], (v3fixed_t*)&tri[2]); - FV_ClosestPointOnLine(Line, point, &EdgePoints[1]); - - FV_Copy(&Line[0], (v3fixed_t*)&tri[2]); - FV_Copy(&Line[1], (v3fixed_t*)&tri[0]); - FV_ClosestPointOnLine(Line, point, &EdgePoints[2]); - - // Find the closest one of the three - FV_Copy(result, &EdgePoints[0]); - closestdist = FV_Distance(point, &EdgePoints[0]); - for (i = 1; i < 3; i++) - { - dist = FV_Distance(point, &EdgePoints[i]); - - if (dist < closestdist) - { - closestdist = dist; - FV_Copy(result, &EdgePoints[i]); - } - } - - // We now have the closest point! Whee! -} - -// -// InsidePolygon -// -// This checks to see if a point is inside the ranges of a polygon -// -boolean FV_InsidePolygon(const fvector_t *vIntersection, const fvector_t *Poly, const int vertexCount) -{ - int i; - UINT64 Angle = 0; // Initialize the angle - fvector_t vA, vB; // Create temp vectors - - // Just because we intersected the plane, doesn't mean we were anywhere near the polygon. - // This functions checks our intersection point to make sure it is inside of the polygon. - // This is another tough function to grasp at first, but let me try and explain. - // It's a brilliant method really, what it does is create triangles within the polygon - // from the intersection point. It then adds up the inner angle of each of those triangles. - // If the angles together add up to 360 degrees (or 2 * PI in radians) then we are inside! - // If the angle is under that value, we must be outside of polygon. To further - // understand why this works, take a pencil and draw a perfect triangle. Draw a dot in - // the middle of the triangle. Now, from that dot, draw a line to each of the vertices. - // Now, we have 3 triangles within that triangle right? Now, we know that if we add up - // all of the angles in a triangle we get 360 right? Well, that is kinda what we are doing, - // but the inverse of that. Say your triangle is an isosceles triangle, so add up the angles - // and you will get 360 degree angles. 90 + 90 + 90 is 360. - - for (i = 0; i < vertexCount; i++) // Go in a circle to each vertex and get the angle between - { - FV_Point2Vec(&Poly[i], vIntersection, &vA); // Subtract the intersection point from the current vertex - // Subtract the point from the next vertex - FV_Point2Vec(&Poly[(i + 1) % vertexCount], vIntersection, &vB); - - Angle += FV_AngleBetweenVectors(&vA, &vB); // Find the angle between the 2 vectors and add them all up as we go along - } - - // Now that we have the total angles added up, we need to check if they add up to 360 degrees. - // Since we are using the dot product, we are working in radians, so we check if the angles - // equals 2*PI. We defined PI in 3DMath.h. You will notice that we use a MATCH_FACTOR - // in conjunction with our desired degree. This is because of the inaccuracy when working - // with floating point numbers. It usually won't always be perfectly 2 * PI, so we need - // to use a little twiddling. I use .9999, but you can change this to fit your own desired accuracy. - - if(Angle >= ANGLE_MAX) // If the angle is greater than 2 PI, (360 degrees) - return 1; // The point is inside of the polygon - - return 0; // If you get here, it obviously wasn't inside the polygon. -} - -// -// IntersectedPolygon -// -// This checks if a line is intersecting a polygon -// -boolean FV_IntersectedPolygon(const fvector_t *vPoly, const fvector_t *vLine, const int vertexCount, fvector_t *collisionPoint) -{ - fvector_t vNormal, vIntersection; - fixed_t originDistance = 0*FRACUNIT; - - - // First we check to see if our line intersected the plane. If this isn't true - // there is no need to go on, so return false immediately. - // We pass in address of vNormal and originDistance so we only calculate it once - - if(!FV_IntersectedPlane(vPoly, vLine, &vNormal, &originDistance)) - return false; - - // Now that we have our normal and distance passed back from IntersectedPlane(), - // we can use it to calculate the intersection point. The intersection point - // is the point that actually is ON the plane. It is between the line. We need - // this point test next, if we are inside the polygon. To get the I-Point, we - // give our function the normal of the plane, the points of the line, and the originDistance. - - FV_IntersectionPoint(&vNormal, vLine, originDistance, &vIntersection); - - // Now that we have the intersection point, we need to test if it's inside the polygon. - // To do this, we pass in : - // (our intersection point, the polygon, and the number of vertices our polygon has) - - if(FV_InsidePolygon(&vIntersection, vPoly, vertexCount)) - { - if (collisionPoint != NULL) // Optional - load the collision point. - { - collisionPoint->x = vIntersection.x; - collisionPoint->y = vIntersection.y; - collisionPoint->z = vIntersection.z; - } - return true; // We collided! - } - - // If we get here, we must have NOT collided - return false; -} - -void FM_Rotate(fmatrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z) -{ -#define M(row,col) dest->m[row * 4 + col] - const fixed_t sinA = FINESINE(angle>>ANGLETOFINESHIFT); - const fixed_t cosA = FINECOSINE(angle>>ANGLETOFINESHIFT); - const fixed_t invCosA = FRACUNIT - cosA; - fvector_t nrm = {x, y, z}; - fixed_t xSq, ySq, zSq; - fixed_t sx, sy, sz; - fixed_t sxy, sxz, syz; - - FV_Normalize(&nrm); - - x = nrm.x; - y = nrm.y; - z = nrm.z; - - xSq = FixedMul(x, FixedMul(invCosA,x)); - ySq = FixedMul(y, FixedMul(invCosA,y)); - zSq = FixedMul(z, FixedMul(invCosA,z)); - - sx = FixedMul(sinA, x); - sy = FixedMul(sinA, y); - sz = FixedMul(sinA, z); - - sxy = FixedMul(x, FixedMul(invCosA,y)); - sxz = FixedMul(x, FixedMul(invCosA,z)); - syz = FixedMul(y, FixedMul(invCosA,z)); - - - M(0, 0) = xSq + cosA; - M(1, 0) = sxy - sz; - M(2, 0) = sxz + sy; - M(3, 0) = 0; - - M(0, 1) = sxy + sz; - M(1, 1) = ySq + cosA; - M(2, 1) = syz - sx; - M(3, 1) = 0; - - M(0, 2) = sxz - sy; - M(1, 2) = syz + sx; - M(2, 2) = zSq + cosA; - M(3, 2) = 0; - - M(0, 3) = 0; - M(1, 3) = 0; - M(2, 3) = 0; - M(3, 3) = FRACUNIT; -#undef M -} - -#endif - - - - -float FV_Distancef(const v3float_t *p1, const v3float_t *p2) -{ - float xs = (p2->x-p1->x * p2->x-p1->x); - float ys = (p2->y-p1->y * p2->y-p1->y); - float zs = (p2->z-p1->z * p2->z-p1->z); - return sqrt(xs+ys+zs); -} - -// Also returns the magnitude -fixed_t FV_NormalizeO(const v3fixed_t *a_normal, v3fixed_t *a_o) -{ - fixed_t magnitude = FV_Magnitude(a_normal); - a_o->x = FixedDiv(a_normal->x, magnitude); - a_o->y = FixedDiv(a_normal->y, magnitude); - a_o->z = FixedDiv(a_normal->z, magnitude); - return magnitude; -} - -// Also returns the magnitude -float FV_NormalizeOf(const v3float_t *a_normal, v3float_t *a_o) -{ - float magnitude = FV_Magnitudef(a_normal); - a_o->x = (a_normal->x/magnitude); - a_o->y = (a_normal->y/magnitude); - a_o->z = (a_normal->z/magnitude); - return magnitude; -} - -fixed_t FV_Normalize(v3fixed_t *a_normal) -{ - return FV_NormalizeO(a_normal, a_normal); -} - -fixed_t FV_Normalizef(v3float_t *a_normal) -{ - return FV_NormalizeOf(a_normal, a_normal); -} - -// -// FV_Normalf -// -// Calculates the normal of a polygon. -// -void FV_Normal(const v3fixed_t *a_triangle, v3fixed_t *a_normal) -{ - v3fixed_t a_1; - v3fixed_t a_2; - - M_MakeVec3(&a_triangle[2], &a_triangle[0], &a_1); - M_MakeVec3(&a_triangle[1], &a_triangle[0], &a_2); - - M_CrossProduct3(&a_1, &a_2, a_normal); - - FV_NormalizeO(a_normal, a_normal); -} - -// -// FV_Normalf -// -// Calculates the normal of a polygon. -// -void FV_Normalf(const v3float_t *a_triangle, v3float_t *a_normal) -{ - v3float_t a_1; - v3float_t a_2; - - M_MakeVec3f(&a_triangle[2], &a_triangle[0], &a_1); - M_MakeVec3f(&a_triangle[1], &a_triangle[0], &a_2); - - M_CrossProduct3f(&a_1, &a_2, a_normal); - - FV_NormalizeOf(a_normal, a_normal); -} - - -// EOF -#endif // #ifdef ESLOPE - -#endif diff --git a/src/m_vector.h b/src/m_vector.h deleted file mode 100644 index a2be3a7de..000000000 --- a/src/m_vector.h +++ /dev/null @@ -1,125 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2004 Stephen McGranahan -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//-------------------------------------------------------------------------- -// -// DESCRIPTION: -// Vectors -// SoM created 05/18/09 -// -//----------------------------------------------------------------------------- - -#ifndef M_VECTOR_H__ -#define M_VECTOR_H__ - -#if 0 //#ifdef ESLOPE - -#include "m_fixed.h" -#include "tables.h" - -#define TWOPI M_PI*2.0 -#define HALFPI M_PI*0.5 -#define QUARTERPI M_PI*0.25 -#define EPSILON 0.000001f -#define OMEGA 10000000.0f - -typedef struct -{ - fixed_t x, y, z; -} v3fixed_t; - -typedef struct -{ - fixed_t x, y; -} v2fixed_t; - -typedef struct -{ - float x, y, z; -} v3float_t; - -typedef struct -{ - float yaw, pitch, roll; -} angles3d_t; - -typedef struct -{ - double x, y, z; -} v3double_t; - -typedef struct -{ - float x, y; -} v2float_t; - - -v3fixed_t *M_MakeVec3(const v3fixed_t *point1, const v3fixed_t *point2, v3fixed_t *a_o); -v3float_t *M_MakeVec3f(const v3float_t *point1, const v3float_t *point2, v3float_t *a_o); -void M_TranslateVec3(v3fixed_t *vec); -void M_TranslateVec3f(v3float_t *vec); -void M_AddVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2); -void M_AddVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2); -void M_SubVec3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2); -void M_SubVec3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2); -fixed_t M_DotVec3(const v3fixed_t *v1, const v3fixed_t *v2); -float M_DotVec3f(const v3float_t *v1, const v3float_t *v2); - -#ifdef SESLOPE -v3double_t *M_MakeVec3d(const v3double_t *point1, const v3double_t *point2, v3double_t *a_o); -double M_DotVec3d(const v3double_t *v1, const v3double_t *v2); -void M_TranslateVec3d(v3double_t *vec); -#endif - -void M_CrossProduct3(v3fixed_t *dest, const v3fixed_t *v1, const v3fixed_t *v2); -void M_CrossProduct3f(v3float_t *dest, const v3float_t *v1, const v3float_t *v2); -fixed_t FV_Magnitude(const v3fixed_t *a_normal); -float FV_Magnitudef(const v3float_t *a_normal); -fixed_t FV_NormalizeO(const v3fixed_t *a_normal, v3fixed_t *a_o); -float FV_NormalizeOf(const v3float_t *a_normal, v3float_t *a_o); -fixed_t FV_Normalize(v3fixed_t *a_normal); -fixed_t FV_Normalizef(v3float_t *a_normal); -void FV_Normal(const v3fixed_t *a_triangle, v3fixed_t *a_normal); -void FV_Normalf(const v3float_t *a_triangle, v3float_t *a_normal); -v3fixed_t *M_LoadVec(v3fixed_t *vec, fixed_t x, fixed_t y, fixed_t z); -v3fixed_t *M_CopyVec(v3fixed_t *a_o, const v3fixed_t *a_i); -v3float_t *M_LoadVecf(v3float_t *vec, float x, float y, float z); -v3float_t *M_CopyVecf(v3float_t *a_o, const v3float_t *a_i); -v3fixed_t *FV_Midpoint(const v3fixed_t *a_1, const v3fixed_t *a_2, v3fixed_t *a_o); -fixed_t FV_Distance(const v3fixed_t *p1, const v3fixed_t *p2); -v3float_t *FV_Midpointf(const v3float_t *a_1, const v3float_t *a_2, v3float_t *a_o); -angle_t FV_AngleBetweenVectors(const v3fixed_t *Vector1, const v3fixed_t *Vector2); -float FV_AngleBetweenVectorsf(const v3float_t *Vector1, const v3float_t *Vector2); -float FV_Distancef(const v3float_t *p1, const v3float_t *p2); - - -// Kalaron: something crazy, vector physics -float M_VectorYaw(v3float_t v); -float M_VectorPitch(v3float_t v); -angles3d_t *M_VectorAlignTo(float Pitch, float Yaw, float Roll, v3float_t v, byte AngleAxis, float Rate); - -void M_VecRotate(v3fixed_t *rotVec, const v3fixed_t *axisVec, const angle_t angle); - - - -#endif - -// EOF -#endif // #ifdef ESLOPE - From 485f671f23a27526e4ad89ff559ec1e842dcd12d Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 23 May 2015 02:18:32 -0500 Subject: [PATCH 069/364] Sloped planes now respect flat offsets --- src/r_plane.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index 1c4abc8c5..aad98364d 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -437,6 +437,9 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, visplane_t *check; unsigned hash; +#ifdef ESLOPE + if (slope); else // Don't mess with this right now if a slope is involved +#endif if (plangle != 0) { // Add the view offset, rotated by the plane angle. @@ -946,8 +949,8 @@ void R_DrawSinglePlane(visplane_t *pl) //double zeroheight; float fudge; - float vx = FIXED_TO_FLOAT(viewx); - float vy = FIXED_TO_FLOAT(viewy); + float vx = FIXED_TO_FLOAT(viewx+xoffs); + float vy = FIXED_TO_FLOAT(viewy-yoffs); float vz = FIXED_TO_FLOAT(viewz); zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); @@ -960,7 +963,7 @@ void R_DrawSinglePlane(visplane_t *pl) ang = ANG2RAD(ANGLE_270 - viewangle); p.x = vx * cos(ang) - vy * sin(ang); p.z = vx * sin(ang) + vy * cos(ang); - p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, 0, 0)) - vz; + p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, -xoffs, yoffs)) - vz; // m is the v direction vector in view space ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle); From b121bcca683066bb36316b791383b446722c7832 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 23 May 2015 12:23:24 -0500 Subject: [PATCH 070/364] Remove P_GetZAtf (it didn't seem to work right anyway) --- src/p_slopes.c | 14 -------------- src/p_slopes.h | 5 ----- 2 files changed, 19 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index a1bfb01c3..ed9623e08 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -772,21 +772,7 @@ fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y) return slope->o.z + FixedMul(dist, slope->zdelta); } -#ifdef SPRINGCLEAN -// -// P_GetZAtf -// -// Returns the height of the sloped plane at (x, y) as a float -// -float P_GetZAtf(pslope_t *slope, float x, float y) -{ - //if (!slope) // SRB2CBTODO: keep this when done with debugging - // I_Error("P_GetZAtf: slope parameter is NULL"); - float dist = (x - slope->of.x) * slope->df.x + (y - slope->of.y) * slope->df.y; - return slope->of.z + (dist * slope->zdeltaf); -} -#endif // // P_QuantizeMomentumToSlope diff --git a/src/p_slopes.h b/src/p_slopes.h index 916690fe7..52988c18f 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -66,11 +66,6 @@ void P_CopySectorSlope(line_t *line); // Returns the height of the sloped plane at (x, y) as a fixed_t fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); - -// Returns the height of the sloped plane at (x, y) as a float -float P_GetZAtf(pslope_t *slope, float x, float y); - - // Lots of physics-based bullshit void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); void P_SlopeLaunch(mobj_t *mo); From 109d37998082fce34b58eff06c967a46e406ff0c Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 23 May 2015 15:44:53 -0500 Subject: [PATCH 071/364] Fix conveyor slopes eventually turning to static --- src/r_plane.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index aad98364d..0cd158355 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -946,12 +946,15 @@ void R_DrawSinglePlane(visplane_t *pl) // I copied ZDoom's code and adapted it to SRB2... -Red floatv3_t p, m, n; float ang; - //double zeroheight; + float vx, vy, vz; float fudge; - float vx = FIXED_TO_FLOAT(viewx+xoffs); - float vy = FIXED_TO_FLOAT(viewy-yoffs); - float vz = FIXED_TO_FLOAT(viewz); + xoffs &= ((1 << (32-nflatshiftup))-1); + yoffs &= ((1 << (32-nflatshiftup))-1); + + vx = FIXED_TO_FLOAT(viewx+xoffs); + vy = FIXED_TO_FLOAT(viewy-yoffs); + vz = FIXED_TO_FLOAT(viewz); zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); From e0d97e4b1a3bc3e5c17f4538237b47754f1c0478 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 23 May 2015 16:27:15 -0500 Subject: [PATCH 072/364] Slope planes should now not turn into static in 99% of cases --- src/r_plane.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index 0cd158355..6aae1e250 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -952,6 +952,15 @@ void R_DrawSinglePlane(visplane_t *pl) xoffs &= ((1 << (32-nflatshiftup))-1); yoffs &= ((1 << (32-nflatshiftup))-1); + xoffs -= (pl->slope->o.x + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1); + yoffs += (pl->slope->o.y + (1 << (31-nflatshiftup))) & ~((1 << (32-nflatshiftup))-1); + + // Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red + fudge = ((1<slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)))) - zeroheight; n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)))) - zeroheight; - // Okay, look, don't ask me why this works, but without this setup there's a disgusting-looking misalignment with the textures. -Red - fudge = ((1< Date: Sun, 24 May 2015 11:27:52 -0500 Subject: [PATCH 073/364] Condense GetFloor/CeilingZ into fewer functions, and use macros for the rest --- src/p_local.h | 23 +- src/p_mobj.c | 1084 ++++++++++++------------------------------------- 2 files changed, 276 insertions(+), 831 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 1c5874b93..543d800cd 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -217,15 +217,22 @@ boolean P_RailThinker(mobj_t *mobj); void P_PushableThinker(mobj_t *mobj); void P_SceneryThinker(mobj_t *mobj); -fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); -fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); -fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); -fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); -fixed_t P_CameraGetFloorZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); -fixed_t P_CameraGetCeilingZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line); -fixed_t P_CameraGetFOFTopZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); -fixed_t P_CameraGetFOFBottomZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line); +fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect); +fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect); +#define P_GetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(mobj, sector, NULL, x, y, line, false, false) +#define P_GetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(mobj, sector, NULL, x, y, line, true, false) +#define P_GetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false) +#define P_GetFOFBottomZ(mobj, sector, fof, x, y, line) P_MobjFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false) +#define P_GetSpecialBottomZ(mobj, src, bound) P_MobjFloorZ(mobj, src, bound, mobj->x, mobj->y, NULL, src != bound, true) +#define P_GetSpecialTopZ(mobj, src, bound) P_MobjCeilingZ(mobj, src, bound, mobj->x, mobj->y, NULL, src == bound, true) + +fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect); +fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect); +#define P_CameraGetFloorZ(mobj, sector, x, y, line) P_CameraFloorZ(mobj, sector, NULL, x, y, line, false, false) +#define P_CameraGetCeilingZ(mobj, sector, x, y, line) P_CameraCeilingZ(mobj, sector, NULL, x, y, line, true, false) +#define P_CameraGetFOFTopZ(mobj, sector, fof, x, y, line) P_CameraCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false) +#define P_CameraGetFOFBottomZ(mobj, sector, fof, x, y, line) P_CameraFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false) boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); diff --git a/src/p_mobj.c b/src/p_mobj.c index 270220f82..a11aa2c0b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -725,7 +725,108 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) // P_GetFloorZ (and its ceiling counterpart) // Gets the floor height (or ceiling height) of the mobj's contact point in sector, assuming object's center if moved to [x, y] // If line is supplied, it's a divider line on the sector. Set it to NULL if you're not checking for collision with a line -fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +// Supply boundsec ONLY when checking for specials! It should be the "in-level" sector, and sector the control sector (if separate). +// If set, then this function will iterate through boundsec's linedefs to find the highest contact point on the slope. Non-special-checking +// usage will handle that later. +static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line, pslope_t *slope, boolean actuallylowest) +{ + // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... + // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box + // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. + vertex_t v1, v2; + v1.x = line->v1->x; + v1.y = line->v1->y; + v2.x = line->v2->x; + v2.y = line->v2->y; + + /*CONS_Printf("BEFORE: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + if (abs(v1.x-x) > radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v1.x-x) - radius; + + if (v1.x < x) { // Moving right + v1.x += diff; + v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v1.x -= diff; + v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v1.y-y) > radius) { + // v1's y is out of range, so rein it in + fixed_t diff = abs(v1.y-y) - radius; + + if (v1.y < y) { // Moving up + v1.y += diff; + v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v1.y -= diff; + v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + if (abs(v2.x-x) > radius) { + // v1's x is out of range, so rein it in + fixed_t diff = abs(v2.x-x) - radius; + + if (v2.x < x) { // Moving right + v2.x += diff; + v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); + } else { // Moving left + v2.x -= diff; + v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); + } + } + + if (abs(v2.y-y) > radius) { + // v2's y is out of range, so rein it in + fixed_t diff = abs(v2.y-y) - radius; + + if (v2.y < y) { // Moving up + v2.y += diff; + v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); + } else { // Moving down + v2.y -= diff; + v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); + } + } + + /*CONS_Printf("AFTER: v1 = %f %f %f\n", + FIXED_TO_FLOAT(v1.x), + FIXED_TO_FLOAT(v1.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) + ); + CONS_Printf(" v2 = %f %f %f\n", + FIXED_TO_FLOAT(v2.x), + FIXED_TO_FLOAT(v2.y), + FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) + );*/ + + // Return the higher of the two points + if (actuallylowest) + return min( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); + else + return max( + P_GetZAt(slope, v1.x, v1.y), + P_GetZAt(slope, v2.x, v2.y) + ); +} + +fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect) { I_Assert(mobj != NULL); I_Assert(sector != NULL); @@ -745,7 +846,7 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t else testy = -mobj->radius; - if (slope->zdelta > 0) { + if ((slope->zdelta > 0) ^ !!(lowest)) { testx = -testx; testy = -testy; } @@ -754,110 +855,56 @@ fixed_t P_GetFloorZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) + if (R_PointInSubsector(testx, testy)->sector == (boundsec ?: sector)) return P_GetZAt(slope, testx, testy); + // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point + if (perfect) { + size_t i; + line_t *ld; + fixed_t bbox[4]; + fixed_t finalheight; + + if (lowest) + finalheight = INT32_MAX; + else + finalheight = INT32_MIN; + + bbox[BOXLEFT] = x-mobj->radius; + bbox[BOXRIGHT] = x+mobj->radius; + bbox[BOXTOP] = y+mobj->radius; + bbox[BOXBOTTOM] = y-mobj->radius; + for (i = 0; i < boundsec->linecount; i++) { + ld = boundsec->lines[i]; + + if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT] + || bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP]) + continue; + + if (P_BoxOnLineSide(bbox, ld) != -1) + continue; + + if (lowest) + finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true)); + else + finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false)); + } + + return finalheight; + } + // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) return P_GetZAt(slope, x, y); - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - /*CONS_Printf("BEFORE: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - /*CONS_Printf("AFTER: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - // Return the higher of the two points - return max( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } + return HighestOnLine(mobj->radius, x, y, line, slope, lowest); } else // Well, that makes it easy. Just get the floor height #endif return sector->floorheight; } -fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect) { I_Assert(mobj != NULL); I_Assert(sector != NULL); @@ -866,118 +913,6 @@ fixed_t P_GetCeilingZ(mobj_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line fixed_t testx, testy; pslope_t *slope = sector->c_slope; - // Get the corner of the object that should be the lowest on the slope - if (slope->d.x < 0) - testx = mobj->radius; - else - testx = -mobj->radius; - - if (slope->d.y < 0) - testy = mobj->radius; - else - testy = -mobj->radius; - - if (slope->zdelta < 0) { - testx = -testx; - testy = -testy; - } - - testx += x; - testy += y; - - // If the lowest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) - return P_GetZAt(slope, testx, testy); - - // If we're just testing for base sector location (no collision line), just go for the center's spot... - // It'll get fixed when we test for collision anyway, and the final result can't be higher than this - if (line == NULL) - return P_GetZAt(slope, x, y); - - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - // Return the lower of the two points - return min( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } - } else // Well, that makes it easy. Just get the ceiling height -#endif - return sector->ceilingheight; -} - -// Do the same as above, but for FOFs! -fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code -{ - I_Assert(mobj != NULL); - I_Assert(sector != NULL); - I_Assert(fof != NULL); -#ifdef ESLOPE - if (*fof->t_slope) { - fixed_t testx, testy; - pslope_t *slope = *fof->t_slope; - // Get the corner of the object that should be the highest on the slope if (slope->d.x < 0) testx = mobj->radius; @@ -989,7 +924,7 @@ fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, f else testy = -mobj->radius; - if (slope->zdelta > 0) { + if ((slope->zdelta > 0) ^ !!(lowest)) { testx = -testx; testy = -testy; } @@ -998,222 +933,57 @@ fixed_t P_GetFOFTopZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, f testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) + if (R_PointInSubsector(testx, testy)->sector == (boundsec ?: sector)) return P_GetZAt(slope, testx, testy); + // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point + if (perfect) { + size_t i; + line_t *ld; + fixed_t bbox[4]; + fixed_t finalheight; + + if (lowest) + finalheight = INT32_MAX; + else + finalheight = INT32_MIN; + + bbox[BOXLEFT] = x-mobj->radius; + bbox[BOXRIGHT] = x+mobj->radius; + bbox[BOXTOP] = y+mobj->radius; + bbox[BOXBOTTOM] = y-mobj->radius; + for (i = 0; i < boundsec->linecount; i++) { + ld = boundsec->lines[i]; + + if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT] + || bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP]) + continue; + + if (P_BoxOnLineSide(bbox, ld) != -1) + continue; + + if (lowest) + finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true)); + else + finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false)); + } + + return finalheight; + } + // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) return P_GetZAt(slope, x, y); - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - /*CONS_Printf("BEFORE: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - /*CONS_Printf("AFTER: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - // Return the higher of the two points - return max( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } - } else // Well, that makes it easy. Just get the top height + return HighestOnLine(mobj->radius, x, y, line, slope, lowest); + } else // Well, that makes it easy. Just get the ceiling height #endif - return *fof->topheight; -} - -fixed_t P_GetFOFBottomZ(mobj_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code -{ - I_Assert(mobj != NULL); - I_Assert(sector != NULL); - I_Assert(fof != NULL); -#ifdef ESLOPE - if (*fof->b_slope) { - fixed_t testx, testy; - pslope_t *slope = *fof->b_slope; - - // Get the corner of the object that should be the lowest on the slope - if (slope->d.x < 0) - testx = mobj->radius; - else - testx = -mobj->radius; - - if (slope->d.y < 0) - testy = mobj->radius; - else - testy = -mobj->radius; - - if (slope->zdelta < 0) { - testx = -testx; - testy = -testy; - } - - testx += x; - testy += y; - - // If the lowest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) - return P_GetZAt(slope, testx, testy); - - // If we're just testing for base sector location (no collision line), just go for the center's spot... - // It'll get fixed when we test for collision anyway, and the final result can't be higher than this - if (line == NULL) - return P_GetZAt(slope, x, y); - - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - // Return the lower of the two points - return min( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } - } else // Well, that makes it easy. Just get the bottom height -#endif - return *fof->bottomheight; + return sector->ceilingheight; } // Now do the same as all above, but for cameras because apparently cameras are special? -fixed_t P_CameraGetFloorZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect) { I_Assert(mobj != NULL); I_Assert(sector != NULL); @@ -1233,7 +1003,7 @@ fixed_t P_CameraGetFloorZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y else testy = -mobj->radius; - if (slope->zdelta > 0) { + if ((slope->zdelta > 0) ^ !!(lowest)) { testx = -testx; testy = -testy; } @@ -1242,110 +1012,56 @@ fixed_t P_CameraGetFloorZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) + if (R_PointInSubsector(testx, testy)->sector == (boundsec ?: sector)) return P_GetZAt(slope, testx, testy); + // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point + if (perfect) { + size_t i; + line_t *ld; + fixed_t bbox[4]; + fixed_t finalheight; + + if (lowest) + finalheight = INT32_MAX; + else + finalheight = INT32_MIN; + + bbox[BOXLEFT] = x-mobj->radius; + bbox[BOXRIGHT] = x+mobj->radius; + bbox[BOXTOP] = y+mobj->radius; + bbox[BOXBOTTOM] = y-mobj->radius; + for (i = 0; i < boundsec->linecount; i++) { + ld = boundsec->lines[i]; + + if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT] + || bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP]) + continue; + + if (P_BoxOnLineSide(bbox, ld) != -1) + continue; + + if (lowest) + finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true)); + else + finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false)); + } + + return finalheight; + } + // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) return P_GetZAt(slope, x, y); - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - /*CONS_Printf("BEFORE: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - /*CONS_Printf("AFTER: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - // Return the higher of the two points - return max( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } + return HighestOnLine(mobj->radius, x, y, line, slope, lowest); } else // Well, that makes it easy. Just get the floor height #endif return sector->floorheight; } -fixed_t P_CameraGetCeilingZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code +fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect) { I_Assert(mobj != NULL); I_Assert(sector != NULL); @@ -1354,118 +1070,6 @@ fixed_t P_CameraGetCeilingZ(camera_t *mobj, sector_t *sector, fixed_t x, fixed_t fixed_t testx, testy; pslope_t *slope = sector->c_slope; - // Get the corner of the object that should be the lowest on the slope - if (slope->d.x < 0) - testx = mobj->radius; - else - testx = -mobj->radius; - - if (slope->d.y < 0) - testy = mobj->radius; - else - testy = -mobj->radius; - - if (slope->zdelta < 0) { - testx = -testx; - testy = -testy; - } - - testx += x; - testy += y; - - // If the lowest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) - return P_GetZAt(slope, testx, testy); - - // If we're just testing for base sector location (no collision line), just go for the center's spot... - // It'll get fixed when we test for collision anyway, and the final result can't be higher than this - if (line == NULL) - return P_GetZAt(slope, x, y); - - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - // Return the lower of the two points - return min( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } - } else // Well, that makes it easy. Just get the ceiling height -#endif - return sector->ceilingheight; -} - -// Do the same as above, but for FOFs! -fixed_t P_CameraGetFOFTopZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code -{ - I_Assert(mobj != NULL); - I_Assert(sector != NULL); - I_Assert(fof != NULL); -#ifdef ESLOPE - if (*fof->t_slope) { - fixed_t testx, testy; - pslope_t *slope = *fof->t_slope; - // Get the corner of the object that should be the highest on the slope if (slope->d.x < 0) testx = mobj->radius; @@ -1477,7 +1081,7 @@ fixed_t P_CameraGetFOFTopZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixe else testy = -mobj->radius; - if (slope->zdelta > 0) { + if ((slope->zdelta > 0) ^ !!(lowest)) { testx = -testx; testy = -testy; } @@ -1486,220 +1090,54 @@ fixed_t P_CameraGetFOFTopZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixe testy += y; // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) + if (R_PointInSubsector(testx, testy)->sector == (boundsec ?: sector)) return P_GetZAt(slope, testx, testy); + // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point + if (perfect) { + size_t i; + line_t *ld; + fixed_t bbox[4]; + fixed_t finalheight; + + if (lowest) + finalheight = INT32_MAX; + else + finalheight = INT32_MIN; + + bbox[BOXLEFT] = x-mobj->radius; + bbox[BOXRIGHT] = x+mobj->radius; + bbox[BOXTOP] = y+mobj->radius; + bbox[BOXBOTTOM] = y-mobj->radius; + for (i = 0; i < boundsec->linecount; i++) { + ld = boundsec->lines[i]; + + if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT] + || bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP]) + continue; + + if (P_BoxOnLineSide(bbox, ld) != -1) + continue; + + if (lowest) + finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true)); + else + finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false)); + } + + return finalheight; + } + // If we're just testing for base sector location (no collision line), just go for the center's spot... // It'll get fixed when we test for collision anyway, and the final result can't be lower than this if (line == NULL) return P_GetZAt(slope, x, y); - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the higher of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - /*CONS_Printf("BEFORE: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - /*CONS_Printf("AFTER: v1 = %f %f %f\n", - FIXED_TO_FLOAT(v1.x), - FIXED_TO_FLOAT(v1.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v1.x, v1.y)) - ); - CONS_Printf(" v2 = %f %f %f\n", - FIXED_TO_FLOAT(v2.x), - FIXED_TO_FLOAT(v2.y), - FIXED_TO_FLOAT(P_GetZAt(slope, v2.x, v2.y)) - );*/ - - // Return the higher of the two points - return max( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } - } else // Well, that makes it easy. Just get the top height + return HighestOnLine(mobj->radius, x, y, line, slope, lowest); + } else // Well, that makes it easy. Just get the ceiling height #endif - return *fof->topheight; + return sector->ceilingheight; } - -fixed_t P_CameraGetFOFBottomZ(camera_t *mobj, sector_t *sector, ffloor_t *fof, fixed_t x, fixed_t y, line_t *line) // SRB2CBTODO: This needs to be over all the code -{ - I_Assert(mobj != NULL); - I_Assert(sector != NULL); - I_Assert(fof != NULL); -#ifdef ESLOPE - if (*fof->b_slope) { - fixed_t testx, testy; - pslope_t *slope = *fof->b_slope; - - // Get the corner of the object that should be the lowest on the slope - if (slope->d.x < 0) - testx = mobj->radius; - else - testx = -mobj->radius; - - if (slope->d.y < 0) - testy = mobj->radius; - else - testy = -mobj->radius; - - if (slope->zdelta < 0) { - testx = -testx; - testy = -testy; - } - - testx += x; - testy += y; - - // If the lowest point is in the sector, then we have it easy! Just get the Z at that point - if (R_PointInSubsector(testx, testy)->sector == sector) - return P_GetZAt(slope, testx, testy); - - // If we're just testing for base sector location (no collision line), just go for the center's spot... - // It'll get fixed when we test for collision anyway, and the final result can't be higher than this - if (line == NULL) - return P_GetZAt(slope, x, y); - - // Alright, so we're sitting on a line that contains our slope sector, and need to figure out the highest point we're touching... - // The solution is simple! Get the line's vertices, and pull each one in along its line until it touches the object's bounding box - // (assuming it isn't already inside), then test each point's slope Z and return the lower of the two. - { - vertex_t v1, v2; - v1.x = line->v1->x; - v1.y = line->v1->y; - v2.x = line->v2->x; - v2.y = line->v2->y; - - if (abs(v1.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v1.x-x) - mobj->radius; - - if (v1.x < x) { // Moving right - v1.x += diff; - v1.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v1.x -= diff; - v1.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v1.y-y) > mobj->radius) { - // v1's y is out of range, so rein it in - fixed_t diff = abs(v1.y-y) - mobj->radius; - - if (v1.y < y) { // Moving up - v1.y += diff; - v1.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v1.y -= diff; - v1.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - if (abs(v2.x-x) > mobj->radius) { - // v1's x is out of range, so rein it in - fixed_t diff = abs(v2.x-x) - mobj->radius; - - if (v2.x < x) { // Moving right - v2.x += diff; - v2.y += FixedMul(diff, FixedDiv(line->dy, line->dx)); - } else { // Moving left - v2.x -= diff; - v2.y -= FixedMul(diff, FixedDiv(line->dy, line->dx)); - } - } - - if (abs(v2.y-y) > mobj->radius) { - // v2's y is out of range, so rein it in - fixed_t diff = abs(v2.y-y) - mobj->radius; - - if (v2.y < y) { // Moving up - v2.y += diff; - v2.x += FixedMul(diff, FixedDiv(line->dx, line->dy)); - } else { // Moving down - v2.y -= diff; - v2.x -= FixedMul(diff, FixedDiv(line->dx, line->dy)); - } - } - - // Return the lower of the two points - return min( - P_GetZAt(slope, v1.x, v1.y), - P_GetZAt(slope, v2.x, v2.y) - ); - } - } else // Well, that makes it easy. Just get the bottom height -#endif - return *fof->bottomheight; -} - static void P_PlayerFlip(mobj_t *mo) { if (!mo->player) From a9d49cd9fa1d2237948fecbd159eb3af82f1754f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 24 May 2015 12:53:30 -0500 Subject: [PATCH 074/364] Make all specials reliant on floor touch work right with sloeps (I might've missed some, though) --- src/p_floor.c | 20 +++++++---- src/p_mobj.c | 8 ++--- src/p_spec.c | 97 +++++++++++++++++++++++++++------------------------ src/p_user.c | 8 ++--- 4 files changed, 73 insertions(+), 60 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 4e289c8d5..b8d3f7b5e 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1174,8 +1174,8 @@ void T_SpikeSector(levelspecthink_t *spikes) if (affectsec == spikes->sector) // Applied to an actual sector { - fixed_t affectfloor = P_GetFloorZ(thing, affectsec, thing->x, thing->y, NULL); - fixed_t affectceil = P_GetCeilingZ(thing, affectsec, thing->x, thing->y, NULL); + fixed_t affectfloor = P_GetSpecialBottomZ(thing, affectsec, affectsec); + fixed_t affectceil = P_GetSpecialTopZ(thing, affectsec, affectsec); if (affectsec->flags & SF_FLIPSPECIAL_FLOOR) { @@ -1197,12 +1197,14 @@ void T_SpikeSector(levelspecthink_t *spikes) } else { + fixed_t affectfloor = P_GetSpecialBottomZ(thing, affectsec, spikes->sector); + fixed_t affectceil = P_GetSpecialTopZ(thing, affectsec, spikes->sector); if (affectsec->flags & SF_FLIPSPECIAL_FLOOR) { if (!(thing->eflags & MFE_VERTICALFLIP) && thing->momz > 0) continue; - if (thing->z == affectsec->ceilingheight) + if (thing->z == affectceil) dothepain = true; } @@ -1211,7 +1213,7 @@ void T_SpikeSector(levelspecthink_t *spikes) if ((thing->eflags & MFE_VERTICALFLIP) && thing->momz < 0) continue; - if (thing->z + thing->height == affectsec->floorheight) + if (thing->z + thing->height == affectfloor) dothepain = true; } } @@ -2090,6 +2092,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) boolean FOFsector = false; boolean inAndOut = false; boolean floortouch = false; + fixed_t bottomheight, topheight; for (i = 0; i < MAXPLAYERS; i++) { @@ -2154,10 +2157,13 @@ void T_EachTimeThinker(levelspecthink_t *eachtime) if (players[j].mo->subsector->sector != targetsec) continue; - if (players[j].mo->z > sec->ceilingheight) + topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec); + bottomheight = P_GetSpecialBottomZ(players[j].mo, sec, targetsec); + + if (players[j].mo->z > topheight) continue; - if (players[j].mo->z + players[j].mo->height < sec->floorheight) + if (players[j].mo->z + players[j].mo->height < bottomheight) continue; if (floortouch == true && P_IsObjectOnGroundIn(players[j].mo, targetsec)) @@ -2317,7 +2323,7 @@ void T_RaiseSector(levelspecthink_t *raise) if (raise->vars[1] && !(thing->player->pflags & PF_STARTDASH)) continue; - if (!(thing->z == raise->sector->ceilingheight)) + if (!(thing->z == P_GetSpecialTopZ(thing, raise->sector, sector))) continue; playeronme = true; diff --git a/src/p_mobj.c b/src/p_mobj.c index a11aa2c0b..edf30d58a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3562,11 +3562,11 @@ static void P_PlayerMobjThinker(mobj_t *mobj) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_CRUMBLE)) continue; - topheight = P_GetFOFTopZ(mobj, node->m_sector, rover, mobj->x, mobj->y, NULL); - bottomheight = P_GetFOFBottomZ(mobj, node->m_sector, rover, mobj->x, mobj->y, NULL); + topheight = P_GetSpecialTopZ(mobj, sectors + rover->secnum, node->m_sector); + bottomheight = P_GetSpecialBottomZ(mobj, sectors + rover->secnum, node->m_sector); - if ((topheight <= mobj->z + 16*mobj->scale && topheight >= mobj->z && !(mobj->eflags & MFE_VERTICALFLIP)) - || (bottomheight >= mobj->z + mobj->height && bottomheight <= mobj->z + mobj->height - 16*mobj->scale && mobj->eflags & MFE_VERTICALFLIP)) // You nut. + if ((topheight == mobj->z && !(mobj->eflags & MFE_VERTICALFLIP)) + || (bottomheight == mobj->z + mobj->height && mobj->eflags & MFE_VERTICALFLIP)) // You nut. EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), mobj->player, rover->alpha, !(rover->flags & FF_NORETURN)); } } diff --git a/src/p_spec.c b/src/p_spec.c index 914e008d9..6cc0e2f45 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3365,6 +3365,7 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *targetsec) { ffloor_t *rover; + fixed_t top, bottom; if (!mo->player) // should NEVER happen return false; @@ -3381,6 +3382,9 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar //if (!(rover->flags & FF_EXISTS)) // return false; + top = P_GetSpecialTopZ(mo, sector, targetsec); + bottom = P_GetSpecialBottomZ(mo, sector, targetsec); + // Check the 3D floor's type... if (rover->flags & FF_BLOCKPLAYER) { @@ -3388,27 +3392,27 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) { - if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != *rover->topheight) + if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != top) return false; } else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) { if (!(mo->eflags & MFE_VERTICALFLIP) - || mo->z + mo->height != *rover->bottomheight) + || mo->z + mo->height != bottom) return false; } else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) { - if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == *rover->bottomheight) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == *rover->topheight))) + if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottom) + || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == top))) return false; } } else { // Water and intangible FOFs - if (mo->z > *rover->topheight || (mo->z + mo->height) < *rover->bottomheight) + if (mo->z > top || (mo->z + mo->height) < bottom) return false; } @@ -3426,9 +3430,9 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar static inline boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) { if (mo->eflags & MFE_VERTICALFLIP) - return (mo->z+mo->height == sec->ceilingheight && sec->flags & SF_FLIPSPECIAL_CEILING); + return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING); else - return (mo->z == sec->floorheight && sec->flags & SF_FLIPSPECIAL_FLOOR); + return (mo->z == P_GetSpecialBottomZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_FLOOR); } /** Applies a sector special to a player. @@ -4389,27 +4393,27 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) { - if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != *rover->topheight) + if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector)) continue; } else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) { if (!(player->mo->eflags & MFE_VERTICALFLIP) - || player->mo->z + player->mo->height != *rover->bottomheight) + || player->mo->z + player->mo->height != P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector)) continue; } else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) { - if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == *rover->bottomheight) - || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == *rover->topheight))) + if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector)) + || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector)))) continue; } } else { // Water and DEATH FOG!!! heh - if (player->mo->z > *rover->topheight || (player->mo->z + player->mo->height) < *rover->bottomheight) + if (player->mo->z > P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector) || (player->mo->z + player->mo->height) < P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector)) continue; } @@ -4582,8 +4586,8 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) return; } - f_affectpoint = P_GetFloorZ(player->mo, sector, player->mo->x, player->mo->y, NULL); - c_affectpoint = P_GetCeilingZ(player->mo, sector, player->mo->x, player->mo->y, NULL); + f_affectpoint = P_GetSpecialBottomZ(player->mo, sector, sector); + c_affectpoint = P_GetSpecialTopZ(player->mo, sector, sector); // Only go further if on the ground if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint) @@ -5340,6 +5344,7 @@ void T_LaserFlash(laserthink_t *flash) sector_t *sourcesec; ffloor_t *ffloor = flash->ffloor; sector_t *sector = flash->sector; + fixed_t top, bottom; if (!ffloor || !(ffloor->flags & FF_EXISTS)) return; @@ -5363,8 +5368,11 @@ void T_LaserFlash(laserthink_t *flash) && thing->flags & MF_BOSS) continue; // Don't hurt bosses - if (thing->z >= sourcesec->ceilingheight - || thing->z + thing->height <= sourcesec->floorheight) + top = P_GetSpecialTopZ(thing, sourcesec, sector); + bottom = P_GetSpecialBottomZ(thing, sourcesec, sector); + + if (thing->z >= top + || thing->z + thing->height <= bottom) continue; if (thing->flags & MF_SHOOTABLE) @@ -6655,6 +6663,8 @@ void T_Scroll(scroll_t *s) if (thing->eflags & MFE_PUSHED) // Already pushed this tic by an exclusive pusher. continue; + height = P_GetSpecialBottomZ(thing, sec, psec); + if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped if (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height != height)) // Thing must a) be non-floating and have z+height == height { @@ -6675,6 +6685,8 @@ void T_Scroll(scroll_t *s) if (thing->eflags & MFE_PUSHED) continue; + height = P_GetSpecialBottomZ(thing, sec, sec); + if (!(thing->flags & MF_NOCLIP) && (!(thing->flags & MF_NOGRAVITY || thing->z > height))) { @@ -6714,6 +6726,8 @@ void T_Scroll(scroll_t *s) if (thing->eflags & MFE_PUSHED) continue; + height = P_GetSpecialTopZ(thing, sec, psec); + if (!(thing->flags & MF_NOCLIP)) // Thing must be clipped if (!(thing->flags & MF_NOGRAVITY || thing->z != height))// Thing must a) be non-floating and have z == height { @@ -6734,6 +6748,8 @@ void T_Scroll(scroll_t *s) if (thing->eflags & MFE_PUSHED) continue; + height = P_GetSpecialTopZ(thing, sec, sec); + if (!(thing->flags & MF_NOCLIP) && (!(thing->flags & MF_NOGRAVITY || thing->z+thing->height < height))) { @@ -7027,7 +7043,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 */ void T_Friction(friction_t *f) { - sector_t *sec; + sector_t *sec, *referrer; mobj_t *thing; msecnode_t *node; @@ -7036,7 +7052,7 @@ void T_Friction(friction_t *f) // Make sure the sector type hasn't changed if (f->roverfriction) { - sector_t *referrer = sectors + f->referrer; + referrer = sectors + f->referrer; if (!(GETSECSPECIAL(referrer->special, 3) == 1 || GETSECSPECIAL(referrer->special, 3) == 3)) @@ -7068,9 +7084,7 @@ void T_Friction(friction_t *f) { if (f->roverfriction) { - sector_t *referrer = §ors[f->referrer]; - - if (thing->floorz != referrer->ceilingheight) + if (thing->floorz != P_GetSpecialTopZ(thing, referrer, sec)) { node = node->m_snext; continue; @@ -7083,7 +7097,7 @@ void T_Friction(friction_t *f) thing->movefactor = f->movefactor; } } - else if (sec->floorheight == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction? + else if (P_GetSpecialBottomZ(thing, sec, sec) == thing->floorz && (thing->friction == ORIG_FRICTION // normal friction? || f->friction < thing->friction)) { thing->friction = f->friction; @@ -7357,7 +7371,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) */ void T_Pusher(pusher_t *p) { - sector_t *sec; + sector_t *sec, *referrer; mobj_t *thing; msecnode_t *node; INT32 xspeed = 0,yspeed = 0; @@ -7366,7 +7380,6 @@ void T_Pusher(pusher_t *p) //INT32 ht = 0; boolean inFOF; boolean touching; - boolean foundfloor = false; boolean moved; xspeed = yspeed = 0; @@ -7378,19 +7391,16 @@ void T_Pusher(pusher_t *p) if (p->roverpusher) { - sector_t *referrer = §ors[p->referrer]; + referrer = §ors[p->referrer]; - if (GETSECSPECIAL(referrer->special, 3) == 2 - || GETSECSPECIAL(referrer->special, 3) == 3) - foundfloor = true; + if (!(GETSECSPECIAL(referrer->special, 3) == 2 + || GETSECSPECIAL(referrer->special, 3) == 3)) + return; } else if (!(GETSECSPECIAL(sec->special, 3) == 2 || GETSECSPECIAL(sec->special, 3) == 3)) return; - if (p->roverpusher && foundfloor == false) // Not even a 3d floor has the PUSH_MASK. - return; - // For constant pushers (wind/current) there are 3 situations: // // 1) Affected Thing is above the floor. @@ -7465,41 +7475,38 @@ void T_Pusher(pusher_t *p) // Find the area that the 'thing' is in if (p->roverpusher) { - sector_t *referrer = §ors[p->referrer]; - INT32 special; + fixed_t top, bottom; - special = GETSECSPECIAL(referrer->special, 3); - - if (!(special == 2 || special == 3)) - return; + top = P_GetSpecialTopZ(thing, referrer, sec); + bottom = P_GetSpecialBottomZ(thing, referrer, sec); if (thing->eflags & MFE_VERTICALFLIP) { - if (referrer->floorheight > thing->z + thing->height - || referrer->ceilingheight < (thing->z + (thing->height >> 1))) + if (bottom > thing->z + thing->height + || top < (thing->z + (thing->height >> 1))) continue; - if (thing->z < referrer->floorheight) + if (thing->z < bottom) touching = true; - if (thing->z + (thing->height >> 1) > referrer->floorheight) + if (thing->z + (thing->height >> 1) > bottom) inFOF = true; } else { - if (referrer->ceilingheight < thing->z || referrer->floorheight > (thing->z + (thing->height >> 1))) + if (top < thing->z || referrer->floorheight > (thing->z + (thing->height >> 1))) continue; - if (thing->z + thing->height > referrer->ceilingheight) + if (thing->z + thing->height > top) touching = true; - if (thing->z + (thing->height >> 1) < referrer->ceilingheight) + if (thing->z + (thing->height >> 1) < top) inFOF = true; } } else // Treat the entire sector as one big FOF { - if (thing->z == thing->subsector->sector->floorheight) + if (thing->z == P_GetSpecialBottomZ(thing, sec, sec)) touching = true; else if (p->type != p_current) inFOF = true; diff --git a/src/p_user.c b/src/p_user.c index 115c79638..d57d5cb99 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1212,7 +1212,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) if (mo->eflags & MFE_VERTICALFLIP) { // Detect if the player is on the ceiling. - if (mo->z+mo->height >= sec->ceilingheight) + if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec)) return true; // Otherwise, detect if the player is on the bottom of a FOF. else @@ -1236,7 +1236,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) continue; // Actually check if the player is on the suitable FOF. - if (mo->z+mo->height == *rover->bottomheight) + if (mo->z+mo->height == P_GetSpecialBottomZ(mo, sectors + rover->secnum, sec)) return true; } } @@ -1245,7 +1245,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) else { // Detect if the player is on the floor. - if (mo->z <= sec->floorheight) + if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec)) return true; // Otherwise, detect if the player is on the top of a FOF. else @@ -1269,7 +1269,7 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) continue; // Actually check if the player is on the suitable FOF. - if (mo->z == *rover->topheight) + if (mo->z == P_GetSpecialTopZ(mo, sectors + rover->secnum, sec)) return true; } } From bddcf98355fd3d3af9d7652ffd01614f13fbac42 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 24 May 2015 15:59:17 -0500 Subject: [PATCH 075/364] Remap slope line specials to 7xx range: shim old values for now --- src/p_slopes.c | 49 +++++++++++++++++++++++++++++++++++++++++++------ src/p_spec.c | 6 +++--- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index ed9623e08..d0b202168 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -174,10 +174,10 @@ void P_SpawnSlope_Line(int linenum) vector2_t direction; fixed_t nx, ny, dz, extent; - boolean frontfloor = (special == 386 || special == 388 || special == 393); - boolean backfloor = (special == 389 || special == 391 || special == 392); - boolean frontceil = (special == 387 || special == 388 || special == 392); - boolean backceil = (special == 390 || special == 391 || special == 393); + boolean frontfloor = (special == 700 || special == 702 || special == 703); + boolean backfloor = (special == 710 || special == 712 || special == 713); + boolean frontceil = (special == 701 || special == 702 || special == 713); + boolean backceil = (special == 711 || special == 712 || special == 703); if(!frontfloor && !backfloor && !frontceil && !backceil) { @@ -457,9 +457,9 @@ void P_CopySectorSlope(line_t *line) { sector_t *srcsec = sectors + i; - if((special - 393) & 1 && !fsec->f_slope && srcsec->f_slope) + if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope) fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope); - if((special - 393) & 2 && !fsec->c_slope && srcsec->c_slope) + if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope) fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope); } @@ -726,6 +726,9 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum) // Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes void P_ResetDynamicSlopes(void) { size_t i; +#if 1 // Rewrite old specials to new ones, and give a console warning + boolean warned = false; +#endif dynslopes = NULL; @@ -735,14 +738,48 @@ void P_ResetDynamicSlopes(void) { { switch (lines[i].special) { +#if 1 // Rewrite old specials to new ones, and give a console warning +#define WARNME if (!warned) {warned = true; CONS_Alert(CONS_WARNING, "This level uses old slope specials.\nA conversion will be needed before 2.2's release.\n");} case 386: case 387: case 388: + lines[i].special += 700-386; + WARNME + P_SpawnSlope_Line(i); + break; + case 389: case 390: case 391: case 392: + lines[i].special += 710-389; + WARNME + P_SpawnSlope_Line(i); + break; + case 393: + lines[i].special = 703; + WARNME + P_SpawnSlope_Line(i); + break; + + case 394: + case 395: + case 396: + lines[i].special += 720-394; + WARNME + break; + +#endif + + case 700: + case 701: + case 702: + case 703: + case 710: + case 711: + case 712: + case 713: P_SpawnSlope_Line(i); break; diff --git a/src/p_spec.c b/src/p_spec.c index 6cc0e2f45..30564ea23 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6452,9 +6452,9 @@ void P_SpawnSpecials(INT32 fromnetsave) break; #ifdef ESLOPE // Slope copy specials. Handled here for sanity. - case 394: - case 395: - case 396: + case 720: + case 721: + case 722: P_CopySectorSlope(&lines[i]); break; #endif From 32759312a153e857a4c0a9d6d79af0ef582e3480 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 24 May 2015 18:22:56 -0500 Subject: [PATCH 076/364] Shut up the Kalaron --- src/r_draw8.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index a028b9c12..279690492 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -628,8 +628,8 @@ void R_DrawTiltedSpan_8(void) double endz = 1.f/iz; double endu = uz*endz; double endv = vz*endz; - UINT32 stepu = (UINT32)((endu - startu) * INVSPAN); - UINT32 stepv = (UINT32)((endv - startv) * INVSPAN); + UINT32 stepu = (INT64)((endu - startu) * INVSPAN); + UINT32 stepv = (INT64)((endv - startv) * INVSPAN); u = (UINT32)(startu) + viewx; v = (UINT32)(startv) + viewy; @@ -665,8 +665,8 @@ void R_DrawTiltedSpan_8(void) double endu = uz*endz; double endv = vz*endz; left = 1.f/left; - UINT32 stepu = (UINT32)((endu - startu) * left); - UINT32 stepv = (UINT32)((endv - startv) * left); + UINT32 stepu = (INT64)((endu - startu) * left); + UINT32 stepv = (INT64)((endv - startv) * left); u = (UINT32)(startu) + viewx; v = (UINT32)(startv) + viewy; @@ -761,8 +761,8 @@ void R_DrawTiltedTranslucentSpan_8(void) double endz = 1.f/iz; double endu = uz*endz; double endv = vz*endz; - UINT32 stepu = (UINT32)((endu - startu) * INVSPAN); - UINT32 stepv = (UINT32)((endv - startv) * INVSPAN); + UINT32 stepu = (INT64)((endu - startu) * INVSPAN); + UINT32 stepv = (INT64)((endv - startv) * INVSPAN); u = (UINT32)(startu) + viewx; v = (UINT32)(startv) + viewy; @@ -798,8 +798,8 @@ void R_DrawTiltedTranslucentSpan_8(void) double endu = uz*endz; double endv = vz*endz; left = 1.f/left; - UINT32 stepu = (UINT32)((endu - startu) * left); - UINT32 stepv = (UINT32)((endv - startv) * left); + UINT32 stepu = (INT64)((endu - startu) * left); + UINT32 stepv = (INT64)((endv - startv) * left); u = (UINT32)(startu) + viewx; v = (UINT32)(startv) + viewy; From d9d3752b4e3a3fcff69f1e2b5055a4d0f1fafd04 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 25 May 2015 11:46:09 -0500 Subject: [PATCH 077/364] Unbreak FOF specials --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 30564ea23..694893502 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4413,7 +4413,7 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) else { // Water and DEATH FOG!!! heh - if (player->mo->z > P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector) || (player->mo->z + player->mo->height) < P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector)) + if (player->mo->z > P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector) || (player->mo->z + player->mo->height) < P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector)) continue; } From 5e18db79e9061291157216613179b0f1d5b0f4fe Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 25 May 2015 12:16:19 -0500 Subject: [PATCH 078/364] Fix mobjs sometimes clipping through floors (whoops!) --- src/p_mobj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index edf30d58a..e44279347 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2272,6 +2272,11 @@ static boolean P_ZMovement(mobj_t *mo) mom.y = mo->momy; mom.z = mo->momz; + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = mo->ceilingz - mo->height; + else + mo->z = mo->floorz; + #ifdef ESLOPE P_TryMove(mo, mo->x, mo->y, true); // Sets mo->standingslope correctly if (mo->standingslope) { @@ -2282,11 +2287,6 @@ static boolean P_ZMovement(mobj_t *mo) } #endif - if (mo->eflags & MFE_VERTICALFLIP) - mo->z = mo->ceilingz - mo->height; - else - mo->z = mo->floorz; - // hit the floor if (mo->type == MT_FIREBALL) // special case for the fireball mom.z = P_MobjFlip(mo)*FixedMul(5*FRACUNIT, mo->scale); From e00d6821859bef7d6d6d0c3b2c1970d8163bae20 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 25 May 2015 13:25:23 -0500 Subject: [PATCH 079/364] Fix issue with objects getting stuck IN floors --- src/p_mobj.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e44279347..7d48ca60c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2278,8 +2278,10 @@ static boolean P_ZMovement(mobj_t *mo) mo->z = mo->floorz; #ifdef ESLOPE - P_TryMove(mo, mo->x, mo->y, true); // Sets mo->standingslope correctly - if (mo->standingslope) { + P_CheckPosition(mo, mo->x, mo->y); // Sets mo->standingslope correctly + if ((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) { + mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope; + // Reverse quantizing might could use its own function later mo->standingslope->zangle = ANGLE_MAX-mo->standingslope->zangle; P_QuantizeMomentumToSlope(&mom, mo->standingslope); From b564a169d80a0ff6db33de6e03f505803d8f05cf Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 17 Jun 2015 21:00:10 +0100 Subject: [PATCH 080/364] Starting work for getting sector.lines in Lua: it WORKS at the least, but I have no way to determine the size of the array itself as of yet --- src/lua_libs.h | 1 + src/lua_maplib.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/lua_libs.h b/src/lua_libs.h index d19ad8857..25552eacb 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -42,6 +42,7 @@ extern lua_State *gL; #define META_CVAR "CONSVAR_T*" +#define META_SECTORLINES "SECTOR_T*LINES" #define META_SIDENUM "LINE_T*SIDENUM" #define META_HUDINFO "HUDINFO_T*" diff --git a/src/lua_maplib.c b/src/lua_maplib.c index e5cc30c12..40acc6dff 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -37,6 +37,7 @@ enum sector_e { sector_thinglist, sector_heightsec, sector_camsec, + sector_lines, sector_ffloors }; @@ -52,6 +53,7 @@ static const char *const sector_opt[] = { "thinglist", "heightsec", "camsec", + "lines", "ffloors", NULL}; @@ -260,6 +262,49 @@ static int sector_iterate(lua_State *L) return 3; } +// sector.lines, i -> sector.lines[i] +// sector.lines.valid, for validity checking +static int sectorlines_get(lua_State *L) +{ + line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES)); + size_t i; + //size_t numoflines; + lua_settop(L, 2); + if (!lua_isnumber(L, 2)) + { + int field = luaL_checkoption(L, 2, NULL, valid_opt); + if (!seclines) + { + if (field == 0) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed sector_t doesn't exist anymore."); + } else if (field == 0) { + lua_pushboolean(L, 1); + return 1; + } + } + + /* \TODO: figure out how to find size of seclines array, rather than the size of a pointer! + Testing for sectors[0].lines in GFZ1 with a test Lua script: + sizeof(seclines) returns 4 + sizeof(*seclines) returns 4 + sizeof(**seclines) returns 84, presumably the size of line_t + You can probably see why I haven't been successful yet, hopefully + //CONS_Printf("sizeof(seclines): %d\n", sizeof(seclines)); + //CONS_Printf("sizeof(seclines[0]): %d\n", sizeof(seclines[0]));*/ + + /*numoflines = sizeof(seclines) / sizeof(seclines[0]); + if (!numoflines) + return luaL_error(L, "no lines found!");*/ + i = (size_t)lua_tointeger(L, 2); + /*if (i > numoflines) + return 0;*/ + LUA_PushUserdata(L, seclines[i], META_LINE); + return 1; +} + static int sector_get(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); @@ -325,6 +370,9 @@ static int sector_get(lua_State *L) return 0; LUA_PushUserdata(L, §ors[sector->camsec], META_SECTOR); return 1; + case sector_lines: // lines + LUA_PushUserdata(L, sector->lines, META_SECTORLINES); + return 1; case sector_ffloors: // ffloors lua_pushcfunction(L, lib_iterateSectorFFloors); LUA_PushUserdata(L, sector->ffloors, META_FFLOOR); @@ -1178,6 +1226,11 @@ static int mapheaderinfo_get(lua_State *L) int LUA_MapLib(lua_State *L) { + luaL_newmetatable(L, META_SECTORLINES); + lua_pushcfunction(L, sectorlines_get); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); + luaL_newmetatable(L, META_SECTOR); lua_pushcfunction(L, sector_get); lua_setfield(L, -2, "__index"); From 96241866bfaf297ac58b0b52baf7a4c6c473d64a Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 19 Jun 2015 01:55:13 -0400 Subject: [PATCH 081/364] Fix Super float anim bug. This commit makes Super floating players break into a normal walk again when they hit the floor, instead of keeping their float animation on the ground. --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index d6ba3866c..31067540f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2285,7 +2285,7 @@ static void P_PlayerZMovement(mobj_t *mo) { if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN) P_SetPlayerMobjState(mo, S_PLAY_RUN); - else if ((mo->player->rmomx || mo->player->rmomy) && mo->player->panim != PA_WALK) + else if ((mo->player->rmomx || mo->player->rmomy) && (mo->player->panim != PA_WALK || mo->state-states == S_PLAY_SUPER_FLOAT)) P_SetPlayerMobjState(mo, S_PLAY_WALK); else if (!mo->player->rmomx && !mo->player->rmomy && mo->player->panim != PA_IDLE) P_SetPlayerMobjState(mo, S_PLAY_STND); @@ -2294,7 +2294,7 @@ static void P_PlayerZMovement(mobj_t *mo) { if (mo->player->speed >= FixedMul(mo->player->runspeed, mo->scale) && mo->player->panim != PA_RUN) P_SetPlayerMobjState(mo, S_PLAY_RUN); - else if ((mo->momx || mo->momy) && mo->player->panim != PA_WALK) + else if ((mo->momx || mo->momy) && (mo->player->panim != PA_WALK || mo->state-states == S_PLAY_SUPER_FLOAT)) P_SetPlayerMobjState(mo, S_PLAY_WALK); else if (!mo->momx && !mo->momy && mo->player->panim != PA_IDLE) P_SetPlayerMobjState(mo, S_PLAY_STND); From 61388459302db4cd328f48fcc972e776d842a02c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 21 Jun 2015 16:58:34 +0100 Subject: [PATCH 082/364] Removed all "-1"s from R_PointToAngle and R_PointToAngle2, in order to allow ALL basic compass directions at the least to be given the right angle by these functions. Note: Before this change, North and West directions would be returned as ANGLE_90-1 and ANGLE_180-1. This caused the pusher polyobjects in THZ2 to slowly move sideways as a side-effect (and probably caused similar bugs in the past too, these functions have barely been touched in a decade it turns out.) --- src/r_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 1edcb815b..19a6b5cba 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -316,13 +316,13 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y) x >= 0 ? y >= 0 ? (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 - ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 + ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 + y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 - ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 + (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4 + ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5 0; } @@ -332,13 +332,13 @@ angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) x >= 0 ? y >= 0 ? (x > y) ? tantoangle[SlopeDiv(y,x)] : // octant 0 - ANGLE_90-1-tantoangle[SlopeDiv(x,y)] : // octant 1 + ANGLE_90-tantoangle[SlopeDiv(x,y)] : // octant 1 x > (y = -y) ? 0-tantoangle[SlopeDiv(y,x)] : // octant 8 ANGLE_270+tantoangle[SlopeDiv(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-1-tantoangle[SlopeDiv(y,x)] :// octant 3 + y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDiv(y,x)] : // octant 3 ANGLE_90 + tantoangle[SlopeDiv(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[ SlopeDiv(y,x)] : // octant 4 - ANGLE_270-1-tantoangle[SlopeDiv(x,y)] : // octant 5 + (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDiv(y,x)] : // octant 4 + ANGLE_270-tantoangle[SlopeDiv(x,y)] : // octant 5 0; } From 0d357adb5206279146416663c97d80af2d944c77 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Thu, 23 Jul 2015 00:03:31 +0100 Subject: [PATCH 083/364] Base colour changes Default colours before new colours are potentially added. Rosewood is the same as orange and will likely be removed. --- src/r_draw.c | 191 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 134 insertions(+), 57 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index cd219c15f..a8f48bbeb 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -236,27 +236,27 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0x03, // SKINCOLOR_SILVER 0x08, // SKINCOLOR_GREY 0x18, // SKINCOLOR_BLACK - 0xd0, // SKINCOLOR_CYAN - 0xdc, // SKINCOLOR_TEAL - 0xc8, // SKINCOLOR_STEELBLUE - 0xe2, // SKINCOLOR_BLUE - 0x40, // SKINCOLOR_PEACH - 0x48, // SKINCOLOR_TAN - 0x90, // SKINCOLOR_PINK - 0xf8, // SKINCOLOR_LAVENDER - 0xc0, // SKINCOLOR_PURPLE - 0x52, // SKINCOLOR_ORANGE - 0x5c, // SKINCOLOR_ROSEWOOD - 0x20, // SKINCOLOR_BEIGE - 0x30, // SKINCOLOR_BROWN - 0x7d, // SKINCOLOR_RED - 0x85, // SKINCOLOR_DARKRED - 0xb8, // SKINCOLOR_NEONGREEN - 0xa0, // SKINCOLOR_GREEN - 0xb0, // SKINCOLOR_ZIM - 0x69, // SKINCOLOR_OLIVE - 0x67, // SKINCOLOR_YELLOW - 0x70, // SKINCOLOR_GOLD + 0x70, // SKINCOLOR_CYAN + 0x7c, // SKINCOLOR_TEAL + 0x9a, // SKINCOLOR_STEELBLUE + 0x80, // SKINCOLOR_BLUE + 0xc8, // SKINCOLOR_PEACH + 0x54, // SKINCOLOR_TAN + 0xc0, // SKINCOLOR_PINK + 0xb0, // SKINCOLOR_LAVENDER + 0xa0, // SKINCOLOR_PURPLE + 0x30, // SKINCOLOR_ORANGE + 0x30, // SKINCOLOR_ROSEWOOD + 0xe0, // SKINCOLOR_BEIGE + 0xd0, // SKINCOLOR_BROWN + 0x20, // SKINCOLOR_RED + 0x28, // SKINCOLOR_DARKRED + 0xf0, // SKINCOLOR_NEONGREEN + 0x60, // SKINCOLOR_GREEN + 0x58, // SKINCOLOR_ZIM + 0x49, // SKINCOLOR_OLIVE + 0x48, // SKINCOLOR_YELLOW + 0x40, // SKINCOLOR_GOLD }; INT32 i; INT32 starttranscolor; @@ -293,25 +293,18 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U { case SKINCOLOR_SILVER: case SKINCOLOR_GREY: - case SKINCOLOR_PEACH: - case SKINCOLOR_BEIGE: case SKINCOLOR_BROWN: case SKINCOLOR_RED: case SKINCOLOR_GREEN: case SKINCOLOR_BLUE: + + case SKINCOLOR_ORANGE: + case SKINCOLOR_ROSEWOOD: // 16 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); break; - case SKINCOLOR_ORANGE: - // 14 colors of orange + brown - for (i = 0; i < SKIN_RAMP_LENGTH-2; i++) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); - for (i = 0; i < 2; i++) - dest_colormap[starttranscolor + (i+SKIN_RAMP_LENGTH-2)] = (UINT8)(152 + i); - break; - case SKINCOLOR_CYAN: // 12 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) @@ -320,57 +313,141 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U case SKINCOLOR_WHITE: case SKINCOLOR_BLACK: - case SKINCOLOR_STEELBLUE: case SKINCOLOR_PINK: - case SKINCOLOR_LAVENDER: - case SKINCOLOR_PURPLE: case SKINCOLOR_DARKRED: case SKINCOLOR_ZIM: - case SKINCOLOR_YELLOW: - case SKINCOLOR_GOLD: // 8 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); break; case SKINCOLOR_TEAL: - // 5 color ramp + // 5 color ramp, from 2 colour ranges for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (5*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xf7; + dest_colormap[starttranscolor + i] = 0xf8; else dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (5*i/SKIN_RAMP_LENGTH) - 1); } break; + case SKINCOLOR_PEACH: + // 10 color rame, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 == 0) + dest_colormap[starttranscolor + i] = 0xC0; // Lightest + else if (10*i/16 == 1) + dest_colormap[starttranscolor + i] = 0x30; // Second + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main + } + break; + + case SKINCOLOR_TAN: + // 8 color rame, from 3 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (8*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x51; // Lightest 1 + else if (8*i/16 == 5) + dest_colormap[starttranscolor + i] = 0xE5; // Darkest 1 + else if (8*i/16 == 6) + dest_colormap[starttranscolor + i] = 0xE9; // Darkest 2 + else if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0xDD; // Darkest 3 + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 1); // main + } + break; + + case SKINCOLOR_BEIGE: + // 13 color range, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (13*i/16 == 12) + dest_colormap[starttranscolor + i] = 0xDD; // darkest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (13*i/SKIN_RAMP_LENGTH)); // Neon green + } + break; + + case SKINCOLOR_STEELBLUE: + // 8 color range, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (8*i/16 <= 1) + dest_colormap[starttranscolor + i] = 0x80 + 8*i/16; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 2); // main + } + break; + + case SKINCOLOR_LAVENDER: + // 10 color range, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 <= 1) + dest_colormap[starttranscolor + i] = 0xEC + 10*i/16; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main + } + break; + + case SKINCOLOR_PURPLE: + // 12 color range, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (12*i/16 == 0) + dest_colormap[starttranscolor + i] = 0xEC; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH) - 1); // main + } + break; + + case SKINCOLOR_YELLOW: + // 13 color range, from 2 color ranges + // actually magenta + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (12*i/16 <= 3) + dest_colormap[starttranscolor + i] = 0x50 + 12*i/16; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH) - 4); // main + } + break; + + case SKINCOLOR_GOLD: + // 10 color rame, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x50; // Lightest + else if (10*i/16 == 1) + dest_colormap[starttranscolor + i] = 0x53; // Second + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main + } + break; + case SKINCOLOR_OLIVE: // 7 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (7*i/SKIN_RAMP_LENGTH)); break; - case SKINCOLOR_TAN: - // 16 color ramp, from two color ranges - for (i = 0; i < SKIN_RAMP_LENGTH/2; i++) // Peach half - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); - for (i = 0; i < SKIN_RAMP_LENGTH/2; i++) // Brown half - dest_colormap[starttranscolor + (i+8)] = (UINT8)(48 + i); - break; - - case SKINCOLOR_ROSEWOOD: - // 12 color ramp, from two color ranges! - for (i = 0; i < 6; i++) // Orange ...third? - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH)); - for (i = 0; i < 10; i++) // Rosewood two-thirds-ish - dest_colormap[starttranscolor + (i+6)] = (UINT8)(152 + (12*i/SKIN_RAMP_LENGTH)); - break; - case SKINCOLOR_NEONGREEN: // Multi-color ramp - dest_colormap[starttranscolor] = 0xA0; // Brighter green - for (i = 0; i < SKIN_RAMP_LENGTH-1; i++) // Neon Green - dest_colormap[starttranscolor + (i+1)] = (UINT8)(skinbasecolors[color - 1] + (6*i/(SKIN_RAMP_LENGTH-1))); + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 <= 1) + dest_colormap[starttranscolor + i] = 0x60 + 10*i/16; // Brighter green + else if (10*i/16 < 9) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // Neon green + else + dest_colormap[starttranscolor + i] = 0x6F; + } break; // Super colors, from lightest to darkest! From 70d0595817ddd20c8519911cdc7e5bea72a87c90 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Thu, 23 Jul 2015 17:58:52 +0100 Subject: [PATCH 084/364] Update colour changes More correct colour ranges. Added Rosewood. Added Super Sonic Colours (No Super Tails or Knuckles, at least not yet). --- src/r_draw.c | 278 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 174 insertions(+), 104 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index a8f48bbeb..6689e6c29 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -239,17 +239,17 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0x70, // SKINCOLOR_CYAN 0x7c, // SKINCOLOR_TEAL 0x9a, // SKINCOLOR_STEELBLUE - 0x80, // SKINCOLOR_BLUE + 0x82, // SKINCOLOR_BLUE 0xc8, // SKINCOLOR_PEACH 0x54, // SKINCOLOR_TAN 0xc0, // SKINCOLOR_PINK 0xb0, // SKINCOLOR_LAVENDER - 0xa0, // SKINCOLOR_PURPLE - 0x30, // SKINCOLOR_ORANGE - 0x30, // SKINCOLOR_ROSEWOOD + 0xa3, // SKINCOLOR_PURPLE + 0x31, // SKINCOLOR_ORANGE + 0x3a, // SKINCOLOR_ROSEWOOD 0xe0, // SKINCOLOR_BEIGE 0xd0, // SKINCOLOR_BROWN - 0x20, // SKINCOLOR_RED + 0x21, // SKINCOLOR_RED 0x28, // SKINCOLOR_DARKRED 0xf0, // SKINCOLOR_NEONGREEN 0x60, // SKINCOLOR_GREEN @@ -294,12 +294,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U case SKINCOLOR_SILVER: case SKINCOLOR_GREY: case SKINCOLOR_BROWN: - case SKINCOLOR_RED: case SKINCOLOR_GREEN: - case SKINCOLOR_BLUE: - - case SKINCOLOR_ORANGE: - case SKINCOLOR_ROSEWOOD: // 16 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); @@ -311,24 +306,43 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH)); break; + case SKINCOLOR_PURPLE: + // 9 color ramp + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); + break; + case SKINCOLOR_WHITE: case SKINCOLOR_BLACK: case SKINCOLOR_PINK: - case SKINCOLOR_DARKRED: case SKINCOLOR_ZIM: // 8 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); break; - case SKINCOLOR_TEAL: - // 5 color ramp, from 2 colour ranges + case SKINCOLOR_RED: for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (5*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xf8; + if (i == 13) + dest_colormap[starttranscolor + i] = 0x47; + else if (i > 13) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 1); else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (5*i/SKIN_RAMP_LENGTH) - 1); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); + } + break; + + case SKINCOLOR_DARKRED: + // 9 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (9*i/16 == 6) + dest_colormap[starttranscolor + i] = 0x47; + else if (9*i/16 > 6) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH) - 1); + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); } break; @@ -345,8 +359,57 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; + case SKINCOLOR_BEIGE: + // 13 color range, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (13*i/16 == 12) + dest_colormap[starttranscolor + i] = 0xDD; // darkest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (13*i/SKIN_RAMP_LENGTH)); // Neon green + } + break; + + case SKINCOLOR_ORANGE: + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 15) + dest_colormap[starttranscolor + i] = 0xEE; + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); + } + break; + + case SKINCOLOR_ROSEWOOD: + // 9 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (9*i/16 == 6) + dest_colormap[starttranscolor + i] = 0xEE; + else if (9*i/16 == 7) + dest_colormap[starttranscolor + i] = 0xEF; + else if (9*i/16 == 8) + dest_colormap[starttranscolor + i] = 0x47; + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); + } + break; + + case SKINCOLOR_GOLD: + // 10 color range, from 2 color ranges + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x50; // Lightest + else if (10*i/16 == 1) + dest_colormap[starttranscolor + i] = 0x53; // Second + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main + } + break; + case SKINCOLOR_TAN: - // 8 color rame, from 3 color ranges + // 8 color range, from 3 color ranges for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (8*i/16 == 0) @@ -362,14 +425,60 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_BEIGE: - // 13 color range, from 2 color ranges + case SKINCOLOR_OLIVE: + // 7 color ramp + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (7*i/SKIN_RAMP_LENGTH)); + break; + + case SKINCOLOR_YELLOW: + // 10 color range, from 2 color ranges for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (13*i/16 == 12) - dest_colormap[starttranscolor + i] = 0xDD; // darkest + if (10*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x53; // Lightest + else if (10*i/16 == 9) + dest_colormap[starttranscolor + i] = 0xDD; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (13*i/SKIN_RAMP_LENGTH)); // Neon green + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 1); // main + } + break; + + case SKINCOLOR_NEONGREEN: + // Multi-color ramp + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 <= 1) + dest_colormap[starttranscolor + i] = 0x60 + 10*i/16; // Brighter green + else if (10*i/16 < 9) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // Neon green + else + dest_colormap[starttranscolor + i] = 0x6F; + } + break; + + case SKINCOLOR_TEAL: + // 6 color ramp + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (6*i/16 == 0) + dest_colormap[starttranscolor + i] = 0xf8; // Lightest + else if (6*i/16 == 5) + dest_colormap[starttranscolor + i] = 0x7a; // Darkest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (6*i/SKIN_RAMP_LENGTH) - 1); + } + break; + + case SKINCOLOR_BLUE: + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 14) + dest_colormap[starttranscolor + i] = 0x9F; + else if (i == 15) + dest_colormap[starttranscolor + i] = 0x1F; + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); } break; @@ -379,6 +488,8 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U { if (8*i/16 <= 1) dest_colormap[starttranscolor + i] = 0x80 + 8*i/16; // Lightest + else if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0x7B; // Darkest else dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 2); // main } @@ -395,108 +506,67 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_PURPLE: - // 12 color range, from 2 color ranges - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (12*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xEC; // Lightest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH) - 1); // main - } - break; - - case SKINCOLOR_YELLOW: - // 13 color range, from 2 color ranges - // actually magenta - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (12*i/16 <= 3) - dest_colormap[starttranscolor + i] = 0x50 + 12*i/16; // Lightest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH) - 4); // main - } - break; - - case SKINCOLOR_GOLD: - // 10 color rame, from 2 color ranges - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (10*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x50; // Lightest - else if (10*i/16 == 1) - dest_colormap[starttranscolor + i] = 0x53; // Second - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main - } - break; - - case SKINCOLOR_OLIVE: - // 7 color ramp - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (7*i/SKIN_RAMP_LENGTH)); - break; - - case SKINCOLOR_NEONGREEN: - // Multi-color ramp - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (10*i/16 <= 1) - dest_colormap[starttranscolor + i] = 0x60 + 10*i/16; // Brighter green - else if (10*i/16 < 9) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // Neon green - else - dest_colormap[starttranscolor + i] = 0x6F; - } - break; - // Super colors, from lightest to darkest! case SKINCOLOR_SUPER1: // Super White for (i = 0; i < 10; i++) - dest_colormap[starttranscolor + i] = 120; // True white - for (; i < SKIN_RAMP_LENGTH; i++) // White-yellow fade - dest_colormap[starttranscolor + i] = (UINT8)(96 + (i-10)); + dest_colormap[starttranscolor + i] = (UINT8)0; // True white + for (; i < 12; i++) // White-yellow fade + dest_colormap[starttranscolor + i] = (UINT8)(80); + for (; i < 15; i++) // White-yellow fade + dest_colormap[starttranscolor + i] = (UINT8)(81 + (i-12)); + dest_colormap[starttranscolor + 15] = (UINT8)(72); break; case SKINCOLOR_SUPER2: // Super Bright - for (i = 0; i < 5; i++) // White-yellow fade - dest_colormap[starttranscolor + i] = (UINT8)(96 + i); - dest_colormap[starttranscolor + 5] = 112; // Golden shine - for (i = 0; i < 8; i++) // Yellow - dest_colormap[starttranscolor + (i+6)] = (UINT8)(101 + (i>>1)); - for (i = 0; i < 2; i++) // With a fine golden finish! :3 - dest_colormap[starttranscolor + (i+14)] = (UINT8)(113 + i); + dest_colormap[starttranscolor] = (UINT8)(0); + for (i = 1; i < 4; i++) // White-yellow fade + dest_colormap[starttranscolor + i] = (UINT8)(80 + (i-1)); + for (; i < 6; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(83); + for (; i < 8; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(72); + for (; i < 14; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(73); + for (; i < 16; i++) // With a fine golden finish! :3 + dest_colormap[starttranscolor + i] = (UINT8)(64 + (i-14)); break; case SKINCOLOR_SUPER3: // Super Yellow - for (i = 0; i < 3; i++) // White-yellow fade - dest_colormap[starttranscolor + i] = (UINT8)(98 + i); - dest_colormap[starttranscolor + 3] = 112; // Golden shine - for (i = 0; i < 8; i++) // Yellow - dest_colormap[starttranscolor + (i+4)] = (UINT8)(101 + (i>>1)); - for (i = 0; i < 4; i++) // With a fine golden finish! :3 - dest_colormap[starttranscolor + (i+12)] = (UINT8)(113 + i); + for (i = 0; i < 2; i++) // White-yellow fade + dest_colormap[starttranscolor + i] = (UINT8)(81 + i); + for (; i < 4; i++) + dest_colormap[starttranscolor + i] = (UINT8)(83); + for (; i < 6; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(72); + for (; i < 12; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(73); + for (; i < 16; i++) // With a fine golden finish! :3 + dest_colormap[starttranscolor + i] = (UINT8)(64 + (i-12)); break; case SKINCOLOR_SUPER4: // "The SSNTails" - dest_colormap[starttranscolor] = 112; // Golden shine - for (i = 0; i < 8; i++) // Yellow - dest_colormap[starttranscolor + (i+1)] = (UINT8)(101 + (i>>1)); - for (i = 0; i < 7; i++) // With a fine golden finish! :3 - dest_colormap[starttranscolor + (i+9)] = (UINT8)(113 + i); + dest_colormap[starttranscolor] = 83; // Golden shine + for (i = 1; i < 3; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(72); + for (; i < 9; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(73); + for (; i < 16; i++) // With a fine golden finish! :3 + dest_colormap[starttranscolor + i] = (UINT8)(64 + (i-9)); break; case SKINCOLOR_SUPER5: // Golden Delicious - for (i = 0; i < 8; i++) // Yellow - dest_colormap[starttranscolor + i] = (UINT8)(101 + (i>>1)); - for (i = 0; i < 7; i++) // With a fine golden finish! :3 - dest_colormap[starttranscolor + (i+8)] = (UINT8)(113 + i); - dest_colormap[starttranscolor + 15] = 155; + for (i = 0; i < 2; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(72); + for (; i < 8; i++) // Yellow + dest_colormap[starttranscolor + i] = (UINT8)(73); + for (; i < 15; i++) // With a fine golden finish! :3 + dest_colormap[starttranscolor + i] = (UINT8)(64 + (i-8)); + dest_colormap[starttranscolor + 15] = (UINT8)63; break; // Super Tails From e054f4b6c6703ca6a11369107c9d2510ea988ecc Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Thu, 23 Jul 2015 18:56:05 +0100 Subject: [PATCH 085/364] Drawfills and Console All relevant DrawFills had colours changed. Console background colour changed. Text colourmapping changed. --- src/console.c | 40 ++++++++++++++++++++-------------------- src/d_clisrv.c | 6 +++--- src/m_menu.c | 2 +- src/r_main.c | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/console.c b/src/console.c index e77c400b3..1c8640396 100644 --- a/src/console.c +++ b/src/console.c @@ -248,11 +248,11 @@ void CON_ReSetupBackColormap(UINT16 num) { j = pal[i] + pal[i+1] + pal[i+2]; cwhitemap[k] = (UINT8)(15 - (j>>6)); - corangemap[k] = (UINT8)(95 - (j>>6)); - cbluemap[k] = (UINT8)(239 - (j>>6)); - cgreenmap[k] = (UINT8)(175 - (j>>6)); + corangemap[k] = (UINT8)(63 - (j>>6)); + cbluemap[k] = (UINT8)(143 - (j>>6)); + cgreenmap[k] = (UINT8)(111 - (j>>6)); cgraymap[k] = (UINT8)(31 - (j>>6)); - credmap[k] = (UINT8)(143 - (j>>6)); + credmap[k] = (UINT8)(47 - (j>>6)); } } @@ -283,11 +283,11 @@ static void CON_SetupBackColormap(void) { j = pal[i] + pal[i+1] + pal[i+2]; cwhitemap[k] = (UINT8)(15 - (j>>6)); - corangemap[k] = (UINT8)(95 - (j>>6)); - cbluemap[k] = (UINT8)(239 - (j>>6)); - cgreenmap[k] = (UINT8)(175 - (j>>6)); + corangemap[k] = (UINT8)(63 - (j>>6)); + cbluemap[k] = (UINT8)(143 - (j>>6)); + cgreenmap[k] = (UINT8)(111 - (j>>6)); cgraymap[k] = (UINT8)(31 - (j>>6)); - credmap[k] = (UINT8)(143 - (j>>6)); + credmap[k] = (UINT8)(47 - (j>>6)); } // setup the other colormaps, for console text @@ -306,20 +306,20 @@ static void CON_SetupBackColormap(void) orangemap[i] = (UINT8)i; } - yellowmap[3] = (UINT8)103; - yellowmap[9] = (UINT8)115; - purplemap[3] = (UINT8)195; - purplemap[9] = (UINT8)198; - lgreenmap[3] = (UINT8)162; - lgreenmap[9] = (UINT8)170; - bluemap[3] = (UINT8)228; - bluemap[9] = (UINT8)238; + yellowmap[3] = (UINT8)73; + yellowmap[9] = (UINT8)66; + purplemap[3] = (UINT8)168; + purplemap[9] = (UINT8)170; + lgreenmap[3] = (UINT8)102; + lgreenmap[9] = (UINT8)106; + bluemap[3] = (UINT8)131; + bluemap[9] = (UINT8)142; graymap[3] = (UINT8)10; graymap[9] = (UINT8)15; - redmap[3] = (UINT8)124; - redmap[9] = (UINT8)127; - orangemap[3] = (UINT8)85; - orangemap[9] = (UINT8)90; + redmap[3] = (UINT8)194; + redmap[9] = (UINT8)32; + orangemap[3] = (UINT8)52; + orangemap[9] = (UINT8)57; } // Setup the console text buffer diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c0179ca1b..31738e9b2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1101,7 +1101,7 @@ static inline void CL_DrawConnectionStatus(void) if (cl_mode != cl_downloadfiles) { INT32 i, animtime = ((ccstime / 4) & 15) + 16; - UINT8 palstart = (cl_mode == cl_searching) ? 128 : 160; + UINT8 palstart = (cl_mode == cl_searching) ? 32 : 96; // 15 pal entries total. const char *cltext; @@ -1139,8 +1139,8 @@ static inline void CL_DrawConnectionStatus(void) dldlength = (INT32)((fileneeded[lastfilenum].currentsize/(double)fileneeded[lastfilenum].totalsize) * 256); if (dldlength > 256) dldlength = 256; - V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 175); - V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 160); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, 256, 8, 111); + V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-24, dldlength, 8, 96); memset(tempname, 0, sizeof(tempname)); nameonly(strncpy(tempname, fileneeded[lastfilenum].filename, 31)); diff --git a/src/m_menu.c b/src/m_menu.c index 06aaac0ef..111be9479 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2820,7 +2820,7 @@ static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv) void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) { // Solid color textbox. - V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 239); + V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 143); //V_DrawFill(x+8, y+8, width*8, boxlines*8, 31); /* patch_t *p; diff --git a/src/r_main.c b/src/r_main.c index ffd4d5d50..77d6a456c 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1282,7 +1282,7 @@ void R_RenderPlayerView(player_t *player) if (cv_homremoval.value == 1) V_DrawFill(0, 0, vid.width, vid.height, 31); // No HOM effect! else //'development' HOM removal -- makes it blindingly obvious if HOM is spotted. - V_DrawFill(0, 0, vid.width, vid.height, 128+(timeinmap&15)); + V_DrawFill(0, 0, vid.width, vid.height, 32+(timeinmap&15)); } portalrender = 0; From 721a5f9b4b57fd1c4237cde298b665e2b91f93ca Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Thu, 23 Jul 2015 21:43:30 +0100 Subject: [PATCH 086/364] Default Translation color + Neon Green change --- src/r_draw.c | 30 ++++++++++++++---------------- src/r_things.c | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 6689e6c29..5f4f28cfc 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -121,7 +121,7 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask; #define METALSONIC_TT_CACHE_INDEX (MAXSKINS + 2) #define ALLWHITE_TT_CACHE_INDEX (MAXSKINS + 3) #define SKIN_RAMP_LENGTH 16 -#define DEFAULT_STARTTRANSCOLOR 160 +#define DEFAULT_STARTTRANSCOLOR 96 #define NUM_PALETTE_ENTRIES 256 static UINT8** translationtablecache[MAXSKINS + 4] = {NULL}; @@ -347,7 +347,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_PEACH: - // 10 color rame, from 2 color ranges + // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (10*i/16 == 0) @@ -360,7 +360,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_BEIGE: - // 13 color range, from 2 color ranges + // 13 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (13*i/16 == 12) @@ -396,7 +396,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_GOLD: - // 10 color range, from 2 color ranges + // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (10*i/16 == 0) @@ -409,7 +409,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_TAN: - // 8 color range, from 3 color ranges + // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (8*i/16 == 0) @@ -426,13 +426,13 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_OLIVE: - // 7 color ramp + // 7 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (7*i/SKIN_RAMP_LENGTH)); break; case SKINCOLOR_YELLOW: - // 10 color range, from 2 color ranges + // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (10*i/16 == 0) @@ -445,20 +445,18 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_NEONGREEN: - // Multi-color ramp + // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (10*i/16 <= 1) - dest_colormap[starttranscolor + i] = 0x60 + 10*i/16; // Brighter green - else if (10*i/16 < 9) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // Neon green + if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0x6E; // Darkest else - dest_colormap[starttranscolor + i] = 0x6F; + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH)); // Neon green } break; case SKINCOLOR_TEAL: - // 6 color ramp + // 6 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (6*i/16 == 0) @@ -483,7 +481,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_STEELBLUE: - // 8 color range, from 2 color ranges + // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (8*i/16 <= 1) @@ -496,7 +494,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_LAVENDER: - // 10 color range, from 2 color ranges + // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (10*i/16 <= 1) diff --git a/src/r_things.c b/src/r_things.c index 9a8b1319b..3b46d4d3d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2235,7 +2235,7 @@ static void Sk_SetDefaultValue(skin_t *skin) strncpy(skin->face, "MISSING", 8); strncpy(skin->superface, "MISSING", 8); - skin->starttranscolor = 160; + skin->starttranscolor = 96; skin->prefcolor = SKINCOLOR_GREEN; skin->normalspeed = 36< Date: Thu, 23 Jul 2015 22:57:54 +0100 Subject: [PATCH 087/364] Rearange colours to be in more correct order --- src/r_draw.c | 174 +++++++++++++++++++++++++-------------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 5f4f28cfc..50c449624 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -321,28 +321,41 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); break; - case SKINCOLOR_RED: + case SKINCOLOR_TEAL: + // 6 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (i == 13) - dest_colormap[starttranscolor + i] = 0x47; - else if (i > 13) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 1); + if (6*i/16 == 0) + dest_colormap[starttranscolor + i] = 0xf8; // Lightest + else if (6*i/16 == 5) + dest_colormap[starttranscolor + i] = 0x7a; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (6*i/SKIN_RAMP_LENGTH) - 1); } break; - case SKINCOLOR_DARKRED: - // 9 colors + case SKINCOLOR_STEELBLUE: + // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (9*i/16 == 6) - dest_colormap[starttranscolor + i] = 0x47; - else if (9*i/16 > 6) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH) - 1); + if (8*i/16 <= 1) + dest_colormap[starttranscolor + i] = 0x80 + 8*i/16; // Lightest + else if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0x7B; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 2); // main + } + break; + + case SKINCOLOR_BLUE: + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 14) + dest_colormap[starttranscolor + i] = 0x9F; + else if (i == 15) + dest_colormap[starttranscolor + i] = 0x1F; + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); } break; @@ -359,14 +372,31 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_BEIGE: - // 13 colors + case SKINCOLOR_TAN: + // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (13*i/16 == 12) - dest_colormap[starttranscolor + i] = 0xDD; // darkest + if (8*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x51; // Lightest 1 + else if (8*i/16 == 5) + dest_colormap[starttranscolor + i] = 0xE5; // Darkest 1 + else if (8*i/16 == 6) + dest_colormap[starttranscolor + i] = 0xE9; // Darkest 2 + else if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0xDD; // Darkest 3 else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (13*i/SKIN_RAMP_LENGTH)); // Neon green + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 1); // main + } + break; + + case SKINCOLOR_LAVENDER: + // 10 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 <= 1) + dest_colormap[starttranscolor + i] = 0xEC + 10*i/16; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main } break; @@ -395,33 +425,50 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_GOLD: - // 10 colors + case SKINCOLOR_BEIGE: + // 13 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (10*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x50; // Lightest - else if (10*i/16 == 1) - dest_colormap[starttranscolor + i] = 0x53; // Second + if (13*i/16 == 12) + dest_colormap[starttranscolor + i] = 0xDD; // darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (13*i/SKIN_RAMP_LENGTH)); // Neon green } break; - case SKINCOLOR_TAN: + case SKINCOLOR_RED: + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 13) + dest_colormap[starttranscolor + i] = 0x47; + else if (i > 13) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 1); + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); + } + break; + + case SKINCOLOR_DARKRED: + // 9 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (9*i/16 == 6) + dest_colormap[starttranscolor + i] = 0x47; + else if (9*i/16 > 6) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH) - 1); + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); + } + break; + + case SKINCOLOR_NEONGREEN: // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (8*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x51; // Lightest 1 - else if (8*i/16 == 5) - dest_colormap[starttranscolor + i] = 0xE5; // Darkest 1 - else if (8*i/16 == 6) - dest_colormap[starttranscolor + i] = 0xE9; // Darkest 2 - else if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0xDD; // Darkest 3 + if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0x6E; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 1); // main + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH)); // Neon green } break; @@ -444,61 +491,14 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_NEONGREEN: - // 8 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0x6E; // Darkest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH)); // Neon green - } - break; - - case SKINCOLOR_TEAL: - // 6 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (6*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xf8; // Lightest - else if (6*i/16 == 5) - dest_colormap[starttranscolor + i] = 0x7a; // Darkest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (6*i/SKIN_RAMP_LENGTH) - 1); - } - break; - - case SKINCOLOR_BLUE: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (i == 14) - dest_colormap[starttranscolor + i] = 0x9F; - else if (i == 15) - dest_colormap[starttranscolor + i] = 0x1F; - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); - } - break; - - case SKINCOLOR_STEELBLUE: - // 8 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (8*i/16 <= 1) - dest_colormap[starttranscolor + i] = 0x80 + 8*i/16; // Lightest - else if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0x7B; // Darkest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 2); // main - } - break; - - case SKINCOLOR_LAVENDER: + case SKINCOLOR_GOLD: // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (10*i/16 <= 1) - dest_colormap[starttranscolor + i] = 0xEC + 10*i/16; // Lightest + if (10*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x50; // Lightest + else if (10*i/16 == 1) + dest_colormap[starttranscolor + i] = 0x53; // Second else dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main } From 9847668863bbd6bcc8d8db097a48e5785ec32a9a Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Fri, 24 Jul 2015 23:39:53 +0100 Subject: [PATCH 088/364] New Colours --- src/dehacked.c | 5 ++- src/doomdef.h | 5 ++- src/r_draw.c | 82 +++++++++++++++++++++++++++++++++++++++++--------- src/st_stuff.c | 2 +- 4 files changed, 76 insertions(+), 18 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index a332da5df..2f50afaa7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7310,14 +7310,17 @@ static const char *COLOR_ENUMS[] = { "GREY", // SKINCOLOR_GREY "BLACK", // SKINCOLOR_BLACK "CYAN", // SKINCOLOR_CYAN + "AQUAMARINE", // SKINCOLOR_AQUAMARINE "TEAL", // SKINCOLOR_TEAL "STEELBLUE", // SKINCOLOR_STEELBLUE "BLUE", // SKINCOLOR_BLUE "PEACH", // SKINCOLOR_PEACH "TAN", // SKINCOLOR_TAN "PINK", // SKINCOLOR_PINK + "ROSY", // SKINCOLOR_ROSY "LAVENDER", // SKINCOLOR_LAVENDER "PURPLE", // SKINCOLOR_PURPLE + "MAGENTA", // SKINCOLOR_MAGENTA "ORANGE", // SKINCOLOR_ORANGE "ROSEWOOD", // SKINCOLOR_ROSEWOOD "BEIGE", // SKINCOLOR_BEIGE @@ -7327,7 +7330,7 @@ static const char *COLOR_ENUMS[] = { "NEONGREEN", // SKINCOLOR_NEONGREEN "GREEN", // SKINCOLOR_GREEN "ZIM", // SKINCOLOR_ZIM - "OLIVE", // SKINCOLOR_OLIVE + "PERIDOT", // SKINCOLOR_PERIDOT "YELLOW", // SKINCOLOR_YELLOW "GOLD" // SKINCOLOR_GOLD }; diff --git a/src/doomdef.h b/src/doomdef.h index 4a6d6e576..1e7edd207 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -231,14 +231,17 @@ typedef enum SKINCOLOR_GREY, SKINCOLOR_BLACK, SKINCOLOR_CYAN, + SKINCOLOR_AQUAMARINE, SKINCOLOR_TEAL, SKINCOLOR_STEELBLUE, SKINCOLOR_BLUE, SKINCOLOR_PEACH, SKINCOLOR_TAN, SKINCOLOR_PINK, + SKINCOLOR_ROSY, SKINCOLOR_LAVENDER, SKINCOLOR_PURPLE, + SKINCOLOR_MAGENTA, SKINCOLOR_ORANGE, SKINCOLOR_ROSEWOOD, SKINCOLOR_BEIGE, @@ -248,7 +251,7 @@ typedef enum SKINCOLOR_NEONGREEN, SKINCOLOR_GREEN, SKINCOLOR_ZIM, - SKINCOLOR_OLIVE, + SKINCOLOR_PERIDOT, SKINCOLOR_YELLOW, SKINCOLOR_GOLD, diff --git a/src/r_draw.c b/src/r_draw.c index 50c449624..f1955c6c0 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -137,14 +137,17 @@ const char *Color_Names[MAXSKINCOLORS] = "Grey", // SKINCOLOR_GREY "Black", // SKINCOLOR_BLACK "Cyan", // SKINCOLOR_CYAN + "Aquamarine",// SKINCOLOR_AQUAMARINE "Teal", // SKINCOLOR_TEAL "Steel_Blue",// SKINCOLOR_STEELBLUE "Blue", // SKINCOLOR_BLUE "Peach", // SKINCOLOR_PEACH "Tan", // SKINCOLOR_TAN "Pink", // SKINCOLOR_PINK + "Rosy", // SKINCOLOR_ROSY "Lavender", // SKINCOLOR_LAVENDER "Purple", // SKINCOLOR_PURPLE + "Magenta", // SKINCOLOR_MAGENTA "Orange", // SKINCOLOR_ORANGE "Rosewood", // SKINCOLOR_ROSEWOOD "Beige", // SKINCOLOR_BEIGE @@ -154,7 +157,7 @@ const char *Color_Names[MAXSKINCOLORS] = "Neon_Green",// SKINCOLOR_NEONGREEN "Green", // SKINCOLOR_GREEN "Zim", // SKINCOLOR_ZIM - "Olive", // SKINCOLOR_OLIVE + "Peridot", // SKINCOLOR_PERIDOT "Yellow", // SKINCOLOR_YELLOW "Gold" // SKINCOLOR_GOLD }; @@ -167,14 +170,17 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_SILVER,12,// SKINCOLOR_GREY SKINCOLOR_WHITE,8, // SKINCOLOR_BLACK SKINCOLOR_NONE,8, // SKINCOLOR_CYAN + SKINCOLOR_NONE,8, // SKINCOLOR_AQUAMARINE SKINCOLOR_NONE,8, // SKINCOLOR_TEAL SKINCOLOR_NONE,8, // SKINCOLOR_STEELBLUE SKINCOLOR_ORANGE,9, // SKINCOLOR_BLUE SKINCOLOR_NONE,8, // SKINCOLOR_PEACH SKINCOLOR_NONE,8, // SKINCOLOR_TAN SKINCOLOR_NONE,8, // SKINCOLOR_PINK + SKINCOLOR_NONE,8, // SKINCOLOR_ROSY SKINCOLOR_NONE,8, // SKINCOLOR_LAVENDER SKINCOLOR_NONE,8, // SKINCOLOR_PURPLE + SKINCOLOR_NONE,8, // SKINCOLOR_MAGENTA SKINCOLOR_BLUE,12, // SKINCOLOR_ORANGE SKINCOLOR_NONE,8, // SKINCOLOR_ROSEWOOD SKINCOLOR_NONE,8, // SKINCOLOR_BEIGE @@ -183,8 +189,8 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_NONE,8, // SKINCOLOR_DARKRED SKINCOLOR_NONE,8, // SKINCOLOR_NEONGREEN SKINCOLOR_RED,11, // SKINCOLOR_GREEN - SKINCOLOR_PURPLE,3, // SKINCOLOR_ZIM - SKINCOLOR_NONE,8, // SKINCOLOR_OLIVE + SKINCOLOR_MAGENTA,3, // SKINCOLOR_ZIM + SKINCOLOR_NONE,8, // SKINCOLOR_PERIDOT SKINCOLOR_NONE,8, // SKINCOLOR_YELLOW SKINCOLOR_NONE,8 // SKINCOLOR_GOLD }; @@ -237,14 +243,17 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0x08, // SKINCOLOR_GREY 0x18, // SKINCOLOR_BLACK 0x70, // SKINCOLOR_CYAN + 0xf8, // SKINCOLOR_AQUAMARINE 0x7c, // SKINCOLOR_TEAL 0x9a, // SKINCOLOR_STEELBLUE 0x82, // SKINCOLOR_BLUE 0xc8, // SKINCOLOR_PEACH 0x54, // SKINCOLOR_TAN 0xc0, // SKINCOLOR_PINK + 0xb8, // SKINCOLOR_ROSY 0xb0, // SKINCOLOR_LAVENDER - 0xa3, // SKINCOLOR_PURPLE + 0x90, // SKINCOLOR_PURPLE + 0xa3, // SKINCOLOR_MAGENTA 0x31, // SKINCOLOR_ORANGE 0x3a, // SKINCOLOR_ROSEWOOD 0xe0, // SKINCOLOR_BEIGE @@ -254,7 +263,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0xf0, // SKINCOLOR_NEONGREEN 0x60, // SKINCOLOR_GREEN 0x58, // SKINCOLOR_ZIM - 0x49, // SKINCOLOR_OLIVE + 0xac, // SKINCOLOR_PERIDOT 0x48, // SKINCOLOR_YELLOW 0x40, // SKINCOLOR_GOLD }; @@ -307,6 +316,12 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_PURPLE: + // 10 color ramp + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH)); + break; + + case SKINCOLOR_MAGENTA: // 9 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); @@ -321,6 +336,17 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); break; + case SKINCOLOR_AQUAMARINE: + // 10 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (10*i/16 >= 8) + dest_colormap[starttranscolor + i] = (UINT8)(0x6C + (10*i/SKIN_RAMP_LENGTH) - 8); // Darkest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH)); + } + break; + case SKINCOLOR_TEAL: // 6 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) @@ -339,7 +365,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (8*i/16 <= 1) - dest_colormap[starttranscolor + i] = 0x80 + 8*i/16; // Lightest + dest_colormap[starttranscolor + i] = (UINT8)(0x80 + 8*i/16); // Lightest else if (8*i/16 == 7) dest_colormap[starttranscolor + i] = 0x7B; // Darkest else @@ -389,12 +415,29 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; + case SKINCOLOR_ROSY: + // 15 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (15*i/16 == 0) + dest_colormap[starttranscolor + i] = 0xEC; // Lightest + else if (15*i/16 == 12) + dest_colormap[starttranscolor + i] = 0x47; // Dark Shade + else if (15*i/16 >= 13) + dest_colormap[starttranscolor + i] = (UINT8)(0x2E + (15*i/SKIN_RAMP_LENGTH) - 13); // Darkest + else if (15*i/16 >= 9) + dest_colormap[starttranscolor + i] = (UINT8)(0x2B + (15*i/SKIN_RAMP_LENGTH) - 9); // Darkish + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (15*i/SKIN_RAMP_LENGTH) - 1); // main + } + break; + case SKINCOLOR_LAVENDER: // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (10*i/16 <= 1) - dest_colormap[starttranscolor + i] = 0xEC + 10*i/16; // Lightest + dest_colormap[starttranscolor + i] = (UINT8)(0xEC + 10*i/16); // Lightest else dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main } @@ -472,22 +515,31 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_OLIVE: - // 7 colors + case SKINCOLOR_PERIDOT: + // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (7*i/SKIN_RAMP_LENGTH)); + { + if (8*i/16 == 0) + dest_colormap[starttranscolor + i] = 0x48; // Lightest + else if (8*i/16 == 7) + dest_colormap[starttranscolor + i] = 0x6D; // Darkest + else if (8*i/16 >= 5) + dest_colormap[starttranscolor + i] = (UINT8)(0x5E + (8*i/SKIN_RAMP_LENGTH) - 5); // Darkish + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 1); // main + } break; case SKINCOLOR_YELLOW: - // 10 colors + // 9 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (10*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x53; // Lightest - else if (10*i/16 == 9) + if (i == 0) + dest_colormap[starttranscolor + i] = 0x48; // Lightest + else if (i == 15) dest_colormap[starttranscolor + i] = 0xDD; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 1); // main + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*(i-1)/SKIN_RAMP_LENGTH)); } break; diff --git a/src/st_stuff.c b/src/st_stuff.c index a9bdacf71..58992bea4 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -889,7 +889,7 @@ static void ST_drawFirstPersonHUD(void) // [21:42] <+Rob> Beige - Lavender - Steel Blue - Peach - Orange - Purple - Silver - Yellow - Pink - Red - Blue - Green - Cyan - Gold static skincolors_t linkColor[14] = {SKINCOLOR_BEIGE, SKINCOLOR_LAVENDER, SKINCOLOR_STEELBLUE, SKINCOLOR_PEACH, SKINCOLOR_ORANGE, - SKINCOLOR_PURPLE, SKINCOLOR_SILVER, SKINCOLOR_SUPER4, SKINCOLOR_PINK, SKINCOLOR_RED, + SKINCOLOR_MAGENTA, SKINCOLOR_SILVER, SKINCOLOR_SUPER4, SKINCOLOR_PINK, SKINCOLOR_RED, SKINCOLOR_BLUE, SKINCOLOR_GREEN, SKINCOLOR_CYAN, SKINCOLOR_GOLD}; static void ST_drawNightsRecords(void) From c6c67d45b0d4dcb8f3486e9c094406c825eb1da1 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 25 Jul 2015 00:14:50 +0100 Subject: [PATCH 089/364] Fix Purple --- src/r_draw.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index f1955c6c0..f54d2f171 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -315,12 +315,6 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH)); break; - case SKINCOLOR_PURPLE: - // 10 color ramp - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH)); - break; - case SKINCOLOR_MAGENTA: // 9 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) @@ -443,6 +437,17 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; + case SKINCOLOR_PURPLE: + // 10 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i <= 3) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) + 2); // main + } + break; + case SKINCOLOR_ORANGE: for (i = 0; i < SKIN_RAMP_LENGTH; i++) { From 14b157b98d532c7a5f8dbf3b6a5afefeb4936835 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 25 Jul 2015 13:35:11 +0100 Subject: [PATCH 090/364] Fix yellow --- src/r_draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index f54d2f171..808b3cc6e 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -536,15 +536,15 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U break; case SKINCOLOR_YELLOW: - // 9 colors + // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (i == 0) - dest_colormap[starttranscolor + i] = 0x48; // Lightest + dest_colormap[starttranscolor + i] = 0x53; // Lightest else if (i == 15) dest_colormap[starttranscolor + i] = 0xDD; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*(i-1)/SKIN_RAMP_LENGTH)); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH)); } break; From 5209787ebd32dce34de130ac4ad92bceb66bc068 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 25 Jul 2015 14:07:05 +0100 Subject: [PATCH 091/364] Rename Colours --- src/dehacked.c | 10 +++++----- src/doomdef.h | 10 +++++----- src/g_game.c | 2 +- src/m_cond.c | 52 +++++++++++++++++++++++++------------------------- src/r_draw.c | 40 +++++++++++++++++++------------------- src/st_stuff.c | 6 +++--- 6 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 2f50afaa7..760ae84b3 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7310,9 +7310,9 @@ static const char *COLOR_ENUMS[] = { "GREY", // SKINCOLOR_GREY "BLACK", // SKINCOLOR_BLACK "CYAN", // SKINCOLOR_CYAN - "AQUAMARINE", // SKINCOLOR_AQUAMARINE + "AQUA", // SKINCOLOR_AQUA "TEAL", // SKINCOLOR_TEAL - "STEELBLUE", // SKINCOLOR_STEELBLUE + "AZURE", // SKINCOLOR_AZURE "BLUE", // SKINCOLOR_BLUE "PEACH", // SKINCOLOR_PEACH "TAN", // SKINCOLOR_TAN @@ -7322,12 +7322,12 @@ static const char *COLOR_ENUMS[] = { "PURPLE", // SKINCOLOR_PURPLE "MAGENTA", // SKINCOLOR_MAGENTA "ORANGE", // SKINCOLOR_ORANGE - "ROSEWOOD", // SKINCOLOR_ROSEWOOD + "RUST", // SKINCOLOR_RUST "BEIGE", // SKINCOLOR_BEIGE "BROWN", // SKINCOLOR_BROWN "RED", // SKINCOLOR_RED - "DARKRED", // SKINCOLOR_DARKRED - "NEONGREEN", // SKINCOLOR_NEONGREEN + "CRIMSON", // SKINCOLOR_CRIMSON + "EMERALD", // SKINCOLOR_EMERALD "GREEN", // SKINCOLOR_GREEN "ZIM", // SKINCOLOR_ZIM "PERIDOT", // SKINCOLOR_PERIDOT diff --git a/src/doomdef.h b/src/doomdef.h index 1e7edd207..d6af0f1a0 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -231,9 +231,9 @@ typedef enum SKINCOLOR_GREY, SKINCOLOR_BLACK, SKINCOLOR_CYAN, - SKINCOLOR_AQUAMARINE, + SKINCOLOR_AQUA, SKINCOLOR_TEAL, - SKINCOLOR_STEELBLUE, + SKINCOLOR_AZURE, SKINCOLOR_BLUE, SKINCOLOR_PEACH, SKINCOLOR_TAN, @@ -243,12 +243,12 @@ typedef enum SKINCOLOR_PURPLE, SKINCOLOR_MAGENTA, SKINCOLOR_ORANGE, - SKINCOLOR_ROSEWOOD, + SKINCOLOR_RUST, SKINCOLOR_BEIGE, SKINCOLOR_BROWN, SKINCOLOR_RED, - SKINCOLOR_DARKRED, - SKINCOLOR_NEONGREEN, + SKINCOLOR_CRIMSON, + SKINCOLOR_EMERALD, SKINCOLOR_GREEN, SKINCOLOR_ZIM, SKINCOLOR_PERIDOT, diff --git a/src/g_game.c b/src/g_game.c index c59f23c07..17734da64 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -123,7 +123,7 @@ boolean useNightsSS = false; UINT8 skincolor_redteam = SKINCOLOR_RED; UINT8 skincolor_blueteam = SKINCOLOR_BLUE; UINT8 skincolor_redring = SKINCOLOR_RED; -UINT8 skincolor_bluering = SKINCOLOR_STEELBLUE; +UINT8 skincolor_bluering = SKINCOLOR_AZURE; tic_t countdowntimer = 0; boolean countdowntimeup = false; diff --git a/src/m_cond.c b/src/m_cond.c index 17f755120..7ef192f7b 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -49,7 +49,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Streams come to an end\n" "where they can no longer fall.\n" "But if you went up...", 0}, - {0, -336, 2064, 195, 1, 'E', SKINCOLOR_NEONGREEN, 0, + {0, -336, 2064, 195, 1, 'E', SKINCOLOR_EMERALD, 0, "This one's in plain sight.\n" "Why haven't you claimed it?\n" "Surely you saw it.", 0}, @@ -77,7 +77,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Near the level's end,\n" "another bridge spans a lake.\n" "What could be under...?", 0}, - {0, -170, 491, 3821, 2, 'E', SKINCOLOR_NEONGREEN, 0, + {0, -170, 491, 3821, 2, 'E', SKINCOLOR_EMERALD, 0, "An ivied tunnel\n" "has a corner that's sunlit.\n" "Go reach for the sky!", 0}, @@ -110,7 +110,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Spinning through small gaps\n" "can slip you into a cave.\n" "In that cave's first stretch...", 0}, - {0, 2848, -9088, 488, 4, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 2848, -9088, 488, 4, 'E', SKINCOLOR_EMERALD, 0, "The slime lake is deep,\n" "but reaching the floor takes height.\n" "Scream \"Geronimo!\"...", 0}, @@ -138,7 +138,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "There is a hallway\n" "that a button floods with slime.\n" "Go through it again!", 0}, - {0, -2468,-12128, 1312, 5, 'E', SKINCOLOR_NEONGREEN, 0, + {0, -2468,-12128, 1312, 5, 'E', SKINCOLOR_EMERALD, 0, "Jumping on turtles\n" "will send you springing skyward.\n" "Now, do that six times...", 0}, @@ -171,7 +171,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "A caved-in hallway?\n" "The floor falls; the path goes down.\n" "But those rocks looked weak...", 0}, - {0, 12576, 16096, -992, 7, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 12576, 16096, -992, 7, 'E', SKINCOLOR_EMERALD, 0, "The end is quite dry.\n" "Some rocks dam the water in.\n" "Knuckles can fix that...", 0}, @@ -199,7 +199,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "In the current maze\n" "hides a dark room of columns.\n" "Find it, then look up.", 0}, - {0, 3104, 16192, 2408, 8, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 3104, 16192, 2408, 8, 'E', SKINCOLOR_EMERALD, 0, "That same dragon's eye\n" "hides another secret room.\n" "There, solve its riddle.", 0}, @@ -232,7 +232,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "The final approach!\n" "A tower holds the emblem\n" "near a ring arrow.", 0}, - {0, 9472, -5890, 710, 10, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 9472, -5890, 710, 10, 'E', SKINCOLOR_EMERALD, 0, "The right starting path\n" "hides this near a canopy,\n" "high, where two trees meet.", 0}, @@ -260,7 +260,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Some of these bookshelves\n" "are not flush against the walls.\n" "Wonder why that is?", 0}, - {0, 12708,-13536, 4768, 11, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 12708,-13536, 4768, 11, 'E', SKINCOLOR_EMERALD, 0, "The ending's towers\n" "are hiding a small alcove.\n" "Check around outside.", 0}, @@ -293,7 +293,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Not far from the start,\n" "if you climb toward the sky,\n" "the cliffs hide something.", 0}, - {0, 12504, 6848, 3424, 13, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 12504, 6848, 3424, 13, 'E', SKINCOLOR_EMERALD, 0, "Right by the exit,\n" "an emblem lies on a cliff.\n" "Ride ropes to reach it.", 0}, @@ -321,7 +321,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Where once a bridge stood,\n" "now magma falls from above.\n" "The bridge dropped something...", 0}, - {0, 8287,-11043, 1328, 16, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 8287,-11043, 1328, 16, 'E', SKINCOLOR_EMERALD, 0, "A lake of magma\n" "ebbs and flows unendingly.\n" "Wait for its nadir.", 0}, @@ -349,7 +349,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Don't jump too high here!\n" "No conveyor will catch you;\n" "you'd fall to your death.", 0}, - {0, -6432, -6192, 584, 22, 'E', SKINCOLOR_NEONGREEN, 0, + {0, -6432, -6192, 584, 22, 'E', SKINCOLOR_EMERALD, 0, "Conveyors! Magma!\n" "What an intense room this is!\n" "But, what brought you here?", 0}, @@ -377,7 +377,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Gears with missing teeth\n" "can hide a clever secret!\n" "Think Green Hill Zone boss.", 0}, - {0, 1920, 20608, 1064, 23, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 1920, 20608, 1064, 23, 'E', SKINCOLOR_EMERALD, 0, "Just before you reach\n" "the defective cargo bay,\n" "fly under a bridge.", 0}, @@ -398,7 +398,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "[PH] In the ceiling of the conveyor belt + laser hallway.", 0}, {0,-13728,-13728, 1552, 24, 'D', SKINCOLOR_ORANGE, 0, "[PH] On top of the platform with rows of spikes in reverse gravity.", 0}, - {0,-14944, 768, 1232, 24, 'E', SKINCOLOR_NEONGREEN, 0, + {0,-14944, 768, 1232, 24, 'E', SKINCOLOR_EMERALD, 0, "Follow the leader.", 0}, */ @@ -430,7 +430,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "The underground room\n" "with platforms that fall and rise\n" "only LOOKS empty...", 0}, - {0 , 4960, -6112, 1312, 30, 'E', SKINCOLOR_NEONGREEN, 0, + {0 , 4960, -6112, 1312, 30, 'E', SKINCOLOR_EMERALD, 0, "This one's straightforward.\n" "What comes to mind when I say:\n" "\"WELCOME TO WARP ZONE!\"?", 0}, @@ -458,7 +458,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "Much like the last one,\n" "you need to find some switches.\n" "Only two, this time.", 0}, - {0, 13184, 18880, 6672, 40, 'E', SKINCOLOR_NEONGREEN, 0, + {0, 13184, 18880, 6672, 40, 'E', SKINCOLOR_EMERALD, 0, "The inner sanctum!\n" "Teleport to its switches;\n" "then, check near the goal.", 0}, @@ -486,7 +486,7 @@ emblem_t emblemlocations[MAXEMBLEMS] = "A room of currents;\n" "most of them are marked by spikes.\n" "This one? A corner.", 0}, - {0, -4128, 21344, 1120, 41, 'E', SKINCOLOR_NEONGREEN, 0, + {0, -4128, 21344, 1120, 41, 'E', SKINCOLOR_EMERALD, 0, "The only way to hit\n" "all those gems at once is with\n" "a radial blast.", 0}, @@ -498,63 +498,63 @@ emblem_t emblemlocations[MAXEMBLEMS] = // FLORAL FIELD // --- - {0, 5394, -996, 160, 50, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, 5394, -996, 160, 50, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 50, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 50, 'T', SKINCOLOR_GREY, 40*TICRATE, "", 0}, // TOXIC PLATEAU // --- - {0, 780, -1664, 32, 51, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, 780, -1664, 32, 51, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 51, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 51, 'T', SKINCOLOR_GREY, 50*TICRATE, "", 0}, // FLOODED COVE // --- - {0, 1824, -1888, 2448, 52, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, 1824, -1888, 2448, 52, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 52, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 52, 'T', SKINCOLOR_GREY, 90*TICRATE, "", 0}, // CAVERN FORTRESS // --- - {0, -3089, -431, 1328, 53, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, -3089, -431, 1328, 53, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 53, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 53, 'T', SKINCOLOR_GREY, 75*TICRATE, "", 0}, // DUSTY WASTELAND // --- - {0, 957, 924, 2956, 54, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, 957, 924, 2956, 54, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 54, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 54, 'T', SKINCOLOR_GREY, 65*TICRATE, "", 0}, // MAGMA CAVES // --- - {0, -2752, 3104, 1800, 55, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, -2752, 3104, 1800, 55, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 55, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 55, 'T', SKINCOLOR_GREY, 80*TICRATE, "", 0}, // EGG SATELLITE // --- - {0, 5334, -609, 3426, 56, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, 5334, -609, 3426, 56, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 56, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 56, 'T', SKINCOLOR_GREY, 120*TICRATE, "", 0}, // BLACK HOLE // --- - {0, 2108, 3776, 32, 57, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, 2108, 3776, 32, 57, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 57, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 57, 'T', SKINCOLOR_GREY, 150*TICRATE, "", 0}, // SPRING HILL // --- - {0, -1840, -1024, 1644, 58, 'N', SKINCOLOR_ROSEWOOD, 0, "", 0}, + {0, -1840, -1024, 1644, 58, 'N', SKINCOLOR_RUST, 0, "", 0}, {ET_NGRADE, 0,0,0, 58, 'Q', SKINCOLOR_TEAL, GRADE_A, "", 0}, {ET_NTIME, 0,0,0, 58, 'T', SKINCOLOR_GREY, 60*TICRATE, "", 0}, }; @@ -565,7 +565,7 @@ extraemblem_t extraemblems[MAXEXTRAEMBLEMS] = {"Game Complete", "Complete 1P Mode", 10, 'X', SKINCOLOR_BLUE, 0}, {"All Emeralds", "Complete 1P Mode with all Emeralds", 11, 'V', SKINCOLOR_GREY, 0}, {"Perfect Bonus", "Perfect Bonus on a non-secret stage", 30, 'P', SKINCOLOR_GOLD, 0}, - {"SRB1 Remake", "Complete SRB1 Remake", 21, 'O', SKINCOLOR_ROSEWOOD, 0}, + {"SRB1 Remake", "Complete SRB1 Remake", 21, 'O', SKINCOLOR_RUST, 0}, {"NiGHTS Mastery", "Show your mastery of NiGHTS!", 22, 'W', SKINCOLOR_TEAL, 0}, }; diff --git a/src/r_draw.c b/src/r_draw.c index 808b3cc6e..4f06a58a7 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -137,9 +137,9 @@ const char *Color_Names[MAXSKINCOLORS] = "Grey", // SKINCOLOR_GREY "Black", // SKINCOLOR_BLACK "Cyan", // SKINCOLOR_CYAN - "Aquamarine",// SKINCOLOR_AQUAMARINE + "Aqua", // SKINCOLOR_AQUAMARINE "Teal", // SKINCOLOR_TEAL - "Steel_Blue",// SKINCOLOR_STEELBLUE + "Azure", // SKINCOLOR_AZURE "Blue", // SKINCOLOR_BLUE "Peach", // SKINCOLOR_PEACH "Tan", // SKINCOLOR_TAN @@ -149,12 +149,12 @@ const char *Color_Names[MAXSKINCOLORS] = "Purple", // SKINCOLOR_PURPLE "Magenta", // SKINCOLOR_MAGENTA "Orange", // SKINCOLOR_ORANGE - "Rosewood", // SKINCOLOR_ROSEWOOD + "Rust", // SKINCOLOR_RUST "Beige", // SKINCOLOR_BEIGE "Brown", // SKINCOLOR_BROWN "Red", // SKINCOLOR_RED - "Dark_Red", // SKINCOLOR_DARKRED - "Neon_Green",// SKINCOLOR_NEONGREEN + "Crimson", // SKINCOLOR_CRIMSON + "Emerald", // SKINCOLOR_EMERALD "Green", // SKINCOLOR_GREEN "Zim", // SKINCOLOR_ZIM "Peridot", // SKINCOLOR_PERIDOT @@ -170,9 +170,9 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_SILVER,12,// SKINCOLOR_GREY SKINCOLOR_WHITE,8, // SKINCOLOR_BLACK SKINCOLOR_NONE,8, // SKINCOLOR_CYAN - SKINCOLOR_NONE,8, // SKINCOLOR_AQUAMARINE + SKINCOLOR_NONE,8, // SKINCOLOR_AQUA SKINCOLOR_NONE,8, // SKINCOLOR_TEAL - SKINCOLOR_NONE,8, // SKINCOLOR_STEELBLUE + SKINCOLOR_NONE,8, // SKINCOLOR_AZURE SKINCOLOR_ORANGE,9, // SKINCOLOR_BLUE SKINCOLOR_NONE,8, // SKINCOLOR_PEACH SKINCOLOR_NONE,8, // SKINCOLOR_TAN @@ -182,12 +182,12 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_NONE,8, // SKINCOLOR_PURPLE SKINCOLOR_NONE,8, // SKINCOLOR_MAGENTA SKINCOLOR_BLUE,12, // SKINCOLOR_ORANGE - SKINCOLOR_NONE,8, // SKINCOLOR_ROSEWOOD + SKINCOLOR_NONE,8, // SKINCOLOR_RUST SKINCOLOR_NONE,8, // SKINCOLOR_BEIGE SKINCOLOR_NONE,8, // SKINCOLOR_BROWN SKINCOLOR_GREEN,5, // SKINCOLOR_RED - SKINCOLOR_NONE,8, // SKINCOLOR_DARKRED - SKINCOLOR_NONE,8, // SKINCOLOR_NEONGREEN + SKINCOLOR_NONE,8, // SKINCOLOR_CRIMSON + SKINCOLOR_NONE,8, // SKINCOLOR_EMERALD SKINCOLOR_RED,11, // SKINCOLOR_GREEN SKINCOLOR_MAGENTA,3, // SKINCOLOR_ZIM SKINCOLOR_NONE,8, // SKINCOLOR_PERIDOT @@ -243,9 +243,9 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0x08, // SKINCOLOR_GREY 0x18, // SKINCOLOR_BLACK 0x70, // SKINCOLOR_CYAN - 0xf8, // SKINCOLOR_AQUAMARINE + 0xf8, // SKINCOLOR_AQUA 0x7c, // SKINCOLOR_TEAL - 0x9a, // SKINCOLOR_STEELBLUE + 0x9a, // SKINCOLOR_AZURE 0x82, // SKINCOLOR_BLUE 0xc8, // SKINCOLOR_PEACH 0x54, // SKINCOLOR_TAN @@ -255,12 +255,12 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0x90, // SKINCOLOR_PURPLE 0xa3, // SKINCOLOR_MAGENTA 0x31, // SKINCOLOR_ORANGE - 0x3a, // SKINCOLOR_ROSEWOOD + 0x3a, // SKINCOLOR_RUST 0xe0, // SKINCOLOR_BEIGE 0xd0, // SKINCOLOR_BROWN 0x21, // SKINCOLOR_RED - 0x28, // SKINCOLOR_DARKRED - 0xf0, // SKINCOLOR_NEONGREEN + 0x28, // SKINCOLOR_CRIMSON + 0xf0, // SKINCOLOR_EMERALD 0x60, // SKINCOLOR_GREEN 0x58, // SKINCOLOR_ZIM 0xac, // SKINCOLOR_PERIDOT @@ -330,7 +330,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); break; - case SKINCOLOR_AQUAMARINE: + case SKINCOLOR_AQUA: // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { @@ -354,7 +354,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_STEELBLUE: + case SKINCOLOR_AZURE: // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { @@ -458,7 +458,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_ROSEWOOD: + case SKINCOLOR_RUST: // 9 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { @@ -496,7 +496,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_DARKRED: + case SKINCOLOR_CRIMSON: // 9 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { @@ -509,7 +509,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_NEONGREEN: + case SKINCOLOR_EMERALD: // 8 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { diff --git a/src/st_stuff.c b/src/st_stuff.c index 58992bea4..13cc36fe1 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -888,7 +888,7 @@ static void ST_drawFirstPersonHUD(void) // [21:42] <+Rob> Beige - Lavender - Steel Blue - Peach - Orange - Purple - Silver - Yellow - Pink - Red - Blue - Green - Cyan - Gold static skincolors_t linkColor[14] = -{SKINCOLOR_BEIGE, SKINCOLOR_LAVENDER, SKINCOLOR_STEELBLUE, SKINCOLOR_PEACH, SKINCOLOR_ORANGE, +{SKINCOLOR_BEIGE, SKINCOLOR_LAVENDER, SKINCOLOR_AZURE, SKINCOLOR_PEACH, SKINCOLOR_ORANGE, SKINCOLOR_MAGENTA, SKINCOLOR_SILVER, SKINCOLOR_SUPER4, SKINCOLOR_PINK, SKINCOLOR_RED, SKINCOLOR_BLUE, SKINCOLOR_GREEN, SKINCOLOR_CYAN, SKINCOLOR_GOLD}; @@ -938,7 +938,7 @@ static void ST_drawNightsRecords(void) V_DrawString(BASEVIDWIDTH/2 - 48, STRINGY(148), aflag, "BONUS:"); V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, STRINGY(140), V_ORANGEMAP|aflag, va("%d", stplyr->finishedrings)); V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, STRINGY(148), V_ORANGEMAP|aflag, va("%d", stplyr->finishedrings * 50)); - ST_DrawNightsOverlayNum(BASEVIDWIDTH/2 + 48, STRINGY(160), aflag, stplyr->lastmarescore, nightsnum, SKINCOLOR_STEELBLUE); + ST_DrawNightsOverlayNum(BASEVIDWIDTH/2 + 48, STRINGY(160), aflag, stplyr->lastmarescore, nightsnum, SKINCOLOR_AZURE); // If new record, say so! if (!(netgame || multiplayer) && G_GetBestNightsScore(gamemap, stplyr->lastmare + 1) <= stplyr->lastmarescore) @@ -1220,7 +1220,7 @@ static void ST_drawNiGHTSHUD(void) #endif ) { - ST_DrawNightsOverlayNum(304, STRINGY(16), SPLITFLAGS(V_SNAPTOTOP)|V_SNAPTORIGHT, stplyr->marescore, nightsnum, SKINCOLOR_STEELBLUE); + ST_DrawNightsOverlayNum(304, STRINGY(16), SPLITFLAGS(V_SNAPTOTOP)|V_SNAPTORIGHT, stplyr->marescore, nightsnum, SKINCOLOR_AZURE); } if (!stplyr->exiting From 079f02ca69a4bbad6843a980594473fe74235eba Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sat, 25 Jul 2015 14:10:52 +0100 Subject: [PATCH 092/364] Fix Peridot --- src/r_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_draw.c b/src/r_draw.c index 4f06a58a7..3518d384c 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -525,7 +525,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (8*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x48; // Lightest + dest_colormap[starttranscolor + i] = 0x58; // Lightest else if (8*i/16 == 7) dest_colormap[starttranscolor + i] = 0x6D; // Darkest else if (8*i/16 >= 5) From cc3d3a67e6d3bcf21d3c13f196786837a875c0ed Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sun, 26 Jul 2015 20:14:47 +0100 Subject: [PATCH 093/364] Colour Changing MD2s I don't know how I can move my old branch over so I've just created a new one. --- src/hardware/hw_md2.c | 314 +++++++++++++++++++++++++++++++++++++++++- src/hardware/hw_md2.h | 1 + 2 files changed, 312 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 02f505351..8953b3a88 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -41,6 +41,7 @@ #include "../r_things.h" #include "hw_main.h" +#include "../v_video.h" #ifdef HAVE_PNG #ifndef _MSC_VER @@ -881,6 +882,59 @@ static void md2_loadTexture(md2_t *model) HWR_UnlockCachedPatch(grpatch); } +// -----------------+ +// md2_loadBlendTexture : Download a pcx or png texture for blending MD2 models +// -----------------+ +static void md2_loadBlendTexture(md2_t *model) +{ + GLPatch_t *grpatch; + char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL); + strcpy(filename, model->filename); + + FIL_ForceExtension(filename, "_blend.png"); + + if (model->blendgrpatch) + { + grpatch = model->blendgrpatch; + Z_Free(grpatch->mipmap.grInfo.data); + } + else + grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO, + &(model->blendgrpatch)); + + if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data) + { + int w = 0, h = 0; +#ifdef HAVE_PNG + grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch); + if (grpatch->mipmap.grInfo.format == 0) +#endif + grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch); + if (grpatch->mipmap.grInfo.format == 0) + { + Z_Free(filename); + return; + } + + grpatch->mipmap.downloaded = 0; + grpatch->mipmap.flags = 0; + + grpatch->width = (INT16)w; + grpatch->height = (INT16)h; + grpatch->mipmap.width = (UINT16)w; + grpatch->mipmap.height = (UINT16)h; + + // not correct! + grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256; + grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256; + grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; + } + HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary + HWR_UnlockCachedPatch(grpatch); + + Z_Free(filename); +} + // Don't spam the console, or the OS with fopen requests! static boolean nomd2s = false; @@ -1058,6 +1112,248 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu fclose(f); } +static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color) +{ + UINT16 w = gpatch->width, h = gpatch->height; + UINT32 size = w*h; + RGBA_t *image, *blendimage, *cur, blendcolor; + + if (grmip->width == 0) + { + + grmip->width = gpatch->width; + grmip->height = gpatch->height; + + // no wrap around, no chroma key + grmip->flags = 0; + // setup the texture info + grmip->grInfo.format = GR_RGBA; + } + + Z_Free(grmip->grInfo.data); + grmip->grInfo.data = NULL; + + cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data); + memset(cur, 0x00, size*4); + + image = gpatch->mipmap.grInfo.data; + blendimage = blendgpatch->mipmap.grInfo.data; + + switch (color) + { + case SKINCOLOR_WHITE: + blendcolor = V_GetColor(3); + break; + case SKINCOLOR_SILVER: + blendcolor = V_GetColor(11); + break; + case SKINCOLOR_GREY: + blendcolor = V_GetColor(23); + break; + case SKINCOLOR_BLACK: + blendcolor = V_GetColor(27); + break; + case SKINCOLOR_CYAN: + blendcolor = V_GetColor(216); + break; + case SKINCOLOR_TEAL: + blendcolor = V_GetColor(220); + break; + case SKINCOLOR_STEELBLUE: + blendcolor = V_GetColor(204); + break; + case SKINCOLOR_BLUE: + blendcolor = V_GetColor(234); + break; + case SKINCOLOR_PEACH: + blendcolor = V_GetColor(73); + break; + case SKINCOLOR_TAN: + blendcolor = V_GetColor(49); + break; + case SKINCOLOR_PINK: + blendcolor = V_GetColor(146); + break; + case SKINCOLOR_LAVENDER: + blendcolor = V_GetColor(252); + break; + case SKINCOLOR_PURPLE: + blendcolor = V_GetColor(195); + break; + case SKINCOLOR_ORANGE: + blendcolor = V_GetColor(87); + break; + case SKINCOLOR_ROSEWOOD: + blendcolor = V_GetColor(94); + break; + case SKINCOLOR_BEIGE: + blendcolor = V_GetColor(40); + break; + case SKINCOLOR_BROWN: + blendcolor = V_GetColor(57); + break; + case SKINCOLOR_RED: + blendcolor = V_GetColor(130); + break; + case SKINCOLOR_DARKRED: + blendcolor = V_GetColor(139); + break; + case SKINCOLOR_NEONGREEN: + blendcolor = V_GetColor(184); + break; + case SKINCOLOR_GREEN: + blendcolor = V_GetColor(170); + break; + case SKINCOLOR_ZIM: + blendcolor = V_GetColor(180); + break; + case SKINCOLOR_OLIVE: + blendcolor = V_GetColor(108); + break; + case SKINCOLOR_YELLOW: + blendcolor = V_GetColor(104); + break; + case SKINCOLOR_GOLD: + blendcolor = V_GetColor(115); + break; + + case SKINCOLOR_SUPER1: + blendcolor = V_GetColor(101); + break; + case SKINCOLOR_SUPER2: + blendcolor = V_GetColor(113); + break; + case SKINCOLOR_SUPER3: + blendcolor = V_GetColor(114); + break; + case SKINCOLOR_SUPER4: + blendcolor = V_GetColor(116); + break; + case SKINCOLOR_SUPER5: + blendcolor = V_GetColor(119); + break; + + case SKINCOLOR_TSUPER1: + blendcolor = V_GetColor(80); + break; + case SKINCOLOR_TSUPER2: + blendcolor = V_GetColor(82); + break; + case SKINCOLOR_TSUPER3: + blendcolor = V_GetColor(84); + break; + case SKINCOLOR_TSUPER4: + blendcolor = V_GetColor(85); + break; + case SKINCOLOR_TSUPER5: + blendcolor = V_GetColor(87); + break; + + case SKINCOLOR_KSUPER1: + blendcolor = V_GetColor(122); + break; + case SKINCOLOR_KSUPER2: + blendcolor = V_GetColor(123); + break; + case SKINCOLOR_KSUPER3: + blendcolor = V_GetColor(124); + break; + case SKINCOLOR_KSUPER4: + blendcolor = V_GetColor(125); + break; + case SKINCOLOR_KSUPER5: + blendcolor = V_GetColor(126); + break; + default: + blendcolor = V_GetColor(247); + break; + } + + while (size--) + { + if (blendimage->s.alpha == 0) + { + // Don't bother with blending the pixel if the alpha of the blend pixel is 0 + cur->rgba = image->rgba; + } + else + { + INT32 tempcolor; + INT16 tempmult, tempalpha; + tempalpha = -(abs(blendimage->s.red-127)-127)*2; + if (tempalpha > 255) + tempalpha = 255; + else if (tempalpha < 0) + tempalpha = 0; + + tempmult = (blendimage->s.red-127)*2; + if (tempmult > 255) + tempmult = 255; + else if (tempmult < 0) + tempmult = 0; + + tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255; + cur->s.red = (UINT8)tempcolor; + tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255; + cur->s.green = (UINT8)tempcolor; + tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255; + cur->s.blue = (UINT8)tempcolor; + cur->s.alpha = image->s.alpha; + } + + cur++; image++; blendimage++; + } + + return; +} + +static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color) +{ + // mostly copied from HWR_GetMappedPatch, hence the similarities and comment + GLMipmap_t *grmip, *newmip; + + if (colormap == colormaps || colormap == NULL) + { + // Don't do any blending + HWD.pfnSetTexture(&gpatch->mipmap); + return; + } + + // search for the mimmap + // skip the first (no colormap translated) + for (grmip = &gpatch->mipmap; grmip->nextcolormap; ) + { + grmip = grmip->nextcolormap; + if (grmip->colormap == colormap) + { + if (grmip->downloaded && grmip->grInfo.data) + { + HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture + Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); + return; + } + } + } + + // If here, the blended texture has not been created + // So we create it + + //BP: WARNING: don't free it manually without clearing the cache of harware renderer + // (it have a liste of mipmap) + // this malloc is cleared in HWR_FreeTextureCache + // (...) unfortunately z_malloc fragment alot the memory :(so malloc is better + newmip = calloc(1, sizeof (*newmip)); + if (newmip == NULL) + I_Error("%s: Out of memory", "HWR_GetMappedPatch"); + grmip->nextcolormap = newmip; + newmip->colormap = colormap; + + HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color); + + HWD.pfnSetTexture(newmip); + Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED); +} + // -----------------+ // HWR_DrawMD2 : Draw MD2 @@ -1194,13 +1490,25 @@ void HWR_DrawMD2(gr_vissprite_t *spr) gpatch = md2->grpatch; if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded) md2_loadTexture(md2); - gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture... + if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available + && (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded)) + md2_loadBlendTexture(md2); + if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture { - // This is safe, since we know the texture has been downloaded - HWD.pfnSetTexture(&gpatch->mipmap); + if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE && + md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format + && gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height) + { + HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, spr->colormap, (skincolors_t)spr->mobj->color); + } + else + { + // This is safe, since we know the texture has been downloaded + HWD.pfnSetTexture(&gpatch->mipmap); + } } else { diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 0fb486ea0..36078268b 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -120,6 +120,7 @@ typedef struct float offset; md2_model_t *model; void *grpatch; + void *blendgrpatch; boolean notfound; INT32 skin; } md2_t; From fa935be129728a82fd30104d507aa81258e1e8ce Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 28 Jul 2015 19:28:51 +0100 Subject: [PATCH 094/364] Fixed the issue where diagonal springs couldn't teleport you to their centers anymore (guess whose fault that was! =D ). Basically I just made P_DoSpring boolean, which probably could be useful to Lua peeps as well. (it returns true if you were sprung, false if not) --- src/lua_baselib.c | 4 ++-- src/p_local.h | 2 +- src/p_map.c | 24 ++++++++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index d76839e73..5e2d31b10 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1009,8 +1009,8 @@ static int lib_pDoSpring(lua_State *L) NOHUD if (!spring || !object) return LUA_ErrInvalid(L, "mobj_t"); - P_DoSpring(spring, object); - return 0; + lua_pushboolean(L, P_DoSpring(spring, object)); + return 1; } // P_INTER diff --git a/src/p_local.h b/src/p_local.h index 59179c1c1..f76384264 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -316,7 +316,7 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist); fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height); boolean PIT_PushableMoved(mobj_t *thing); -void P_DoSpring(mobj_t *spring, mobj_t *object); +boolean P_DoSpring(mobj_t *spring, mobj_t *object); // // P_SETUP diff --git a/src/p_map.c b/src/p_map.c index b44b89974..b2a4b36de 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -102,7 +102,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) // MOVEMENT ITERATOR FUNCTIONS // ========================================================================= -void P_DoSpring(mobj_t *spring, mobj_t *object) +boolean P_DoSpring(mobj_t *spring, mobj_t *object) { INT32 pflags; fixed_t offx, offy; @@ -110,16 +110,16 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) fixed_t horizspeed = spring->info->damage; if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic - return; + return false; // Spectators don't trigger springs. if (object->player && object->player->spectator) - return; + return false; if (object->player && (object->player->pflags & PF_NIGHTSMODE)) { /*Someone want to make these work like bumpers?*/ - return; + return false; } object->eflags |= MFE_SPRUNG; // apply this flag asap! @@ -209,6 +209,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object) P_SetPlayerMobjState(object, S_PLAY_ATK1); } } + return true; } static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) @@ -365,6 +366,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) static boolean PIT_CheckThing(mobj_t *thing) { fixed_t blockdist; + boolean iwassprung = false; // don't clip against self if (thing == tmthing) @@ -819,7 +821,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { if ( thing->z <= tmthing->z + tmthing->height && tmthing->z <= thing->z + thing->height) - P_DoSpring(thing, tmthing); + iwassprung = P_DoSpring(thing, tmthing); } } @@ -906,7 +908,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { if ( thing->z <= tmthing->z + tmthing->height && tmthing->z <= thing->z + thing->height) - P_DoSpring(thing, tmthing); + iwassprung = P_DoSpring(thing, tmthing); } // Are you touching the side of the object you're interacting with? else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height @@ -928,12 +930,14 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - - if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE)); - else + if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE)) + { + if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now... + return false; // "cancel" P_TryMove via blocking so you keep your current position + } // Monitors are not treated as solid to players who are jumping, spinning or gliding, // unless it's a CTF team monitor and you're on the wrong team - if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) + else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING) && !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2))) ; // z checking at last From d050a60f3600eea067c2476f8d8461309ec2b515 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Mon, 3 Aug 2015 02:01:56 +0100 Subject: [PATCH 095/364] Change a few colours. --- src/hardware/hw_md2.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 8953b3a88..e4b839b68 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1145,37 +1145,37 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, blendcolor = V_GetColor(3); break; case SKINCOLOR_SILVER: - blendcolor = V_GetColor(11); + blendcolor = V_GetColor(10); break; case SKINCOLOR_GREY: - blendcolor = V_GetColor(23); + blendcolor = V_GetColor(15); break; case SKINCOLOR_BLACK: blendcolor = V_GetColor(27); break; case SKINCOLOR_CYAN: - blendcolor = V_GetColor(216); + blendcolor = V_GetColor(215); break; case SKINCOLOR_TEAL: - blendcolor = V_GetColor(220); + blendcolor = V_GetColor(221); break; case SKINCOLOR_STEELBLUE: - blendcolor = V_GetColor(204); + blendcolor = V_GetColor(203); break; case SKINCOLOR_BLUE: - blendcolor = V_GetColor(234); + blendcolor = V_GetColor(232); break; case SKINCOLOR_PEACH: - blendcolor = V_GetColor(73); + blendcolor = V_GetColor(71); break; case SKINCOLOR_TAN: - blendcolor = V_GetColor(49); + blendcolor = V_GetColor(79); break; case SKINCOLOR_PINK: - blendcolor = V_GetColor(146); + blendcolor = V_GetColor(147); break; case SKINCOLOR_LAVENDER: - blendcolor = V_GetColor(252); + blendcolor = V_GetColor(251); break; case SKINCOLOR_PURPLE: blendcolor = V_GetColor(195); @@ -1202,7 +1202,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, blendcolor = V_GetColor(184); break; case SKINCOLOR_GREEN: - blendcolor = V_GetColor(170); + blendcolor = V_GetColor(166); break; case SKINCOLOR_ZIM: blendcolor = V_GetColor(180); @@ -1218,23 +1218,23 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, break; case SKINCOLOR_SUPER1: - blendcolor = V_GetColor(101); + blendcolor = V_GetColor(97); break; case SKINCOLOR_SUPER2: - blendcolor = V_GetColor(113); + blendcolor = V_GetColor(100); break; case SKINCOLOR_SUPER3: - blendcolor = V_GetColor(114); + blendcolor = V_GetColor(103); break; case SKINCOLOR_SUPER4: - blendcolor = V_GetColor(116); + blendcolor = V_GetColor(113); break; case SKINCOLOR_SUPER5: - blendcolor = V_GetColor(119); + blendcolor = V_GetColor(116); break; case SKINCOLOR_TSUPER1: - blendcolor = V_GetColor(80); + blendcolor = V_GetColor(81); break; case SKINCOLOR_TSUPER2: blendcolor = V_GetColor(82); From 6026fa42eb1cea15614348e901cbe9f1cd279bdf Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 14:47:05 -0500 Subject: [PATCH 096/364] Add masked FOF slopes (+other rendering tweaks) --- src/r_draw.h | 1 + src/r_draw8.c | 171 +++++++++++++++++++++++++++++++++++++++++++++----- src/r_plane.c | 8 ++- 3 files changed, 163 insertions(+), 17 deletions(-) diff --git a/src/r_draw.h b/src/r_draw.h index e1818545b..63fecc046 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -154,6 +154,7 @@ void R_DrawSpan_8(void); #ifdef ESLOPE void R_DrawTiltedSpan_8(void); void R_DrawTiltedTranslucentSpan_8(void); +void R_DrawTiltedSplat_8(void); #endif void R_DrawSplat_8(void); void R_DrawTranslucentSplat_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index 279690492..f78f1494b 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -593,8 +593,8 @@ void R_DrawTiltedSpan_8(void) do { double z = 1.f/iz; - u = (UINT32)(uz*z) + viewx; - v = (UINT32)(vz*z) + viewy; + u = (INT64)(uz*z) + viewx; + v = (INT64)(vz*z) + viewy; colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); @@ -630,8 +630,8 @@ void R_DrawTiltedSpan_8(void) double endv = vz*endz; UINT32 stepu = (INT64)((endu - startu) * INVSPAN); UINT32 stepv = (INT64)((endv - startv) * INVSPAN); - u = (UINT32)(startu) + viewx; - v = (UINT32)(startv) + viewy; + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; for (i = SPANSIZE-1; i >= 0; i--) { @@ -649,8 +649,8 @@ void R_DrawTiltedSpan_8(void) { if (width == 1) { - u = (UINT32)(startu); - v = (UINT32)(startv); + u = (INT64)(startu); + v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); *dest = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; } @@ -667,8 +667,8 @@ void R_DrawTiltedSpan_8(void) left = 1.f/left; UINT32 stepu = (INT64)((endu - startu) * left); UINT32 stepv = (INT64)((endv - startv) * left); - u = (UINT32)(startu) + viewx; - v = (UINT32)(startv) + viewy; + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; for (; width != 0; width--) { @@ -726,8 +726,8 @@ void R_DrawTiltedTranslucentSpan_8(void) do { double z = 1.f/iz; - u = (UINT32)(uz*z) + viewx; - v = (UINT32)(vz*z) + viewy; + u = (INT64)(uz*z) + viewx; + v = (INT64)(vz*z) + viewy; colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); @@ -763,8 +763,8 @@ void R_DrawTiltedTranslucentSpan_8(void) double endv = vz*endz; UINT32 stepu = (INT64)((endu - startu) * INVSPAN); UINT32 stepv = (INT64)((endv - startv) * INVSPAN); - u = (UINT32)(startu) + viewx; - v = (UINT32)(startv) + viewy; + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; for (i = SPANSIZE-1; i >= 0; i--) { @@ -782,8 +782,8 @@ void R_DrawTiltedTranslucentSpan_8(void) { if (width == 1) { - u = (UINT32)(startu); - v = (UINT32)(startv); + u = (INT64)(startu); + v = (INT64)(startv); colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); *dest = colormap[*(ds_transmap + (source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)] << 8) + dest[0])]; } @@ -800,8 +800,8 @@ void R_DrawTiltedTranslucentSpan_8(void) left = 1.f/left; UINT32 stepu = (INT64)((endu - startu) * left); UINT32 stepv = (INT64)((endv - startv) * left); - u = (UINT32)(startu) + viewx; - v = (UINT32)(startv) + viewy; + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; for (; width != 0; width--) { @@ -815,6 +815,145 @@ void R_DrawTiltedTranslucentSpan_8(void) } #endif } + +void R_DrawTiltedSplat_8(void) +{ + // x1, x2 = ds_x1, ds_x2 + int width = ds_x2 - ds_x1; + double iz, uz, vz; + UINT32 u, v; + int i; + + UINT8 *source; + UINT8 *colormap; + UINT8 *dest; + + UINT8 val; + + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); + + // Lighting is simple. It's just linear interpolation from start to end + { + float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float lightstart, lightend; + + lightend = (iz + ds_sz.x*width) * planelightfloat; + lightstart = iz * planelightfloat; + + R_CalcTiltedLighting(FLOAT_TO_FIXED(lightstart), FLOAT_TO_FIXED(lightend)); + //CONS_Printf("tilted lighting %f to %f (foc %f)\n", lightstart, lightend, focallengthf); + } + + uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); + vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx); + + dest = ylookup[ds_y] + columnofs[ds_x1]; + source = ds_source; + //colormap = ds_colormap; + +#if 0 // The "perfect" reference version of this routine. Pretty slow. + // Use it only to see how things are supposed to look. + i = 0; + do + { + double z = 1.f/iz; + u = (INT64)(uz*z) + viewx; + v = (INT64)(vz*z) + viewy; + + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + + val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + if (val != TRANSPARENTPIXEL) + *dest = val; + dest++; + iz += ds_sz.x; + uz += ds_su.x; + vz += ds_sv.x; + } while (--width >= 0); +#else +#define SPANSIZE 16 +#define INVSPAN 0.0625f + + double startz = 1.f/iz; + double startu = uz*startz; + double startv = vz*startz; + double izstep, uzstep, vzstep; + + izstep = ds_sz.x * SPANSIZE; + uzstep = ds_su.x * SPANSIZE; + vzstep = ds_sv.x * SPANSIZE; + //x1 = 0; + width++; + + while (width >= SPANSIZE) + { + iz += izstep; + uz += uzstep; + vz += vzstep; + + double endz = 1.f/iz; + double endu = uz*endz; + double endv = vz*endz; + UINT32 stepu = (INT64)((endu - startu) * INVSPAN); + UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; + + for (i = SPANSIZE-1; i >= 0; i--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + if (val != TRANSPARENTPIXEL) + *dest = val; + dest++; + u += stepu; + v += stepv; + } + startu = endu; + startv = endv; + width -= SPANSIZE; + } + if (width > 0) + { + if (width == 1) + { + u = (INT64)(startu); + v = (INT64)(startv); + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + if (val != TRANSPARENTPIXEL) + *dest = val; + } + else + { + double left = width; + iz += ds_sz.x * left; + uz += ds_su.x * left; + vz += ds_sv.x * left; + + double endz = 1.f/iz; + double endu = uz*endz; + double endv = vz*endz; + left = 1.f/left; + UINT32 stepu = (INT64)((endu - startu) * left); + UINT32 stepv = (INT64)((endv - startv) * left); + u = (INT64)(startu) + viewx; + v = (INT64)(startv) + viewy; + + for (; width != 0; width--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + val = colormap[source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]]; + if (val != TRANSPARENTPIXEL) + *dest = val; + dest++; + u += stepu; + v += stepv; + } + } + } +#endif +} #endif // ESLOPE /** \brief The R_DrawSplat_8 function diff --git a/src/r_plane.c b/src/r_plane.c index 6aae1e250..406a38d7b 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -836,7 +836,11 @@ void R_DrawSinglePlane(visplane_t *pl) else light = (pl->lightlevel >> LIGHTSEGSHIFT); #ifndef NOWATER - if (pl->ffloor->flags & FF_RIPPLE) + if (pl->ffloor->flags & FF_RIPPLE +#ifdef ESLOPE + && !pl->slope +#endif + ) { INT32 top, bottom; @@ -1024,6 +1028,8 @@ void R_DrawSinglePlane(visplane_t *pl) if (spanfunc == R_DrawTranslucentSpan_8) spanfunc = R_DrawTiltedTranslucentSpan_8; + else if (spanfunc == splatfunc) + spanfunc = R_DrawTiltedSplat_8; else spanfunc = R_DrawTiltedSpan_8; From 049bbce5c00854c1446c28e6b2d15c04eaa19cdd Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 17:37:50 -0500 Subject: [PATCH 097/364] Add data to slope struct that will be useful later --- src/r_defs.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/r_defs.h b/src/r_defs.h index 9f35af7e5..6f9127ee9 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -233,11 +233,19 @@ typedef struct secplane_t fixed_t a, b, c, d, ic; } secplane_t; -// Kalaron Slopes +// Slopes #ifdef ESLOPE +typedef enum { + SL_NOPHYSICS = 1, // Don't do momentum adjustment with this slope + SL_NODYNAMIC = 1<<1, // Slope will never need to move during the level, so don't fuss with recalculating it + SL_ANCHORVERTEX = 1<<2, // Slope is using a Slope Vertex Thing to anchor its position + SL_VERTEXSLOPE = 1<<3, // Slope is built from three Slope Vertex Things +} slopeflags_t; typedef struct pslope_s { + UINT16 id; // The number of the slope, mostly used for netgame syncing purposes + // --- Information used in clipping/projection --- // Origin vector for the plane vector3_t o; @@ -262,7 +270,10 @@ typedef struct pslope_s struct line_s *sourceline; // The line that generated the slope fixed_t extent; // Distance value used for recalculating zdelta - UINT8 refpos; // 1=front floor 2=front ceiling 3=back floor 4=back ceiling (used for dynamic sloping) 0=disabled + UINT8 refpos; // 1=front floor 2=front ceiling 3=back floor 4=back ceiling (used for dynamic sloping) + + UINT8 flags; // Slope options + struct mobj_s **vertices; // List should be three long for slopes made by vertex things, or one long for slopes using one vertex thing to anchor struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later } pslope_t; From 51284c01d8cb84fe889cb8fc36bc132054bd1e6a Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 17:39:33 -0500 Subject: [PATCH 098/364] Start using slope flags/id in creation process --- src/p_slopes.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index d0b202168..77b0347d9 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -40,7 +40,8 @@ #ifdef ESLOPE -static pslope_t *dynslopes = NULL; +static pslope_t *slopelist = NULL; +static UINT16 slopecount = 0; // Calculate line normal void P_CalculateSlopeNormal(pslope_t *slope) { @@ -53,9 +54,12 @@ void P_CalculateSlopeNormal(pslope_t *slope) { void P_RunDynamicSlopes(void) { pslope_t *slope; - for (slope = dynslopes; slope; slope = slope->next) { + for (slope = slopelist; slope; slope = slope->next) { fixed_t zdelta; + if (slope->flags & SL_NODYNAMIC) + continue; + switch(slope->refpos) { case 1: // front floor zdelta = slope->sourceline->backsector->floorheight - slope->sourceline->frontsector->floorheight; @@ -92,7 +96,7 @@ void P_RunDynamicSlopes(void) { // Alocates and fill the contents of a slope structure. // static pslope_t *P_MakeSlope(const vector3_t *o, const vector2_t *d, - const fixed_t zdelta, boolean dynamic) + const fixed_t zdelta, UINT8 flags) { pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); memset(ret, 0, sizeof(*ret)); @@ -106,10 +110,14 @@ static pslope_t *P_MakeSlope(const vector3_t *o, const vector2_t *d, ret->zdelta = zdelta; - if (dynamic) { // Add to the dynamic slopes list - ret->next = dynslopes; - dynslopes = ret; - } + ret->flags = flags; + + // Add to the slope list + ret->next = slopelist; + slopelist = ret; + + slopecount++; + ret->id = slopecount; return ret; } @@ -179,6 +187,14 @@ void P_SpawnSlope_Line(int linenum) boolean frontceil = (special == 701 || special == 702 || special == 713); boolean backceil = (special == 711 || special == 712 || special == 703); + UINT8 flags = 0; // Slope flags + if (line->flags & ML_NOSONIC) + flags |= SL_NOPHYSICS; + if (line->flags & ML_NOTAILS) + flags |= SL_NODYNAMIC; + if (line->flags & ML_NOKNUX) + flags |= SL_ANCHORVERTEX; + if(!frontfloor && !backfloor && !frontceil && !backceil) { CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n"); @@ -235,7 +251,7 @@ void P_SpawnSlope_Line(int linenum) // In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef fslope = line->frontsector->f_slope = - P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); + P_MakeSlope(&point, &direction, dz, flags); // Set up some shit fslope->extent = extent; @@ -291,7 +307,7 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(origin.z - point.z, extent); cslope = line->frontsector->c_slope = - P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); + P_MakeSlope(&point, &direction, dz, flags); // Set up some shit cslope->extent = extent; @@ -356,7 +372,7 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(origin.z - point.z, extent); fslope = line->backsector->f_slope = - P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); + P_MakeSlope(&point, &direction, dz, flags); // Set up some shit fslope->extent = extent; @@ -398,7 +414,7 @@ void P_SpawnSlope_Line(int linenum) dz = FixedDiv(origin.z - point.z, extent); cslope = line->backsector->c_slope = - P_MakeSlope(&point, &direction, dz, !(line->flags & ML_NOTAILS)); + P_MakeSlope(&point, &direction, dz, flags); // Set up some shit cslope->extent = extent; @@ -730,7 +746,8 @@ void P_ResetDynamicSlopes(void) { boolean warned = false; #endif - dynslopes = NULL; + slopelist = NULL; + slopecount = 0; // We'll handle copy slopes later, after all the tag lists have been made. // Yes, this means copied slopes won't affect things' spawning heights. Too bad for you. From 14ea936f7478e1c5c6473d4e31f902fb5bba2378 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 18:06:42 -0500 Subject: [PATCH 099/364] Sync mobj->standingslope in netgames --- src/p_saveg.c | 13 ++++++++++++- src/p_slopes.c | 12 ++++++++++++ src/p_slopes.h | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index eec3dbf3e..621abcb48 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -30,6 +30,9 @@ #include "r_sky.h" #include "p_polyobj.h" #include "lua_script.h" +#ifdef ESLOPE +#include "p_slopes.h" +#endif savedata_t savedata; UINT8 *save_p; @@ -921,7 +924,8 @@ typedef enum MD2_EXTVAL1 = 1<<5, MD2_EXTVAL2 = 1<<6, MD2_HNEXT = 1<<7, - MD2_HPREV = 1<<8 + MD2_HPREV = 1<<8, + MD2_SLOPE = 1<<9 } mobj_diff2_t; typedef enum @@ -1109,6 +1113,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_HNEXT; if (mobj->hprev) diff2 |= MD2_HPREV; + if (mobj->standingslope) + diff2 |= MD2_SLOPE; if (diff2 != 0) diff |= MD_MORE; @@ -1221,6 +1227,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, mobj->hnext->mobjnum); if (diff2 & MD2_HPREV) WRITEUINT32(save_p, mobj->hprev->mobjnum); + if (diff2 & MD2_SLOPE) + WRITEUINT16(save_p, mobj->standingslope->id); WRITEUINT32(save_p, mobj->mobjnum); } @@ -2068,6 +2076,9 @@ static void LoadMobjThinker(actionf_p1 thinker) mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p); if (diff2 & MD2_HPREV) mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p); + if (diff2 & MD2_SLOPE) + mobj->standingslope = P_SlopeById(READUINT16(save_p)); + if (diff & MD_REDFLAG) { diff --git a/src/p_slopes.c b/src/p_slopes.c index 77b0347d9..316a953b8 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -484,6 +484,18 @@ void P_CopySectorSlope(line_t *line) line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef } +// +// P_SlopeById +// +// Looks in the slope list for a slope with a specified ID. Mostly useful for netgame sync +// +pslope_t *P_SlopeById(UINT16 id) +{ + pslope_t *ret; + for (ret = slopelist; ret && ret->id != id; ret = ret->next); + return ret; +} + #ifdef SPRINGCLEAN #include "byteptr.h" diff --git a/src/p_slopes.h b/src/p_slopes.h index 52988c18f..e92198675 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -63,6 +63,8 @@ typedef enum // void P_CopySectorSlope(line_t *line); +pslope_t *P_SlopeById(UINT16 id); + // Returns the height of the sloped plane at (x, y) as a fixed_t fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y); From c7b6cd705f790a23bc8b81b84f1697e486f56283 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 19:27:10 -0500 Subject: [PATCH 100/364] Separate P_LoadThings into two functions to make the next commit cleaner --- src/p_setup.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index c836d601c..3491669c7 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -850,7 +850,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum) // // P_LoadThings // -static void P_LoadThings(lumpnum_t lumpnum) +static void P_PrepareThings(lumpnum_t lumpnum) { size_t i; mapthing_t *mt; @@ -888,6 +888,15 @@ static void P_LoadThings(lumpnum_t lumpnum) } Z_Free(datastart); +} + +static void P_LoadThings(void) +{ + size_t i; + mapthing_t *mt; + + // Loading the things lump itself into memory is now handled in P_PrepareThings, above + mt = mapthings; numhuntemeralds = 0; for (i = 0; i < nummapthings; i++, mt++) @@ -2123,7 +2132,8 @@ void P_LoadThingsOnly(void) P_LevelInitStuff(); - P_LoadThings(lastloadedmaplumpnum + ML_THINGS); + P_PrepareThings(lastloadedmaplumpnum + ML_THINGS); + P_LoadThings(); P_SpawnSecretItems(true); } @@ -2540,11 +2550,13 @@ boolean P_SetupLevel(boolean skipprecip) P_MapStart(); + P_PrepareThings(lastloadedmaplumpnum + ML_THINGS); + #ifdef ESLOPE P_ResetDynamicSlopes(); #endif - P_LoadThings(lastloadedmaplumpnum + ML_THINGS); + P_LoadThings(); P_SpawnSecretItems(loademblems); From 1f5fc04d60be12f85c953730556ed68de3f002ec Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 22:15:59 -0500 Subject: [PATCH 101/364] Add vertex slopes --- src/p_slopes.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++ src/r_defs.h | 2 +- 2 files changed, 159 insertions(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 316a953b8..f14fc0f60 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -34,6 +34,7 @@ #include "z_zone.h" #include "p_spec.h" #include "p_slopes.h" +#include "p_setup.h" #include "r_main.h" #include "p_maputl.h" #include "w_wad.h" @@ -50,6 +51,65 @@ void P_CalculateSlopeNormal(pslope_t *slope) { slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y); } +// With a vertex slope that has its vertices set, configure relevant slope info +void P_ReconfigureVertexSlope(pslope_t *slope) +{ + vector3_t vec1, vec2; + + // Set slope normal + vec1.x = (slope->vertices[1]->x - slope->vertices[0]->x) << FRACBITS; + vec1.y = (slope->vertices[1]->y - slope->vertices[0]->y) << FRACBITS; + vec1.z = (slope->vertices[1]->z - slope->vertices[0]->z) << FRACBITS; + + vec2.x = (slope->vertices[2]->x - slope->vertices[0]->x) << FRACBITS; + vec2.y = (slope->vertices[2]->y - slope->vertices[0]->y) << FRACBITS; + vec2.z = (slope->vertices[2]->z - slope->vertices[0]->z) << FRACBITS; + + // ugggggggh fixed-point maaaaaaath + slope->extent = max( + max(max(abs(vec1.x), abs(vec1.y)), abs(vec1.z)), + max(max(abs(vec2.x), abs(vec2.y)), abs(vec2.z)) + ) >> (FRACBITS+5); + vec1.x /= slope->extent; + vec1.y /= slope->extent; + vec1.z /= slope->extent; + vec2.x /= slope->extent; + vec2.y /= slope->extent; + vec2.z /= slope->extent; + + FV3_Cross(&vec1, &vec2, &slope->normal); + + slope->extent = R_PointToDist2(0, 0, R_PointToDist2(0, 0, slope->normal.x, slope->normal.y), slope->normal.z); + if (slope->normal.z < 0) + slope->extent = -slope->extent; + + slope->normal.x = FixedDiv(slope->normal.x, slope->extent); + slope->normal.y = FixedDiv(slope->normal.y, slope->extent); + slope->normal.z = FixedDiv(slope->normal.z, slope->extent); + + // Set origin + slope->o.x = slope->vertices[0]->x << FRACBITS; + slope->o.y = slope->vertices[0]->y << FRACBITS; + slope->o.z = slope->vertices[0]->z << FRACBITS; + + if (slope->normal.x == 0 && slope->normal.y == 0) { // Set some defaults for a non-sloped "slope" + slope->zangle = slope->xydirection = 0; + slope->zdelta = slope->d.x = slope->d.y = 0; + } else { + // Get direction vector + slope->extent = R_PointToDist2(0, 0, slope->normal.x, slope->normal.y); + slope->d.x = -FixedDiv(slope->normal.x, slope->extent); + slope->d.y = -FixedDiv(slope->normal.y, slope->extent); + + // Z delta + slope->zdelta = FixedDiv(slope->extent, slope->normal.z); + + // Get angles + slope->xydirection = R_PointToAngle2(0, 0, slope->d.x, slope->d.y)+ANGLE_180; + slope->zangle = -R_PointToAngle2(0, 0, FRACUNIT, slope->zdelta); + } +} + // Recalculate dynamic slopes void P_RunDynamicSlopes(void) { pslope_t *slope; @@ -77,6 +137,24 @@ void P_RunDynamicSlopes(void) { zdelta = slope->sourceline->frontsector->ceilingheight - slope->sourceline->backsector->ceilingheight; slope->o.z = slope->sourceline->backsector->ceilingheight; break; + case 5: // vertices + { + mapthing_t *mt; + size_t i, l; + line_t *line; + + for (i = 0; i < 3; i++) { + mt = slope->vertices[i]; + l = P_FindSpecialLineFromTag(799, mt->angle, -1); + if (l != -1) { + line = &lines[l]; + mt->z = line->frontsector->floorheight >> FRACBITS; + } + } + + P_ReconfigureVertexSlope(slope); + } + continue; // TODO default: I_Error("P_RunDynamicSlopes: slope has invalid type!"); @@ -456,6 +534,68 @@ void P_SpawnSlope_Line(int linenum) return; } +// +// P_NewVertexSlope +// +// Creates a new slope from three vertices with the specified IDs +// +pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags) +{ + size_t i; + mapthing_t *mt = mapthings; + + pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL); + memset(ret, 0, sizeof(*ret)); + + // Start by setting flags + ret->flags = flags; + + // Now set up the vertex list + ret->vertices = Z_Malloc(3*sizeof(mapthing_t), PU_LEVEL, NULL); + memset(ret->vertices, 0, 3*sizeof(mapthing_t)); + + // And... look for the vertices in question. + for (i = 0; i < nummapthings; i++, mt++) { + if (mt->type != 750) // Haha, I'm hijacking the old Chaos Spawn thingtype for something! + continue; + + if (!ret->vertices[0] && mt->angle == tag1) + ret->vertices[0] = mt; + else if (!ret->vertices[1] && mt->angle == tag2) + ret->vertices[1] = mt; + else if (!ret->vertices[2] && mt->angle == tag3) + ret->vertices[2] = mt; + } + + if (!ret->vertices[0]) + CONS_Printf("PANIC 0\n"); + if (!ret->vertices[1]) + CONS_Printf("PANIC 1\n"); + if (!ret->vertices[2]) + CONS_Printf("PANIC 2\n"); + + // Now set heights for each vertex, because they haven't been set yet + for (i = 0; i < 3; i++) { + mt = ret->vertices[i]; + if (mt->extrainfo) + mt->z = mt->options; + else + mt->z = (R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector->floorheight >> FRACBITS) + (mt->options >> ZSHIFT); + } + + P_ReconfigureVertexSlope(ret); + ret->refpos = 5; + + // Add to the slope list + ret->next = slopelist; + slopelist = ret; + + slopecount++; + ret->id = slopecount; + + return ret; +} + // @@ -812,6 +952,24 @@ void P_ResetDynamicSlopes(void) { P_SpawnSlope_Line(i); break; + case 704: + { + UINT8 flags = SL_VERTEXSLOPE; + if (lines[i].flags & ML_NOSONIC) + flags |= SL_NOPHYSICS; + if (!(lines[i].flags & ML_NOTAILS)) + flags |= SL_NODYNAMIC; + + if (lines[i].flags & ML_NOKNUX) + lines[i].frontsector->f_slope = P_NewVertexSlope(lines[i].tag, sides[lines[i].sidenum[0]].textureoffset >> FRACBITS, + sides[lines[i].sidenum[0]].rowoffset >> FRACBITS, flags); + else + lines[i].frontsector->f_slope = P_NewVertexSlope(lines[i].tag, lines[i].tag, lines[i].tag, flags); + + lines[i].frontsector->hasslope = true; + } + break; + default: break; } diff --git a/src/r_defs.h b/src/r_defs.h index 6f9127ee9..f18410fe8 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -273,7 +273,7 @@ typedef struct pslope_s UINT8 refpos; // 1=front floor 2=front ceiling 3=back floor 4=back ceiling (used for dynamic sloping) UINT8 flags; // Slope options - struct mobj_s **vertices; // List should be three long for slopes made by vertex things, or one long for slopes using one vertex thing to anchor + mapthing_t **vertices; // List should be three long for slopes made by vertex things, or one long for slopes using one vertex thing to anchor struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later } pslope_t; From 50b5e978cc8fcf2ce8f05a92bca14d48d006be02 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 3 Aug 2015 23:09:50 -0500 Subject: [PATCH 102/364] Support ceiling/backsector vertex slopes --- src/p_slopes.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index f14fc0f60..baec5e1ef 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -953,20 +953,47 @@ void P_ResetDynamicSlopes(void) { break; case 704: + case 705: + case 714: + case 715: { + pslope_t **slopetoset; + size_t which = lines[i].special; + UINT8 flags = SL_VERTEXSLOPE; if (lines[i].flags & ML_NOSONIC) flags |= SL_NOPHYSICS; if (!(lines[i].flags & ML_NOTAILS)) flags |= SL_NODYNAMIC; - if (lines[i].flags & ML_NOKNUX) - lines[i].frontsector->f_slope = P_NewVertexSlope(lines[i].tag, sides[lines[i].sidenum[0]].textureoffset >> FRACBITS, - sides[lines[i].sidenum[0]].rowoffset >> FRACBITS, flags); - else - lines[i].frontsector->f_slope = P_NewVertexSlope(lines[i].tag, lines[i].tag, lines[i].tag, flags); + if (which == 704) + { + slopetoset = &lines[i].frontsector->f_slope; + which = 0; + } + else if (which == 705) + { + slopetoset = &lines[i].frontsector->c_slope; + which = 0; + } + else if (which == 714) + { + slopetoset = &lines[i].backsector->f_slope; + which = 1; + } + else // 715 + { + slopetoset = &lines[i].backsector->c_slope; + which = 1; + } - lines[i].frontsector->hasslope = true; + if (lines[i].flags & ML_NOKNUX) + *slopetoset = P_NewVertexSlope(lines[i].tag, sides[lines[i].sidenum[which]].textureoffset >> FRACBITS, + sides[lines[i].sidenum[which]].rowoffset >> FRACBITS, flags); + else + *slopetoset = P_NewVertexSlope(lines[i].tag, lines[i].tag, lines[i].tag, flags); + + sides[lines[i].sidenum[which]].sector->hasslope = true; } break; From b449bd826a014bdc07f43c544f522a628ed128c0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 13 Aug 2015 19:42:00 +0100 Subject: [PATCH 103/364] Rewrote A_SetTargetsTarget to be more sensible and efficient --- src/p_enemy.c | 55 ++++++++++++++++++++------------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4719a9d06..93ffbff7d 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7592,48 +7592,35 @@ void A_SetTargetsTarget(mobj_t *actor) { INT32 locvar1 = var1; INT32 locvar2 = var2; - mobj_t *targetedmobj = NULL; - thinker_t *th; - mobj_t *mo2; + mobj_t *oldtarg = NULL, *newtarg = NULL; #ifdef HAVE_BLUA if (LUA_CallAction("A_SetTargetsTarget", actor)) return; #endif - if ((!locvar1 && (!actor->target)) || (locvar1 && (!actor->tracer))) + // actor's target + if (locvar1) // or tracer + oldtarg = actor->tracer; + else + oldtarg = actor->target; + + if (P_MobjWasRemoved(oldtarg)) return; - if ((!locvar1 && !locvar2 && (!actor->target->target)) - || (!locvar1 && locvar2 && (!actor->target->tracer)) - || (locvar1 && !locvar2 && (!actor->tracer->target)) - || (locvar1 && locvar2 && (!actor->tracer->tracer))) - return; // Don't search for nothing. - - // scan the thinkers - for (th = thinkercap.next; th != &thinkercap; th = th->next) - { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo2 = (mobj_t *)th; - - if ((!locvar1 && !locvar2 && (mo2 == actor->target->target)) - || (!locvar1 && locvar2 && (mo2 == actor->target->tracer)) - || (locvar1 && !locvar2 && (mo2 == actor->tracer->target)) - || (locvar1 && locvar2 && (mo2 == actor->tracer->tracer))) - { - targetedmobj = mo2; - break; - } - } - - if (!targetedmobj) - return; // Oops, nothing found.. - - if (!locvar1) - P_SetTarget(&actor->target, targetedmobj); + // actor's target's target! + if (locvar2) // or tracer + newtarg = oldtarg->tracer; else - P_SetTarget(&actor->tracer, targetedmobj); + newtarg = oldtarg->target; + + if (P_MobjWasRemoved(newtarg)) + return; + + // set actor's new target + if (locvar1) // or tracer + P_SetTarget(&actor->tracer, newtarg); + else + P_SetTarget(&actor->target, newtarg); } // Function: A_SetObjectFlags From fbda813155c880f6b515992fd82661909e833a16 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 14 Aug 2015 18:32:30 -0400 Subject: [PATCH 104/364] whitespace cleanup from merge --- src/p_polyobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index ab7a63411..faa3242d4 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -612,12 +612,12 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id) if (seg->linedef->special != POLYOBJ_START_LINE) continue; - + if (seg->linedef->tag != po->id) continue; Polyobj_GetInfo(po->id, &poflags, &parentID, &potrans); // apply extra settings if they exist! - + // save original flags and translucency to reference later for netgames! po->spawnflags = po->flags = poflags; po->spawntrans = po->translucency = potrans; From f8b439769ad190552a804273728da40f1a7c347c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 15 Aug 2015 13:00:49 +0100 Subject: [PATCH 105/364] Fixed Tag and H&S getting each other's suicide behaviors by mistake. --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 478bd459c..e9512e960 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1988,7 +1988,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) // allow them to try again, rather than sitting the whole thing out. if (leveltime >= hidetime * TICRATE) { - if (gametype == GT_HIDEANDSEEK)//suiciding in survivor makes you IT. + if (gametype == GT_TAG)//suiciding in survivor makes you IT. { target->player->pflags |= PF_TAGIT; CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it! From d0d19e684c1283d90acaa498556c1a26bebf6471 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Fri, 21 Aug 2015 18:34:21 +0100 Subject: [PATCH 106/364] Change Lavender, Azure, Blue --- src/r_draw.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 3518d384c..8e046417e 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -324,6 +324,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U case SKINCOLOR_WHITE: case SKINCOLOR_BLACK: case SKINCOLOR_PINK: + case SKINCOLOR_LAVENDER: case SKINCOLOR_ZIM: // 8 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) @@ -360,8 +361,6 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U { if (8*i/16 <= 1) dest_colormap[starttranscolor + i] = (UINT8)(0x80 + 8*i/16); // Lightest - else if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0x7B; // Darkest else dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 2); // main } @@ -371,7 +370,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (i == 14) - dest_colormap[starttranscolor + i] = 0x9F; + dest_colormap[starttranscolor + i] = 0xED; else if (i == 15) dest_colormap[starttranscolor + i] = 0x1F; else @@ -426,17 +425,6 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U } break; - case SKINCOLOR_LAVENDER: - // 10 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (10*i/16 <= 1) - dest_colormap[starttranscolor + i] = (UINT8)(0xEC + 10*i/16); // Lightest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main - } - break; - case SKINCOLOR_PURPLE: // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) From 5a033181b82b4a851e7942c0a1c8f207f1b4917b Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Fri, 21 Aug 2015 20:17:11 +0100 Subject: [PATCH 107/364] Metal Sonic Flash --- src/r_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_draw.c b/src/r_draw.c index 8e046417e..81bcc9438 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -283,7 +283,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U if (skinnum == TC_BOSS) dest_colormap[31] = 0; else if (skinnum == TC_METALSONIC) - dest_colormap[239] = 0; + dest_colormap[143] = 0; return; } From d5884a69573f9bdadb60cc78efb8b672eabbee9f Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Fri, 21 Aug 2015 18:23:37 -0500 Subject: [PATCH 108/364] Add Chee to credits (she helped port important drawing code!) --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index f541995d4..a85fd11cb 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -982,6 +982,7 @@ static const char *credits[] = { "", "\1Programming", "\1Assistance", + "\"chi.miru\"", // Red's secret weapon, the REAL reason slopes exist (also helped port drawing code from ZDoom) "Andrew \"orospakr\" Clunis", "Gregor \"Oogaland\" Dick", "Julio \"Chaos Zero 64\" Guir", From f3d40c34a0ba498bf0e215ef46100e9bc012fec2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 21 Aug 2015 20:46:41 -0400 Subject: [PATCH 109/364] git warning: trailing whitespace --- src/hardware/hw_md2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index de648f1b9..67720231c 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -926,7 +926,7 @@ void HWR_InitMD2(void) CONS_Printf("MD2 for sprite PLAY detected in md2.dat, use a player skin instead!\n"); continue; } - + for (i = 0; i < NUMSPRITES; i++) { if (stricmp(name, sprnames[i]) == 0) From c64e4d58b70addea6e2f5f0ea6a0fe2f8e1a91d4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 21 Aug 2015 20:47:00 -0400 Subject: [PATCH 110/364] git warning: new blank line at EOF --- src/p_slopes.c | 1 - src/p_slopes.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index baec5e1ef..bb150944e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1133,4 +1133,3 @@ void P_ButteredSlope(mobj_t *mo) // EOF #endif // #ifdef ESLOPE - diff --git a/src/p_slopes.h b/src/p_slopes.h index e92198675..8d82632ff 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -78,4 +78,3 @@ void P_ButteredSlope(mobj_t *mo); // EOF #endif // #ifdef ESLOPE - From 96c71c68c80ebc63aec3221edb1fbd67d3b5b2ac Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 21 Aug 2015 21:27:20 -0400 Subject: [PATCH 111/364] remove NEED_FIXED_VECTOR and fix angelchk testcase --- src/doomdef.h | 4 ---- src/m_fixed.c | 4 ---- src/m_fixed.h | 5 ----- src/tables.c | 5 ----- src/tables.h | 5 ----- tools/anglechk.c | 7 +++++++ 6 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index bfa5ee0ce..92570f623 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -440,12 +440,8 @@ extern const char *compdate, *comptime, *comprevision; //#define SLOPENESS /// Kalaron/Eternity Engine slope code (SRB2CB ported) -/// Depends on NEED_FIXED_VECTORS? for a few functions. #define ESLOPE -/// Fixed and float point types -//#define NEED_FIXED_VECTOR - /// Delete file while the game is running. /// \note EXTREMELY buggy, tends to crash game. //#define DELFILE diff --git a/src/m_fixed.c b/src/m_fixed.c index 739265aa2..53974936e 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -119,8 +119,6 @@ fixed_t FixedHypot(fixed_t x, fixed_t y) return FixedMul(ax, yx1); // |x|*((1 + (x/y)^2)^1/2) } -#if 1 //#ifdef NEED_FIXED_VECTOR - vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y) { vec->x = x; @@ -863,8 +861,6 @@ void FM_Scale(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z) #undef M } -#endif - #ifdef M_TESTCASE //#define MULDIV_TEST #define SQRT_TEST diff --git a/src/m_fixed.h b/src/m_fixed.h index 53962269b..cd22d483f 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -357,9 +357,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x) return INT32_MAX; } - -#if 1//#ifdef NEED_FIXED_VECTOR - typedef struct { fixed_t x; @@ -438,6 +435,4 @@ void FM_MultMatrix(matrix_t *dest, const matrix_t *multme); void FM_Translate(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z); void FM_Scale(matrix_t *dest, fixed_t x, fixed_t y, fixed_t z); -#endif // defined NEED_FIXED_VECTOR - #endif //m_fixed.h diff --git a/src/tables.c b/src/tables.c index 3ee2685c8..83e952832 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2225,9 +2225,6 @@ angle_t tantoangle[2049] = 536870912 }; - -#if 1 //#ifdef NEED_FIXED_VECTOR - static angle_t fineacon[65536*2] = { ANGLE_MAX, 2143707442, 2142143280, 2140943052, 2139931208, 2139039753, 2138233813, 2137492672, 2136802831, 2136154917, 2135542102, 2134959233, 2134402306, 2133868139, 2133354148, 2132858208, 2132378539, 2131913638, 2131462220, 2131023174, 2130595537, 2130178462, 2129771202, 2129373097, 2128983555, 2128602046, 2128228092, 2127861261, 2127501162, 2127147436, 2126799757, 2126457825, @@ -10706,5 +10703,3 @@ void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z) M(3, 3) = FRACUNIT; #undef M } - -#endif diff --git a/src/tables.h b/src/tables.h index b1de1a428..d7ec589da 100644 --- a/src/tables.h +++ b/src/tables.h @@ -96,9 +96,6 @@ FUNCMATH angle_t FixedAngle(fixed_t fa); // and with a factor, with +factor for (fa/factor) and -factor for (fa*factor) FUNCMATH angle_t FixedAngleC(fixed_t fa, fixed_t factor); - -#if 1 //#ifdef NEED_FIXED_VECTOR - /// The FixedAcos function FUNCMATH angle_t FixedAcos(fixed_t x); @@ -112,8 +109,6 @@ void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle /// Fixed Point Matrix functions void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z); -#endif // defined NEED_FIXED_VECTOR - // The table values in tables.c are calculated with this many fractional bits. #define FINE_FRACBITS 16 diff --git a/tools/anglechk.c b/tools/anglechk.c index bb9c4d9ea..4a67069bf 100644 --- a/tools/anglechk.c +++ b/tools/anglechk.c @@ -351,6 +351,13 @@ int main(int argc, char** argv) return 0; } +static void *cpu_cpy(void *dest, const void *src, size_t n) +{ + return memcpy(dest, src, n); +} + +void *(*M_Memcpy)(void* dest, const void* src, size_t n) = cpu_cpy; + void I_Error(const char *error, ...) { (void)error; From 9155fd6c14eb8ab09bbfc7bc3892eb2736c28099 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Mon, 24 Aug 2015 22:09:19 -0500 Subject: [PATCH 112/364] Fix unexpected behavior with colormaps in sloped sectors To be specific: when a sector had a sloped ceiling and a colormap was placed above it, the colormap wouldn't fill anything above where the ceiling height is at the sector's midpoint. This is fixed. --- src/r_bsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/r_bsp.c b/src/r_bsp.c index 5474a4345..7d584a976 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -1218,6 +1218,7 @@ void R_Prep3DFloors(sector_t *sector) heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight; sector->lightlist[0].height = heighttest + 1; + sector->lightlist[0].slope = sector->c_slope; #else sector->lightlist[0].height = sector->ceilingheight + 1; #endif From 0f038f9a3bb2dfa880061d60a2a04e6b9e89c7d1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Sep 2015 12:45:26 +0100 Subject: [PATCH 113/364] Add M_Options(0); to F4/F5/F7 code to prevent them going to Main Menu instead of SP/MP pause menus when the latter should be shown --- src/m_menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 06aaac0ef..c7a9fcc16 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2203,6 +2203,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + M_Options(0); currentMenu = &OP_SoundOptionsDef; itemOn = 0; return true; @@ -2212,6 +2213,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + M_Options(0); M_VideoModeMenu(0); return true; #endif @@ -2223,6 +2225,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + M_Options(0); M_SetupNextMenu(&OP_MainDef); return true; From 775ccde424f57d533a93ac44db6a7905a18c16f8 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Sep 2015 12:45:26 +0100 Subject: [PATCH 114/364] Add M_Options(0); to F4/F5/F7 code to prevent them going to Main Menu instead of SP/MP pause menus when the latter should be shown --- src/m_menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 06aaac0ef..c7a9fcc16 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2203,6 +2203,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + M_Options(0); currentMenu = &OP_SoundOptionsDef; itemOn = 0; return true; @@ -2212,6 +2213,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + M_Options(0); M_VideoModeMenu(0); return true; #endif @@ -2223,6 +2225,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + M_Options(0); M_SetupNextMenu(&OP_MainDef); return true; From 52e2087ee7e2a068195e58d6b27828f06c9a7b5e Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Thu, 3 Sep 2015 13:13:55 -0400 Subject: [PATCH 115/364] Fixed NetVars hook mistakenly assuming index starts from 0. --- src/lua_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_script.c b/src/lua_script.c index 8b40d9f00..0634c96ab 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -743,7 +743,7 @@ static int NetArchive(lua_State *L) { int TABLESINDEX = lua_upvalueindex(1); int i, n = lua_gettop(L); - for (i = 0; i < n; i++) + for (i = 1; i <= n; i++) ArchiveValue(TABLESINDEX, i); return n; } @@ -893,7 +893,7 @@ static int NetUnArchive(lua_State *L) { int TABLESINDEX = lua_upvalueindex(1); int i, n = lua_gettop(L); - for (i = 0; i < n; i++) + for (i = 1; i <= n; i++) UnArchiveValue(TABLESINDEX); return n; } From 773e5fbda6d327d4b2f1aec2eff66c4e0207aa34 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 24 Sep 2015 15:35:55 -0500 Subject: [PATCH 116/364] Fix sloped FOF/ground weirdness ( STJr/SRB2Internal#26 ) --- src/r_bsp.c | 52 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index 7d584a976..503b2e1f0 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -916,7 +916,7 @@ static void R_Subsector(size_t num) if (frontsector->ffloors) { ffloor_t *rover; - fixed_t heightcheck; + fixed_t heightcheck, planecenterz, floorcenterz, ceilingcenterz; for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next) { @@ -934,25 +934,38 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; + + floorcenterz = +#ifdef ESLOPE + frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + frontsector->floorheight; + + ceilingcenterz = +#ifdef ESLOPE + frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + frontsector->ceilingheight; heightcheck = #ifdef ESLOPE *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : #endif *rover->bottomheight; - if (*rover->bottomheight <= frontsector->ceilingheight - && *rover->bottomheight >= frontsector->floorheight + + planecenterz = +#ifdef ESLOPE + *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + *rover->bottomheight; + if (planecenterz <= ceilingcenterz + && planecenterz >= floorcenterz && ((viewz < heightcheck && !(rover->flags & FF_INVERTPLANES)) || (viewz > heightcheck && (rover->flags & FF_BOTHPLANES)))) { -#ifdef ESLOPE - light = R_GetPlaneLight(frontsector, - *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->bottomheight, - viewz < heightcheck); -#else - light = R_GetPlaneLight(frontsector, *rover->bottomheight, + light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->bottomheight); -#endif + ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover @@ -988,18 +1001,19 @@ static void R_Subsector(size_t num) *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : #endif *rover->topheight; - if (*rover->topheight >= frontsector->floorheight - && *rover->topheight <= frontsector->ceilingheight + + planecenterz = +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : +#endif + *rover->topheight; + if (planecenterz >= floorcenterz + && planecenterz <= ceilingcenterz && ((viewz > heightcheck && !(rover->flags & FF_INVERTPLANES)) || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { -#ifdef ESLOPE - light = R_GetPlaneLight(frontsector, - *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : *rover->topheight, - viewz < heightcheck); -#else - light = R_GetPlaneLight(frontsector, *rover->topheight, viewz < *rover->topheight); -#endif + light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight); + ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover From 210757f27bc5fe20136b66a4667fc631264b4661 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 2 Oct 2015 13:45:51 +0100 Subject: [PATCH 117/364] Removed the removal of SF_SUPER from skins other than Sonic --- src/r_things.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 2247d238e..35e043015 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2653,9 +2653,6 @@ next_token: } free(buf2); - if (skin != &skins[0]) - skin->flags &= ~SF_SUPER; - // Add sprites { UINT16 z; From 368b458eeed6a2fdb33bdcba7d18067ba23b4458 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Oct 2015 17:57:35 +0100 Subject: [PATCH 118/364] We can compile the slopes code now, yay! My brain hurts. Compiling errors fixed in this commit: * Various cases of mixed declaration and statement code * Implicit declaration of slope functions (read: you forgot to put "include "p_slopes.h" in MORE than a few places) * an odd case of a bad fixed_t to float typecase, cause by using P_GetZAt directly inside FIXED_TO_FLOAT * a few minor cases of bad unsigned-signed comparisons * no prototypes for some of the new slope functions. For goodness sake Red, this is basic stuff! --- src/p_map.c | 16 +++++--- src/p_maputl.c | 21 ++++++---- src/p_mobj.c | 10 +++-- src/p_slopes.c | 34 +++++++++-------- src/p_slopes.h | 5 +++ src/p_spec.c | 5 ++- src/p_user.c | 3 +- src/r_bsp.c | 1 + src/r_draw.h | 7 ++-- src/r_draw8.c | 101 +++++++++++++++++++++++++++---------------------- src/r_plane.c | 17 +++++++-- src/r_segs.c | 9 ++++- src/r_things.c | 1 + 13 files changed, 140 insertions(+), 90 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 0c79af36e..214048fb3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1255,11 +1255,13 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; + if (!(rover->flags & FF_EXISTS)) continue; - fixed_t topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); - fixed_t bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); + topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); + bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY)) { @@ -1559,11 +1561,12 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); - fixed_t bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); + topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); + bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); delta1 = thiscam->z - (bottomheight + ((topheight - bottomheight)/2)); @@ -3946,14 +3949,15 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) for (rover = sec->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) diff --git a/src/p_maputl.c b/src/p_maputl.c index c9a42bd43..8f349a2a9 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -20,6 +20,7 @@ #include "r_data.h" #include "p_maputl.h" #include "p_polyobj.h" +#include "p_slopes.h" #include "z_zone.h" // @@ -442,11 +443,12 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors) for (rover = front->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); + topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); + bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -465,11 +467,12 @@ void P_CameraLineOpening(line_t *linedef) if (back->ffloors) for (rover = back->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); + topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); + bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -636,6 +639,7 @@ void P_LineOpening(line_t *linedef) // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; @@ -645,8 +649,8 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); + bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -679,6 +683,7 @@ void P_LineOpening(line_t *linedef) // Check for backsectors fake floors for (rover = back->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; @@ -688,8 +693,8 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); + bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); diff --git a/src/p_mobj.c b/src/p_mobj.c index 3a538e96f..915c742e8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -859,6 +859,7 @@ void P_ExplodeMissile(mobj_t *mo) // Returns TRUE if mobj is inside a non-solid 3d floor. boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) return false; @@ -866,8 +867,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) return false; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -3169,13 +3170,14 @@ void P_MobjCheckWater(mobj_t *mobj) for (rover = sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || (((rover->flags & FF_BLOCKPLAYER) && mobj->player) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) diff --git a/src/p_slopes.c b/src/p_slopes.c index bb150944e..755939039 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -32,6 +32,7 @@ #include "r_state.h" #include "m_bbox.h" #include "z_zone.h" +#include "p_local.h" #include "p_spec.h" #include "p_slopes.h" #include "p_setup.h" @@ -140,7 +141,8 @@ void P_RunDynamicSlopes(void) { case 5: // vertices { mapthing_t *mt; - size_t i, l; + size_t i; + INT32 l; line_t *line; for (i = 0; i < 3; i++) { @@ -322,7 +324,8 @@ void P_SpawnSlope_Line(int linenum) if(frontfloor) { - + fixed_t highest, lowest; + size_t l; point.z = line->frontsector->floorheight; // Startz dz = FixedDiv(origin.z - point.z, extent); // Destinationz @@ -351,12 +354,11 @@ void P_SpawnSlope_Line(int linenum) // *You can use sourceline as a reference to see if two slopes really are the same // Default points for high and low - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; // Now check to see what the REAL high and low points of the slope inside the sector // TODO: Is this really needed outside of FOFs? -Red - size_t l; for (l = 0; l < line->frontsector->linecount; l++) { @@ -380,6 +382,8 @@ void P_SpawnSlope_Line(int linenum) } if(frontceil) { + fixed_t highest, lowest; + size_t l; origin.z = line->backsector->ceilingheight; point.z = line->frontsector->ceilingheight; dz = FixedDiv(origin.z - point.z, extent); @@ -396,9 +400,8 @@ void P_SpawnSlope_Line(int linenum) cslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->frontsector->linecount; l++) { @@ -446,6 +449,8 @@ void P_SpawnSlope_Line(int linenum) if(backfloor) { + fixed_t highest, lowest; + size_t l; point.z = line->backsector->floorheight; dz = FixedDiv(origin.z - point.z, extent); @@ -461,9 +466,8 @@ void P_SpawnSlope_Line(int linenum) fslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->backsector->linecount; l++) { @@ -487,6 +491,8 @@ void P_SpawnSlope_Line(int linenum) } if(backceil) { + fixed_t highest, lowest; + size_t l; origin.z = line->frontsector->ceilingheight; point.z = line->backsector->ceilingheight; dz = FixedDiv(origin.z - point.z, extent); @@ -503,10 +509,8 @@ void P_SpawnSlope_Line(int linenum) cslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->backsector->linecount; l++) { diff --git a/src/p_slopes.h b/src/p_slopes.h index 8d82632ff..f2d1cd81e 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -29,6 +29,9 @@ #define P_SLOPES_H__ #ifdef ESLOPE +void P_CalculateSlopeNormal(pslope_t *slope); +void P_ReconfigureVertexSlope(pslope_t *slope); + void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); // P_SpawnSlope_Line @@ -36,6 +39,8 @@ void P_RunDynamicSlopes(void); // sectors. void P_SpawnSlope_Line(int linenum); +pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags); + #ifdef SPRINGCLEAN // Loads just map objects that make slopes, // terrain affecting objects have to be spawned first diff --git a/src/p_spec.c b/src/p_spec.c index eeb19476a..0d786c695 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -29,6 +29,7 @@ #include "r_main.h" //Two extra includes. #include "r_sky.h" #include "p_polyobj.h" +#include "p_slopes.h" #include "hu_stuff.h" #include "m_misc.h" #include "m_cond.h" //unlock triggers @@ -7043,7 +7044,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 */ void T_Friction(friction_t *f) { - sector_t *sec, *referrer; + sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; @@ -7371,7 +7372,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) */ void T_Pusher(pusher_t *p) { - sector_t *sec, *referrer; + sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; INT32 xspeed = 0,yspeed = 0; diff --git a/src/p_user.c b/src/p_user.c index ef063dab2..8854d8d64 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -29,6 +29,7 @@ #include "m_random.h" #include "m_misc.h" #include "i_video.h" +#include "p_slopes.h" #include "p_spec.h" #include "r_splats.h" #include "z_zone.h" @@ -2312,11 +2313,11 @@ static void P_DoClimbing(player_t *player) boolean thrust; boolean boostup; boolean skyclimber; + fixed_t floorheight, ceilingheight; // ESLOPE thrust = false; floorclimb = false; boostup = false; skyclimber = false; - fixed_t floorheight, ceilingheight; // ESLOPE #ifdef ESLOPE floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) diff --git a/src/r_bsp.c b/src/r_bsp.c index 503b2e1f0..badf8bdac 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -18,6 +18,7 @@ #include "r_splats.h" #include "p_local.h" // camera +#include "p_slopes.h" #include "z_zone.h" // Check R_Prep3DFloors seg_t *curline; diff --git a/src/r_draw.h b/src/r_draw.h index 63fecc046..0ece26487 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -65,9 +65,9 @@ typedef struct { float x, y, z; } floatv3_t; -pslope_t *ds_slope; // Current slope being used -floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? -float focallengthf, zeroheight; +extern pslope_t *ds_slope; // Current slope being used +extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +extern float focallengthf, zeroheight; #endif // Variable flat sizes @@ -152,6 +152,7 @@ void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawSpan_8(void); #ifdef ESLOPE +void R_CalcTiltedLighting(fixed_t start, fixed_t end); void R_DrawTiltedSpan_8(void); void R_DrawTiltedTranslucentSpan_8(void); void R_DrawTiltedSplat_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index f78f1494b..2a4c89be7 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -529,14 +529,14 @@ void R_DrawSpan_8 (void) #ifdef ESLOPE // R_CalcTiltedLighting // Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly. -static size_t tiltlighting[MAXVIDWIDTH]; +static INT32 tiltlighting[MAXVIDWIDTH]; void R_CalcTiltedLighting(fixed_t start, fixed_t end) { // ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version // of this function. Here's my own. INT32 left = ds_x1, right = ds_x2; fixed_t step = (end-start)/(ds_x2-ds_x1+1); - size_t i; + INT32 i; // I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once, // but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now... @@ -566,6 +566,11 @@ void R_DrawTiltedSpan_8(void) UINT8 *colormap; UINT8 *dest; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -608,10 +613,9 @@ void R_DrawTiltedSpan_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -625,11 +629,11 @@ void R_DrawTiltedSpan_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -661,12 +665,12 @@ void R_DrawTiltedSpan_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -683,7 +687,6 @@ void R_DrawTiltedSpan_8(void) #endif } - /** \brief The R_DrawTiltedTranslucentSpan_8 function Like DrawTiltedSpan, but translucent */ @@ -699,6 +702,11 @@ void R_DrawTiltedTranslucentSpan_8(void) UINT8 *colormap; UINT8 *dest; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -741,10 +749,9 @@ void R_DrawTiltedTranslucentSpan_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -758,11 +765,11 @@ void R_DrawTiltedTranslucentSpan_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -794,12 +801,12 @@ void R_DrawTiltedTranslucentSpan_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -830,6 +837,11 @@ void R_DrawTiltedSplat_8(void) UINT8 val; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -874,10 +886,9 @@ void R_DrawTiltedSplat_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -891,11 +902,11 @@ void R_DrawTiltedSplat_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -931,12 +942,12 @@ void R_DrawTiltedSplat_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; diff --git a/src/r_plane.c b/src/r_plane.c index 406a38d7b..fa0e0eac3 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -28,6 +28,8 @@ #include "p_setup.h" // levelflats +#include "p_slopes.h" + // // opening // @@ -952,6 +954,9 @@ void R_DrawSinglePlane(visplane_t *pl) float ang; float vx, vy, vz; float fudge; + // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly + // use this as a temp var to store P_GetZAt's return value each time + fixed_t temp; xoffs &= ((1 << (32-nflatshiftup))-1); yoffs &= ((1 << (32-nflatshiftup))-1); @@ -969,7 +974,8 @@ void R_DrawSinglePlane(visplane_t *pl) vy = FIXED_TO_FLOAT(viewy-yoffs); vz = FIXED_TO_FLOAT(viewz); - zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); + temp = P_GetZAt(pl->slope, viewx, viewy); + zeroheight = FIXED_TO_FLOAT(temp); #define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180) @@ -979,7 +985,8 @@ void R_DrawSinglePlane(visplane_t *pl) ang = ANG2RAD(ANGLE_270 - viewangle); p.x = vx * cos(ang) - vy * sin(ang); p.z = vx * sin(ang) + vy * cos(ang); - p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, -xoffs, yoffs)) - vz; + temp = P_GetZAt(pl->slope, -xoffs, yoffs); + p.y = FIXED_TO_FLOAT(temp) - vz; // m is the v direction vector in view space ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle); @@ -991,8 +998,10 @@ void R_DrawSinglePlane(visplane_t *pl) n.z = -cos(ang); ang = ANG2RAD(pl->plangle); - m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)))) - zeroheight; - n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)))) - zeroheight; + temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang))); + m.y = FIXED_TO_FLOAT(temp) - zeroheight; + temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang))); + n.y = FIXED_TO_FLOAT(temp) - zeroheight; m.x /= fudge; m.y /= fudge; diff --git a/src/r_segs.c b/src/r_segs.c index 2d41d702c..75e7b8b98 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -22,6 +22,7 @@ #include "d_netcmd.h" #include "m_misc.h" #include "p_local.h" // Camera... +#include "p_slopes.h" #include "console.h" // con_clipviewtop // OPTIMIZE: closed two sided lines as single sided @@ -1489,7 +1490,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) fixed_t hyp; fixed_t sineval; angle_t distangle, offsetangle; - fixed_t vtop; + //fixed_t vtop; INT32 lightnum; INT32 i, p; lightlist_t *light; @@ -1502,6 +1503,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) maskedtextureheight = NULL; + //initialize segleft and segright + memset(&segleft, 0x00, sizeof(segleft)); + memset(&segright, 0x00, sizeof(segright)); + if (ds_p == drawsegs+maxdrawsegs) { size_t pos = ds_p - drawsegs; @@ -2630,11 +2635,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ffloor_t * rover; - i = 0; #ifdef ESLOPE fixed_t rovertest; fixed_t planevistest; #endif + i = 0; if (backsector->ffloors) { diff --git a/src/r_things.c b/src/r_things.c index 2247d238e..60fbad1af 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -24,6 +24,7 @@ #include "r_plane.h" #include "p_tick.h" #include "p_local.h" +#include "p_slopes.h" #include "dehacked.h" // get_number (for thok) #include "d_netfil.h" // blargh. for nameonly(). #include "m_cheat.h" // objectplace From d4976d677fcbacbd169b1031dce74359b8fb1155 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Oct 2015 20:30:29 +0100 Subject: [PATCH 119/364] Move finecosine[] declaration to where it really belongs in the source code --- src/r_main.c | 9 --------- src/tables.c | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 1170b3414..a4e72cba9 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -114,15 +114,6 @@ INT32 viewangletox[FINEANGLES/2]; // from clipangle to -clipangle. angle_t xtoviewangle[MAXVIDWIDTH+1]; -// UNUSED. -// The finetangentgent[angle+FINEANGLES/4] table -// holds the fixed_t tangent values for view angles, -// ranging from INT32_MIN to 0 to INT32_MAX. - -#if !(defined _NDS) || !(defined NONET) -fixed_t *finecosine = &finesine[FINEANGLES/4]; -#endif - lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; lighttable_t *scalelightfixed[MAXLIGHTSCALE]; lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; diff --git a/src/tables.c b/src/tables.c index 6f0446e01..47161e667 100644 --- a/src/tables.c +++ b/src/tables.c @@ -1960,10 +1960,10 @@ fixed_t finesine[10240] = 65531, 65531, 65532, 65532, 65533, 65533, 65534, 65534, 65534, 65535, 65535, 65535, 65535, 65535, 65535, 65535 }; + +fixed_t *finecosine = &finesine[FINEANGLES/4]; #endif - - angle_t tantoangle[2049] = { 0, 333772, 667544, 1001315, 1335086, 1668857, 2002626, 2336395, From fdc2c3adcd6fe71eaba71fce21dd33ce812860ff Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Oct 2015 21:21:16 +0100 Subject: [PATCH 120/364] Fix up lib_finetangent so tan() returns values starting from "0" in Lua (finetangent itself hasn't been touched) Also fixed how the function went out of the array's bounds for ANGLE_180 and above (or negative angles) --- src/lua_mathlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 8ca2e17af..f4b5ca5fe 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -77,7 +77,9 @@ static int lib_finecosine(lua_State *L) static int lib_finetangent(lua_State *L) { - lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); + // HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should + // use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds + lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095)); return 1; } From a9b96a1668d86f29aaa1bff99bf4364b8c0bb168 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Oct 2015 14:05:05 +0100 Subject: [PATCH 121/364] Replaced the old finetangent[] with a new more accurate one I made using a Python script. Actually uses 0 and 65536 now! (and also INT32_MIN) --- src/tables.c | 1024 +++++++++++++++++++++++++------------------------- 1 file changed, 512 insertions(+), 512 deletions(-) diff --git a/src/tables.c b/src/tables.c index 47161e667..deb5a6b19 100644 --- a/src/tables.c +++ b/src/tables.c @@ -162,518 +162,518 @@ angle_t FixedAngle(fixed_t fa) #if !(defined _NDS) || !(defined NONET) fixed_t finetangent[4096] = { - -170910304, -56965752, -34178904, -24413316, -18988036, -15535599, -13145455, -11392683, - -10052327, -8994149, -8137527, -7429880, -6835455, -6329090, -5892567, -5512368, - -5178251, -4882318, -4618375, -4381502, -4167737, -3973855, -3797206, -3635590, - -3487165, -3350381, -3223918, -3106651, -2997613, -2895966, -2800983, -2712030, - -2628549, -2550052, -2476104, -2406322, -2340362, -2277919, -2218719, -2162516, - -2109087, -2058233, -2009771, -1963536, -1919378, -1877161, -1836758, -1798063, - -1760956, -1725348, -1691149, -1658278, -1626658, -1596220, -1566898, -1538632, - -1511367, -1485049, -1459630, -1435065, -1411312, -1388330, -1366084, -1344537, - -1323658, -1303416, -1283783, -1264730, -1246234, -1228269, -1210813, -1193846, - -1177345, -1161294, -1145673, -1130465, -1115654, -1101225, -1087164, -1073455, - -1060087, -1047046, -1034322, -1021901, -1009774, -997931, -986361, -975054, - -964003, -953199, -942633, -932298, -922186, -912289, -902602, -893117, - -883829, -874730, -865817, -857081, -848520, -840127, -831898, -823827, - -815910, -808143, -800521, -793041, -785699, -778490, -771411, -764460, - -757631, -750922, -744331, -737853, -731486, -725227, -719074, -713023, - -707072, -701219, -695462, -689797, -684223, -678737, -673338, -668024, - -662792, -657640, -652568, -647572, -642651, -637803, -633028, -628323, - -623686, -619117, -614613, -610174, -605798, -601483, -597229, -593033, - -588896, -584815, -580789, -576818, -572901, -569035, -565221, -561456, - -557741, -554074, -550455, -546881, -543354, -539870, -536431, -533034, - -529680, -526366, -523094, -519861, -516667, -513512, -510394, -507313, - -504269, -501261, -498287, -495348, -492443, -489571, -486732, -483925, - -481150, -478406, -475692, -473009, -470355, -467730, -465133, -462565, - -460024, -457511, -455024, -452564, -450129, -447720, -445337, -442978, - -440643, -438332, -436045, -433781, -431540, -429321, -427125, -424951, - -422798, -420666, -418555, -416465, -414395, -412344, -410314, -408303, - -406311, -404338, -402384, -400448, -398530, -396630, -394747, -392882, - -391034, -389202, -387387, -385589, -383807, -382040, -380290, -378555, - -376835, -375130, -373440, -371765, -370105, -368459, -366826, -365208, - -363604, -362013, -360436, -358872, -357321, -355783, -354257, -352744, - -351244, -349756, -348280, -346816, -345364, -343924, -342495, -341078, - -339671, -338276, -336892, -335519, -334157, -332805, -331464, -330133, - -328812, -327502, -326201, -324910, -323629, -322358, -321097, -319844, - -318601, -317368, -316143, -314928, -313721, -312524, -311335, -310154, - -308983, -307819, -306664, -305517, -304379, -303248, -302126, -301011, - -299904, -298805, -297714, -296630, -295554, -294485, -293423, -292369, - -291322, -290282, -289249, -288223, -287204, -286192, -285186, -284188, - -283195, -282210, -281231, -280258, -279292, -278332, -277378, -276430, - -275489, -274553, -273624, -272700, -271782, -270871, -269965, -269064, - -268169, -267280, -266397, -265519, -264646, -263779, -262917, -262060, - -261209, -260363, -259522, -258686, -257855, -257029, -256208, -255392, - -254581, -253774, -252973, -252176, -251384, -250596, -249813, -249035, - -248261, -247492, -246727, -245966, -245210, -244458, -243711, -242967, - -242228, -241493, -240763, -240036, -239314, -238595, -237881, -237170, - -236463, -235761, -235062, -234367, -233676, -232988, -232304, -231624, - -230948, -230275, -229606, -228941, -228279, -227621, -226966, -226314, - -225666, -225022, -224381, -223743, -223108, -222477, -221849, -221225, - -220603, -219985, -219370, -218758, -218149, -217544, -216941, -216341, - -215745, -215151, -214561, -213973, -213389, -212807, -212228, -211652, - -211079, -210509, -209941, -209376, -208815, -208255, -207699, -207145, - -206594, -206045, -205500, -204956, -204416, -203878, -203342, -202809, - -202279, -201751, -201226, -200703, -200182, -199664, -199149, -198636, - -198125, -197616, -197110, -196606, -196105, -195606, -195109, -194614, - -194122, -193631, -193143, -192658, -192174, -191693, -191213, -190736, - -190261, -189789, -189318, -188849, -188382, -187918, -187455, -186995, - -186536, -186080, -185625, -185173, -184722, -184274, -183827, -183382, - -182939, -182498, -182059, -181622, -181186, -180753, -180321, -179891, - -179463, -179037, -178612, -178190, -177769, -177349, -176932, -176516, - -176102, -175690, -175279, -174870, -174463, -174057, -173653, -173251, - -172850, -172451, -172053, -171657, -171263, -170870, -170479, -170089, - -169701, -169315, -168930, -168546, -168164, -167784, -167405, -167027, - -166651, -166277, -165904, -165532, -165162, -164793, -164426, -164060, - -163695, -163332, -162970, -162610, -162251, -161893, -161537, -161182, - -160828, -160476, -160125, -159775, -159427, -159079, -158734, -158389, - -158046, -157704, -157363, -157024, -156686, -156349, -156013, -155678, - -155345, -155013, -154682, -154352, -154024, -153697, -153370, -153045, - -152722, -152399, -152077, -151757, -151438, -151120, -150803, -150487, - -150172, -149859, -149546, -149235, -148924, -148615, -148307, -148000, - -147693, -147388, -147084, -146782, -146480, -146179, -145879, -145580, - -145282, -144986, -144690, -144395, -144101, -143808, -143517, -143226, - -142936, -142647, -142359, -142072, -141786, -141501, -141217, -140934, - -140651, -140370, -140090, -139810, -139532, -139254, -138977, -138701, - -138426, -138152, -137879, -137607, -137335, -137065, -136795, -136526, - -136258, -135991, -135725, -135459, -135195, -134931, -134668, -134406, - -134145, -133884, -133625, -133366, -133108, -132851, -132594, -132339, - -132084, -131830, -131576, -131324, -131072, -130821, -130571, -130322, - -130073, -129825, -129578, -129332, -129086, -128841, -128597, -128353, - -128111, -127869, -127627, -127387, -127147, -126908, -126669, -126432, - -126195, -125959, -125723, -125488, -125254, -125020, -124787, -124555, - -124324, -124093, -123863, -123633, -123404, -123176, -122949, -122722, - -122496, -122270, -122045, -121821, -121597, -121374, -121152, -120930, - -120709, -120489, -120269, -120050, -119831, -119613, -119396, -119179, - -118963, -118747, -118532, -118318, -118104, -117891, -117678, -117466, - -117254, -117044, -116833, -116623, -116414, -116206, -115998, -115790, - -115583, -115377, -115171, -114966, -114761, -114557, -114354, -114151, - -113948, -113746, -113545, -113344, -113143, -112944, -112744, -112546, - -112347, -112150, -111952, -111756, -111560, -111364, -111169, -110974, - -110780, -110586, -110393, -110200, -110008, -109817, -109626, -109435, - -109245, -109055, -108866, -108677, -108489, -108301, -108114, -107927, - -107741, -107555, -107369, -107184, -107000, -106816, -106632, -106449, - -106266, -106084, -105902, -105721, -105540, -105360, -105180, -105000, - -104821, -104643, -104465, -104287, -104109, -103933, -103756, -103580, - -103404, -103229, -103054, -102880, -102706, -102533, -102360, -102187, - -102015, -101843, -101671, -101500, -101330, -101159, -100990, -100820, - -100651, -100482, -100314, -100146, -99979, -99812, -99645, -99479, - -99313, -99148, -98982, -98818, -98653, -98489, -98326, -98163, - -98000, -97837, -97675, -97513, -97352, -97191, -97030, -96870, - -96710, -96551, -96391, -96233, -96074, -95916, -95758, -95601, - -95444, -95287, -95131, -94975, -94819, -94664, -94509, -94354, - -94200, -94046, -93892, -93739, -93586, -93434, -93281, -93129, - -92978, -92826, -92675, -92525, -92375, -92225, -92075, -91926, - -91777, -91628, -91480, -91332, -91184, -91036, -90889, -90742, - -90596, -90450, -90304, -90158, -90013, -89868, -89724, -89579, - -89435, -89292, -89148, -89005, -88862, -88720, -88577, -88435, - -88294, -88152, -88011, -87871, -87730, -87590, -87450, -87310, - -87171, -87032, -86893, -86755, -86616, -86479, -86341, -86204, - -86066, -85930, -85793, -85657, -85521, -85385, -85250, -85114, - -84980, -84845, -84710, -84576, -84443, -84309, -84176, -84043, - -83910, -83777, -83645, -83513, -83381, -83250, -83118, -82987, - -82857, -82726, -82596, -82466, -82336, -82207, -82078, -81949, - -81820, -81691, -81563, -81435, -81307, -81180, -81053, -80925, - -80799, -80672, -80546, -80420, -80294, -80168, -80043, -79918, - -79793, -79668, -79544, -79420, -79296, -79172, -79048, -78925, - -78802, -78679, -78557, -78434, -78312, -78190, -78068, -77947, - -77826, -77705, -77584, -77463, -77343, -77223, -77103, -76983, - -76864, -76744, -76625, -76506, -76388, -76269, -76151, -76033, - -75915, -75797, -75680, -75563, -75446, -75329, -75213, -75096, - -74980, -74864, -74748, -74633, -74517, -74402, -74287, -74172, - -74058, -73944, -73829, -73715, -73602, -73488, -73375, -73262, - -73149, -73036, -72923, -72811, -72699, -72587, -72475, -72363, - -72252, -72140, -72029, -71918, -71808, -71697, -71587, -71477, - -71367, -71257, -71147, -71038, -70929, -70820, -70711, -70602, - -70494, -70385, -70277, -70169, -70061, -69954, -69846, -69739, - -69632, -69525, -69418, -69312, -69205, -69099, -68993, -68887, - -68781, -68676, -68570, -68465, -68360, -68255, -68151, -68046, - -67942, -67837, -67733, -67629, -67526, -67422, -67319, -67216, - -67113, -67010, -66907, -66804, -66702, -66600, -66498, -66396, - -66294, -66192, -66091, -65989, -65888, -65787, -65686, -65586, - -65485, -65385, -65285, -65185, -65085, -64985, -64885, -64786, - -64687, -64587, -64488, -64389, -64291, -64192, -64094, -63996, - -63897, -63799, -63702, -63604, -63506, -63409, -63312, -63215, - -63118, -63021, -62924, -62828, -62731, -62635, -62539, -62443, - -62347, -62251, -62156, -62060, -61965, -61870, -61775, -61680, - -61585, -61491, -61396, -61302, -61208, -61114, -61020, -60926, - -60833, -60739, -60646, -60552, -60459, -60366, -60273, -60181, - -60088, -59996, -59903, -59811, -59719, -59627, -59535, -59444, - -59352, -59261, -59169, -59078, -58987, -58896, -58805, -58715, - -58624, -58534, -58443, -58353, -58263, -58173, -58083, -57994, - -57904, -57815, -57725, -57636, -57547, -57458, -57369, -57281, - -57192, -57104, -57015, -56927, -56839, -56751, -56663, -56575, - -56487, -56400, -56312, -56225, -56138, -56051, -55964, -55877, - -55790, -55704, -55617, -55531, -55444, -55358, -55272, -55186, - -55100, -55015, -54929, -54843, -54758, -54673, -54587, -54502, - -54417, -54333, -54248, -54163, -54079, -53994, -53910, -53826, - -53741, -53657, -53574, -53490, -53406, -53322, -53239, -53156, - -53072, -52989, -52906, -52823, -52740, -52657, -52575, -52492, - -52410, -52327, -52245, -52163, -52081, -51999, -51917, -51835, - -51754, -51672, -51591, -51509, -51428, -51347, -51266, -51185, - -51104, -51023, -50942, -50862, -50781, -50701, -50621, -50540, - -50460, -50380, -50300, -50221, -50141, -50061, -49982, -49902, - -49823, -49744, -49664, -49585, -49506, -49427, -49349, -49270, - -49191, -49113, -49034, -48956, -48878, -48799, -48721, -48643, - -48565, -48488, -48410, -48332, -48255, -48177, -48100, -48022, - -47945, -47868, -47791, -47714, -47637, -47560, -47484, -47407, - -47331, -47254, -47178, -47102, -47025, -46949, -46873, -46797, - -46721, -46646, -46570, -46494, -46419, -46343, -46268, -46193, - -46118, -46042, -45967, -45892, -45818, -45743, -45668, -45593, - -45519, -45444, -45370, -45296, -45221, -45147, -45073, -44999, - -44925, -44851, -44778, -44704, -44630, -44557, -44483, -44410, - -44337, -44263, -44190, -44117, -44044, -43971, -43898, -43826, - -43753, -43680, -43608, -43535, -43463, -43390, -43318, -43246, - -43174, -43102, -43030, -42958, -42886, -42814, -42743, -42671, - -42600, -42528, -42457, -42385, -42314, -42243, -42172, -42101, - -42030, -41959, -41888, -41817, -41747, -41676, -41605, -41535, - -41465, -41394, -41324, -41254, -41184, -41113, -41043, -40973, - -40904, -40834, -40764, -40694, -40625, -40555, -40486, -40416, - -40347, -40278, -40208, -40139, -40070, -40001, -39932, -39863, - -39794, -39726, -39657, -39588, -39520, -39451, -39383, -39314, - -39246, -39178, -39110, -39042, -38973, -38905, -38837, -38770, - -38702, -38634, -38566, -38499, -38431, -38364, -38296, -38229, - -38161, -38094, -38027, -37960, -37893, -37826, -37759, -37692, - -37625, -37558, -37491, -37425, -37358, -37291, -37225, -37158, - -37092, -37026, -36959, -36893, -36827, -36761, -36695, -36629, - -36563, -36497, -36431, -36365, -36300, -36234, -36168, -36103, - -36037, -35972, -35907, -35841, -35776, -35711, -35646, -35580, - -35515, -35450, -35385, -35321, -35256, -35191, -35126, -35062, - -34997, -34932, -34868, -34803, -34739, -34675, -34610, -34546, - -34482, -34418, -34354, -34289, -34225, -34162, -34098, -34034, - -33970, -33906, -33843, -33779, -33715, -33652, -33588, -33525, - -33461, -33398, -33335, -33272, -33208, -33145, -33082, -33019, - -32956, -32893, -32830, -32767, -32705, -32642, -32579, -32516, - -32454, -32391, -32329, -32266, -32204, -32141, -32079, -32017, - -31955, -31892, -31830, -31768, -31706, -31644, -31582, -31520, - -31458, -31396, -31335, -31273, -31211, -31150, -31088, -31026, - -30965, -30904, -30842, -30781, -30719, -30658, -30597, -30536, - -30474, -30413, -30352, -30291, -30230, -30169, -30108, -30048, - -29987, -29926, -29865, -29805, -29744, -29683, -29623, -29562, - -29502, -29441, -29381, -29321, -29260, -29200, -29140, -29080, - -29020, -28959, -28899, -28839, -28779, -28719, -28660, -28600, - -28540, -28480, -28420, -28361, -28301, -28241, -28182, -28122, - -28063, -28003, -27944, -27884, -27825, -27766, -27707, -27647, - -27588, -27529, -27470, -27411, -27352, -27293, -27234, -27175, - -27116, -27057, -26998, -26940, -26881, -26822, -26763, -26705, - -26646, -26588, -26529, -26471, -26412, -26354, -26295, -26237, - -26179, -26120, -26062, -26004, -25946, -25888, -25830, -25772, - -25714, -25656, -25598, -25540, -25482, -25424, -25366, -25308, - -25251, -25193, -25135, -25078, -25020, -24962, -24905, -24847, - -24790, -24732, -24675, -24618, -24560, -24503, -24446, -24389, - -24331, -24274, -24217, -24160, -24103, -24046, -23989, -23932, - -23875, -23818, -23761, -23704, -23647, -23591, -23534, -23477, - -23420, -23364, -23307, -23250, -23194, -23137, -23081, -23024, - -22968, -22911, -22855, -22799, -22742, -22686, -22630, -22573, - -22517, -22461, -22405, -22349, -22293, -22237, -22181, -22125, - -22069, -22013, -21957, -21901, -21845, -21789, -21733, -21678, - -21622, -21566, -21510, -21455, -21399, -21343, -21288, -21232, - -21177, -21121, -21066, -21010, -20955, -20900, -20844, -20789, - -20734, -20678, -20623, -20568, -20513, -20457, -20402, -20347, - -20292, -20237, -20182, -20127, -20072, -20017, -19962, -19907, - -19852, -19797, -19742, -19688, -19633, -19578, -19523, -19469, - -19414, -19359, -19305, -19250, -19195, -19141, -19086, -19032, - -18977, -18923, -18868, -18814, -18760, -18705, -18651, -18597, - -18542, -18488, -18434, -18380, -18325, -18271, -18217, -18163, - -18109, -18055, -18001, -17946, -17892, -17838, -17784, -17731, - -17677, -17623, -17569, -17515, -17461, -17407, -17353, -17300, - -17246, -17192, -17138, -17085, -17031, -16977, -16924, -16870, - -16817, -16763, -16710, -16656, -16603, -16549, -16496, -16442, - -16389, -16335, -16282, -16229, -16175, -16122, -16069, -16015, - -15962, -15909, -15856, -15802, -15749, -15696, -15643, -15590, - -15537, -15484, -15431, -15378, -15325, -15272, -15219, -15166, - -15113, -15060, -15007, -14954, -14901, -14848, -14795, -14743, - -14690, -14637, -14584, -14531, -14479, -14426, -14373, -14321, - -14268, -14215, -14163, -14110, -14057, -14005, -13952, -13900, - -13847, -13795, -13742, -13690, -13637, -13585, -13533, -13480, - -13428, -13375, -13323, -13271, -13218, -13166, -13114, -13062, - -13009, -12957, -12905, -12853, -12800, -12748, -12696, -12644, - -12592, -12540, -12488, -12436, -12383, -12331, -12279, -12227, - -12175, -12123, -12071, -12019, -11967, -11916, -11864, -11812, - -11760, -11708, -11656, -11604, -11552, -11501, -11449, -11397, - -11345, -11293, -11242, -11190, -11138, -11086, -11035, -10983, - -10931, -10880, -10828, -10777, -10725, -10673, -10622, -10570, - -10519, -10467, -10415, -10364, -10312, -10261, -10209, -10158, - -10106, -10055, -10004, -9952, -9901, -9849, -9798, -9747, - -9695, -9644, -9592, -9541, -9490, -9438, -9387, -9336, - -9285, -9233, -9182, -9131, -9080, -9028, -8977, -8926, - -8875, -8824, -8772, -8721, -8670, -8619, -8568, -8517, - -8466, -8414, -8363, -8312, -8261, -8210, -8159, -8108, - -8057, -8006, -7955, -7904, -7853, -7802, -7751, -7700, - -7649, -7598, -7547, -7496, -7445, -7395, -7344, -7293, - -7242, -7191, -7140, -7089, -7038, -6988, -6937, -6886, - -6835, -6784, -6733, -6683, -6632, -6581, -6530, -6480, - -6429, -6378, -6327, -6277, -6226, -6175, -6124, -6074, - -6023, -5972, -5922, -5871, -5820, -5770, -5719, -5668, - -5618, -5567, -5517, -5466, -5415, -5365, -5314, -5264, - -5213, -5162, -5112, -5061, -5011, -4960, -4910, -4859, - -4808, -4758, -4707, -4657, -4606, -4556, -4505, -4455, - -4404, -4354, -4303, -4253, -4202, -4152, -4101, -4051, - -4001, -3950, -3900, -3849, -3799, -3748, -3698, -3648, - -3597, -3547, -3496, -3446, -3395, -3345, -3295, -3244, - -3194, -3144, -3093, -3043, -2992, -2942, -2892, -2841, - -2791, -2741, -2690, -2640, -2590, -2539, -2489, -2439, - -2388, -2338, -2288, -2237, -2187, -2137, -2086, -2036, - -1986, -1935, -1885, -1835, -1784, -1734, -1684, -1633, - -1583, -1533, -1483, -1432, -1382, -1332, -1281, -1231, - -1181, -1131, -1080, -1030, -980, -929, -879, -829, - -779, -728, -678, -628, -578, -527, -477, -427, - -376, -326, -276, -226, -175, -125, -75, -25, - 25, 75, 125, 175, 226, 276, 326, 376, - 427, 477, 527, 578, 628, 678, 728, 779, - 829, 879, 929, 980, 1030, 1080, 1131, 1181, - 1231, 1281, 1332, 1382, 1432, 1483, 1533, 1583, - 1633, 1684, 1734, 1784, 1835, 1885, 1935, 1986, - 2036, 2086, 2137, 2187, 2237, 2288, 2338, 2388, - 2439, 2489, 2539, 2590, 2640, 2690, 2741, 2791, - 2841, 2892, 2942, 2992, 3043, 3093, 3144, 3194, - 3244, 3295, 3345, 3395, 3446, 3496, 3547, 3597, - 3648, 3698, 3748, 3799, 3849, 3900, 3950, 4001, - 4051, 4101, 4152, 4202, 4253, 4303, 4354, 4404, - 4455, 4505, 4556, 4606, 4657, 4707, 4758, 4808, - 4859, 4910, 4960, 5011, 5061, 5112, 5162, 5213, - 5264, 5314, 5365, 5415, 5466, 5517, 5567, 5618, - 5668, 5719, 5770, 5820, 5871, 5922, 5972, 6023, - 6074, 6124, 6175, 6226, 6277, 6327, 6378, 6429, - 6480, 6530, 6581, 6632, 6683, 6733, 6784, 6835, - 6886, 6937, 6988, 7038, 7089, 7140, 7191, 7242, - 7293, 7344, 7395, 7445, 7496, 7547, 7598, 7649, - 7700, 7751, 7802, 7853, 7904, 7955, 8006, 8057, - 8108, 8159, 8210, 8261, 8312, 8363, 8414, 8466, - 8517, 8568, 8619, 8670, 8721, 8772, 8824, 8875, - 8926, 8977, 9028, 9080, 9131, 9182, 9233, 9285, - 9336, 9387, 9438, 9490, 9541, 9592, 9644, 9695, - 9747, 9798, 9849, 9901, 9952, 10004, 10055, 10106, - 10158, 10209, 10261, 10312, 10364, 10415, 10467, 10519, - 10570, 10622, 10673, 10725, 10777, 10828, 10880, 10931, - 10983, 11035, 11086, 11138, 11190, 11242, 11293, 11345, - 11397, 11449, 11501, 11552, 11604, 11656, 11708, 11760, - 11812, 11864, 11916, 11967, 12019, 12071, 12123, 12175, - 12227, 12279, 12331, 12383, 12436, 12488, 12540, 12592, - 12644, 12696, 12748, 12800, 12853, 12905, 12957, 13009, - 13062, 13114, 13166, 13218, 13271, 13323, 13375, 13428, - 13480, 13533, 13585, 13637, 13690, 13742, 13795, 13847, - 13900, 13952, 14005, 14057, 14110, 14163, 14215, 14268, - 14321, 14373, 14426, 14479, 14531, 14584, 14637, 14690, - 14743, 14795, 14848, 14901, 14954, 15007, 15060, 15113, - 15166, 15219, 15272, 15325, 15378, 15431, 15484, 15537, - 15590, 15643, 15696, 15749, 15802, 15856, 15909, 15962, - 16015, 16069, 16122, 16175, 16229, 16282, 16335, 16389, - 16442, 16496, 16549, 16603, 16656, 16710, 16763, 16817, - 16870, 16924, 16977, 17031, 17085, 17138, 17192, 17246, - 17300, 17353, 17407, 17461, 17515, 17569, 17623, 17677, - 17731, 17784, 17838, 17892, 17946, 18001, 18055, 18109, - 18163, 18217, 18271, 18325, 18380, 18434, 18488, 18542, - 18597, 18651, 18705, 18760, 18814, 18868, 18923, 18977, - 19032, 19086, 19141, 19195, 19250, 19305, 19359, 19414, - 19469, 19523, 19578, 19633, 19688, 19742, 19797, 19852, - 19907, 19962, 20017, 20072, 20127, 20182, 20237, 20292, - 20347, 20402, 20457, 20513, 20568, 20623, 20678, 20734, - 20789, 20844, 20900, 20955, 21010, 21066, 21121, 21177, - 21232, 21288, 21343, 21399, 21455, 21510, 21566, 21622, - 21678, 21733, 21789, 21845, 21901, 21957, 22013, 22069, - 22125, 22181, 22237, 22293, 22349, 22405, 22461, 22517, - 22573, 22630, 22686, 22742, 22799, 22855, 22911, 22968, - 23024, 23081, 23137, 23194, 23250, 23307, 23364, 23420, - 23477, 23534, 23591, 23647, 23704, 23761, 23818, 23875, - 23932, 23989, 24046, 24103, 24160, 24217, 24274, 24331, - 24389, 24446, 24503, 24560, 24618, 24675, 24732, 24790, - 24847, 24905, 24962, 25020, 25078, 25135, 25193, 25251, - 25308, 25366, 25424, 25482, 25540, 25598, 25656, 25714, - 25772, 25830, 25888, 25946, 26004, 26062, 26120, 26179, - 26237, 26295, 26354, 26412, 26471, 26529, 26588, 26646, - 26705, 26763, 26822, 26881, 26940, 26998, 27057, 27116, - 27175, 27234, 27293, 27352, 27411, 27470, 27529, 27588, - 27647, 27707, 27766, 27825, 27884, 27944, 28003, 28063, - 28122, 28182, 28241, 28301, 28361, 28420, 28480, 28540, - 28600, 28660, 28719, 28779, 28839, 28899, 28959, 29020, - 29080, 29140, 29200, 29260, 29321, 29381, 29441, 29502, - 29562, 29623, 29683, 29744, 29805, 29865, 29926, 29987, - 30048, 30108, 30169, 30230, 30291, 30352, 30413, 30474, - 30536, 30597, 30658, 30719, 30781, 30842, 30904, 30965, - 31026, 31088, 31150, 31211, 31273, 31335, 31396, 31458, - 31520, 31582, 31644, 31706, 31768, 31830, 31892, 31955, - 32017, 32079, 32141, 32204, 32266, 32329, 32391, 32454, - 32516, 32579, 32642, 32705, 32767, 32830, 32893, 32956, - 33019, 33082, 33145, 33208, 33272, 33335, 33398, 33461, - 33525, 33588, 33652, 33715, 33779, 33843, 33906, 33970, - 34034, 34098, 34162, 34225, 34289, 34354, 34418, 34482, - 34546, 34610, 34675, 34739, 34803, 34868, 34932, 34997, - 35062, 35126, 35191, 35256, 35321, 35385, 35450, 35515, - 35580, 35646, 35711, 35776, 35841, 35907, 35972, 36037, - 36103, 36168, 36234, 36300, 36365, 36431, 36497, 36563, - 36629, 36695, 36761, 36827, 36893, 36959, 37026, 37092, - 37158, 37225, 37291, 37358, 37425, 37491, 37558, 37625, - 37692, 37759, 37826, 37893, 37960, 38027, 38094, 38161, - 38229, 38296, 38364, 38431, 38499, 38566, 38634, 38702, - 38770, 38837, 38905, 38973, 39042, 39110, 39178, 39246, - 39314, 39383, 39451, 39520, 39588, 39657, 39726, 39794, - 39863, 39932, 40001, 40070, 40139, 40208, 40278, 40347, - 40416, 40486, 40555, 40625, 40694, 40764, 40834, 40904, - 40973, 41043, 41113, 41184, 41254, 41324, 41394, 41465, - 41535, 41605, 41676, 41747, 41817, 41888, 41959, 42030, - 42101, 42172, 42243, 42314, 42385, 42457, 42528, 42600, - 42671, 42743, 42814, 42886, 42958, 43030, 43102, 43174, - 43246, 43318, 43390, 43463, 43535, 43608, 43680, 43753, - 43826, 43898, 43971, 44044, 44117, 44190, 44263, 44337, - 44410, 44483, 44557, 44630, 44704, 44778, 44851, 44925, - 44999, 45073, 45147, 45221, 45296, 45370, 45444, 45519, - 45593, 45668, 45743, 45818, 45892, 45967, 46042, 46118, - 46193, 46268, 46343, 46419, 46494, 46570, 46646, 46721, - 46797, 46873, 46949, 47025, 47102, 47178, 47254, 47331, - 47407, 47484, 47560, 47637, 47714, 47791, 47868, 47945, - 48022, 48100, 48177, 48255, 48332, 48410, 48488, 48565, - 48643, 48721, 48799, 48878, 48956, 49034, 49113, 49191, - 49270, 49349, 49427, 49506, 49585, 49664, 49744, 49823, - 49902, 49982, 50061, 50141, 50221, 50300, 50380, 50460, - 50540, 50621, 50701, 50781, 50862, 50942, 51023, 51104, - 51185, 51266, 51347, 51428, 51509, 51591, 51672, 51754, - 51835, 51917, 51999, 52081, 52163, 52245, 52327, 52410, - 52492, 52575, 52657, 52740, 52823, 52906, 52989, 53072, - 53156, 53239, 53322, 53406, 53490, 53574, 53657, 53741, - 53826, 53910, 53994, 54079, 54163, 54248, 54333, 54417, - 54502, 54587, 54673, 54758, 54843, 54929, 55015, 55100, - 55186, 55272, 55358, 55444, 55531, 55617, 55704, 55790, - 55877, 55964, 56051, 56138, 56225, 56312, 56400, 56487, - 56575, 56663, 56751, 56839, 56927, 57015, 57104, 57192, - 57281, 57369, 57458, 57547, 57636, 57725, 57815, 57904, - 57994, 58083, 58173, 58263, 58353, 58443, 58534, 58624, - 58715, 58805, 58896, 58987, 59078, 59169, 59261, 59352, - 59444, 59535, 59627, 59719, 59811, 59903, 59996, 60088, - 60181, 60273, 60366, 60459, 60552, 60646, 60739, 60833, - 60926, 61020, 61114, 61208, 61302, 61396, 61491, 61585, - 61680, 61775, 61870, 61965, 62060, 62156, 62251, 62347, - 62443, 62539, 62635, 62731, 62828, 62924, 63021, 63118, - 63215, 63312, 63409, 63506, 63604, 63702, 63799, 63897, - 63996, 64094, 64192, 64291, 64389, 64488, 64587, 64687, - 64786, 64885, 64985, 65085, 65185, 65285, 65385, 65485, - 65586, 65686, 65787, 65888, 65989, 66091, 66192, 66294, - 66396, 66498, 66600, 66702, 66804, 66907, 67010, 67113, - 67216, 67319, 67422, 67526, 67629, 67733, 67837, 67942, - 68046, 68151, 68255, 68360, 68465, 68570, 68676, 68781, - 68887, 68993, 69099, 69205, 69312, 69418, 69525, 69632, - 69739, 69846, 69954, 70061, 70169, 70277, 70385, 70494, - 70602, 70711, 70820, 70929, 71038, 71147, 71257, 71367, - 71477, 71587, 71697, 71808, 71918, 72029, 72140, 72252, - 72363, 72475, 72587, 72699, 72811, 72923, 73036, 73149, - 73262, 73375, 73488, 73602, 73715, 73829, 73944, 74058, - 74172, 74287, 74402, 74517, 74633, 74748, 74864, 74980, - 75096, 75213, 75329, 75446, 75563, 75680, 75797, 75915, - 76033, 76151, 76269, 76388, 76506, 76625, 76744, 76864, - 76983, 77103, 77223, 77343, 77463, 77584, 77705, 77826, - 77947, 78068, 78190, 78312, 78434, 78557, 78679, 78802, - 78925, 79048, 79172, 79296, 79420, 79544, 79668, 79793, - 79918, 80043, 80168, 80294, 80420, 80546, 80672, 80799, - 80925, 81053, 81180, 81307, 81435, 81563, 81691, 81820, - 81949, 82078, 82207, 82336, 82466, 82596, 82726, 82857, - 82987, 83118, 83250, 83381, 83513, 83645, 83777, 83910, - 84043, 84176, 84309, 84443, 84576, 84710, 84845, 84980, - 85114, 85250, 85385, 85521, 85657, 85793, 85930, 86066, - 86204, 86341, 86479, 86616, 86755, 86893, 87032, 87171, - 87310, 87450, 87590, 87730, 87871, 88011, 88152, 88294, - 88435, 88577, 88720, 88862, 89005, 89148, 89292, 89435, - 89579, 89724, 89868, 90013, 90158, 90304, 90450, 90596, - 90742, 90889, 91036, 91184, 91332, 91480, 91628, 91777, - 91926, 92075, 92225, 92375, 92525, 92675, 92826, 92978, - 93129, 93281, 93434, 93586, 93739, 93892, 94046, 94200, - 94354, 94509, 94664, 94819, 94975, 95131, 95287, 95444, - 95601, 95758, 95916, 96074, 96233, 96391, 96551, 96710, - 96870, 97030, 97191, 97352, 97513, 97675, 97837, 98000, - 98163, 98326, 98489, 98653, 98818, 98982, 99148, 99313, - 99479, 99645, 99812, 99979, 100146, 100314, 100482, 100651, - 100820, 100990, 101159, 101330, 101500, 101671, 101843, 102015, - 102187, 102360, 102533, 102706, 102880, 103054, 103229, 103404, - 103580, 103756, 103933, 104109, 104287, 104465, 104643, 104821, - 105000, 105180, 105360, 105540, 105721, 105902, 106084, 106266, - 106449, 106632, 106816, 107000, 107184, 107369, 107555, 107741, - 107927, 108114, 108301, 108489, 108677, 108866, 109055, 109245, - 109435, 109626, 109817, 110008, 110200, 110393, 110586, 110780, - 110974, 111169, 111364, 111560, 111756, 111952, 112150, 112347, - 112546, 112744, 112944, 113143, 113344, 113545, 113746, 113948, - 114151, 114354, 114557, 114761, 114966, 115171, 115377, 115583, - 115790, 115998, 116206, 116414, 116623, 116833, 117044, 117254, - 117466, 117678, 117891, 118104, 118318, 118532, 118747, 118963, - 119179, 119396, 119613, 119831, 120050, 120269, 120489, 120709, - 120930, 121152, 121374, 121597, 121821, 122045, 122270, 122496, - 122722, 122949, 123176, 123404, 123633, 123863, 124093, 124324, - 124555, 124787, 125020, 125254, 125488, 125723, 125959, 126195, - 126432, 126669, 126908, 127147, 127387, 127627, 127869, 128111, - 128353, 128597, 128841, 129086, 129332, 129578, 129825, 130073, - 130322, 130571, 130821, 131072, 131324, 131576, 131830, 132084, - 132339, 132594, 132851, 133108, 133366, 133625, 133884, 134145, - 134406, 134668, 134931, 135195, 135459, 135725, 135991, 136258, - 136526, 136795, 137065, 137335, 137607, 137879, 138152, 138426, - 138701, 138977, 139254, 139532, 139810, 140090, 140370, 140651, - 140934, 141217, 141501, 141786, 142072, 142359, 142647, 142936, - 143226, 143517, 143808, 144101, 144395, 144690, 144986, 145282, - 145580, 145879, 146179, 146480, 146782, 147084, 147388, 147693, - 148000, 148307, 148615, 148924, 149235, 149546, 149859, 150172, - 150487, 150803, 151120, 151438, 151757, 152077, 152399, 152722, - 153045, 153370, 153697, 154024, 154352, 154682, 155013, 155345, - 155678, 156013, 156349, 156686, 157024, 157363, 157704, 158046, - 158389, 158734, 159079, 159427, 159775, 160125, 160476, 160828, - 161182, 161537, 161893, 162251, 162610, 162970, 163332, 163695, - 164060, 164426, 164793, 165162, 165532, 165904, 166277, 166651, - 167027, 167405, 167784, 168164, 168546, 168930, 169315, 169701, - 170089, 170479, 170870, 171263, 171657, 172053, 172451, 172850, - 173251, 173653, 174057, 174463, 174870, 175279, 175690, 176102, - 176516, 176932, 177349, 177769, 178190, 178612, 179037, 179463, - 179891, 180321, 180753, 181186, 181622, 182059, 182498, 182939, - 183382, 183827, 184274, 184722, 185173, 185625, 186080, 186536, - 186995, 187455, 187918, 188382, 188849, 189318, 189789, 190261, - 190736, 191213, 191693, 192174, 192658, 193143, 193631, 194122, - 194614, 195109, 195606, 196105, 196606, 197110, 197616, 198125, - 198636, 199149, 199664, 200182, 200703, 201226, 201751, 202279, - 202809, 203342, 203878, 204416, 204956, 205500, 206045, 206594, - 207145, 207699, 208255, 208815, 209376, 209941, 210509, 211079, - 211652, 212228, 212807, 213389, 213973, 214561, 215151, 215745, - 216341, 216941, 217544, 218149, 218758, 219370, 219985, 220603, - 221225, 221849, 222477, 223108, 223743, 224381, 225022, 225666, - 226314, 226966, 227621, 228279, 228941, 229606, 230275, 230948, - 231624, 232304, 232988, 233676, 234367, 235062, 235761, 236463, - 237170, 237881, 238595, 239314, 240036, 240763, 241493, 242228, - 242967, 243711, 244458, 245210, 245966, 246727, 247492, 248261, - 249035, 249813, 250596, 251384, 252176, 252973, 253774, 254581, - 255392, 256208, 257029, 257855, 258686, 259522, 260363, 261209, - 262060, 262917, 263779, 264646, 265519, 266397, 267280, 268169, - 269064, 269965, 270871, 271782, 272700, 273624, 274553, 275489, - 276430, 277378, 278332, 279292, 280258, 281231, 282210, 283195, - 284188, 285186, 286192, 287204, 288223, 289249, 290282, 291322, - 292369, 293423, 294485, 295554, 296630, 297714, 298805, 299904, - 301011, 302126, 303248, 304379, 305517, 306664, 307819, 308983, - 310154, 311335, 312524, 313721, 314928, 316143, 317368, 318601, - 319844, 321097, 322358, 323629, 324910, 326201, 327502, 328812, - 330133, 331464, 332805, 334157, 335519, 336892, 338276, 339671, - 341078, 342495, 343924, 345364, 346816, 348280, 349756, 351244, - 352744, 354257, 355783, 357321, 358872, 360436, 362013, 363604, - 365208, 366826, 368459, 370105, 371765, 373440, 375130, 376835, - 378555, 380290, 382040, 383807, 385589, 387387, 389202, 391034, - 392882, 394747, 396630, 398530, 400448, 402384, 404338, 406311, - 408303, 410314, 412344, 414395, 416465, 418555, 420666, 422798, - 424951, 427125, 429321, 431540, 433781, 436045, 438332, 440643, - 442978, 445337, 447720, 450129, 452564, 455024, 457511, 460024, - 462565, 465133, 467730, 470355, 473009, 475692, 478406, 481150, - 483925, 486732, 489571, 492443, 495348, 498287, 501261, 504269, - 507313, 510394, 513512, 516667, 519861, 523094, 526366, 529680, - 533034, 536431, 539870, 543354, 546881, 550455, 554074, 557741, - 561456, 565221, 569035, 572901, 576818, 580789, 584815, 588896, - 593033, 597229, 601483, 605798, 610174, 614613, 619117, 623686, - 628323, 633028, 637803, 642651, 647572, 652568, 657640, 662792, - 668024, 673338, 678737, 684223, 689797, 695462, 701219, 707072, - 713023, 719074, 725227, 731486, 737853, 744331, 750922, 757631, - 764460, 771411, 778490, 785699, 793041, 800521, 808143, 815910, - 823827, 831898, 840127, 848520, 857081, 865817, 874730, 883829, - 893117, 902602, 912289, 922186, 932298, 942633, 953199, 964003, - 975054, 986361, 997931, 1009774, 1021901, 1034322, 1047046, 1060087, - 1073455, 1087164, 1101225, 1115654, 1130465, 1145673, 1161294, 1177345, - 1193846, 1210813, 1228269, 1246234, 1264730, 1283783, 1303416, 1323658, - 1344537, 1366084, 1388330, 1411312, 1435065, 1459630, 1485049, 1511367, - 1538632, 1566898, 1596220, 1626658, 1658278, 1691149, 1725348, 1760956, - 1798063, 1836758, 1877161, 1919378, 1963536, 2009771, 2058233, 2109087, - 2162516, 2218719, 2277919, 2340362, 2406322, 2476104, 2550052, 2628549, - 2712030, 2800983, 2895966, 2997613, 3106651, 3223918, 3350381, 3487165, - 3635590, 3797206, 3973855, 4167737, 4381502, 4618375, 4882318, 5178251, - 5512368, 5892567, 6329090, 6835455, 7429880, 8137527, 8994149, 10052327, - 11392683, 13145455, 15535599, 18988036, 24413316, 34178904, 56965752, 170910304 + INT32_MIN, -85445642, -42722796, -28481836, -21361347, -17089048, -14240842, -12206405, + -10680573, -9493811, -8544398, -7767602, -7120270, -6572525, -6103026, -5696125, + -5340085, -5025930, -4746679, -4496821, -4271947, -4068489, -3883524, -3714643, + -3559833, -3417407, -3285935, -3164201, -3051161, -2945916, -2847685, -2755792, + -2669640, -2588709, -2512537, -2440718, -2372887, -2308722, -2247933, -2190260, + -2135471, -2083353, -2033716, -1986387, -1941209, -1898038, -1856743, -1817205, + -1779313, -1742967, -1708075, -1674550, -1642314, -1611294, -1581422, -1552635, + -1524876, -1498091, -1472229, -1447242, -1423088, -1399726, -1377116, -1355224, + -1334015, -1313459, -1293525, -1274185, -1255414, -1237186, -1219479, -1202270, + -1185538, -1169265, -1153430, -1138018, -1123011, -1108393, -1094149, -1080266, + -1066729, -1053527, -1040645, -1028074, -1015802, -1003818, -992112, -980675, + -969498, -958571, -947887, -937438, -927215, -917211, -907420, -897835, + -888449, -879257, -870251, -861428, -852780, -844303, -835992, -827843, + -819849, -812008, -804314, -796763, -789353, -782077, -774934, -767919, + -761030, -754261, -747612, -741077, -734655, -728343, -722137, -716035, + -710035, -704133, -698328, -692618, -686999, -681469, -676027, -670671, + -665398, -660206, -655094, -650060, -645102, -640218, -635407, -630667, + -625996, -621393, -616857, -612386, -607978, -603633, -599348, -595124, + -590957, -586848, -582795, -578797, -574853, -570962, -567122, -563332, + -559593, -555902, -552259, -548662, -545112, -541606, -538145, -534727, + -531351, -528018, -524725, -521472, -518259, -515084, -511948, -508849, + -505787, -502760, -499769, -496813, -493891, -491003, -488148, -485325, + -482534, -479774, -477045, -474347, -471678, -469038, -466428, -463845, + -461291, -458764, -456264, -453791, -451343, -448922, -446526, -444154, + -441807, -439485, -437186, -434910, -432658, -430428, -428221, -426035, + -423871, -421729, -419608, -417507, -415427, -413367, -411327, -409306, + -407305, -405323, -403359, -401414, -399487, -397578, -395686, -393812, + -391956, -390116, -388293, -386486, -384696, -382921, -381163, -379420, + -377693, -375981, -374283, -372601, -370933, -369280, -367641, -366016, + -364404, -362807, -361223, -359652, -358094, -356550, -355018, -353499, + -351993, -350499, -349017, -347547, -346089, -344643, -343208, -341785, + -340373, -338973, -337583, -336204, -334837, -333480, -332133, -330797, + -329471, -328156, -326850, -325554, -324269, -322993, -321726, -320469, + -319222, -317984, -316754, -315535, -314324, -313121, -311928, -310743, + -309567, -308400, -307240, -306090, -304947, -303812, -302686, -301567, + -300457, -299354, -298259, -297171, -296091, -295018, -293953, -292895, + -291845, -290801, -289765, -288735, -287713, -286697, -285688, -284686, + -283691, -282702, -281719, -280743, -279774, -278811, -277854, -276903, + -275959, -275020, -274088, -273161, -272241, -271326, -270417, -269514, + -268616, -267724, -266838, -265957, -265082, -264212, -263347, -262488, + -261634, -260785, -259941, -259103, -258270, -257441, -256618, -255799, + -254986, -254177, -253373, -252574, -251779, -250989, -250204, -249423, + -248647, -247876, -247109, -246346, -245588, -244834, -244084, -243338, + -242597, -241860, -241128, -240399, -239674, -238954, -238237, -237525, + -236816, -236112, -235411, -234714, -234021, -233331, -232646, -231964, + -231286, -230611, -229940, -229273, -228610, -227949, -227293, -226640, + -225990, -225344, -224701, -224061, -223425, -222792, -222163, -221536, + -220913, -220294, -219677, -219064, -218453, -217846, -217242, -216641, + -216043, -215448, -214856, -214267, -213681, -213097, -212517, -211940, + -211365, -210793, -210225, -209658, -209095, -208535, -207977, -207422, + -206869, -206319, -205772, -205228, -204686, -204147, -203610, -203076, + -202544, -202015, -201488, -200964, -200442, -199923, -199406, -198892, + -198380, -197870, -197363, -196858, -196355, -195855, -195357, -194861, + -194367, -193876, -193387, -192900, -192416, -191933, -191453, -190975, + -190499, -190025, -189553, -189083, -188615, -188150, -187686, -187225, + -186765, -186308, -185852, -185399, -184947, -184498, -184050, -183604, + -183160, -182718, -182278, -181840, -181404, -180969, -180537, -180106, + -179677, -179250, -178824, -178401, -177979, -177559, -177140, -176724, + -176309, -175896, -175484, -175074, -174666, -174260, -173855, -173452, + -173050, -172650, -172252, -171855, -171460, -171066, -170674, -170284, + -169895, -169508, -169122, -168738, -168355, -167974, -167594, -167216, + -166839, -166464, -166090, -165718, -165347, -164977, -164609, -164242, + -163877, -163513, -163151, -162790, -162430, -162072, -161715, -161359, + -161005, -160652, -160300, -159950, -159601, -159253, -158906, -158561, + -158217, -157875, -157533, -157193, -156855, -156517, -156181, -155845, + -155512, -155179, -154847, -154517, -154188, -153860, -153533, -153208, + -152883, -152560, -152238, -151917, -151597, -151279, -150961, -150645, + -150329, -150015, -149702, -149390, -149079, -148769, -148461, -148153, + -147846, -147541, -147236, -146933, -146630, -146329, -146029, -145729, + -145431, -145134, -144837, -144542, -144248, -143955, -143662, -143371, + -143081, -142791, -142503, -142215, -141929, -141643, -141359, -141075, + -140792, -140511, -140230, -139950, -139671, -139393, -139115, -138839, + -138564, -138289, -138016, -137743, -137471, -137200, -136930, -136661, + -136392, -136125, -135858, -135592, -135327, -135063, -134799, -134537, + -134275, -134014, -133754, -133495, -133237, -132979, -132722, -132466, + -132211, -131957, -131703, -131450, -131198, -130947, -130696, -130446, + -130197, -129949, -129701, -129455, -129209, -128963, -128719, -128475, + -128232, -127990, -127748, -127507, -127267, -127027, -126789, -126551, + -126313, -126077, -125841, -125605, -125371, -125137, -124904, -124671, + -124439, -124208, -123978, -123748, -123519, -123290, -123062, -122835, + -122609, -122383, -122158, -121933, -121709, -121486, -121263, -121041, + -120820, -120599, -120379, -120159, -119940, -119722, -119504, -119287, + -119071, -118855, -118639, -118425, -118211, -117997, -117784, -117572, + -117360, -117149, -116938, -116728, -116519, -116310, -116102, -115894, + -115687, -115480, -115274, -115069, -114864, -114659, -114455, -114252, + -114049, -113847, -113645, -113444, -113244, -113043, -112844, -112645, + -112446, -112248, -112051, -111854, -111658, -111462, -111266, -111071, + -110877, -110683, -110490, -110297, -110104, -109912, -109721, -109530, + -109340, -109150, -108960, -108771, -108583, -108395, -108207, -108020, + -107834, -107648, -107462, -107277, -107092, -106908, -106724, -106541, + -106358, -106175, -105993, -105812, -105631, -105450, -105270, -105090, + -104911, -104732, -104554, -104376, -104198, -104021, -103844, -103668, + -103492, -103317, -103142, -102967, -102793, -102619, -102446, -102273, + -102101, -101929, -101757, -101586, -101415, -101244, -101074, -100905, + -100736, -100567, -100398, -100230, -100063, -99895, -99729, -99562, + -99396, -99230, -99065, -98900, -98735, -98571, -98408, -98244, + -98081, -97918, -97756, -97594, -97433, -97271, -97111, -96950, + -96790, -96630, -96471, -96312, -96153, -95995, -95837, -95680, + -95522, -95365, -95209, -95053, -94897, -94741, -94586, -94431, + -94277, -94123, -93969, -93816, -93663, -93510, -93357, -93205, + -93053, -92902, -92751, -92600, -92450, -92300, -92150, -92000, + -91851, -91702, -91554, -91406, -91258, -91110, -90963, -90816, + -90669, -90523, -90377, -90231, -90086, -89941, -89796, -89651, + -89507, -89363, -89220, -89077, -88934, -88791, -88648, -88506, + -88365, -88223, -88082, -87941, -87800, -87660, -87520, -87380, + -87241, -87101, -86963, -86824, -86686, -86547, -86410, -86272, + -86135, -85998, -85861, -85725, -85589, -85453, -85317, -85182, + -85047, -84912, -84778, -84643, -84509, -84376, -84242, -84109, + -83976, -83843, -83711, -83579, -83447, -83315, -83184, -83053, + -82922, -82791, -82661, -82531, -82401, -82271, -82142, -82013, + -81884, -81756, -81627, -81499, -81371, -81244, -81116, -80989, + -80862, -80735, -80609, -80483, -80357, -80231, -80106, -79980, + -79855, -79731, -79606, -79482, -79358, -79234, -79110, -78987, + -78864, -78741, -78618, -78495, -78373, -78251, -78129, -78008, + -77886, -77765, -77644, -77524, -77403, -77283, -77163, -77043, + -76923, -76804, -76685, -76566, -76447, -76328, -76210, -76092, + -75974, -75856, -75739, -75621, -75504, -75387, -75271, -75154, + -75038, -74922, -74806, -74690, -74575, -74460, -74345, -74230, + -74115, -74001, -73886, -73772, -73659, -73545, -73431, -73318, + -73205, -73092, -72979, -72867, -72755, -72643, -72531, -72419, + -72307, -72196, -72085, -71974, -71863, -71752, -71642, -71532, + -71422, -71312, -71202, -71093, -70983, -70874, -70765, -70656, + -70548, -70439, -70331, -70223, -70115, -70007, -69900, -69793, + -69685, -69578, -69472, -69365, -69258, -69152, -69046, -68940, + -68834, -68728, -68623, -68518, -68413, -68308, -68203, -68098, + -67994, -67889, -67785, -67681, -67578, -67474, -67371, -67267, + -67164, -67061, -66958, -66856, -66753, -66651, -66549, -66447, + -66345, -66243, -66141, -66040, -65939, -65838, -65737, -65636, + -65536, -65435, -65335, -65235, -65135, -65035, -64935, -64836, + -64736, -64637, -64538, -64439, -64340, -64241, -64143, -64045, + -63946, -63848, -63750, -63653, -63555, -63458, -63360, -63263, + -63166, -63069, -62972, -62876, -62779, -62683, -62587, -62491, + -62395, -62299, -62204, -62108, -62013, -61918, -61822, -61728, + -61633, -61538, -61444, -61349, -61255, -61161, -61067, -60973, + -60879, -60786, -60692, -60599, -60506, -60413, -60320, -60227, + -60134, -60042, -59950, -59857, -59765, -59673, -59581, -59489, + -59398, -59306, -59215, -59124, -59033, -58942, -58851, -58760, + -58669, -58579, -58489, -58398, -58308, -58218, -58128, -58039, + -57949, -57859, -57770, -57681, -57592, -57503, -57414, -57325, + -57236, -57148, -57059, -56971, -56883, -56795, -56707, -56619, + -56531, -56444, -56356, -56269, -56181, -56094, -56007, -55920, + -55834, -55747, -55660, -55574, -55487, -55401, -55315, -55229, + -55143, -55057, -54972, -54886, -54801, -54715, -54630, -54545, + -54460, -54375, -54290, -54205, -54121, -54036, -53952, -53868, + -53784, -53699, -53615, -53532, -53448, -53364, -53281, -53197, + -53114, -53031, -52948, -52865, -52782, -52699, -52616, -52533, + -52451, -52369, -52286, -52204, -52122, -52040, -51958, -51876, + -51794, -51713, -51631, -51550, -51469, -51387, -51306, -51225, + -51144, -51063, -50983, -50902, -50822, -50741, -50661, -50581, + -50500, -50420, -50340, -50260, -50181, -50101, -50021, -49942, + -49862, -49783, -49704, -49625, -49546, -49467, -49388, -49309, + -49230, -49152, -49073, -48995, -48917, -48838, -48760, -48682, + -48604, -48526, -48449, -48371, -48293, -48216, -48138, -48061, + -47984, -47907, -47830, -47753, -47676, -47599, -47522, -47445, + -47369, -47292, -47216, -47140, -47063, -46987, -46911, -46835, + -46759, -46684, -46608, -46532, -46457, -46381, -46306, -46230, + -46155, -46080, -46005, -45930, -45855, -45780, -45705, -45631, + -45556, -45482, -45407, -45333, -45259, -45184, -45110, -45036, + -44962, -44888, -44815, -44741, -44667, -44594, -44520, -44447, + -44373, -44300, -44227, -44154, -44081, -44008, -43935, -43862, + -43789, -43717, -43644, -43571, -43499, -43427, -43354, -43282, + -43210, -43138, -43066, -42994, -42922, -42850, -42779, -42707, + -42635, -42564, -42492, -42421, -42350, -42279, -42207, -42136, + -42065, -41994, -41923, -41853, -41782, -41711, -41641, -41570, + -41500, -41429, -41359, -41289, -41219, -41148, -41078, -41008, + -40939, -40869, -40799, -40729, -40660, -40590, -40520, -40451, + -40382, -40312, -40243, -40174, -40105, -40036, -39967, -39898, + -39829, -39760, -39691, -39623, -39554, -39486, -39417, -39349, + -39280, -39212, -39144, -39076, -39007, -38939, -38871, -38804, + -38736, -38668, -38600, -38532, -38465, -38397, -38330, -38262, + -38195, -38128, -38060, -37993, -37926, -37859, -37792, -37725, + -37658, -37591, -37525, -37458, -37391, -37325, -37258, -37192, + -37125, -37059, -36993, -36926, -36860, -36794, -36728, -36662, + -36596, -36530, -36464, -36398, -36333, -36267, -36201, -36136, + -36070, -36005, -35939, -35874, -35809, -35743, -35678, -35613, + -35548, -35483, -35418, -35353, -35288, -35223, -35159, -35094, + -35029, -34965, -34900, -34836, -34771, -34707, -34642, -34578, + -34514, -34450, -34386, -34322, -34257, -34194, -34130, -34066, + -34002, -33938, -33874, -33811, -33747, -33684, -33620, -33557, + -33493, -33430, -33366, -33303, -33240, -33177, -33114, -33051, + -32988, -32925, -32862, -32799, -32736, -32673, -32610, -32548, + -32485, -32422, -32360, -32297, -32235, -32173, -32110, -32048, + -31986, -31923, -31861, -31799, -31737, -31675, -31613, -31551, + -31489, -31427, -31366, -31304, -31242, -31180, -31119, -31057, + -30996, -30934, -30873, -30811, -30750, -30689, -30627, -30566, + -30505, -30444, -30383, -30322, -30261, -30200, -30139, -30078, + -30017, -29956, -29896, -29835, -29774, -29714, -29653, -29593, + -29532, -29472, -29411, -29351, -29291, -29230, -29170, -29110, + -29050, -28989, -28929, -28869, -28809, -28749, -28689, -28630, + -28570, -28510, -28450, -28390, -28331, -28271, -28212, -28152, + -28092, -28033, -27974, -27914, -27855, -27795, -27736, -27677, + -27618, -27559, -27499, -27440, -27381, -27322, -27263, -27204, + -27145, -27087, -27028, -26969, -26910, -26851, -26793, -26734, + -26675, -26617, -26558, -26500, -26441, -26383, -26325, -26266, + -26208, -26150, -26091, -26033, -25975, -25917, -25859, -25801, + -25743, -25685, -25627, -25569, -25511, -25453, -25395, -25337, + -25280, -25222, -25164, -25106, -25049, -24991, -24934, -24876, + -24819, -24761, -24704, -24646, -24589, -24532, -24474, -24417, + -24360, -24303, -24246, -24188, -24131, -24074, -24017, -23960, + -23903, -23846, -23789, -23733, -23676, -23619, -23562, -23505, + -23449, -23392, -23335, -23279, -23222, -23166, -23109, -23053, + -22996, -22940, -22883, -22827, -22770, -22714, -22658, -22602, + -22545, -22489, -22433, -22377, -22321, -22265, -22209, -22153, + -22097, -22041, -21985, -21929, -21873, -21817, -21761, -21705, + -21650, -21594, -21538, -21483, -21427, -21371, -21316, -21260, + -21205, -21149, -21094, -21038, -20983, -20927, -20872, -20817, + -20761, -20706, -20651, -20595, -20540, -20485, -20430, -20375, + -20320, -20264, -20209, -20154, -20099, -20044, -19989, -19935, + -19880, -19825, -19770, -19715, -19660, -19605, -19551, -19496, + -19441, -19387, -19332, -19277, -19223, -19168, -19114, -19059, + -19005, -18950, -18896, -18841, -18787, -18732, -18678, -18624, + -18569, -18515, -18461, -18407, -18352, -18298, -18244, -18190, + -18136, -18082, -18028, -17974, -17919, -17865, -17811, -17758, + -17704, -17650, -17596, -17542, -17488, -17434, -17380, -17327, + -17273, -17219, -17165, -17112, -17058, -17004, -16951, -16897, + -16843, -16790, -16736, -16683, -16629, -16576, -16522, -16469, + -16415, -16362, -16309, -16255, -16202, -16149, -16095, -16042, + -15989, -15935, -15882, -15829, -15776, -15723, -15670, -15616, + -15563, -15510, -15457, -15404, -15351, -15298, -15245, -15192, + -15139, -15086, -15033, -14980, -14927, -14875, -14822, -14769, + -14716, -14663, -14611, -14558, -14505, -14452, -14400, -14347, + -14294, -14242, -14189, -14136, -14084, -14031, -13979, -13926, + -13874, -13821, -13769, -13716, -13664, -13611, -13559, -13506, + -13454, -13402, -13349, -13297, -13245, -13192, -13140, -13088, + -13035, -12983, -12931, -12879, -12827, -12774, -12722, -12670, + -12618, -12566, -12514, -12462, -12409, -12357, -12305, -12253, + -12201, -12149, -12097, -12045, -11993, -11941, -11890, -11838, + -11786, -11734, -11682, -11630, -11578, -11526, -11475, -11423, + -11371, -11319, -11268, -11216, -11164, -11112, -11061, -11009, + -10957, -10906, -10854, -10802, -10751, -10699, -10647, -10596, + -10544, -10493, -10441, -10390, -10338, -10287, -10235, -10184, + -10132, -10081, -10029, -9978, -9926, -9875, -9824, -9772, + -9721, -9669, -9618, -9567, -9515, -9464, -9413, -9362, + -9310, -9259, -9208, -9156, -9105, -9054, -9003, -8952, + -8900, -8849, -8798, -8747, -8696, -8645, -8593, -8542, + -8491, -8440, -8389, -8338, -8287, -8236, -8185, -8134, + -8083, -8032, -7981, -7930, -7879, -7828, -7777, -7726, + -7675, -7624, -7573, -7522, -7471, -7420, -7369, -7318, + -7267, -7216, -7166, -7115, -7064, -7013, -6962, -6911, + -6861, -6810, -6759, -6708, -6657, -6607, -6556, -6505, + -6454, -6403, -6353, -6302, -6251, -6201, -6150, -6099, + -6048, -5998, -5947, -5896, -5846, -5795, -5744, -5694, + -5643, -5592, -5542, -5491, -5441, -5390, -5339, -5289, + -5238, -5188, -5137, -5086, -5036, -4985, -4935, -4884, + -4834, -4783, -4733, -4682, -4632, -4581, -4531, -4480, + -4430, -4379, -4329, -4278, -4228, -4177, -4127, -4076, + -4026, -3975, -3925, -3874, -3824, -3774, -3723, -3673, + -3622, -3572, -3521, -3471, -3421, -3370, -3320, -3269, + -3219, -3169, -3118, -3068, -3018, -2967, -2917, -2866, + -2816, -2766, -2715, -2665, -2615, -2564, -2514, -2464, + -2413, -2363, -2313, -2262, -2212, -2162, -2111, -2061, + -2011, -1960, -1910, -1860, -1810, -1759, -1709, -1659, + -1608, -1558, -1508, -1457, -1407, -1357, -1307, -1256, + -1206, -1156, -1105, -1055, -1005, -955, -904, -854, + -804, -754, -703, -653, -603, -552, -502, -452, + -402, -351, -301, -251, -201, -150, -100, -50, + 0, 50, 100, 150, 201, 251, 301, 351, + 402, 452, 502, 552, 603, 653, 703, 754, + 804, 854, 904, 955, 1005, 1055, 1105, 1156, + 1206, 1256, 1307, 1357, 1407, 1457, 1508, 1558, + 1608, 1659, 1709, 1759, 1810, 1860, 1910, 1960, + 2011, 2061, 2111, 2162, 2212, 2262, 2313, 2363, + 2413, 2464, 2514, 2564, 2615, 2665, 2715, 2766, + 2816, 2866, 2917, 2967, 3018, 3068, 3118, 3169, + 3219, 3269, 3320, 3370, 3421, 3471, 3521, 3572, + 3622, 3673, 3723, 3774, 3824, 3874, 3925, 3975, + 4026, 4076, 4127, 4177, 4228, 4278, 4329, 4379, + 4430, 4480, 4531, 4581, 4632, 4682, 4733, 4783, + 4834, 4884, 4935, 4985, 5036, 5086, 5137, 5188, + 5238, 5289, 5339, 5390, 5441, 5491, 5542, 5592, + 5643, 5694, 5744, 5795, 5846, 5896, 5947, 5998, + 6048, 6099, 6150, 6201, 6251, 6302, 6353, 6403, + 6454, 6505, 6556, 6607, 6657, 6708, 6759, 6810, + 6861, 6911, 6962, 7013, 7064, 7115, 7166, 7216, + 7267, 7318, 7369, 7420, 7471, 7522, 7573, 7624, + 7675, 7726, 7777, 7828, 7879, 7930, 7981, 8032, + 8083, 8134, 8185, 8236, 8287, 8338, 8389, 8440, + 8491, 8542, 8593, 8645, 8696, 8747, 8798, 8849, + 8900, 8952, 9003, 9054, 9105, 9156, 9208, 9259, + 9310, 9362, 9413, 9464, 9515, 9567, 9618, 9669, + 9721, 9772, 9824, 9875, 9926, 9978, 10029, 10081, + 10132, 10184, 10235, 10287, 10338, 10390, 10441, 10493, + 10544, 10596, 10647, 10699, 10751, 10802, 10854, 10906, + 10957, 11009, 11061, 11112, 11164, 11216, 11268, 11319, + 11371, 11423, 11475, 11526, 11578, 11630, 11682, 11734, + 11786, 11838, 11890, 11941, 11993, 12045, 12097, 12149, + 12201, 12253, 12305, 12357, 12409, 12462, 12514, 12566, + 12618, 12670, 12722, 12774, 12827, 12879, 12931, 12983, + 13035, 13088, 13140, 13192, 13245, 13297, 13349, 13402, + 13454, 13506, 13559, 13611, 13664, 13716, 13769, 13821, + 13874, 13926, 13979, 14031, 14084, 14136, 14189, 14242, + 14294, 14347, 14400, 14452, 14505, 14558, 14611, 14663, + 14716, 14769, 14822, 14875, 14927, 14980, 15033, 15086, + 15139, 15192, 15245, 15298, 15351, 15404, 15457, 15510, + 15563, 15616, 15670, 15723, 15776, 15829, 15882, 15935, + 15989, 16042, 16095, 16149, 16202, 16255, 16309, 16362, + 16415, 16469, 16522, 16576, 16629, 16683, 16736, 16790, + 16843, 16897, 16951, 17004, 17058, 17112, 17165, 17219, + 17273, 17327, 17380, 17434, 17488, 17542, 17596, 17650, + 17704, 17758, 17811, 17865, 17919, 17974, 18028, 18082, + 18136, 18190, 18244, 18298, 18352, 18407, 18461, 18515, + 18569, 18624, 18678, 18732, 18787, 18841, 18896, 18950, + 19005, 19059, 19114, 19168, 19223, 19277, 19332, 19387, + 19441, 19496, 19551, 19605, 19660, 19715, 19770, 19825, + 19880, 19935, 19989, 20044, 20099, 20154, 20209, 20264, + 20320, 20375, 20430, 20485, 20540, 20595, 20651, 20706, + 20761, 20817, 20872, 20927, 20983, 21038, 21094, 21149, + 21205, 21260, 21316, 21371, 21427, 21483, 21538, 21594, + 21650, 21705, 21761, 21817, 21873, 21929, 21985, 22041, + 22097, 22153, 22209, 22265, 22321, 22377, 22433, 22489, + 22545, 22602, 22658, 22714, 22770, 22827, 22883, 22940, + 22996, 23053, 23109, 23166, 23222, 23279, 23335, 23392, + 23449, 23505, 23562, 23619, 23676, 23733, 23789, 23846, + 23903, 23960, 24017, 24074, 24131, 24188, 24246, 24303, + 24360, 24417, 24474, 24532, 24589, 24646, 24704, 24761, + 24819, 24876, 24934, 24991, 25049, 25106, 25164, 25222, + 25280, 25337, 25395, 25453, 25511, 25569, 25627, 25685, + 25743, 25801, 25859, 25917, 25975, 26033, 26091, 26150, + 26208, 26266, 26325, 26383, 26441, 26500, 26558, 26617, + 26675, 26734, 26793, 26851, 26910, 26969, 27028, 27087, + 27145, 27204, 27263, 27322, 27381, 27440, 27499, 27559, + 27618, 27677, 27736, 27795, 27855, 27914, 27974, 28033, + 28092, 28152, 28212, 28271, 28331, 28390, 28450, 28510, + 28570, 28630, 28689, 28749, 28809, 28869, 28929, 28989, + 29050, 29110, 29170, 29230, 29291, 29351, 29411, 29472, + 29532, 29593, 29653, 29714, 29774, 29835, 29896, 29956, + 30017, 30078, 30139, 30200, 30261, 30322, 30383, 30444, + 30505, 30566, 30627, 30689, 30750, 30811, 30873, 30934, + 30996, 31057, 31119, 31180, 31242, 31304, 31366, 31427, + 31489, 31551, 31613, 31675, 31737, 31799, 31861, 31923, + 31986, 32048, 32110, 32173, 32235, 32297, 32360, 32422, + 32485, 32548, 32610, 32673, 32736, 32799, 32862, 32925, + 32988, 33051, 33114, 33177, 33240, 33303, 33366, 33430, + 33493, 33557, 33620, 33684, 33747, 33811, 33874, 33938, + 34002, 34066, 34130, 34194, 34257, 34322, 34386, 34450, + 34514, 34578, 34642, 34707, 34771, 34836, 34900, 34965, + 35029, 35094, 35159, 35223, 35288, 35353, 35418, 35483, + 35548, 35613, 35678, 35743, 35809, 35874, 35939, 36005, + 36070, 36136, 36201, 36267, 36333, 36398, 36464, 36530, + 36596, 36662, 36728, 36794, 36860, 36926, 36993, 37059, + 37125, 37192, 37258, 37325, 37391, 37458, 37525, 37591, + 37658, 37725, 37792, 37859, 37926, 37993, 38060, 38128, + 38195, 38262, 38330, 38397, 38465, 38532, 38600, 38668, + 38736, 38804, 38871, 38939, 39007, 39076, 39144, 39212, + 39280, 39349, 39417, 39486, 39554, 39623, 39691, 39760, + 39829, 39898, 39967, 40036, 40105, 40174, 40243, 40312, + 40382, 40451, 40520, 40590, 40660, 40729, 40799, 40869, + 40939, 41008, 41078, 41148, 41219, 41289, 41359, 41429, + 41500, 41570, 41641, 41711, 41782, 41853, 41923, 41994, + 42065, 42136, 42207, 42279, 42350, 42421, 42492, 42564, + 42635, 42707, 42779, 42850, 42922, 42994, 43066, 43138, + 43210, 43282, 43354, 43427, 43499, 43571, 43644, 43717, + 43789, 43862, 43935, 44008, 44081, 44154, 44227, 44300, + 44373, 44447, 44520, 44594, 44667, 44741, 44815, 44888, + 44962, 45036, 45110, 45184, 45259, 45333, 45407, 45482, + 45556, 45631, 45705, 45780, 45855, 45930, 46005, 46080, + 46155, 46230, 46306, 46381, 46457, 46532, 46608, 46684, + 46759, 46835, 46911, 46987, 47063, 47140, 47216, 47292, + 47369, 47445, 47522, 47599, 47676, 47753, 47830, 47907, + 47984, 48061, 48138, 48216, 48293, 48371, 48449, 48526, + 48604, 48682, 48760, 48838, 48917, 48995, 49073, 49152, + 49230, 49309, 49388, 49467, 49546, 49625, 49704, 49783, + 49862, 49942, 50021, 50101, 50181, 50260, 50340, 50420, + 50500, 50581, 50661, 50741, 50822, 50902, 50983, 51063, + 51144, 51225, 51306, 51387, 51469, 51550, 51631, 51713, + 51794, 51876, 51958, 52040, 52122, 52204, 52286, 52369, + 52451, 52533, 52616, 52699, 52782, 52865, 52948, 53031, + 53114, 53197, 53281, 53364, 53448, 53532, 53615, 53699, + 53784, 53868, 53952, 54036, 54121, 54205, 54290, 54375, + 54460, 54545, 54630, 54715, 54801, 54886, 54972, 55057, + 55143, 55229, 55315, 55401, 55487, 55574, 55660, 55747, + 55834, 55920, 56007, 56094, 56181, 56269, 56356, 56444, + 56531, 56619, 56707, 56795, 56883, 56971, 57059, 57148, + 57236, 57325, 57414, 57503, 57592, 57681, 57770, 57859, + 57949, 58039, 58128, 58218, 58308, 58398, 58489, 58579, + 58669, 58760, 58851, 58942, 59033, 59124, 59215, 59306, + 59398, 59489, 59581, 59673, 59765, 59857, 59950, 60042, + 60134, 60227, 60320, 60413, 60506, 60599, 60692, 60786, + 60879, 60973, 61067, 61161, 61255, 61349, 61444, 61538, + 61633, 61728, 61822, 61918, 62013, 62108, 62204, 62299, + 62395, 62491, 62587, 62683, 62779, 62876, 62972, 63069, + 63166, 63263, 63360, 63458, 63555, 63653, 63750, 63848, + 63946, 64045, 64143, 64241, 64340, 64439, 64538, 64637, + 64736, 64836, 64935, 65035, 65135, 65235, 65335, 65435, + 65535, 65636, 65737, 65838, 65939, 66040, 66141, 66243, + 66345, 66447, 66549, 66651, 66753, 66856, 66958, 67061, + 67164, 67267, 67371, 67474, 67578, 67681, 67785, 67889, + 67994, 68098, 68203, 68308, 68413, 68518, 68623, 68728, + 68834, 68940, 69046, 69152, 69258, 69365, 69472, 69578, + 69685, 69793, 69900, 70007, 70115, 70223, 70331, 70439, + 70548, 70656, 70765, 70874, 70983, 71093, 71202, 71312, + 71422, 71532, 71642, 71752, 71863, 71974, 72085, 72196, + 72307, 72419, 72531, 72643, 72755, 72867, 72979, 73092, + 73205, 73318, 73431, 73545, 73659, 73772, 73886, 74001, + 74115, 74230, 74345, 74460, 74575, 74690, 74806, 74922, + 75038, 75154, 75271, 75387, 75504, 75621, 75739, 75856, + 75974, 76092, 76210, 76328, 76447, 76566, 76685, 76804, + 76923, 77043, 77163, 77283, 77403, 77524, 77644, 77765, + 77886, 78008, 78129, 78251, 78373, 78495, 78618, 78741, + 78864, 78987, 79110, 79234, 79358, 79482, 79606, 79731, + 79855, 79980, 80106, 80231, 80357, 80483, 80609, 80735, + 80862, 80989, 81116, 81244, 81371, 81499, 81627, 81756, + 81884, 82013, 82142, 82271, 82401, 82531, 82661, 82791, + 82922, 83053, 83184, 83315, 83447, 83579, 83711, 83843, + 83976, 84109, 84242, 84376, 84509, 84643, 84778, 84912, + 85047, 85182, 85317, 85453, 85589, 85725, 85861, 85998, + 86135, 86272, 86410, 86547, 86686, 86824, 86963, 87101, + 87241, 87380, 87520, 87660, 87800, 87941, 88082, 88223, + 88365, 88506, 88648, 88791, 88934, 89077, 89220, 89363, + 89507, 89651, 89796, 89941, 90086, 90231, 90377, 90523, + 90669, 90816, 90963, 91110, 91258, 91406, 91554, 91702, + 91851, 92000, 92150, 92300, 92450, 92600, 92751, 92902, + 93053, 93205, 93357, 93510, 93663, 93816, 93969, 94123, + 94277, 94431, 94586, 94741, 94897, 95053, 95209, 95365, + 95522, 95680, 95837, 95995, 96153, 96312, 96471, 96630, + 96790, 96950, 97111, 97271, 97433, 97594, 97756, 97918, + 98081, 98244, 98408, 98571, 98735, 98900, 99065, 99230, + 99396, 99562, 99729, 99895, 100063, 100230, 100398, 100567, + 100736, 100905, 101074, 101244, 101415, 101586, 101757, 101929, + 102101, 102273, 102446, 102619, 102793, 102967, 103142, 103317, + 103492, 103668, 103844, 104021, 104198, 104376, 104554, 104732, + 104911, 105090, 105270, 105450, 105631, 105812, 105993, 106175, + 106358, 106541, 106724, 106908, 107092, 107277, 107462, 107648, + 107834, 108020, 108207, 108395, 108583, 108771, 108960, 109150, + 109340, 109530, 109721, 109912, 110104, 110297, 110490, 110683, + 110877, 111071, 111266, 111462, 111658, 111854, 112051, 112248, + 112446, 112645, 112844, 113043, 113244, 113444, 113645, 113847, + 114049, 114252, 114455, 114659, 114864, 115069, 115274, 115480, + 115687, 115894, 116102, 116310, 116519, 116728, 116938, 117149, + 117360, 117572, 117784, 117997, 118211, 118425, 118639, 118855, + 119071, 119287, 119504, 119722, 119940, 120159, 120379, 120599, + 120820, 121041, 121263, 121486, 121709, 121933, 122158, 122383, + 122609, 122835, 123062, 123290, 123519, 123748, 123978, 124208, + 124439, 124671, 124904, 125137, 125371, 125605, 125841, 126077, + 126313, 126551, 126789, 127027, 127267, 127507, 127748, 127990, + 128232, 128475, 128719, 128963, 129209, 129455, 129701, 129949, + 130197, 130446, 130696, 130947, 131198, 131450, 131703, 131957, + 132211, 132466, 132722, 132979, 133237, 133495, 133754, 134014, + 134275, 134537, 134799, 135063, 135327, 135592, 135858, 136125, + 136392, 136661, 136930, 137200, 137471, 137743, 138016, 138289, + 138564, 138839, 139115, 139393, 139671, 139950, 140230, 140511, + 140792, 141075, 141359, 141643, 141929, 142215, 142503, 142791, + 143081, 143371, 143662, 143955, 144248, 144542, 144837, 145134, + 145431, 145729, 146029, 146329, 146630, 146933, 147236, 147541, + 147846, 148153, 148461, 148769, 149079, 149390, 149702, 150015, + 150329, 150645, 150961, 151279, 151597, 151917, 152238, 152560, + 152883, 153208, 153533, 153860, 154188, 154517, 154847, 155179, + 155512, 155845, 156181, 156517, 156855, 157193, 157533, 157875, + 158217, 158561, 158906, 159253, 159601, 159950, 160300, 160652, + 161005, 161359, 161715, 162072, 162430, 162790, 163151, 163513, + 163877, 164242, 164609, 164977, 165347, 165718, 166090, 166464, + 166839, 167216, 167594, 167974, 168355, 168738, 169122, 169508, + 169895, 170284, 170674, 171066, 171460, 171855, 172252, 172650, + 173050, 173452, 173855, 174260, 174666, 175074, 175484, 175896, + 176309, 176724, 177140, 177559, 177979, 178401, 178824, 179250, + 179677, 180106, 180537, 180969, 181404, 181840, 182278, 182718, + 183160, 183604, 184050, 184498, 184947, 185399, 185852, 186308, + 186765, 187225, 187686, 188150, 188615, 189083, 189553, 190025, + 190499, 190975, 191453, 191933, 192416, 192900, 193387, 193876, + 194367, 194861, 195357, 195855, 196355, 196858, 197363, 197870, + 198380, 198892, 199406, 199923, 200442, 200964, 201488, 202015, + 202544, 203076, 203610, 204147, 204686, 205228, 205772, 206319, + 206869, 207422, 207977, 208535, 209095, 209658, 210225, 210793, + 211365, 211940, 212517, 213097, 213681, 214267, 214856, 215448, + 216043, 216641, 217242, 217846, 218453, 219064, 219677, 220294, + 220913, 221536, 222163, 222792, 223425, 224061, 224701, 225344, + 225990, 226640, 227293, 227949, 228610, 229273, 229940, 230611, + 231286, 231964, 232646, 233331, 234021, 234714, 235411, 236112, + 236816, 237525, 238237, 238954, 239674, 240399, 241128, 241860, + 242597, 243338, 244084, 244834, 245588, 246346, 247109, 247876, + 248647, 249423, 250204, 250989, 251779, 252574, 253373, 254177, + 254986, 255799, 256618, 257441, 258270, 259103, 259941, 260785, + 261634, 262488, 263347, 264212, 265082, 265957, 266838, 267724, + 268616, 269514, 270417, 271326, 272241, 273161, 274088, 275020, + 275959, 276903, 277854, 278811, 279774, 280743, 281719, 282702, + 283691, 284686, 285688, 286697, 287713, 288735, 289765, 290801, + 291845, 292895, 293953, 295018, 296091, 297171, 298259, 299354, + 300457, 301567, 302686, 303812, 304947, 306090, 307240, 308400, + 309567, 310743, 311928, 313121, 314324, 315535, 316754, 317984, + 319222, 320469, 321726, 322993, 324269, 325554, 326850, 328156, + 329471, 330797, 332133, 333480, 334837, 336204, 337583, 338973, + 340373, 341785, 343208, 344643, 346089, 347547, 349017, 350499, + 351993, 353499, 355018, 356550, 358094, 359652, 361223, 362807, + 364404, 366016, 367641, 369280, 370933, 372601, 374283, 375981, + 377693, 379420, 381163, 382921, 384696, 386486, 388293, 390116, + 391956, 393812, 395686, 397578, 399487, 401414, 403359, 405323, + 407305, 409306, 411327, 413367, 415427, 417507, 419608, 421729, + 423871, 426035, 428221, 430428, 432658, 434910, 437186, 439485, + 441807, 444154, 446526, 448922, 451343, 453791, 456264, 458764, + 461291, 463845, 466428, 469038, 471678, 474347, 477045, 479774, + 482534, 485325, 488148, 491003, 493891, 496813, 499769, 502760, + 505787, 508849, 511948, 515084, 518259, 521472, 524725, 528018, + 531351, 534727, 538145, 541606, 545112, 548662, 552259, 555902, + 559593, 563332, 567122, 570962, 574853, 578797, 582795, 586848, + 590957, 595124, 599348, 603633, 607978, 612386, 616857, 621393, + 625996, 630667, 635407, 640218, 645102, 650060, 655094, 660206, + 665398, 670671, 676027, 681469, 686999, 692618, 698328, 704133, + 710035, 716035, 722137, 728343, 734655, 741077, 747612, 754261, + 761030, 767919, 774934, 782077, 789353, 796763, 804314, 812008, + 819849, 827843, 835992, 844303, 852780, 861428, 870251, 879257, + 888449, 897835, 907420, 917211, 927215, 937438, 947887, 958571, + 969498, 980675, 992112, 1003818, 1015802, 1028074, 1040645, 1053527, + 1066729, 1080266, 1094149, 1108393, 1123011, 1138018, 1153430, 1169265, + 1185538, 1202270, 1219479, 1237186, 1255414, 1274185, 1293525, 1313459, + 1334015, 1355224, 1377116, 1399726, 1423088, 1447242, 1472229, 1498091, + 1524876, 1552635, 1581422, 1611294, 1642314, 1674550, 1708075, 1742967, + 1779313, 1817205, 1856743, 1898038, 1941209, 1986387, 2033716, 2083353, + 2135471, 2190260, 2247933, 2308722, 2372887, 2440718, 2512537, 2588709, + 2669640, 2755792, 2847685, 2945916, 3051161, 3164201, 3285935, 3417407, + 3559833, 3714643, 3883524, 4068489, 4271947, 4496821, 4746679, 5025930, + 5340085, 5696125, 6103026, 6572525, 7120270, 7767602, 8544398, 9493811, + 10680573, 12206405, 14240842, 17089048, 21361347, 28481836, 42722796, 85445642 }; From 08c0c7676c4b64f7b9a0ea40269ff6a22d53973d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Oct 2015 21:01:04 +0100 Subject: [PATCH 122/364] Since cv_pointlimit is handled in P_CheckPointLimit, I've just created P_CheckTimeLimit for cv_timelimit. It helps make P_UpdateSpecials less messy-looking anyway. --- src/p_inter.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++- src/p_local.h | 1 + src/p_spec.c | 101 ++----------------------------------------- 3 files changed, 120 insertions(+), 99 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index f9dc3c342..e49d89eb4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1648,11 +1648,126 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit")); } +/** Checks if the level timer is over the timelimit and the round should end, + * unless you are in overtime. In which case leveltime may stretch out beyond + * timelimitintics and overtime's status will be checked here each tick. + * Verify that the value of ::cv_timelimit is greater than zero before + * calling this function. + * + * \sa cv_timelimit, P_CheckPointLimit, P_UpdateSpecials + */ +void P_CheckTimeLimit(void) +{ + INT32 i, k; + + if (!cv_timelimit.value) + return; + + if (!(multiplayer || netgame)) + return; + + if (G_PlatformGametype()) + return; + + if (leveltime < timelimitintics) + return; + + if (gameaction == ga_completed) + return; + + //Tagmode round end but only on the tic before the + //XD_EXITLEVEL packet is recieved by all players. + if (G_TagGametype()) + { + if (leveltime == (timelimitintics + 1)) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator + || (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT)) + continue; + + CONS_Printf(M_GetText("%s recieved double points for surviving the round.\n"), player_names[i]); + P_AddPlayerScore(&players[i], players[i].score); + } + } + + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); + } + + //Optional tie-breaker for Match/CTF + else if (cv_overtime.value) + { + INT32 playerarray[MAXPLAYERS]; + INT32 tempplayer = 0; + INT32 spectators = 0; + INT32 playercount = 0; + + //Figure out if we have enough participating players to care. + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && players[i].spectator) + spectators++; + } + + if ((D_NumPlayers() - spectators) > 1) + { + // Play the starpost sfx after the first second of overtime. + if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE))) + S_StartSound(NULL, sfx_strpst); + + // Normal Match + if (!G_GametypeHasTeams()) + { + //Store the nodes of participating players in an array. + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + { + playerarray[playercount] = i; + playercount++; + } + } + + //Sort 'em. + for (i = 1; i < playercount; i++) + { + for (k = i; k < playercount; k++) + { + if (players[playerarray[i-1]].score < players[playerarray[k]].score) + { + tempplayer = playerarray[i-1]; + playerarray[i-1] = playerarray[k]; + playerarray[k] = tempplayer; + } + } + } + + //End the round if the top players aren't tied. + if (players[playerarray[0]].score == players[playerarray[1]].score) + return; + } + else + { + //In team match and CTF, determining a tie is much simpler. =P + if (redscore == bluescore) + return; + } + } + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); + } + + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); +} + /** Checks if a player's score is over the pointlimit and the round should end. * Verify that the value of ::cv_pointlimit is greater than zero before * calling this function. * - * \sa cv_pointlimit, P_UpdateSpecials + * \sa cv_pointlimit, P_CheckTimeLimit, P_UpdateSpecials */ void P_CheckPointLimit(void) { diff --git a/src/p_local.h b/src/p_local.h index 498bf0828..6bd402912 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -397,6 +397,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss); void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); void P_PlayerFlagBurst(player_t *player, boolean toss); +void P_CheckTimeLimit(void); void P_CheckPointLimit(void); void P_CheckSurvivors(void); boolean P_CheckRacers(void); diff --git a/src/p_spec.c b/src/p_spec.c index 0d786c695..88174c220 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4648,114 +4648,19 @@ void P_PlayerInSpecialSector(player_t *player) /** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up. * - * \sa cv_timelimit, P_CheckPointLimit + * \sa P_CheckTimeLimit, P_CheckPointLimit */ void P_UpdateSpecials(void) { anim_t *anim; - INT32 i, k; + INT32 i; INT32 pic; size_t j; levelflat_t *foundflats; // for flat animation // LEVEL TIMER - // Exit if the timer is equal to or greater the timelimit, unless you are - // in overtime. In which case leveltime may stretch out beyond timelimitintics - // and overtime's status will be checked here each tick. - if (cv_timelimit.value && timelimitintics <= leveltime && (multiplayer || netgame) - && G_RingSlingerGametype() && (gameaction != ga_completed)) - { - boolean pexit = false; - - //Tagmode round end but only on the tic before the - //XD_EXITLEVEL packet is recieved by all players. - if (G_TagGametype()) - { - if (leveltime == (timelimitintics + 1)) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator - || (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT)) - continue; - - CONS_Printf(M_GetText("%s recieved double points for surviving the round.\n"), player_names[i]); - P_AddPlayerScore(&players[i], players[i].score); - } - } - - pexit = true; - } - - //Optional tie-breaker for Match/CTF - else if (G_RingSlingerGametype() && cv_overtime.value) - { - INT32 playerarray[MAXPLAYERS]; - INT32 tempplayer = 0; - INT32 spectators = 0; - INT32 playercount = 0; - - //Figure out if we have enough participating players to care. - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && players[i].spectator) - spectators++; - } - - if ((D_NumPlayers() - spectators) > 1) - { - // Play the starpost sfx after the first second of overtime. - if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE))) - S_StartSound(NULL, sfx_strpst); - - // Normal Match - if (!G_GametypeHasTeams()) - { - //Store the nodes of participating players in an array. - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && !players[i].spectator) - { - playerarray[playercount] = i; - playercount++; - } - } - - //Sort 'em. - for (i = 1; i < playercount; i++) - { - for (k = i; k < playercount; k++) - { - if (players[playerarray[i-1]].score < players[playerarray[k]].score) - { - tempplayer = playerarray[i-1]; - playerarray[i-1] = playerarray[k]; - playerarray[k] = tempplayer; - } - } - } - - //End the round if the top players aren't tied. - if (!(players[playerarray[0]].score == players[playerarray[1]].score)) - pexit = true; - } - else - { - //In team match and CTF, determining a tie is much simpler. =P - if (!(redscore == bluescore)) - pexit = true; - } - } - else - pexit = true; - } - else - pexit = true; - - if (server && pexit) - SendNetXCmd(XD_EXITLEVEL, NULL, 0); - } + P_CheckTimeLimit(); // POINT LIMIT P_CheckPointLimit(); From 165aec3d34b8c5521b4941ffe0c4d7bb733dc4c1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Oct 2015 22:23:40 +0100 Subject: [PATCH 123/364] FF_TRANSSHIFT is meant for transmaps linked to states, not anything else! I'm surprised how the source code flew in the face of this fact for so long and just used it everywhere, that's just silly. --- src/f_wipe.c | 2 +- src/r_plane.c | 42 +++++++++++++----------------------------- src/r_segs.c | 48 ++++++++++++------------------------------------ src/r_splats.c | 2 +- src/r_things.c | 4 ++-- src/v_video.c | 6 +++--- 6 files changed, 32 insertions(+), 72 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index 8e7c622c4..0d3061324 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -232,7 +232,7 @@ static void F_DoWipe(fademask_t *fademask) do { // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<polyobj->translucency >= 10) return; // Don't even draw it - else if (pl->polyobj->translucency == 9) - ds_transmap = ((tr_trans90)<polyobj->translucency == 8) - ds_transmap = ((tr_trans80)<polyobj->translucency == 7) - ds_transmap = ((tr_trans70)<polyobj->translucency == 6) - ds_transmap = ((tr_trans60)<polyobj->translucency == 5) - ds_transmap = ((tr_trans50)<polyobj->translucency == 4) - ds_transmap = ((tr_trans40)<polyobj->translucency == 3) - ds_transmap = ((tr_trans30)<polyobj->translucency == 2) - ds_transmap = ((tr_trans20)<polyobj->translucency == 1) - ds_transmap = ((tr_trans10)<polyobj->translucency <= 9 && pl->polyobj->translucency > 0) + ds_transmap = transtables + ((pl->polyobj->translucency-1)<<16); else // Opaque, but allow transparent flat pixels spanfunc = splatfunc; if (pl->extra_colormap && pl->extra_colormap->fog) light = (pl->lightlevel >> LIGHTSEGSHIFT); else - light = LIGHTLEVELS-1; + light = LIGHTLEVELS-1; } else #endif @@ -805,23 +789,23 @@ void R_DrawSinglePlane(visplane_t *pl) if (pl->ffloor->alpha < 12) return; // Don't even draw it else if (pl->ffloor->alpha < 38) - ds_transmap = ((tr_trans90)<ffloor->alpha < 64) - ds_transmap = ((tr_trans80)<ffloor->alpha < 89) - ds_transmap = ((tr_trans70)<ffloor->alpha < 115) - ds_transmap = ((tr_trans60)<ffloor->alpha < 140) - ds_transmap = ((tr_trans50)<ffloor->alpha < 166) - ds_transmap = ((tr_trans40)<ffloor->alpha < 192) - ds_transmap = ((tr_trans30)<ffloor->alpha < 217) - ds_transmap = ((tr_trans20)<ffloor->alpha < 243) - ds_transmap = ((tr_trans10)<special) { case 900: - dc_transmap = ((tr_trans10)<special-900)<<16); colfunc = fuzzcolfunc; break; case 909: @@ -354,7 +330,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (curline->polyseg->translucency >= NUMTRANSMAPS) return; - dc_transmap = ((curline->polyseg->translucency)<polyseg->translucency-1)<<16); colfunc = fuzzcolfunc; } @@ -733,23 +709,23 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->alpha < 12) return; // Don't even draw it else if (pfloor->alpha < 38) - dc_transmap = ((tr_trans90)<alpha < 64) - dc_transmap = ((tr_trans80)<alpha < 89) - dc_transmap = ((tr_trans70)<alpha < 115) - dc_transmap = ((tr_trans60)<alpha < 140) - dc_transmap = ((tr_trans50)<alpha < 166) - dc_transmap = ((tr_trans40)<alpha < 192) - dc_transmap = ((tr_trans30)<alpha < 217) - dc_transmap = ((tr_trans20)<alpha < 243) - dc_transmap = ((tr_trans10)<flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) - vis->transmap = ((tr_trans80-1)<transmap = transtables + ((tr_trans80-1)<<16); // because now the translucency is set through FF_TRANSMASK else if (thing->frame & FF_TRANSMASK) - vis->transmap = (thing->frame & FF_TRANSMASK) - 0x10000 + transtables; + vis->transmap = transtables + ((((thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)-1)<<16); if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW)) && (!vis->extra_colormap || !vis->extra_colormap->fog)) diff --git a/src/v_video.c b/src/v_video.c index 524c15cc7..010c042c3 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -366,7 +366,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t } if (alphalevel) { - v_translevel = ((alphalevel)< Date: Mon, 12 Oct 2015 15:10:43 +0100 Subject: [PATCH 124/364] Partial undo of what I did last commit to make Inu happy again. Note: polyobj_t's "translucency" is apparently a SIGNED integer, so in theory it's possible to get polyobj flats to use the "spanfunc = splatfunc" line using negative values. If this is not meant to happen, this should probably be fixed asap --- src/f_wipe.c | 2 +- src/r_plane.c | 24 ++++++++++++------------ src/r_segs.c | 24 ++++++++++++------------ src/r_splats.c | 2 +- src/r_things.c | 4 ++-- src/v_video.c | 6 +++--- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index 0d3061324..8e7c622c4 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -232,7 +232,7 @@ static void F_DoWipe(fademask_t *fademask) do { // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<<16); + transtbl = transtables + ((9 - *mask)<polyobj->translucency >= 10) return; // Don't even draw it - else if (pl->polyobj->translucency <= 9 && pl->polyobj->translucency > 0) - ds_transmap = transtables + ((pl->polyobj->translucency-1)<<16); + else if (pl->polyobj->translucency > 0) + ds_transmap = transtables + ((pl->polyobj->translucency-1)<ffloor->alpha < 12) return; // Don't even draw it else if (pl->ffloor->alpha < 38) - ds_transmap = transtables + ((tr_trans90-1)<<16); + ds_transmap = transtables + ((tr_trans90-1)<ffloor->alpha < 64) - ds_transmap = transtables + ((tr_trans80-1)<<16); + ds_transmap = transtables + ((tr_trans80-1)<ffloor->alpha < 89) - ds_transmap = transtables + ((tr_trans70-1)<<16); + ds_transmap = transtables + ((tr_trans70-1)<ffloor->alpha < 115) - ds_transmap = transtables + ((tr_trans60-1)<<16); + ds_transmap = transtables + ((tr_trans60-1)<ffloor->alpha < 140) - ds_transmap = transtables + ((tr_trans50-1)<<16); + ds_transmap = transtables + ((tr_trans50-1)<ffloor->alpha < 166) - ds_transmap = transtables + ((tr_trans40-1)<<16); + ds_transmap = transtables + ((tr_trans40-1)<ffloor->alpha < 192) - ds_transmap = transtables + ((tr_trans30-1)<<16); + ds_transmap = transtables + ((tr_trans30-1)<ffloor->alpha < 217) - ds_transmap = transtables + ((tr_trans20-1)<<16); + ds_transmap = transtables + ((tr_trans20-1)<ffloor->alpha < 243) - ds_transmap = transtables + ((tr_trans10-1)<<16); + ds_transmap = transtables + ((tr_trans10-1)<special-900)<<16); + dc_transmap = transtables + ((ldef->special-900)<polyseg->translucency >= NUMTRANSMAPS) return; - dc_transmap = transtables + ((curline->polyseg->translucency-1)<<16); + dc_transmap = transtables + ((curline->polyseg->translucency-1)<alpha < 12) return; // Don't even draw it else if (pfloor->alpha < 38) - dc_transmap = transtables + ((tr_trans90-1)<<16); + dc_transmap = transtables + ((tr_trans90-1)<alpha < 64) - dc_transmap = transtables + ((tr_trans80-1)<<16); + dc_transmap = transtables + ((tr_trans80-1)<alpha < 89) - dc_transmap = transtables + ((tr_trans70-1)<<16); + dc_transmap = transtables + ((tr_trans70-1)<alpha < 115) - dc_transmap = transtables + ((tr_trans60-1)<<16); + dc_transmap = transtables + ((tr_trans60-1)<alpha < 140) - dc_transmap = transtables + ((tr_trans50-1)<<16); + dc_transmap = transtables + ((tr_trans50-1)<alpha < 166) - dc_transmap = transtables + ((tr_trans40-1)<<16); + dc_transmap = transtables + ((tr_trans40-1)<alpha < 192) - dc_transmap = transtables + ((tr_trans30-1)<<16); + dc_transmap = transtables + ((tr_trans30-1)<alpha < 217) - dc_transmap = transtables + ((tr_trans20-1)<<16); + dc_transmap = transtables + ((tr_trans20-1)<alpha < 243) - dc_transmap = transtables + ((tr_trans10-1)<<16); + dc_transmap = transtables + ((tr_trans10-1)<flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) - vis->transmap = transtables + ((tr_trans80-1)<<16); // because now the translucency is set through FF_TRANSMASK + vis->transmap = transtables + ((tr_trans80-1)<frame & FF_TRANSMASK) - vis->transmap = transtables + ((((thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)-1)<<16); + vis->transmap = transtables + (thing->frame & FF_TRANSMASK) - 0x10000; if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW)) && (!vis->extra_colormap || !vis->extra_colormap->fog)) diff --git a/src/v_video.c b/src/v_video.c index 010c042c3..c5afd783f 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -366,7 +366,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t } if (alphalevel) { - v_translevel = transtables + ((alphalevel-1)<<16); + v_translevel = transtables + ((alphalevel-1)< Date: Wed, 21 Oct 2015 15:32:50 +0100 Subject: [PATCH 125/364] From what I can tell, correcting this one value in finetangent[] shouldn't cause any harm at all, so... --- src/tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tables.c b/src/tables.c index deb5a6b19..3f881be7d 100644 --- a/src/tables.c +++ b/src/tables.c @@ -546,7 +546,7 @@ fixed_t finetangent[4096] = 63166, 63263, 63360, 63458, 63555, 63653, 63750, 63848, 63946, 64045, 64143, 64241, 64340, 64439, 64538, 64637, 64736, 64836, 64935, 65035, 65135, 65235, 65335, 65435, - 65535, 65636, 65737, 65838, 65939, 66040, 66141, 66243, + 65536, 65636, 65737, 65838, 65939, 66040, 66141, 66243, 66345, 66447, 66549, 66651, 66753, 66856, 66958, 67061, 67164, 67267, 67371, 67474, 67578, 67681, 67785, 67889, 67994, 68098, 68203, 68308, 68413, 68518, 68623, 68728, From ac24ce234fb517a073825a73f70bc423458348ec Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 21 Oct 2015 15:40:59 +0100 Subject: [PATCH 126/364] If this isn't an accidental copy+paste then I'd be very surprised --- src/g_game.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 643ec8c93..57b2f731f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -297,9 +297,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, #if JOYAXISSET > 3 {7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"}, #endif -#if JOYAXISSET > 3 -{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"}, -#endif #if JOYAXISSET > 4 {7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"}, #endif From b94fc008abb8c694749666fad346b838ea43b7ea Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 21 Oct 2015 16:01:16 +0100 Subject: [PATCH 127/364] doomtype.h tweaks some of the mess in here really bothers me --- src/doomtype.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doomtype.h b/src/doomtype.h index ff4199775..8e7da6881 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -100,11 +100,13 @@ typedef long ssize_t; #if defined (_MSC_VER) || defined (__OS2__) // Microsoft VisualC++ +#ifdef _MSC_VER #if (_MSC_VER <= 1800) // MSVC 2013 and back #define snprintf _snprintf #if (_MSC_VER <= 1200) // MSVC 2012 and back #define vsnprintf _vsnprintf #endif +#endif #endif #define strncasecmp strnicmp #define strcasecmp stricmp @@ -177,6 +179,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz); // not the number of bytes in the buffer. #define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst) +// \note __BYTEBOOL__ used to be set above if "macintosh" was defined, +// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now? #ifndef __BYTEBOOL__ #define __BYTEBOOL__ @@ -193,7 +197,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #else typedef enum {false, true} boolean; #endif - //#endif // __cplusplus #endif // __BYTEBOOL__ /* 7.18.2.1 Limits of exact-width integer types */ From 77f118dd2f748d45221758746fca7829b361e5b6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 6 Nov 2015 14:23:06 +0000 Subject: [PATCH 128/364] Removed dummied-out Pope XVI code --- src/st_stuff.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 6e19b92ff..585db0c87 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1842,37 +1842,6 @@ static void ST_overlayDrawer(void) LUAh_GameHUD(stplyr); #endif -#if 0 // Pope XVI - if (!(netgame || multiplayer) && !modifiedgame && gamemap == 11 && ALL7EMERALDS(emeralds) - && stplyr->mo && stplyr->mo->subsector && stplyr->mo->subsector->sector-sectors == 1361) - { - if (grade & 2048) // NAGZ - { - V_DrawCenteredString(BASEVIDWIDTH/2, 70, 0, M_GetText("I, Pope Rededict XVI proclaim")); - V_DrawCenteredString(BASEVIDWIDTH/2, 80, 0, M_GetText("AJ & Amy")); - V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, M_GetText("Husband & Wife")); - V_DrawCenteredString(BASEVIDWIDTH/2, 100, 0, M_GetText("on this day")); - V_DrawCenteredString(BASEVIDWIDTH/2, 110, 0, M_GetText("May 16, 2009")); - - P_GivePlayerRings(stplyr, 9999); - } - else - { - V_DrawCenteredString(BASEVIDWIDTH/2, 60, 0, M_GetText("Oh... it's you again...")); - V_DrawCenteredString(BASEVIDWIDTH/2, 80, 0, M_GetText("Look, I wanted to apologize for the way")); - V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, M_GetText("I've acted in the past.")); - V_DrawCenteredString(BASEVIDWIDTH/2, 110, 0, M_GetText("I've seen the error of my ways")); - V_DrawCenteredString(BASEVIDWIDTH/2, 120, 0, M_GetText("and turned over a new leaf.")); - V_DrawCenteredString(BASEVIDWIDTH/2, 140, 0, M_GetText("Instead of sending people to hell,")); - V_DrawCenteredString(BASEVIDWIDTH/2, 150, 0, M_GetText("I now send them to heaven!")); - - P_LinedefExecute(4200, stplyr->mo, stplyr->mo->subsector->sector); - P_LinedefExecute(4201, stplyr->mo, stplyr->mo->subsector->sector); - stplyr->mo->momx = stplyr->mo->momy = 0; - } - } -#endif - // draw level title Tails if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer)) #ifdef HAVE_BLUA From 1ed54078215a2ab5b0618de25bee6007bf4c0c76 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 7 Nov 2015 13:56:21 -0600 Subject: [PATCH 129/364] update stuff --- src/console.c | 15 +- src/d_main.c | 8 +- src/dehacked.c | 40 +-- src/doomdef.h | 40 +-- src/hardware/hw_defs.h | 5 +- src/m_menu.c | 3 +- src/r_draw.c | 570 +++++++++++++++++++---------------------- src/r_draw8.c | 3 +- 8 files changed, 329 insertions(+), 355 deletions(-) diff --git a/src/console.c b/src/console.c index 1c8640396..fe447b10a 100644 --- a/src/console.c +++ b/src/console.c @@ -249,7 +249,7 @@ void CON_ReSetupBackColormap(UINT16 num) j = pal[i] + pal[i+1] + pal[i+2]; cwhitemap[k] = (UINT8)(15 - (j>>6)); corangemap[k] = (UINT8)(63 - (j>>6)); - cbluemap[k] = (UINT8)(143 - (j>>6)); + cbluemap[k] = (UINT8)(159 - (j>>6)); cgreenmap[k] = (UINT8)(111 - (j>>6)); cgraymap[k] = (UINT8)(31 - (j>>6)); credmap[k] = (UINT8)(47 - (j>>6)); @@ -284,7 +284,7 @@ static void CON_SetupBackColormap(void) j = pal[i] + pal[i+1] + pal[i+2]; cwhitemap[k] = (UINT8)(15 - (j>>6)); corangemap[k] = (UINT8)(63 - (j>>6)); - cbluemap[k] = (UINT8)(143 - (j>>6)); + cbluemap[k] = (UINT8)(159 - (j>>6)); cgreenmap[k] = (UINT8)(111 - (j>>6)); cgraymap[k] = (UINT8)(31 - (j>>6)); credmap[k] = (UINT8)(47 - (j>>6)); @@ -308,15 +308,15 @@ static void CON_SetupBackColormap(void) yellowmap[3] = (UINT8)73; yellowmap[9] = (UINT8)66; - purplemap[3] = (UINT8)168; - purplemap[9] = (UINT8)170; + purplemap[3] = (UINT8)184; + purplemap[9] = (UINT8)186; lgreenmap[3] = (UINT8)102; lgreenmap[9] = (UINT8)106; - bluemap[3] = (UINT8)131; - bluemap[9] = (UINT8)142; + bluemap[3] = (UINT8)147; + bluemap[9] = (UINT8)158; graymap[3] = (UINT8)10; graymap[9] = (UINT8)15; - redmap[3] = (UINT8)194; + redmap[3] = (UINT8)210; redmap[9] = (UINT8)32; orangemap[3] = (UINT8)52; orangemap[9] = (UINT8)57; @@ -1472,3 +1472,4 @@ void CON_Drawer(void) else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS) CON_DrawHudlines(); } + diff --git a/src/d_main.c b/src/d_main.c index a959a8632..709cbea7b 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1121,10 +1121,10 @@ void D_SRB2Main(void) #if 1 // md5s last updated 12/14/14 // Check MD5s of autoloaded files - W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad - W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta - W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta - W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta + //W_VerifyFileMD5(0, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad + //W_VerifyFileMD5(1, ASSET_HASH_ZONES_DTA); // zones.dta + //W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta + //W_VerifyFileMD5(3, ASSET_HASH_RINGS_DTA); // rings.dta //W_VerifyFileMD5(4, "0c66790502e648bfce90fdc5bb15722e"); // patch.dta // don't check music.dta because people like to modify it, and it doesn't matter if they do // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. diff --git a/src/dehacked.c b/src/dehacked.c index 760ae84b3..b22f7b867 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7309,30 +7309,31 @@ static const char *COLOR_ENUMS[] = { "SILVER", // SKINCOLOR_SILVER "GREY", // SKINCOLOR_GREY "BLACK", // SKINCOLOR_BLACK - "CYAN", // SKINCOLOR_CYAN - "AQUA", // SKINCOLOR_AQUA - "TEAL", // SKINCOLOR_TEAL - "AZURE", // SKINCOLOR_AZURE - "BLUE", // SKINCOLOR_BLUE - "PEACH", // SKINCOLOR_PEACH - "TAN", // SKINCOLOR_TAN - "PINK", // SKINCOLOR_PINK - "ROSY", // SKINCOLOR_ROSY - "LAVENDER", // SKINCOLOR_LAVENDER - "PURPLE", // SKINCOLOR_PURPLE - "MAGENTA", // SKINCOLOR_MAGENTA - "ORANGE", // SKINCOLOR_ORANGE - "RUST", // SKINCOLOR_RUST "BEIGE", // SKINCOLOR_BEIGE + "PEACH", // SKINCOLOR_PEACH "BROWN", // SKINCOLOR_BROWN "RED", // SKINCOLOR_RED "CRIMSON", // SKINCOLOR_CRIMSON - "EMERALD", // SKINCOLOR_EMERALD - "GREEN", // SKINCOLOR_GREEN - "ZIM", // SKINCOLOR_ZIM - "PERIDOT", // SKINCOLOR_PERIDOT + "ORANGE", // SKINCOLOR_ORANGE + "RUST", // SKINCOLOR_RUST + "GOLD", // SKINCOLOR_GOLD "YELLOW", // SKINCOLOR_YELLOW - "GOLD" // SKINCOLOR_GOLD + "TAN", // SKINCOLOR_TAN + "MOSS", // SKINCOLOR_MOSS + "PERIDOT", // SKINCOLOR_PERIDOT + "GREEN", // SKINCOLOR_GREEN + "EMERALD", // SKINCOLOR_EMERALD + "AQUA", // SKINCOLOR_AQUA + "TEAL", // SKINCOLOR_TEAL + "CYAN", // SKINCOLOR_CYAN + "BLUE", // SKINCOLOR_BLUE + "AZURE", // SKINCOLOR_AZURE + "PASTEL", // SKINCOLOR_PASTEL + "PURPLE", // SKINCOLOR_PURPLE + "LAVENDER", // SKINCOLOR_LAVENDER + "MAGENTA", // SKINCOLOR_MAGENTA + "PINK", // SKINCOLOR_PINK + "ROSY" // SKINCOLOR_ROSY }; static const char *const POWERS_LIST[] = { @@ -8769,3 +8770,4 @@ void LUA_SetActionByName(void *state, const char *actiontocompare) } #endif // HAVE_BLUA + diff --git a/src/doomdef.h b/src/doomdef.h index d6af0f1a0..88fc206a2 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -230,30 +230,31 @@ typedef enum SKINCOLOR_SILVER, SKINCOLOR_GREY, SKINCOLOR_BLACK, - SKINCOLOR_CYAN, - SKINCOLOR_AQUA, - SKINCOLOR_TEAL, - SKINCOLOR_AZURE, - SKINCOLOR_BLUE, - SKINCOLOR_PEACH, - SKINCOLOR_TAN, - SKINCOLOR_PINK, - SKINCOLOR_ROSY, - SKINCOLOR_LAVENDER, - SKINCOLOR_PURPLE, - SKINCOLOR_MAGENTA, - SKINCOLOR_ORANGE, - SKINCOLOR_RUST, SKINCOLOR_BEIGE, + SKINCOLOR_PEACH, SKINCOLOR_BROWN, SKINCOLOR_RED, SKINCOLOR_CRIMSON, - SKINCOLOR_EMERALD, - SKINCOLOR_GREEN, - SKINCOLOR_ZIM, - SKINCOLOR_PERIDOT, - SKINCOLOR_YELLOW, + SKINCOLOR_ORANGE, + SKINCOLOR_RUST, SKINCOLOR_GOLD, + SKINCOLOR_YELLOW, + SKINCOLOR_TAN, + SKINCOLOR_MOSS, + SKINCOLOR_PERIDOT, + SKINCOLOR_GREEN, + SKINCOLOR_EMERALD, + SKINCOLOR_AQUA, + SKINCOLOR_TEAL, + SKINCOLOR_CYAN, + SKINCOLOR_BLUE, + SKINCOLOR_AZURE, + SKINCOLOR_PASTEL, + SKINCOLOR_PURPLE, + SKINCOLOR_LAVENDER, + SKINCOLOR_MAGENTA, + SKINCOLOR_PINK, + SKINCOLOR_ROSY, // Careful! MAXSKINCOLORS cannot be greater than 0x20! MAXSKINCOLORS, @@ -498,3 +499,4 @@ extern const char *compdate, *comptime, *comprevision; //#define REDSANALOG #endif // __DOOMDEF__ + diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 70d776d9e..5a39fead1 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -46,8 +46,8 @@ typedef unsigned char FBOOLEAN; #define HWR_PATCHES_CHROMAKEY_COLORINDEX 0 #define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 1 #else -#define HWR_PATCHES_CHROMAKEY_COLORINDEX 247 -#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 220 +#define HWR_PATCHES_CHROMAKEY_COLORINDEX 255 +#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 130 #endif // the chroma key color shows on border sprites, set it to black @@ -229,3 +229,4 @@ enum hwdfiltermode #endif //_HWR_DEFS_ + diff --git a/src/m_menu.c b/src/m_menu.c index 111be9479..f115e9d44 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2820,7 +2820,7 @@ static void M_DrawSlider(INT32 x, INT32 y, const consvar_t *cv) void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines) { // Solid color textbox. - V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 143); + V_DrawFill(x+5, y+5, width*8+6, boxlines*8+6, 159); //V_DrawFill(x+8, y+8, width*8, boxlines*8, 31); /* patch_t *p; @@ -7409,3 +7409,4 @@ static void M_HandleFogColor(INT32 choice) } } #endif + diff --git a/src/r_draw.c b/src/r_draw.c index 81bcc9438..420b96c1d 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -131,68 +131,70 @@ static UINT8** translationtablecache[MAXSKINS + 4] = {NULL}; // TODO Callum: Can this be translated? const char *Color_Names[MAXSKINCOLORS] = { - "None", // SKINCOLOR_NONE - "White", // SKINCOLOR_WHITE - "Silver", // SKINCOLOR_SILVER - "Grey", // SKINCOLOR_GREY - "Black", // SKINCOLOR_BLACK - "Cyan", // SKINCOLOR_CYAN - "Aqua", // SKINCOLOR_AQUAMARINE - "Teal", // SKINCOLOR_TEAL - "Azure", // SKINCOLOR_AZURE - "Blue", // SKINCOLOR_BLUE - "Peach", // SKINCOLOR_PEACH - "Tan", // SKINCOLOR_TAN - "Pink", // SKINCOLOR_PINK - "Rosy", // SKINCOLOR_ROSY - "Lavender", // SKINCOLOR_LAVENDER - "Purple", // SKINCOLOR_PURPLE - "Magenta", // SKINCOLOR_MAGENTA - "Orange", // SKINCOLOR_ORANGE - "Rust", // SKINCOLOR_RUST - "Beige", // SKINCOLOR_BEIGE - "Brown", // SKINCOLOR_BROWN - "Red", // SKINCOLOR_RED - "Crimson", // SKINCOLOR_CRIMSON - "Emerald", // SKINCOLOR_EMERALD - "Green", // SKINCOLOR_GREEN - "Zim", // SKINCOLOR_ZIM - "Peridot", // SKINCOLOR_PERIDOT - "Yellow", // SKINCOLOR_YELLOW - "Gold" // SKINCOLOR_GOLD + "None", // SKINCOLOR_NONE + "White", // SKINCOLOR_WHITE + "Silver", // SKINCOLOR_SILVER + "Grey", // SKINCOLOR_GREY + "Black", // SKINCOLOR_BLACK + "Beige", // SKINCOLOR_BEIGE + "Peach", // SKINCOLOR_PEACH + "Brown", // SKINCOLOR_BROWN + "Red", // SKINCOLOR_RED + "Crimson", // SKINCOLOR_CRIMSON + "Orange", // SKINCOLOR_ORANGE + "Rust", // SKINCOLOR_RUST + "Gold", // SKINCOLOR_GOLD + "Yellow", // SKINCOLOR_YELLOW + "Tan", // SKINCOLOR_TAN + "Moss", // SKINCOLOR_MOSS + "Peridot", // SKINCOLOR_PERIDOT + "Green", // SKINCOLOR_GREEN + "Emerald", // SKINCOLOR_EMERALD + "Aqua", // SKINCOLOR_AQUA + "Teal", // SKINCOLOR_TEAL + "Cyan", // SKINCOLOR_CYAN + "Blue", // SKINCOLOR_BLUE + "Azure", // SKINCOLOR_AZURE + "Pastel", // SKINCOLOR_PASTEL + "Purple", // SKINCOLOR_PURPLE + "Lavender", // SKINCOLOR_LAVENDER + "Magenta", // SKINCOLOR_MAGENTA + "Pink", // SKINCOLOR_PINK + "Rosy" // SKINCOLOR_ROSY }; const UINT8 Color_Opposite[MAXSKINCOLORS*2] = { - SKINCOLOR_NONE,8, // SKINCOLOR_NONE - SKINCOLOR_BLACK,10, // SKINCOLOR_WHITE - SKINCOLOR_GREY,4, // SKINCOLOR_SILVER - SKINCOLOR_SILVER,12,// SKINCOLOR_GREY - SKINCOLOR_WHITE,8, // SKINCOLOR_BLACK - SKINCOLOR_NONE,8, // SKINCOLOR_CYAN - SKINCOLOR_NONE,8, // SKINCOLOR_AQUA - SKINCOLOR_NONE,8, // SKINCOLOR_TEAL - SKINCOLOR_NONE,8, // SKINCOLOR_AZURE - SKINCOLOR_ORANGE,9, // SKINCOLOR_BLUE - SKINCOLOR_NONE,8, // SKINCOLOR_PEACH - SKINCOLOR_NONE,8, // SKINCOLOR_TAN - SKINCOLOR_NONE,8, // SKINCOLOR_PINK - SKINCOLOR_NONE,8, // SKINCOLOR_ROSY - SKINCOLOR_NONE,8, // SKINCOLOR_LAVENDER - SKINCOLOR_NONE,8, // SKINCOLOR_PURPLE - SKINCOLOR_NONE,8, // SKINCOLOR_MAGENTA - SKINCOLOR_BLUE,12, // SKINCOLOR_ORANGE - SKINCOLOR_NONE,8, // SKINCOLOR_RUST - SKINCOLOR_NONE,8, // SKINCOLOR_BEIGE - SKINCOLOR_NONE,8, // SKINCOLOR_BROWN - SKINCOLOR_GREEN,5, // SKINCOLOR_RED - SKINCOLOR_NONE,8, // SKINCOLOR_CRIMSON - SKINCOLOR_NONE,8, // SKINCOLOR_EMERALD - SKINCOLOR_RED,11, // SKINCOLOR_GREEN - SKINCOLOR_MAGENTA,3, // SKINCOLOR_ZIM - SKINCOLOR_NONE,8, // SKINCOLOR_PERIDOT - SKINCOLOR_NONE,8, // SKINCOLOR_YELLOW - SKINCOLOR_NONE,8 // SKINCOLOR_GOLD + SKINCOLOR_NONE,8, // SKINCOLOR_NONE + SKINCOLOR_BLACK,10, // SKINCOLOR_WHITE + SKINCOLOR_GREY,4, // SKINCOLOR_SILVER + SKINCOLOR_SILVER,12, // SKINCOLOR_GREY + SKINCOLOR_WHITE,8, // SKINCOLOR_BLACK + SKINCOLOR_BEIGE,8, // SKINCOLOR_BEIGE - needs new offset + SKINCOLOR_BROWN,8, // SKINCOLOR_PEACH - ditto + SKINCOLOR_PEACH,8, // SKINCOLOR_BROWN - ditto + SKINCOLOR_GREEN,5, // SKINCOLOR_RED + SKINCOLOR_CYAN,8, // SKINCOLOR_CRIMSON - ditto + SKINCOLOR_BLUE,12, // SKINCOLOR_ORANGE + SKINCOLOR_TAN,8, // SKINCOLOR_RUST - ditto + SKINCOLOR_LAVENDER,8, // SKINCOLOR_GOLD - ditto + SKINCOLOR_TEAL,8, // SKINCOLOR_YELLOW - ditto + SKINCOLOR_RUST,8, // SKINCOLOR_TAN - ditto + SKINCOLOR_MAGENTA,3, // SKINCOLOR_MOSS + SKINCOLOR_PURPLE,8, // SKINCOLOR_PERIDOT - ditto + SKINCOLOR_RED,11, // SKINCOLOR_GREEN + SKINCOLOR_PASTEL,8, // SKINCOLOR_EMERALD - ditto + SKINCOLOR_ROSY,8, // SKINCOLOR_AQUA - ditto + SKINCOLOR_YELLOW,8, // SKINCOLOR_TEAL - ditto + SKINCOLOR_CRIMSON,8, // SKINCOLOR_CYAN - ditto + SKINCOLOR_ORANGE,9, // SKINCOLOR_BLUE + SKINCOLOR_PINK,8, // SKINCOLOR_AZURE - ditto + SKINCOLOR_EMERALD,8, // SKINCOLOR_PASTEL - ditto + SKINCOLOR_PERIDOT,8, // SKINCOLOR_PURPLE - ditto + SKINCOLOR_GOLD,8, // SKINCOLOR_LAVENDER - ditto + SKINCOLOR_MOSS,8, // SKINCOLOR_MAGENTA - ditto + SKINCOLOR_AZURE,8, // SKINCOLOR_PINK - ditto + SKINCOLOR_AQUA,8 // SKINCOLOR_ROSY - ditto }; CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; @@ -242,30 +244,31 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U 0x03, // SKINCOLOR_SILVER 0x08, // SKINCOLOR_GREY 0x18, // SKINCOLOR_BLACK - 0x70, // SKINCOLOR_CYAN - 0xf8, // SKINCOLOR_AQUA - 0x7c, // SKINCOLOR_TEAL - 0x9a, // SKINCOLOR_AZURE - 0x82, // SKINCOLOR_BLUE - 0xc8, // SKINCOLOR_PEACH - 0x54, // SKINCOLOR_TAN - 0xc0, // SKINCOLOR_PINK - 0xb8, // SKINCOLOR_ROSY - 0xb0, // SKINCOLOR_LAVENDER - 0x90, // SKINCOLOR_PURPLE - 0xa3, // SKINCOLOR_MAGENTA - 0x31, // SKINCOLOR_ORANGE - 0x3a, // SKINCOLOR_RUST - 0xe0, // SKINCOLOR_BEIGE - 0xd0, // SKINCOLOR_BROWN + 0xf0, // SKINCOLOR_BEIGE + 0xd8, // SKINCOLOR_PEACH + 0xe0, // SKINCOLOR_BROWN 0x21, // SKINCOLOR_RED 0x28, // SKINCOLOR_CRIMSON - 0xf0, // SKINCOLOR_EMERALD - 0x60, // SKINCOLOR_GREEN - 0x58, // SKINCOLOR_ZIM - 0xac, // SKINCOLOR_PERIDOT - 0x48, // SKINCOLOR_YELLOW + 0x31, // SKINCOLOR_ORANGE + 0x3a, // SKINCOLOR_RUST 0x40, // SKINCOLOR_GOLD + 0x48, // SKINCOLOR_YELLOW + 0x54, // SKINCOLOR_TAN + 0x58, // SKINCOLOR_MOSS + 0xbc, // SKINCOLOR_PERIDOT + 0x60, // SKINCOLOR_GREEN + 0x70, // SKINCOLOR_EMERALD + 0x78, // SKINCOLOR_AQUA + 0x8c, // SKINCOLOR_TEAL + 0x80, // SKINCOLOR_CYAN + 0x92, // SKINCOLOR_BLUE + 0xaa, // SKINCOLOR_AZURE + 0xa0, // SKINCOLOR_PASTEL + 0xa0, // SKINCOLOR_PURPLE + 0xc0, // SKINCOLOR_LAVENDER + 0xb3, // SKINCOLOR_MAGENTA + 0xd0, // SKINCOLOR_PINK + 0xc8, // SKINCOLOR_ROSY }; INT32 i; INT32 starttranscolor; @@ -283,7 +286,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U if (skinnum == TC_BOSS) dest_colormap[31] = 0; else if (skinnum == TC_METALSONIC) - dest_colormap[143] = 0; + dest_colormap[159] = 0; return; } @@ -309,176 +312,59 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); break; + case SKINCOLOR_WHITE: case SKINCOLOR_CYAN: // 12 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (12*i/SKIN_RAMP_LENGTH)); break; - case SKINCOLOR_MAGENTA: - // 9 color ramp - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); - break; - - case SKINCOLOR_WHITE: case SKINCOLOR_BLACK: - case SKINCOLOR_PINK: + case SKINCOLOR_MOSS: + case SKINCOLOR_EMERALD: case SKINCOLOR_LAVENDER: - case SKINCOLOR_ZIM: + case SKINCOLOR_PINK: // 8 color ramp for (i = 0; i < SKIN_RAMP_LENGTH; i++) dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); break; - case SKINCOLOR_AQUA: - // 10 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (10*i/16 >= 8) - dest_colormap[starttranscolor + i] = (UINT8)(0x6C + (10*i/SKIN_RAMP_LENGTH) - 8); // Darkest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH)); - } - break; - - case SKINCOLOR_TEAL: - // 6 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (6*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xf8; // Lightest - else if (6*i/16 == 5) - dest_colormap[starttranscolor + i] = 0x7a; // Darkest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (6*i/SKIN_RAMP_LENGTH) - 1); - } - break; - - case SKINCOLOR_AZURE: - // 8 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (8*i/16 <= 1) - dest_colormap[starttranscolor + i] = (UINT8)(0x80 + 8*i/16); // Lightest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 2); // main - } - break; - - case SKINCOLOR_BLUE: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (i == 14) - dest_colormap[starttranscolor + i] = 0xED; - else if (i == 15) - dest_colormap[starttranscolor + i] = 0x1F; - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); - } - break; - - case SKINCOLOR_PEACH: - // 10 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (10*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xC0; // Lightest - else if (10*i/16 == 1) - dest_colormap[starttranscolor + i] = 0x30; // Second - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main - } - break; - - case SKINCOLOR_TAN: - // 8 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (8*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x51; // Lightest 1 - else if (8*i/16 == 5) - dest_colormap[starttranscolor + i] = 0xE5; // Darkest 1 - else if (8*i/16 == 6) - dest_colormap[starttranscolor + i] = 0xE9; // Darkest 2 - else if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0xDD; // Darkest 3 - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 1); // main - } - break; - - case SKINCOLOR_ROSY: - // 15 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (15*i/16 == 0) - dest_colormap[starttranscolor + i] = 0xEC; // Lightest - else if (15*i/16 == 12) - dest_colormap[starttranscolor + i] = 0x47; // Dark Shade - else if (15*i/16 >= 13) - dest_colormap[starttranscolor + i] = (UINT8)(0x2E + (15*i/SKIN_RAMP_LENGTH) - 13); // Darkest - else if (15*i/16 >= 9) - dest_colormap[starttranscolor + i] = (UINT8)(0x2B + (15*i/SKIN_RAMP_LENGTH) - 9); // Darkish - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (15*i/SKIN_RAMP_LENGTH) - 1); // main - } - break; - - case SKINCOLOR_PURPLE: - // 10 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (i <= 3) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); // Lightest - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) + 2); // main - } - break; - - case SKINCOLOR_ORANGE: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (i == 15) - dest_colormap[starttranscolor + i] = 0xEE; - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); - } - break; - - case SKINCOLOR_RUST: - // 9 colors - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - { - if (9*i/16 == 6) - dest_colormap[starttranscolor + i] = 0xEE; - else if (9*i/16 == 7) - dest_colormap[starttranscolor + i] = 0xEF; - else if (9*i/16 == 8) - dest_colormap[starttranscolor + i] = 0x47; - else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); - } - break; - case SKINCOLOR_BEIGE: // 13 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (13*i/16 == 12) - dest_colormap[starttranscolor + i] = 0xDD; // darkest + if (i == 15) + dest_colormap[starttranscolor + i] = 0xed; // Darkest + else if (i <= 6) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + ((i + 1) >> 1)); // Brightest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (13*i/SKIN_RAMP_LENGTH)); // Neon green + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 3); } break; - + + case SKINCOLOR_PEACH: + // 11 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 0) + dest_colormap[starttranscolor + i] = 0xD0; // Lightest 1 + else if (i == 1) + dest_colormap[starttranscolor + i] = 0x30; // Lightest 2 + else if (i <= 11) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) - 1); + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 7); // Darkest + } + break; + case SKINCOLOR_RED: + // 16 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { if (i == 13) - dest_colormap[starttranscolor + i] = 0x47; + dest_colormap[starttranscolor + i] = 0x47; // Semidark else if (i > 13) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 1); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 1); // Darkest else dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); } @@ -488,38 +374,52 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U // 9 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (9*i/16 == 6) - dest_colormap[starttranscolor + i] = 0x47; - else if (9*i/16 > 6) - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH) - 1); + if (i/2 == 6) + dest_colormap[starttranscolor + i] = 0x47; // Semidark + else if (i/2 == 7) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 8); // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (9*i/SKIN_RAMP_LENGTH)); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); } break; - case SKINCOLOR_EMERALD: - // 8 colors + case SKINCOLOR_ORANGE: for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0x6E; // Darkest + if (i == 15) + dest_colormap[starttranscolor + i] = 0x2c; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH)); // Neon green + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); } break; - case SKINCOLOR_PERIDOT: - // 8 colors + case SKINCOLOR_RUST: + // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (8*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x58; // Lightest - else if (8*i/16 == 7) - dest_colormap[starttranscolor + i] = 0x6D; // Darkest - else if (8*i/16 >= 5) - dest_colormap[starttranscolor + i] = (UINT8)(0x5E + (8*i/SKIN_RAMP_LENGTH) - 5); // Darkish + if (i <= 11) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); + else if (i == 12) + dest_colormap[starttranscolor + i] = 0x2c; // Darkest 4 + else if (i == 13) + dest_colormap[starttranscolor + i] = 0xfe; // Darkest 3 else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH) - 1); // main + dest_colormap[starttranscolor + i] = 0x2d + i - 14; // Darkest 2 and 1 + } + break; + + case SKINCOLOR_GOLD: + // 10 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 0) + dest_colormap[starttranscolor + i] = 0x50; // Lightest 1 + else if (i == 1) + dest_colormap[starttranscolor + i] = 0x53; // Lightest 2 + else if (i/2 == 7) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 8); //Darkest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) - 1); } break; @@ -530,22 +430,135 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U if (i == 0) dest_colormap[starttranscolor + i] = 0x53; // Lightest else if (i == 15) - dest_colormap[starttranscolor + i] = 0xDD; // Darkest + dest_colormap[starttranscolor + i] = 0xed; // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (8*i/SKIN_RAMP_LENGTH)); + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1)); } break; - case SKINCOLOR_GOLD: + case SKINCOLOR_TAN: + // 8 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i/2 == 0) + dest_colormap[starttranscolor + i] = 0x51; // Lightest + else if (i/2 == 5) + dest_colormap[starttranscolor + i] = 0xf5; // Darkest 1 + else if (i/2 == 6) + dest_colormap[starttranscolor + i] = 0xf9; // Darkest 2 + else if (i/2 == 7) + dest_colormap[starttranscolor + i] = 0xed; // Darkest 3 + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) - 1); + } + break; + + case SKINCOLOR_PERIDOT: + // 8 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i/2 == 0) + dest_colormap[starttranscolor + i] = 0x58; // Lightest + else if (i/2 == 7) + dest_colormap[starttranscolor + i] = 0x77; // Darkest + else if (i/2 >= 5) + dest_colormap[starttranscolor + i] = (UINT8)(0x5e + (i >> 1) - 5); // Semidark + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) - 1); + } + break; + + case SKINCOLOR_AQUA: // 10 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) { - if (10*i/16 == 0) - dest_colormap[starttranscolor + i] = 0x50; // Lightest - else if (10*i/16 == 1) - dest_colormap[starttranscolor + i] = 0x53; // Second + if (i == 0) + dest_colormap[starttranscolor + i] = 0x78; // Lightest + else if (i >= 14) + dest_colormap[starttranscolor + i] = (UINT8)(0x76 + i - 14); // Darkest else - dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (10*i/SKIN_RAMP_LENGTH) - 2); // main + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) + 1); + } + break; + + case SKINCOLOR_TEAL: + // 6 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i <= 1) + dest_colormap[starttranscolor + i] = 0x78; // Lightest + else if (i >= 13) + dest_colormap[starttranscolor + i] = 0x8a; // Darkest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + ((i - 1)/3)); + } + break; + + case SKINCOLOR_AZURE: + // 8 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i <= 3) + dest_colormap[starttranscolor + i] = (UINT8)(0x90 + i/2); // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) - 2); + } + break; + + case SKINCOLOR_BLUE: + // 16 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 15) + dest_colormap[starttranscolor + i] = 0x1F; //Darkest 1 + else if (i == 14) + dest_colormap[starttranscolor + i] = 0xfd; //Darkest 2 + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); + } + break; + + case SKINCOLOR_PASTEL: + // 10 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i >= 12) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 7); // Darkest + else if (i <= 1) + dest_colormap[starttranscolor + i] = 0x90; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) - 1); + } + break; + + case SKINCOLOR_PURPLE: + // 10 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i <= 3) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i); // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) + 2); + } + break; + + case SKINCOLOR_MAGENTA: + // 9 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + if (i == 0) + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1]); // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + (i >> 1) + 1); + break; + + case SKINCOLOR_ROSY: + // 9 colors + for (i = 0; i < SKIN_RAMP_LENGTH; i++) + { + if (i == 0) + dest_colormap[starttranscolor + i] = 0xfc; // Lightest + else + dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + ((i - 1) >> 1)); } break; @@ -612,67 +625,19 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + 15] = (UINT8)63; break; - // Super Tails + // Super Tails and Knuckles, who really should be dummied out by now case SKINCOLOR_TSUPER1: - for (i = 0; i < 10; i++) // white - dest_colormap[starttranscolor + i] = 120; - for (; i < SKIN_RAMP_LENGTH; i++) // orange - dest_colormap[starttranscolor + i] = (UINT8)(80 + (i-10)); - break; - case SKINCOLOR_TSUPER2: - for (i = 0; i < 4; i++) // white - dest_colormap[starttranscolor + i] = 120; - for (; i < SKIN_RAMP_LENGTH; i++) // orange - dest_colormap[starttranscolor + i] = (UINT8)(80 + ((i-4)>>1)); - break; - case SKINCOLOR_TSUPER3: - dest_colormap[starttranscolor] = 120; // pure white - dest_colormap[starttranscolor+1] = 120; - for (i = 2; i < SKIN_RAMP_LENGTH; i++) // orange - dest_colormap[starttranscolor + i] = (UINT8)(80 + ((i-2)>>1)); - break; - case SKINCOLOR_TSUPER4: - dest_colormap[starttranscolor] = 120; // pure white - for (i = 1; i < 9; i++) // orange - dest_colormap[starttranscolor + i] = (UINT8)(80 + (i-1)); - for (; i < SKIN_RAMP_LENGTH; i++) // gold - dest_colormap[starttranscolor + i] = (UINT8)(115 + (5*(i-9)/7)); - break; - case SKINCOLOR_TSUPER5: - for (i = 0; i < 8; i++) // orange - dest_colormap[starttranscolor + i] = (UINT8)(80 + i); - for (; i < SKIN_RAMP_LENGTH; i++) // gold - dest_colormap[starttranscolor + i] = (UINT8)(115 + (5*(i-8)/8)); - break; - - // Super Knuckles case SKINCOLOR_KSUPER1: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(120 + (i >> 2)); - break; - case SKINCOLOR_KSUPER2: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(120 + (6*i/SKIN_RAMP_LENGTH)); - break; - case SKINCOLOR_KSUPER3: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(120 + (i >> 1)); - break; - case SKINCOLOR_KSUPER4: - for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(121 + (i >> 1)); - break; - case SKINCOLOR_KSUPER5: for (i = 0; i < SKIN_RAMP_LENGTH; i++) - dest_colormap[starttranscolor + i] = (UINT8)(122 + (i >> 1)); + dest_colormap[starttranscolor + i] = 0xFF; break; default: @@ -986,3 +951,4 @@ void R_DrawViewBorder(void) // ========================================================================== #include "r_draw16.c" + diff --git a/src/r_draw8.c b/src/r_draw8.c index e0264ba92..d6c109574 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -105,7 +105,7 @@ void R_DrawColumn_8(void) } } -#define TRANSPARENTPIXEL 247 +#define TRANSPARENTPIXEL 255 void R_Draw2sMultiPatchColumn_8(void) { @@ -947,3 +947,4 @@ void R_DrawColumnShadowed_8(void) if (dc_yl <= realyh) walldrawerfunc(); // R_DrawWallColumn_8 for the appropriate architecture } + From 5409367a5f56434cf9fe0ada86958a492a29e4db Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 7 Nov 2015 15:32:11 -0600 Subject: [PATCH 130/364] Define TRANSPARENTPIXEL as 255 in asm files --- src/tmap.nas | 2 +- src/tmap_mmx.nas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tmap.nas b/src/tmap.nas index 6d1629c20..dbe64806d 100644 --- a/src/tmap.nas +++ b/src/tmap.nas @@ -17,7 +17,7 @@ [BITS 32] %define FRACBITS 16 -%define TRANSPARENTPIXEL 247 +%define TRANSPARENTPIXEL 255 %ifdef LINUX %macro cextern 1 diff --git a/src/tmap_mmx.nas b/src/tmap_mmx.nas index 928916668..758cd4395 100644 --- a/src/tmap_mmx.nas +++ b/src/tmap_mmx.nas @@ -18,7 +18,7 @@ [BITS 32] %define FRACBITS 16 -%define TRANSPARENTPIXEL 247 +%define TRANSPARENTPIXEL 255 %ifdef LINUX %macro cextern 1 From fed463f1d24a150fe4d56221f7c807c1d4089e0b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 8 Nov 2015 17:50:05 +0000 Subject: [PATCH 131/364] NextLevel for level headers can now take the special strings "Title" "Evaluation" or "Credits" in place of their usual numbers (optionally, that is) --- src/dehacked.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 0ba054f07..795157264 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1132,6 +1132,10 @@ static void readlevelheader(MYFILE *f, INT32 num) } else if (fastcmp(word, "NEXTLEVEL")) { + if (fastcmp(word2, "TITLE")) i = 1100; + else if (fastcmp(word2, "EVALUATION")) i = 1101; + else if (fastcmp(word2, "CREDITS")) i = 1102; + else // Support using the actual map name, // i.e., Nextlevel = AB, Nextlevel = FZ, etc. From 2b6e65f122b00528eb9fd11222ee6ef2d5ac7795 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Mon, 9 Nov 2015 16:45:35 -0500 Subject: [PATCH 132/364] Added missing comma to COLOR_ENUMS string array after "ROSY". It's not SKINCOLOR_ROSYSUPER1, after all. --- src/dehacked.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6905d8379..d5b808e35 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7337,7 +7337,7 @@ static const char *COLOR_ENUMS[] = { "LAVENDER", // SKINCOLOR_LAVENDER "MAGENTA", // SKINCOLOR_MAGENTA "PINK", // SKINCOLOR_PINK - "ROSY" // SKINCOLOR_ROSY + "ROSY", // SKINCOLOR_ROSY // Super special awesome Super flashing colors! "SUPER1", // SKINCOLOR_SUPER1 "SUPER2", // SKINCOLOR_SUPER2, From f6eac1a6accf0e7203c2467453b4f08a9947a120 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 16:39:32 +0000 Subject: [PATCH 133/364] large dispoffset values no longer cause sprites to be distorted more detailed description: vissprites now store dispoffset in a separate variable from (y)scale, and uses it to influence order between sprites without it affecting the actual drawing of the sprites themselves --- src/r_things.c | 17 ++++++++++++++--- src/r_things.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 60fbad1af..dff0317fb 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1266,7 +1266,8 @@ static void R_ProjectSprite(mobj_t *thing) vis = R_NewVisSprite(); vis->heightsec = heightsec; //SoM: 3/17/2000 vis->mobjflags = thing->flags; - vis->scale = yscale + thing->info->dispoffset; //<scale = yscale; //<dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15 vis->gx = thing->x; vis->gy = thing->y; vis->gz = gz; @@ -1482,6 +1483,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) // store information in a vissprite vis = R_NewVisSprite(); vis->scale = yscale; //<dispoffset = 0; // Monster Iestyn: 23/11/15 vis->gx = thing->x; vis->gy = thing->y; vis->gz = gz; @@ -1633,6 +1635,7 @@ void R_SortVisSprites(void) vissprite_t *best = NULL; vissprite_t unsorted; fixed_t bestscale; + INT32 bestdispoffset; if (!visspritecount) return; @@ -1663,12 +1666,19 @@ void R_SortVisSprites(void) vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead; for (i = 0; i < visspritecount; i++) { - bestscale = INT32_MAX; + bestscale = bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->scale < bestscale) { bestscale = ds->scale; + bestdispoffset = ds->dispoffset; + best = ds; + } + // order visprites of same scale by dispoffset, smallest first + else if (ds->scale == bestscale && ds->dispoffset < bestdispoffset) + { + bestdispoffset = ds->dispoffset; best = ds; } } @@ -1920,7 +1930,8 @@ static void R_CreateDrawNodes(void) if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt) continue; - if (r2->sprite->scale > rover->scale) + if (r2->sprite->scale > rover->scale + || (r2->sprite->scale == rover->scale && r2->sprite->dispoffset > rover->dispoffset)) { entry = R_CreateDrawNode(NULL); (entry->prev = r2->prev)->next = entry; diff --git a/src/r_things.h b/src/r_things.h index 054a6497d..3e2d13fd7 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -162,6 +162,7 @@ typedef struct vissprite_s boolean precip; boolean vflip; // Flip vertically boolean isScaled; + INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } vissprite_t; // A drawnode is something that points to a 3D floor, 3D side, or masked From 30ef257050cb91edb6452655d17792330347f4b6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 17:01:10 +0000 Subject: [PATCH 134/364] dispoffset now works in OpenGL --- src/hardware/hw_glob.h | 1 + src/hardware/hw_main.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 88786bc11..83dff02f8 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -79,6 +79,7 @@ typedef struct gr_vissprite_s boolean vflip; //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; + INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 820eb25fc..0574a5719 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3998,6 +3998,7 @@ static void HWR_SortVisSprites(void) gr_vissprite_t *best = NULL; gr_vissprite_t unsorted; float bestdist; + INT32 bestdispoffset; if (!gr_visspritecount) return; @@ -4025,11 +4026,19 @@ static void HWR_SortVisSprites(void) for (i = 0; i < gr_visspritecount; i++) { bestdist = ZCLIP_PLANE-1; + bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->tz > bestdist) { bestdist = ds->tz; + bestdispoffset = ds->dispoffset; + best = ds; + } + // order visprites of same scale by dispoffset, smallest first + else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset) + { + bestdispoffset = ds->dispoffset; best = ds; } } @@ -4653,6 +4662,7 @@ static void HWR_ProjectSprite(mobj_t *thing) #endif vis->x2 = tx; vis->tz = tz; + vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = thing; @@ -4769,6 +4779,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) vis->x1 = x1; vis->x2 = tx; vis->tz = tz; + vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = (mobj_t *)thing; From bb9488f2a2665690076d5d205f6fe89169865d77 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 21:04:33 +0000 Subject: [PATCH 135/364] Removed a few old OpenGL-specific hacks that compensated for lack of dispoffset (I won't touch overlays for now) --- src/p_mobj.c | 26 ++------------------------ src/p_user.c | 25 +------------------------ 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 915c742e8..9bf2049c6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5924,8 +5924,6 @@ static void P_NightsItemChase(mobj_t *thing) static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) { - fixed_t destx, desty; - if (!thing->target || thing->target->health <= 0 || !thing->target->player || (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super] || thing->target->player->powers[pw_invulnerability] > 1) @@ -5950,26 +5948,6 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return false; } - if (!splitscreen && rendermode != render_soft) - { - angle_t viewingangle; - - if (players[displayplayer].awayviewtics) - viewingangle = R_PointToAngle2(thing->target->x, thing->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); - else if (!camera.chase && players[displayplayer].mo) - viewingangle = R_PointToAngle2(thing->target->x, thing->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y); - else - viewingangle = R_PointToAngle2(thing->target->x, thing->target->y, camera.x, camera.y); - - destx = thing->target->x + P_ReturnThrustX(thing->target, viewingangle, FixedMul(FRACUNIT, thing->scale)); - desty = thing->target->y + P_ReturnThrustY(thing->target, viewingangle, FixedMul(FRACUNIT, thing->scale)); - } - else - { - destx = thing->target->x; - desty = thing->target->y; - } - if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & 0xFF)) { thing->movecount = (thing->target->player->powers[pw_shield] & 0xFF); @@ -5994,8 +5972,8 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) P_SetScale(thing, thing->target->scale); P_UnsetThingPosition(thing); - thing->x = destx; - thing->y = desty; + thing->x = thing->target->x; + thing->y = thing->target->y; if (thing->eflags & MFE_VERTICALFLIP) thing->z = thing->target->z + thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) - FixedMul(2*FRACUNIT, thing->target->scale); else diff --git a/src/p_user.c b/src/p_user.c index 8854d8d64..51318f674 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2115,30 +2115,7 @@ static void P_CheckInvincibilityTimer(player_t *player) player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); else if (leveltime % (TICRATE/7) == 0) { - fixed_t destx, desty; - mobj_t *sparkle; - - if (!splitscreen && rendermode != render_soft) - { - angle_t viewingangle; - - if (players[displayplayer].awayviewtics) - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); - else if (!camera.chase && players[displayplayer].mo) - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].mo->x, players[displayplayer].mo->y); - else - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, camera.x, camera.y); - - destx = player->mo->x + P_ReturnThrustX(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); - desty = player->mo->y + P_ReturnThrustY(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); - } - else - { - destx = player->mo->x; - desty = player->mo->y; - } - - sparkle = P_SpawnMobj(destx, desty, player->mo->z, MT_IVSP); + mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP); sparkle->destscale = player->mo->scale; P_SetScale(sparkle, player->mo->scale); } From e0e9c7c1720d11ac6e6dd9826d518beaee9d7a86 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Dec 2015 22:38:57 +0000 Subject: [PATCH 136/364] Added missing SHORT macros around these variables, they're needed for big-endian builds to use these properly ...I'm to blame for this particular slipup as it happens, surprise surprise --- src/p_saveg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 07e7b3564..f329ab758 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -636,7 +636,7 @@ static void P_NetArchiveWorld(void) if (li->special != SHORT(mld->special)) diff |= LD_SPECIAL; - if (mld->special == 321 || mld->special == 322) // only reason li->callcount would be non-zero is if either of these are involved + if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved diff |= LD_CLLCOUNT; if (li->sidenum[0] != 0xffff) From b9b1e2b2984966445bcd7155394c34ef65b61dbb Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 2 Jan 2016 21:53:43 -0600 Subject: [PATCH 137/364] Fix MD2s --- src/hardware/hw_md2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 67720231c..77795ccc0 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1085,7 +1085,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (!cv_grmd2.value) return; - if (!spr->precip) + if (spr->precip) return; // MD2 colormap fix From b043520411016d482b5f8b6275478f6250fe2404 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 8 Nov 2015 17:50:05 +0000 Subject: [PATCH 138/364] NextLevel for level headers can now take the special strings "Title" "Evaluation" or "Credits" in place of their usual numbers (optionally, that is) --- src/dehacked.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 6b7900f76..44ef998ac 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1132,6 +1132,10 @@ static void readlevelheader(MYFILE *f, INT32 num) } else if (fastcmp(word, "NEXTLEVEL")) { + if (fastcmp(word2, "TITLE")) i = 1100; + else if (fastcmp(word2, "EVALUATION")) i = 1101; + else if (fastcmp(word2, "CREDITS")) i = 1102; + else // Support using the actual map name, // i.e., Nextlevel = AB, Nextlevel = FZ, etc. From 8cad9a6dc87931df736b3e527a862021005ba0c2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Oct 2015 17:57:35 +0100 Subject: [PATCH 139/364] We can compile the slopes code now, yay! My brain hurts. Compiling errors fixed in this commit: * Various cases of mixed declaration and statement code * Implicit declaration of slope functions (read: you forgot to put "include "p_slopes.h" in MORE than a few places) * an odd case of a bad fixed_t to float typecase, cause by using P_GetZAt directly inside FIXED_TO_FLOAT * a few minor cases of bad unsigned-signed comparisons * no prototypes for some of the new slope functions. For goodness sake Red, this is basic stuff! --- src/p_map.c | 16 +++++--- src/p_maputl.c | 21 ++++++---- src/p_mobj.c | 10 +++-- src/p_slopes.c | 34 +++++++++-------- src/p_slopes.h | 5 +++ src/p_spec.c | 5 ++- src/p_user.c | 3 +- src/r_bsp.c | 1 + src/r_draw.h | 7 ++-- src/r_draw8.c | 101 +++++++++++++++++++++++++++---------------------- src/r_plane.c | 17 +++++++-- src/r_segs.c | 9 ++++- src/r_things.c | 1 + 13 files changed, 140 insertions(+), 90 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index c4dafe81d..224ed31bf 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1245,11 +1245,13 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; + if (!(rover->flags & FF_EXISTS)) continue; - fixed_t topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); - fixed_t bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); + topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); + bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY)) { @@ -1549,11 +1551,12 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); - fixed_t bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); + topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); + bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, x, y, NULL); delta1 = thiscam->z - (bottomheight + ((topheight - bottomheight)/2)); @@ -3943,14 +3946,15 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height) for (rover = sec->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; if ((!(rover->flags & FF_SOLID || rover->flags & FF_QUICKSAND) || (rover->flags & FF_SWIMMABLE))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) diff --git a/src/p_maputl.c b/src/p_maputl.c index c9a42bd43..8f349a2a9 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -20,6 +20,7 @@ #include "r_data.h" #include "p_maputl.h" #include "p_polyobj.h" +#include "p_slopes.h" #include "z_zone.h" // @@ -442,11 +443,12 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors) for (rover = front->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); + topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); + bottomheight = P_CameraGetFOFBottomZ(mapcampointer, front, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -465,11 +467,12 @@ void P_CameraLineOpening(line_t *linedef) if (back->ffloors) for (rover = back->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) continue; - fixed_t topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); + topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); + bottomheight = P_CameraGetFOFBottomZ(mapcampointer, back, rover, tmx, tmy, linedef); delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -636,6 +639,7 @@ void P_LineOpening(line_t *linedef) // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; @@ -645,8 +649,8 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); + bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); @@ -679,6 +683,7 @@ void P_LineOpening(line_t *linedef) // Check for backsectors fake floors for (rover = back->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; @@ -688,8 +693,8 @@ void P_LineOpening(line_t *linedef) || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) continue; - fixed_t topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); - fixed_t bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); + bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); diff --git a/src/p_mobj.c b/src/p_mobj.c index 324989067..fd5b2d455 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -696,6 +696,7 @@ void P_ExplodeMissile(mobj_t *mo) // Returns TRUE if mobj is inside a non-solid 3d floor. boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) return false; @@ -703,8 +704,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) return false; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) @@ -3006,13 +3007,14 @@ void P_MobjCheckWater(mobj_t *mobj) for (rover = sector->ffloors; rover; rover = rover->next) { + fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || (((rover->flags & FF_BLOCKPLAYER) && mobj->player) || ((rover->flags & FF_BLOCKOTHERS) && !mobj->player))) continue; - fixed_t topheight = *rover->topheight; - fixed_t bottomheight = *rover->bottomheight; + topheight = *rover->topheight; + bottomheight = *rover->bottomheight; #ifdef ESLOPE if (*rover->t_slope) diff --git a/src/p_slopes.c b/src/p_slopes.c index bb150944e..755939039 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -32,6 +32,7 @@ #include "r_state.h" #include "m_bbox.h" #include "z_zone.h" +#include "p_local.h" #include "p_spec.h" #include "p_slopes.h" #include "p_setup.h" @@ -140,7 +141,8 @@ void P_RunDynamicSlopes(void) { case 5: // vertices { mapthing_t *mt; - size_t i, l; + size_t i; + INT32 l; line_t *line; for (i = 0; i < 3; i++) { @@ -322,7 +324,8 @@ void P_SpawnSlope_Line(int linenum) if(frontfloor) { - + fixed_t highest, lowest; + size_t l; point.z = line->frontsector->floorheight; // Startz dz = FixedDiv(origin.z - point.z, extent); // Destinationz @@ -351,12 +354,11 @@ void P_SpawnSlope_Line(int linenum) // *You can use sourceline as a reference to see if two slopes really are the same // Default points for high and low - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; // Now check to see what the REAL high and low points of the slope inside the sector // TODO: Is this really needed outside of FOFs? -Red - size_t l; for (l = 0; l < line->frontsector->linecount; l++) { @@ -380,6 +382,8 @@ void P_SpawnSlope_Line(int linenum) } if(frontceil) { + fixed_t highest, lowest; + size_t l; origin.z = line->backsector->ceilingheight; point.z = line->frontsector->ceilingheight; dz = FixedDiv(origin.z - point.z, extent); @@ -396,9 +400,8 @@ void P_SpawnSlope_Line(int linenum) cslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->frontsector->linecount; l++) { @@ -446,6 +449,8 @@ void P_SpawnSlope_Line(int linenum) if(backfloor) { + fixed_t highest, lowest; + size_t l; point.z = line->backsector->floorheight; dz = FixedDiv(origin.z - point.z, extent); @@ -461,9 +466,8 @@ void P_SpawnSlope_Line(int linenum) fslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->backsector->linecount; l++) { @@ -487,6 +491,8 @@ void P_SpawnSlope_Line(int linenum) } if(backceil) { + fixed_t highest, lowest; + size_t l; origin.z = line->frontsector->ceilingheight; point.z = line->backsector->ceilingheight; dz = FixedDiv(origin.z - point.z, extent); @@ -503,10 +509,8 @@ void P_SpawnSlope_Line(int linenum) cslope->sourceline = line; // Remember the way the slope is formed - fixed_t highest = point.z > origin.z ? point.z : origin.z; - fixed_t lowest = point.z < origin.z ? point.z : origin.z; - - size_t l; + highest = point.z > origin.z ? point.z : origin.z; + lowest = point.z < origin.z ? point.z : origin.z; for (l = 0; l < line->backsector->linecount; l++) { diff --git a/src/p_slopes.h b/src/p_slopes.h index 8d82632ff..f2d1cd81e 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -29,6 +29,9 @@ #define P_SLOPES_H__ #ifdef ESLOPE +void P_CalculateSlopeNormal(pslope_t *slope); +void P_ReconfigureVertexSlope(pslope_t *slope); + void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); // P_SpawnSlope_Line @@ -36,6 +39,8 @@ void P_RunDynamicSlopes(void); // sectors. void P_SpawnSlope_Line(int linenum); +pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags); + #ifdef SPRINGCLEAN // Loads just map objects that make slopes, // terrain affecting objects have to be spawned first diff --git a/src/p_spec.c b/src/p_spec.c index 694893502..3f39bd08e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -29,6 +29,7 @@ #include "r_main.h" //Two extra includes. #include "r_sky.h" #include "p_polyobj.h" +#include "p_slopes.h" #include "hu_stuff.h" #include "m_misc.h" #include "m_cond.h" //unlock triggers @@ -7043,7 +7044,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 */ void T_Friction(friction_t *f) { - sector_t *sec, *referrer; + sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; @@ -7371,7 +7372,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) */ void T_Pusher(pusher_t *p) { - sector_t *sec, *referrer; + sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; INT32 xspeed = 0,yspeed = 0; diff --git a/src/p_user.c b/src/p_user.c index b0eb2a224..d693cb277 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -29,6 +29,7 @@ #include "m_random.h" #include "m_misc.h" #include "i_video.h" +#include "p_slopes.h" #include "p_spec.h" #include "r_splats.h" #include "z_zone.h" @@ -2317,11 +2318,11 @@ static void P_DoClimbing(player_t *player) boolean thrust; boolean boostup; boolean skyclimber; + fixed_t floorheight, ceilingheight; // ESLOPE thrust = false; floorclimb = false; boostup = false; skyclimber = false; - fixed_t floorheight, ceilingheight; // ESLOPE #ifdef ESLOPE floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) diff --git a/src/r_bsp.c b/src/r_bsp.c index 503b2e1f0..badf8bdac 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -18,6 +18,7 @@ #include "r_splats.h" #include "p_local.h" // camera +#include "p_slopes.h" #include "z_zone.h" // Check R_Prep3DFloors seg_t *curline; diff --git a/src/r_draw.h b/src/r_draw.h index 63fecc046..0ece26487 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -65,9 +65,9 @@ typedef struct { float x, y, z; } floatv3_t; -pslope_t *ds_slope; // Current slope being used -floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? -float focallengthf, zeroheight; +extern pslope_t *ds_slope; // Current slope being used +extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff? +extern float focallengthf, zeroheight; #endif // Variable flat sizes @@ -152,6 +152,7 @@ void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); void R_DrawSpan_8(void); #ifdef ESLOPE +void R_CalcTiltedLighting(fixed_t start, fixed_t end); void R_DrawTiltedSpan_8(void); void R_DrawTiltedTranslucentSpan_8(void); void R_DrawTiltedSplat_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index f78f1494b..2a4c89be7 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -529,14 +529,14 @@ void R_DrawSpan_8 (void) #ifdef ESLOPE // R_CalcTiltedLighting // Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly. -static size_t tiltlighting[MAXVIDWIDTH]; +static INT32 tiltlighting[MAXVIDWIDTH]; void R_CalcTiltedLighting(fixed_t start, fixed_t end) { // ZDoom uses a different lighting setup to us, and I couldn't figure out how to adapt their version // of this function. Here's my own. INT32 left = ds_x1, right = ds_x2; fixed_t step = (end-start)/(ds_x2-ds_x1+1); - size_t i; + INT32 i; // I wanna do some optimizing by checking for out-of-range segments on either side to fill in all at once, // but I'm too bad at coding to not crash the game trying to do that. I guess this is fast enough for now... @@ -566,6 +566,11 @@ void R_DrawTiltedSpan_8(void) UINT8 *colormap; UINT8 *dest; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -608,10 +613,9 @@ void R_DrawTiltedSpan_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -625,11 +629,11 @@ void R_DrawTiltedSpan_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -661,12 +665,12 @@ void R_DrawTiltedSpan_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -683,7 +687,6 @@ void R_DrawTiltedSpan_8(void) #endif } - /** \brief The R_DrawTiltedTranslucentSpan_8 function Like DrawTiltedSpan, but translucent */ @@ -699,6 +702,11 @@ void R_DrawTiltedTranslucentSpan_8(void) UINT8 *colormap; UINT8 *dest; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -741,10 +749,9 @@ void R_DrawTiltedTranslucentSpan_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -758,11 +765,11 @@ void R_DrawTiltedTranslucentSpan_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -794,12 +801,12 @@ void R_DrawTiltedTranslucentSpan_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -830,6 +837,11 @@ void R_DrawTiltedSplat_8(void) UINT8 val; + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); // Lighting is simple. It's just linear interpolation from start to end @@ -874,10 +886,9 @@ void R_DrawTiltedSplat_8(void) #define SPANSIZE 16 #define INVSPAN 0.0625f - double startz = 1.f/iz; - double startu = uz*startz; - double startv = vz*startz; - double izstep, uzstep, vzstep; + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; izstep = ds_sz.x * SPANSIZE; uzstep = ds_su.x * SPANSIZE; @@ -891,11 +902,11 @@ void R_DrawTiltedSplat_8(void) uz += uzstep; vz += vzstep; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; - UINT32 stepu = (INT64)((endu - startu) * INVSPAN); - UINT32 stepv = (INT64)((endv - startv) * INVSPAN); + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; @@ -931,12 +942,12 @@ void R_DrawTiltedSplat_8(void) uz += ds_su.x * left; vz += ds_sv.x * left; - double endz = 1.f/iz; - double endu = uz*endz; - double endv = vz*endz; + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; left = 1.f/left; - UINT32 stepu = (INT64)((endu - startu) * left); - UINT32 stepv = (INT64)((endv - startv) * left); + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); u = (INT64)(startu) + viewx; v = (INT64)(startv) + viewy; diff --git a/src/r_plane.c b/src/r_plane.c index 406a38d7b..fa0e0eac3 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -28,6 +28,8 @@ #include "p_setup.h" // levelflats +#include "p_slopes.h" + // // opening // @@ -952,6 +954,9 @@ void R_DrawSinglePlane(visplane_t *pl) float ang; float vx, vy, vz; float fudge; + // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly + // use this as a temp var to store P_GetZAt's return value each time + fixed_t temp; xoffs &= ((1 << (32-nflatshiftup))-1); yoffs &= ((1 << (32-nflatshiftup))-1); @@ -969,7 +974,8 @@ void R_DrawSinglePlane(visplane_t *pl) vy = FIXED_TO_FLOAT(viewy-yoffs); vz = FIXED_TO_FLOAT(viewz); - zeroheight = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx, viewy)); + temp = P_GetZAt(pl->slope, viewx, viewy); + zeroheight = FIXED_TO_FLOAT(temp); #define ANG2RAD(angle) ((float)((angle)*M_PI)/ANGLE_180) @@ -979,7 +985,8 @@ void R_DrawSinglePlane(visplane_t *pl) ang = ANG2RAD(ANGLE_270 - viewangle); p.x = vx * cos(ang) - vy * sin(ang); p.z = vx * sin(ang) + vy * cos(ang); - p.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, -xoffs, yoffs)) - vz; + temp = P_GetZAt(pl->slope, -xoffs, yoffs); + p.y = FIXED_TO_FLOAT(temp) - vz; // m is the v direction vector in view space ang = ANG2RAD(ANGLE_180 - viewangle - pl->plangle); @@ -991,8 +998,10 @@ void R_DrawSinglePlane(visplane_t *pl) n.z = -cos(ang); ang = ANG2RAD(pl->plangle); - m.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang)))) - zeroheight; - n.y = FIXED_TO_FLOAT(P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang)))) - zeroheight; + temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(sin(ang)), viewy + FLOAT_TO_FIXED(cos(ang))); + m.y = FIXED_TO_FLOAT(temp) - zeroheight; + temp = P_GetZAt(pl->slope, viewx + FLOAT_TO_FIXED(cos(ang)), viewy - FLOAT_TO_FIXED(sin(ang))); + n.y = FIXED_TO_FLOAT(temp) - zeroheight; m.x /= fudge; m.y /= fudge; diff --git a/src/r_segs.c b/src/r_segs.c index 2d41d702c..75e7b8b98 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -22,6 +22,7 @@ #include "d_netcmd.h" #include "m_misc.h" #include "p_local.h" // Camera... +#include "p_slopes.h" #include "console.h" // con_clipviewtop // OPTIMIZE: closed two sided lines as single sided @@ -1489,7 +1490,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) fixed_t hyp; fixed_t sineval; angle_t distangle, offsetangle; - fixed_t vtop; + //fixed_t vtop; INT32 lightnum; INT32 i, p; lightlist_t *light; @@ -1502,6 +1503,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) maskedtextureheight = NULL; + //initialize segleft and segright + memset(&segleft, 0x00, sizeof(segleft)); + memset(&segright, 0x00, sizeof(segright)); + if (ds_p == drawsegs+maxdrawsegs) { size_t pos = ds_p - drawsegs; @@ -2630,11 +2635,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) { ffloor_t * rover; - i = 0; #ifdef ESLOPE fixed_t rovertest; fixed_t planevistest; #endif + i = 0; if (backsector->ffloors) { diff --git a/src/r_things.c b/src/r_things.c index 3a38eb482..85221dce2 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -24,6 +24,7 @@ #include "r_plane.h" #include "p_tick.h" #include "p_local.h" +#include "p_slopes.h" #include "dehacked.h" // get_number (for thok) #include "d_netfil.h" // blargh. for nameonly(). #include "m_cheat.h" // objectplace From 6929b6fe4bb13451fd3ecb89cc63cddaf22af9a2 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 3 Jan 2016 10:33:45 -0600 Subject: [PATCH 140/364] Make internal slope functions static and remove from header --- src/p_slopes.c | 6 +++--- src/p_slopes.h | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 755939039..2d55cf194 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -46,14 +46,14 @@ static pslope_t *slopelist = NULL; static UINT16 slopecount = 0; // Calculate line normal -void P_CalculateSlopeNormal(pslope_t *slope) { +static void P_CalculateSlopeNormal(pslope_t *slope) { slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT); slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x); slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y); } // With a vertex slope that has its vertices set, configure relevant slope info -void P_ReconfigureVertexSlope(pslope_t *slope) +static void P_ReconfigureVertexSlope(pslope_t *slope) { vector3_t vec1, vec2; @@ -543,7 +543,7 @@ void P_SpawnSlope_Line(int linenum) // // Creates a new slope from three vertices with the specified IDs // -pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags) +static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags) { size_t i; mapthing_t *mt = mapthings; diff --git a/src/p_slopes.h b/src/p_slopes.h index f2d1cd81e..8d82632ff 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -29,9 +29,6 @@ #define P_SLOPES_H__ #ifdef ESLOPE -void P_CalculateSlopeNormal(pslope_t *slope); -void P_ReconfigureVertexSlope(pslope_t *slope); - void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); // P_SpawnSlope_Line @@ -39,8 +36,6 @@ void P_RunDynamicSlopes(void); // sectors. void P_SpawnSlope_Line(int linenum); -pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags); - #ifdef SPRINGCLEAN // Loads just map objects that make slopes, // terrain affecting objects have to be spawned first From 27b65e35698707e5e25103d9d46d8709b159977c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 3 Jan 2016 18:19:11 +0000 Subject: [PATCH 141/364] Several changes to split jump anims from spin anims: * SPR2_JUMP and SPR2_SJMP are now the jump sprite sets for spin chars * SPR2_SPNG and SPR2_SSPG are the new sprite sets for spring up anims (instead of JUMP/SJMP) * S_PLAY_JUMP and S_PLAY_SUPER_JUMP are now the states for spin char jumps * S_PLAY_SPRING and S_PLAY_SUPER_SPRING are the new states for spring up (instead of the "JUMP" states) * PA_JUMP is now PA_SPRING (jumping anims are lumped with PA_ROLL) --- src/d_player.h | 2 +- src/dehacked.c | 4 +++- src/info.c | 8 ++++++-- src/info.h | 8 ++++++-- src/p_map.c | 6 +++--- src/p_mobj.c | 22 +++++++++++++++++----- src/p_user.c | 43 ++++++++++++++++++++++--------------------- 7 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e2a1081b0..2425ea1bd 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -166,7 +166,7 @@ typedef enum PA_RUN, PA_PAIN, PA_ROLL, - PA_JUMP, + PA_SPRING, PA_FALL, PA_ABILITY, PA_RIDE diff --git a/src/dehacked.c b/src/dehacked.c index 0ba054f07..d5240f9c9 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3755,6 +3755,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_DASH", "S_PLAY_GASP", "S_PLAY_JUMP", + "S_PLAY_SPRING", "S_PLAY_FALL", "S_PLAY_EDGE", "S_PLAY_RIDE", @@ -3779,6 +3780,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_SUPER_SPIN", "S_PLAY_SUPER_GASP", "S_PLAY_SUPER_JUMP", + "S_PLAY_SUPER_SPRING", "S_PLAY_SUPER_FALL", "S_PLAY_SUPER_EDGE", "S_PLAY_SUPER_RIDE", @@ -7675,7 +7677,7 @@ struct { {"PA_RUN",PA_RUN}, {"PA_PAIN",PA_PAIN}, {"PA_ROLL",PA_ROLL}, - {"PA_JUMP",PA_JUMP}, + {"PA_SPRING",PA_SPRING}, {"PA_FALL",PA_FALL}, {"PA_ABILITY",PA_ABILITY}, {"PA_RIDE",PA_RIDE}, diff --git a/src/info.c b/src/info.c index 8d7c249ad..ed9bff286 100644 --- a/src/info.c +++ b/src/info.c @@ -69,6 +69,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "DASH", "GASP", "JUMP", + "SPNG", "FALL", "EDGE", "RIDE", @@ -94,6 +95,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "SSPN", "SGSP", "SJMP", + "SSPG", "SFAL", "SEDG", "SRID", @@ -135,7 +137,8 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN {SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH {SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP - {SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP + {SPR_PLAY, SPR2_JUMP, 1, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP + {SPR_PLAY, SPR2_SPNG, 2, {NULL}, 0, 0, S_PLAY_SPRING}, // S_PLAY_SPRING {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL {SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE @@ -159,7 +162,8 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SDRN, 4, {NULL}, 0, 0, S_PLAY_SUPER_DRWN}, // S_PLAY_SUPER_DRWN {SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN {SPR_PLAY, SPR2_SGSP, 14, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP - {SPR_PLAY, SPR2_SJMP, 2, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP + {SPR_PLAY, SPR2_SJMP, 1, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP + {SPR_PLAY, SPR2_SSPG, 2, {NULL}, 0, 0, S_PLAY_SUPER_SPRING}, // S_PLAY_SUPER_SPRING {SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE {SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE diff --git a/src/info.h b/src/info.h index e313526b9..306b928e5 100644 --- a/src/info.h +++ b/src/info.h @@ -588,6 +588,7 @@ enum playersprite SPR2_DASH, SPR2_GASP, SPR2_JUMP, + SPR2_SPNG, // spring SPR2_FALL, SPR2_EDGE, SPR2_RIDE, @@ -613,6 +614,7 @@ enum playersprite SPR2_SSPN, SPR2_SGSP, SPR2_SJMP, + SPR2_SSPG, SPR2_SFAL, SPR2_SEDG, SPR2_SRID, @@ -649,7 +651,8 @@ typedef enum state S_PLAY_SPIN, S_PLAY_DASH, S_PLAY_GASP, - S_PLAY_JUMP, + S_PLAY_JUMP, // spin jump (todo: make jump separate from spring up for non-spin chars too?) + S_PLAY_SPRING, S_PLAY_FALL, S_PLAY_EDGE, S_PLAY_RIDE, @@ -673,7 +676,8 @@ typedef enum state S_PLAY_SUPER_DRWN, S_PLAY_SUPER_SPIN, S_PLAY_SUPER_GASP, - S_PLAY_SUPER_JUMP, + S_PLAY_SUPER_JUMP, // see note above + S_PLAY_SUPER_SPRING, S_PLAY_SUPER_FALL, S_PLAY_SUPER_EDGE, S_PLAY_SUPER_RIDE, diff --git a/src/p_map.c b/src/p_map.c index 214048fb3..2f9824641 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -199,7 +199,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) P_ResetPlayer(object->player); if (P_MobjFlip(object)*vertispeed > 0) - P_SetPlayerMobjState(object, S_PLAY_JUMP); + P_SetPlayerMobjState(object, S_PLAY_SPRING); else if (P_MobjFlip(object)*vertispeed < 0) P_SetPlayerMobjState(object, S_PLAY_FALL); else // horizontal spring @@ -213,7 +213,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance) { object->player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(object, S_PLAY_SPIN); + P_SetPlayerMobjState(object, S_PLAY_JUMP); } } return true; @@ -1929,7 +1929,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Don't 'step up' while springing, // Only step up "if needed". - if (thing->player->panim == PA_JUMP + if (thing->player->panim == PA_SPRING && P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale)) maxstep = 0; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 915c742e8..6ee020c2a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -163,7 +163,11 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case S_PLAY_GASP: return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_GASP); case S_PLAY_JUMP: + if (!(player->charflags & SF_SUPERSPIN)) + return true; return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_JUMP); + case S_PLAY_SPRING: + return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_SPRING); case S_PLAY_FALL: return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_FALL); case S_PLAY_EDGE: @@ -209,12 +213,14 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case S_PLAY_SPIN: case S_PLAY_DASH: + case S_PLAY_JUMP: case S_PLAY_SUPER_SPIN: + case S_PLAY_SUPER_JUMP: player->panim = PA_ROLL; break; - case S_PLAY_JUMP: - case S_PLAY_SUPER_JUMP: - player->panim = PA_JUMP; + case S_PLAY_SPRING: + case S_PLAY_SUPER_SPRING: + player->panim = PA_SPRING; break; case S_PLAY_FALL: case S_PLAY_SUPER_FALL: @@ -317,9 +323,12 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) spr2 = SPR2_SPIN; break; case SPR2_GASP: - spr2 = SPR2_JUMP; + spr2 = SPR2_SPNG; break; case SPR2_JUMP: + spr2 = SPR2_SPIN; + break; + case SPR2_SPNG: // spring spr2 = SPR2_FALL; break; case SPR2_FALL: @@ -330,7 +339,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case SPR2_FLY: - spr2 = SPR2_JUMP; + spr2 = SPR2_SPNG; break; case SPR2_TIRE: spr2 = SPR2_FLY; @@ -379,6 +388,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case SPR2_SJMP: spr2 = SPR2_JUMP; break; + case SPR2_SSPG: + spr2 = SPR2_SPNG; + break; case SPR2_SFAL: spr2 = SPR2_FALL; break; diff --git a/src/p_user.c b/src/p_user.c index 8854d8d64..f91c2a35d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1598,7 +1598,7 @@ void P_DoPlayerExit(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } player->powers[pw_underwater] = 0; player->powers[pw_spacetime] = 0; @@ -2689,21 +2689,21 @@ static void P_DoClimbing(player_t *player) player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } if (skyclimber) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } else { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } if (cmd->sidemove != 0 || cmd->forwardmove != 0) @@ -2721,7 +2721,7 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); } @@ -2732,7 +2732,7 @@ static void P_DoClimbing(player_t *player) localangle2 = player->mo->angle; if (player->climbing == 0) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); if (player->climbing && P_IsObjectOnGround(player->mo)) { @@ -3520,8 +3520,9 @@ static void P_DoSuperStuff(player_t *player) if (player->mo->health > 0) { - if ((player->pflags & PF_JUMPED || player->pflags & PF_SPINNING) - && player->mo->state-states != S_PLAY_DASH) + if (player->pflags & PF_JUMPED) + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + else if (player->pflags & PF_SPINNING && player->mo->state-states != S_PLAY_DASH) P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); else switch (player->mo->state-states) { @@ -3539,8 +3540,8 @@ static void P_DoSuperStuff(player_t *player) case S_PLAY_SUPER_PAIN: P_SetPlayerMobjState(player->mo, S_PLAY_PAIN); break; - case S_PLAY_SUPER_JUMP: - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + case S_PLAY_SUPER_SPRING: + P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); break; case S_PLAY_SUPER_FALL: P_SetPlayerMobjState(player->mo, S_PLAY_FALL); @@ -3760,9 +3761,9 @@ void P_DoJump(player_t *player, boolean soundandstate) S_StartSound(player->mo, sfx_jump); // Play jump sound! if (!(player->charability2 == CA2_SPINDASH)) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); else - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } @@ -6539,10 +6540,10 @@ static void P_MovePlayer(player_t *player) } // If Springing, but travelling DOWNWARD, change back! - if (player->panim == PA_JUMP && P_MobjFlip(player->mo)*player->mo->momz < 0) + if (player->panim == PA_SPRING && P_MobjFlip(player->mo)*player->mo->momz < 0) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); // If Springing but on the ground, change back! - else if (onground && (player->panim == PA_JUMP || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz) + else if (onground && (player->panim == PA_SPRING || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz) P_SetPlayerMobjState(player->mo, S_PLAY_STND); // If you are stopped and are still walking, stand still! @@ -6581,7 +6582,7 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } player->pflags &= ~PF_GLIDING; @@ -6639,7 +6640,7 @@ static void P_MovePlayer(player_t *player) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } else { @@ -6709,7 +6710,7 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } player->powers[pw_tailsfly] = 0; @@ -7289,7 +7290,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); return; } @@ -7406,7 +7407,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } P_SetTarget(&player->mo->tracer, NULL); @@ -8722,7 +8723,7 @@ void P_PlayerThink(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); } else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && player->panim != PA_ROLL && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); if (player->flashcount) player->flashcount--; @@ -9350,7 +9351,7 @@ void P_PlayerAfterThink(player_t *player) && ((!player->powers[pw_super] && player->panim != PA_ROLL) || player->mo->state == &states[player->mo->info->painstate]) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); if (player->pflags & PF_CARRIED && player->mo->tracer) { From 3e93ec21a1bad0379c2f292301b0c15f010068f2 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sun, 3 Jan 2016 18:25:45 -0600 Subject: [PATCH 142/364] Make internal slope functions static and remove from header I hate merges. Why do things keep getting undone? --- src/p_slopes.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/p_slopes.h b/src/p_slopes.h index f2d1cd81e..8d82632ff 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -29,9 +29,6 @@ #define P_SLOPES_H__ #ifdef ESLOPE -void P_CalculateSlopeNormal(pslope_t *slope); -void P_ReconfigureVertexSlope(pslope_t *slope); - void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); // P_SpawnSlope_Line @@ -39,8 +36,6 @@ void P_RunDynamicSlopes(void); // sectors. void P_SpawnSlope_Line(int linenum); -pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags); - #ifdef SPRINGCLEAN // Loads just map objects that make slopes, // terrain affecting objects have to be spawned first From 1ba005c511b877d24fbd35dabd57c0225e113d23 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Mon, 4 Jan 2016 01:34:56 -0800 Subject: [PATCH 143/364] Fixed crash on Deton explosion. (Detons need deathstates, otherwise they are removed partway through exploding. Not fun.) --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 8d7c249ad..b22295fd1 100644 --- a/src/info.c +++ b/src/info.c @@ -3426,7 +3426,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_XPLD1, // deathstate S_DETON16, // xdeathstate sfx_pop, // deathsound 1*FRACUNIT, // speed From e18f467885eeb7998cb8973e80f70f30fa5511ea Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Fri, 8 Jan 2016 08:16:16 -0800 Subject: [PATCH 144/364] Further optimization of fading code because I'm crazy The less branches, the better. Optimization is a bitch, you know. --- src/f_wipe.c | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index 8e7c622c4..6f14e577a 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -231,34 +231,52 @@ static void F_DoWipe(fademask_t *fademask) maskx = masky = 0; do { - // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<= fademask->width) ++masky, maskx = 0; From 146011937a3c92960cd3be0fbe2314c21852bcbb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 10 Jan 2016 18:24:58 +0000 Subject: [PATCH 145/364] Fixed what appears to be a minor including error in sdl/i_system.c Basically, Wolfy's linux (non-CMake) compiling apparently fails here, and config.in.h actually lives outside of the sdl folder. Blame a particular someone for blindly copy+pasting these includes in this file without considering the consequences when adding support for CMake everywhere. --- src/sdl/i_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index fa09dc343..4b45c373c 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -21,9 +21,9 @@ /// \brief SRB2 system stuff for SDL #ifdef CMAKECONFIG -#include "config.h" +#include "../config.h" #else -#include "config.h.in" +#include "../config.h.in" #endif #ifndef _WIN32_WCE From be266c27e11a4770f5a23212c8b0c78b6f1432b5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 10 Jan 2016 20:56:09 +0000 Subject: [PATCH 146/364] Removed void typedef for GLPatch_t used when HWRENDER is undefined Apparently all parts of the source code that require GLPatch_t are themselves used only if HWRENDER is defined. Do I need to say more? Not sure if this will fix Wolfy's latest problem or not though --- src/w_wad.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/w_wad.h b/src/w_wad.h index 614b7e4ae..d283c54a0 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -16,8 +16,6 @@ #ifdef HWRENDER #include "hardware/hw_data.h" -#else -typedef void GLPatch_t; #endif #ifdef __GNUG__ From a8e4234d743726a9a0957a5193be96447263beb6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 11 Jan 2016 14:51:55 +0000 Subject: [PATCH 147/364] Fixed implicit declaration of some functions if compiling without OpenGL support Not related to Wolfy's problems afaik... this branch seems to be turning into a misc compiling fixes branch now --- src/sdl/i_video.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index faee1bc69..dbb97f093 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -217,10 +217,12 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) } } +#ifdef HWRENDER if (rendermode == render_opengl) { OglSdlSurface(vid.width, vid.height); } +#endif if (rendermode == render_soft) { @@ -401,9 +403,11 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) default: break; } +#ifdef HWRENDER DBG_Printf("Unknown incoming scancode: %d, represented %c\n", code, SDL_GetKeyName(SDL_GetKeyFromScancode(code))); +#endif return 0; } From 997ae7dcc9ab634531b265589905b8bced11a0d5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 10 Jan 2016 18:24:58 +0000 Subject: [PATCH 148/364] Fixed what appears to be a minor including error in sdl/i_system.c Basically, Wolfy's linux (non-CMake) compiling apparently fails here, and config.in.h actually lives outside of the sdl folder. Blame a particular someone for blindly copy+pasting these includes in this file without considering the consequences when adding support for CMake everywhere. --- src/sdl/i_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 66e1ece18..7b75b4d34 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -21,9 +21,9 @@ /// \brief SRB2 system stuff for SDL #ifdef CMAKECONFIG -#include "config.h" +#include "../config.h" #else -#include "config.h.in" +#include "../config.h.in" #endif #ifndef _WIN32_WCE From de576c56a5c3f29ee16892918cb10c0346da11d3 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 10 Jan 2016 20:56:09 +0000 Subject: [PATCH 149/364] Removed void typedef for GLPatch_t used when HWRENDER is undefined Apparently all parts of the source code that require GLPatch_t are themselves used only if HWRENDER is defined. Do I need to say more? Not sure if this will fix Wolfy's latest problem or not though --- src/w_wad.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/w_wad.h b/src/w_wad.h index 614b7e4ae..d283c54a0 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -16,8 +16,6 @@ #ifdef HWRENDER #include "hardware/hw_data.h" -#else -typedef void GLPatch_t; #endif #ifdef __GNUG__ From 22cf800f2fb3a1a1b8ddbe364e443cff37f8e16a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 11 Jan 2016 14:51:55 +0000 Subject: [PATCH 150/364] Fixed implicit declaration of some functions if compiling without OpenGL support Not related to Wolfy's problems afaik... this branch seems to be turning into a misc compiling fixes branch now --- src/sdl/i_video.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index faee1bc69..dbb97f093 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -217,10 +217,12 @@ static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen) } } +#ifdef HWRENDER if (rendermode == render_opengl) { OglSdlSurface(vid.width, vid.height); } +#endif if (rendermode == render_soft) { @@ -401,9 +403,11 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) default: break; } +#ifdef HWRENDER DBG_Printf("Unknown incoming scancode: %d, represented %c\n", code, SDL_GetKeyName(SDL_GetKeyFromScancode(code))); +#endif return 0; } From fea0a9577a7d573ce0e871bec34229f03f445375 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Fri, 8 Jan 2016 08:16:16 -0800 Subject: [PATCH 151/364] Further optimization of fading code because I'm crazy The less branches, the better. Optimization is a bitch, you know. --- src/f_wipe.c | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/src/f_wipe.c b/src/f_wipe.c index 8e7c622c4..6f14e577a 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -231,34 +231,52 @@ static void F_DoWipe(fademask_t *fademask) maskx = masky = 0; do { - // pointer to transtable that this mask would use - transtbl = transtables + ((9 - *mask)<= fademask->width) ++masky, maskx = 0; From 049689334da57e2f5d5ddf4cd4dd05496a80d6be Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 16:39:32 +0000 Subject: [PATCH 152/364] large dispoffset values no longer cause sprites to be distorted more detailed description: vissprites now store dispoffset in a separate variable from (y)scale, and uses it to influence order between sprites without it affecting the actual drawing of the sprites themselves --- src/r_things.c | 17 ++++++++++++++--- src/r_things.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 85221dce2..fc1628d10 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1257,7 +1257,8 @@ static void R_ProjectSprite(mobj_t *thing) vis = R_NewVisSprite(); vis->heightsec = heightsec; //SoM: 3/17/2000 vis->mobjflags = thing->flags; - vis->scale = yscale + thing->info->dispoffset; //<scale = yscale; //<dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15 vis->gx = thing->x; vis->gy = thing->y; vis->gz = gz; @@ -1473,6 +1474,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) // store information in a vissprite vis = R_NewVisSprite(); vis->scale = yscale; //<dispoffset = 0; // Monster Iestyn: 23/11/15 vis->gx = thing->x; vis->gy = thing->y; vis->gz = gz; @@ -1624,6 +1626,7 @@ void R_SortVisSprites(void) vissprite_t *best = NULL; vissprite_t unsorted; fixed_t bestscale; + INT32 bestdispoffset; if (!visspritecount) return; @@ -1654,12 +1657,19 @@ void R_SortVisSprites(void) vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead; for (i = 0; i < visspritecount; i++) { - bestscale = INT32_MAX; + bestscale = bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->scale < bestscale) { bestscale = ds->scale; + bestdispoffset = ds->dispoffset; + best = ds; + } + // order visprites of same scale by dispoffset, smallest first + else if (ds->scale == bestscale && ds->dispoffset < bestdispoffset) + { + bestdispoffset = ds->dispoffset; best = ds; } } @@ -1911,7 +1921,8 @@ static void R_CreateDrawNodes(void) if (r2->sprite->szt > rover->sz || r2->sprite->sz < rover->szt) continue; - if (r2->sprite->scale > rover->scale) + if (r2->sprite->scale > rover->scale + || (r2->sprite->scale == rover->scale && r2->sprite->dispoffset > rover->dispoffset)) { entry = R_CreateDrawNode(NULL); (entry->prev = r2->prev)->next = entry; diff --git a/src/r_things.h b/src/r_things.h index 5a7036c6a..43b46f257 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -162,6 +162,7 @@ typedef struct vissprite_s boolean precip; boolean vflip; // Flip vertically boolean isScaled; + INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } vissprite_t; // A drawnode is something that points to a 3D floor, 3D side, or masked From 4a8dd8031e50a8a27e083621e2b322cea6c1f336 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 17:01:10 +0000 Subject: [PATCH 153/364] dispoffset now works in OpenGL --- src/hardware/hw_glob.h | 1 + src/hardware/hw_main.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 88786bc11..83dff02f8 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -79,6 +79,7 @@ typedef struct gr_vissprite_s boolean vflip; //Hurdler: 25/04/2000: now support colormap in hardware mode UINT8 *colormap; + INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } gr_vissprite_t; // -------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4afd79983..7d6caa049 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3998,6 +3998,7 @@ static void HWR_SortVisSprites(void) gr_vissprite_t *best = NULL; gr_vissprite_t unsorted; float bestdist; + INT32 bestdispoffset; if (!gr_visspritecount) return; @@ -4025,11 +4026,19 @@ static void HWR_SortVisSprites(void) for (i = 0; i < gr_visspritecount; i++) { bestdist = ZCLIP_PLANE-1; + bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->tz > bestdist) { bestdist = ds->tz; + bestdispoffset = ds->dispoffset; + best = ds; + } + // order visprites of same scale by dispoffset, smallest first + else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset) + { + bestdispoffset = ds->dispoffset; best = ds; } } @@ -4653,6 +4662,7 @@ static void HWR_ProjectSprite(mobj_t *thing) #endif vis->x2 = tx; vis->tz = tz; + vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = thing; @@ -4769,6 +4779,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) vis->x1 = x1; vis->x2 = tx; vis->tz = tz; + vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->patchlumpnum = sprframe->lumppat[rot]; vis->flip = flip; vis->mobj = (mobj_t *)thing; From 529f5af6142f0f01d6bb979c6dbd35ef762a7ce0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 23 Nov 2015 21:04:33 +0000 Subject: [PATCH 154/364] Removed a few old OpenGL-specific hacks that compensated for lack of dispoffset (I won't touch overlays for now) --- src/p_mobj.c | 26 ++------------------------ src/p_user.c | 25 +------------------------ 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index fd5b2d455..0f25a8655 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5761,8 +5761,6 @@ static void P_NightsItemChase(mobj_t *thing) static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) { - fixed_t destx, desty; - if (!thing->target || thing->target->health <= 0 || !thing->target->player || (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super] || thing->target->player->powers[pw_invulnerability] > 1) @@ -5787,26 +5785,6 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return false; } - if (!splitscreen && rendermode != render_soft) - { - angle_t viewingangle; - - if (players[displayplayer].awayviewtics) - viewingangle = R_PointToAngle2(thing->target->x, thing->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); - else if (!camera.chase && players[displayplayer].mo) - viewingangle = R_PointToAngle2(thing->target->x, thing->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y); - else - viewingangle = R_PointToAngle2(thing->target->x, thing->target->y, camera.x, camera.y); - - destx = thing->target->x + P_ReturnThrustX(thing->target, viewingangle, FixedMul(FRACUNIT, thing->scale)); - desty = thing->target->y + P_ReturnThrustY(thing->target, viewingangle, FixedMul(FRACUNIT, thing->scale)); - } - else - { - destx = thing->target->x; - desty = thing->target->y; - } - if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & 0xFF)) { thing->movecount = (thing->target->player->powers[pw_shield] & 0xFF); @@ -5831,8 +5809,8 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) P_SetScale(thing, thing->target->scale); P_UnsetThingPosition(thing); - thing->x = destx; - thing->y = desty; + thing->x = thing->target->x; + thing->y = thing->target->y; if (thing->eflags & MFE_VERTICALFLIP) thing->z = thing->target->z + thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) - FixedMul(2*FRACUNIT, thing->target->scale); else diff --git a/src/p_user.c b/src/p_user.c index d693cb277..9853aa137 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2120,30 +2120,7 @@ static void P_CheckInvincibilityTimer(player_t *player) player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); else if (leveltime % (TICRATE/7) == 0) { - fixed_t destx, desty; - mobj_t *sparkle; - - if (!splitscreen && rendermode != render_soft) - { - angle_t viewingangle; - - if (players[displayplayer].awayviewtics) - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); - else if (!camera.chase && players[displayplayer].mo) - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, players[displayplayer].mo->x, players[displayplayer].mo->y); - else - viewingangle = R_PointToAngle2(player->mo->x, player->mo->y, camera.x, camera.y); - - destx = player->mo->x + P_ReturnThrustX(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); - desty = player->mo->y + P_ReturnThrustY(player->mo, viewingangle, FixedMul(FRACUNIT, player->mo->scale)); - } - else - { - destx = player->mo->x; - desty = player->mo->y; - } - - sparkle = P_SpawnMobj(destx, desty, player->mo->z, MT_IVSP); + mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP); sparkle->destscale = player->mo->scale; P_SetScale(sparkle, player->mo->scale); } From 752d97dfb34af42af479d02da6c495dcc58c199c Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:31:48 -0800 Subject: [PATCH 155/364] Branch and revision information in builds Also makes comptime.bat work with git if able. Development builds will now show the branch and the SHA1 hash of the revision. Also been tested to work with subversion, where it displays "Subversion r####". You know, just in case. --- comptime.bat | 28 ++++++++++++++++++++++++---- comptime.sh | 10 +++++++--- src/comptime.c | 2 ++ src/d_netcmd.c | 4 ++++ src/doomdef.h | 8 +++++--- src/m_menu.c | 9 ++++++--- src/m_misc.c | 10 ++++------ 7 files changed, 52 insertions(+), 19 deletions(-) diff --git a/comptime.bat b/comptime.bat index 23ee7ea55..b8450ff64 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,10 +1,30 @@ @ECHO OFF -set REV=Unknown +set BRA=Unknown +set REV=illegal + copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul -SET REV=illegal -FOR /F "usebackq" %%s IN (`svnversion %1`) DO @SET REV=%%s + +if exist .git goto gitrev +if exist .svn goto svnrev +goto filwri + +:gitrev +set GIT=%2 +if "%GIT%"=="" set GIT=git +FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s +FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s +set REV=%REV:~0,8% +goto filwri + +:svnrev +set BRA=Subversion +FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +goto filwri + +:filwri ECHO // Do not edit! This file was autogenerated > %1\comptime.h ECHO // by the %0 batch file >> %1\comptime.h ECHO // >> %1\comptime.h -ECHO const char* comprevision = "r%REV%"; >> %1\comptime.h +ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h +ECHO const char* comprevision = "%REV%"; >> %1\comptime.h diff --git a/comptime.sh b/comptime.sh index 703bb2d35..71c5f08aa 100755 --- a/comptime.sh +++ b/comptime.sh @@ -5,13 +5,15 @@ if [ x"$1" != x ]; then fi versiongit() { - gitversion=`git describe` + gitbranch=`git rev-parse --abbrev-ref HEAD` + gitversion=`git rev-parse HEAD` cat < $path/comptime.h // Do not edit! This file was autogenerated -// by the $0 script with git svn +// by the $0 script with git // -const char* comprevision = "$gitversion"; +const char* compbranch = "$gitbranch"; +const char* comprevision = "${gitversion:0:8}"; EOF exit 0 } @@ -23,6 +25,7 @@ versionsvn() { // Do not edit! This file was autogenerated // by the $0 script with subversion // +const char* compbranch = "Subversion"; const char* comprevision = "r$svnrevision"; EOF exit 0 @@ -34,6 +37,7 @@ versionfake() { // Do not edit! This file was autogenerated // by the $0 script with an unknown or nonexist SCM // +const char* compbranch = "Unknown"; const char* comprevision = "illegal"; EOF } diff --git a/src/comptime.c b/src/comptime.c index a4dc5b0f9..9f1fe2f71 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -9,12 +9,14 @@ #if (defined(CMAKECONFIG)) #include "config.h" +const char *compbranch = ""; // hell if I know what to do with cmake const char *comprevision = SRB2_COMP_REVISION; #elif (defined(COMPVERSION)) #include "comptime.h" #else +const char *compbranch = "Unknown"; const char *comprevision = "illegal"; #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 557715064..6d9fb6b51 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3179,7 +3179,11 @@ static void Command_ListWADS_f(void) */ static void Command_Version_f(void) { +#ifdef DEVELOP + CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s)\n", compbranch, comprevision, compdate, comptime); +#else CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision); +#endif } #ifdef UPDATE_ALERT diff --git a/src/doomdef.h b/src/doomdef.h index 46dcd0808..3fd24b0ae 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -142,8 +142,10 @@ extern FILE *logstream; #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number -#define VERSIONSTRING "Trunk" -#define VERSIONSTRINGW L"Trunk" +#define VERSIONSTRING "Development EXE" +#define VERSIONSTRINGW L"Development EXE" +// most interface strings are ignored in development mode. +// we use comprevision and compbranch instead. #else #define VERSION 202 // Game version #define SUBVERSION 0 // more precise version number @@ -430,7 +432,7 @@ INT32 I_GetKey(void); #endif // Compile date and time and revision. -extern const char *compdate, *comptime, *comprevision; +extern const char *compdate, *comptime, *comprevision, *compbranch; // Disabled code and code under testing // None of these that are disabled in the normal build are guaranteed to work perfectly diff --git a/src/m_menu.c b/src/m_menu.c index 13465b266..439950049 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2463,11 +2463,14 @@ void M_Drawer(void) V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); } else -#if VERSION > 0 || SUBVERSION > 0 + { +#ifdef DEVELOP // Development -- show revision / branch info + V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); + V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); +#else // Regular build V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); -#else // Trunk build, show revision info - V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s (%s)", VERSIONSTRING, comprevision)); #endif + } } } diff --git a/src/m_misc.c b/src/m_misc.c index 57b8c4585..eaafc0696 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1800,16 +1800,14 @@ UINT8 M_HighestBit(UINT32 num) const char *GetRevisionString(void) { - INT32 vinfo; - static char rev[8] = {0}; + static char rev[9] = {0}; if (rev[0]) return rev; - vinfo = atoi(&comprevision[1]); - if (vinfo) - snprintf(rev, 7, "r%d", vinfo); + if (comprevision[0] == 'r') + strncpy(rev, comprevision, 7); else - strcpy(rev, "rNULL"); + snprintf(rev, 7, "r%s", comprevision); rev[7] = '\0'; return rev; From ada7e6497a0aa49568c683e48604196078a69e0f Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:36:27 -0800 Subject: [PATCH 156/364] SVN needs the revision prefixed with 'r' --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index b8450ff64..119b3bb5c 100644 --- a/comptime.bat +++ b/comptime.bat @@ -20,6 +20,7 @@ goto filwri :svnrev set BRA=Subversion FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +set REV=r%REV% goto filwri :filwri From cc0fbf1c1b3feec271e1be08b1ca5c343f701e0e Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:57:17 -0800 Subject: [PATCH 157/364] Revert "Several changes to split jump anims from spin anims:" This reverts commit 27b65e35698707e5e25103d9d46d8709b159977c. --- src/d_player.h | 2 +- src/dehacked.c | 4 +--- src/info.c | 8 ++------ src/info.h | 8 ++------ src/p_map.c | 6 +++--- src/p_mobj.c | 22 +++++----------------- src/p_user.c | 43 +++++++++++++++++++++---------------------- 7 files changed, 35 insertions(+), 58 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 2425ea1bd..e2a1081b0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -166,7 +166,7 @@ typedef enum PA_RUN, PA_PAIN, PA_ROLL, - PA_SPRING, + PA_JUMP, PA_FALL, PA_ABILITY, PA_RIDE diff --git a/src/dehacked.c b/src/dehacked.c index 4222b4f7c..4dfd23a43 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3759,7 +3759,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_DASH", "S_PLAY_GASP", "S_PLAY_JUMP", - "S_PLAY_SPRING", "S_PLAY_FALL", "S_PLAY_EDGE", "S_PLAY_RIDE", @@ -3784,7 +3783,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_SUPER_SPIN", "S_PLAY_SUPER_GASP", "S_PLAY_SUPER_JUMP", - "S_PLAY_SUPER_SPRING", "S_PLAY_SUPER_FALL", "S_PLAY_SUPER_EDGE", "S_PLAY_SUPER_RIDE", @@ -7685,7 +7683,7 @@ struct { {"PA_RUN",PA_RUN}, {"PA_PAIN",PA_PAIN}, {"PA_ROLL",PA_ROLL}, - {"PA_SPRING",PA_SPRING}, + {"PA_JUMP",PA_JUMP}, {"PA_FALL",PA_FALL}, {"PA_ABILITY",PA_ABILITY}, {"PA_RIDE",PA_RIDE}, diff --git a/src/info.c b/src/info.c index 10ce319bf..b22295fd1 100644 --- a/src/info.c +++ b/src/info.c @@ -69,7 +69,6 @@ char spr2names[NUMPLAYERSPRITES][5] = "DASH", "GASP", "JUMP", - "SPNG", "FALL", "EDGE", "RIDE", @@ -95,7 +94,6 @@ char spr2names[NUMPLAYERSPRITES][5] = "SSPN", "SGSP", "SJMP", - "SSPG", "SFAL", "SEDG", "SRID", @@ -137,8 +135,7 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN {SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH {SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP - {SPR_PLAY, SPR2_JUMP, 1, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP - {SPR_PLAY, SPR2_SPNG, 2, {NULL}, 0, 0, S_PLAY_SPRING}, // S_PLAY_SPRING + {SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL {SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE @@ -162,8 +159,7 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SDRN, 4, {NULL}, 0, 0, S_PLAY_SUPER_DRWN}, // S_PLAY_SUPER_DRWN {SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN {SPR_PLAY, SPR2_SGSP, 14, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP - {SPR_PLAY, SPR2_SJMP, 1, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP - {SPR_PLAY, SPR2_SSPG, 2, {NULL}, 0, 0, S_PLAY_SUPER_SPRING}, // S_PLAY_SUPER_SPRING + {SPR_PLAY, SPR2_SJMP, 2, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP {SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE {SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE diff --git a/src/info.h b/src/info.h index 306b928e5..e313526b9 100644 --- a/src/info.h +++ b/src/info.h @@ -588,7 +588,6 @@ enum playersprite SPR2_DASH, SPR2_GASP, SPR2_JUMP, - SPR2_SPNG, // spring SPR2_FALL, SPR2_EDGE, SPR2_RIDE, @@ -614,7 +613,6 @@ enum playersprite SPR2_SSPN, SPR2_SGSP, SPR2_SJMP, - SPR2_SSPG, SPR2_SFAL, SPR2_SEDG, SPR2_SRID, @@ -651,8 +649,7 @@ typedef enum state S_PLAY_SPIN, S_PLAY_DASH, S_PLAY_GASP, - S_PLAY_JUMP, // spin jump (todo: make jump separate from spring up for non-spin chars too?) - S_PLAY_SPRING, + S_PLAY_JUMP, S_PLAY_FALL, S_PLAY_EDGE, S_PLAY_RIDE, @@ -676,8 +673,7 @@ typedef enum state S_PLAY_SUPER_DRWN, S_PLAY_SUPER_SPIN, S_PLAY_SUPER_GASP, - S_PLAY_SUPER_JUMP, // see note above - S_PLAY_SUPER_SPRING, + S_PLAY_SUPER_JUMP, S_PLAY_SUPER_FALL, S_PLAY_SUPER_EDGE, S_PLAY_SUPER_RIDE, diff --git a/src/p_map.c b/src/p_map.c index 2f9824641..214048fb3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -199,7 +199,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) P_ResetPlayer(object->player); if (P_MobjFlip(object)*vertispeed > 0) - P_SetPlayerMobjState(object, S_PLAY_SPRING); + P_SetPlayerMobjState(object, S_PLAY_JUMP); else if (P_MobjFlip(object)*vertispeed < 0) P_SetPlayerMobjState(object, S_PLAY_FALL); else // horizontal spring @@ -213,7 +213,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance) { object->player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(object, S_PLAY_JUMP); + P_SetPlayerMobjState(object, S_PLAY_SPIN); } } return true; @@ -1929,7 +1929,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Don't 'step up' while springing, // Only step up "if needed". - if (thing->player->panim == PA_SPRING + if (thing->player->panim == PA_JUMP && P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale)) maxstep = 0; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 159edd9fb..9bf2049c6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -163,11 +163,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case S_PLAY_GASP: return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_GASP); case S_PLAY_JUMP: - if (!(player->charflags & SF_SUPERSPIN)) - return true; return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_JUMP); - case S_PLAY_SPRING: - return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_SPRING); case S_PLAY_FALL: return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_FALL); case S_PLAY_EDGE: @@ -213,14 +209,12 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case S_PLAY_SPIN: case S_PLAY_DASH: - case S_PLAY_JUMP: case S_PLAY_SUPER_SPIN: - case S_PLAY_SUPER_JUMP: player->panim = PA_ROLL; break; - case S_PLAY_SPRING: - case S_PLAY_SUPER_SPRING: - player->panim = PA_SPRING; + case S_PLAY_JUMP: + case S_PLAY_SUPER_JUMP: + player->panim = PA_JUMP; break; case S_PLAY_FALL: case S_PLAY_SUPER_FALL: @@ -323,12 +317,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) spr2 = SPR2_SPIN; break; case SPR2_GASP: - spr2 = SPR2_SPNG; + spr2 = SPR2_JUMP; break; case SPR2_JUMP: - spr2 = SPR2_SPIN; - break; - case SPR2_SPNG: // spring spr2 = SPR2_FALL; break; case SPR2_FALL: @@ -339,7 +330,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case SPR2_FLY: - spr2 = SPR2_SPNG; + spr2 = SPR2_JUMP; break; case SPR2_TIRE: spr2 = SPR2_FLY; @@ -388,9 +379,6 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case SPR2_SJMP: spr2 = SPR2_JUMP; break; - case SPR2_SSPG: - spr2 = SPR2_SPNG; - break; case SPR2_SFAL: spr2 = SPR2_FALL; break; diff --git a/src/p_user.c b/src/p_user.c index 44c6f2af4..51318f674 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1598,7 +1598,7 @@ void P_DoPlayerExit(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } player->powers[pw_underwater] = 0; player->powers[pw_spacetime] = 0; @@ -2666,21 +2666,21 @@ static void P_DoClimbing(player_t *player) player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } if (skyclimber) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } else { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } if (cmd->sidemove != 0 || cmd->forwardmove != 0) @@ -2698,7 +2698,7 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); } @@ -2709,7 +2709,7 @@ static void P_DoClimbing(player_t *player) localangle2 = player->mo->angle; if (player->climbing == 0) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); if (player->climbing && P_IsObjectOnGround(player->mo)) { @@ -3497,9 +3497,8 @@ static void P_DoSuperStuff(player_t *player) if (player->mo->health > 0) { - if (player->pflags & PF_JUMPED) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); - else if (player->pflags & PF_SPINNING && player->mo->state-states != S_PLAY_DASH) + if ((player->pflags & PF_JUMPED || player->pflags & PF_SPINNING) + && player->mo->state-states != S_PLAY_DASH) P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); else switch (player->mo->state-states) { @@ -3517,8 +3516,8 @@ static void P_DoSuperStuff(player_t *player) case S_PLAY_SUPER_PAIN: P_SetPlayerMobjState(player->mo, S_PLAY_PAIN); break; - case S_PLAY_SUPER_SPRING: - P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); + case S_PLAY_SUPER_JUMP: + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); break; case S_PLAY_SUPER_FALL: P_SetPlayerMobjState(player->mo, S_PLAY_FALL); @@ -3738,9 +3737,9 @@ void P_DoJump(player_t *player, boolean soundandstate) S_StartSound(player->mo, sfx_jump); // Play jump sound! if (!(player->charability2 == CA2_SPINDASH)) - P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); - else P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + else + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } @@ -6517,10 +6516,10 @@ static void P_MovePlayer(player_t *player) } // If Springing, but travelling DOWNWARD, change back! - if (player->panim == PA_SPRING && P_MobjFlip(player->mo)*player->mo->momz < 0) + if (player->panim == PA_JUMP && P_MobjFlip(player->mo)*player->mo->momz < 0) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); // If Springing but on the ground, change back! - else if (onground && (player->panim == PA_SPRING || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz) + else if (onground && (player->panim == PA_JUMP || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz) P_SetPlayerMobjState(player->mo, S_PLAY_STND); // If you are stopped and are still walking, stand still! @@ -6559,7 +6558,7 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } player->pflags &= ~PF_GLIDING; @@ -6617,7 +6616,7 @@ static void P_MovePlayer(player_t *player) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } else { @@ -6687,7 +6686,7 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } } player->powers[pw_tailsfly] = 0; @@ -7267,7 +7266,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); return; } @@ -7384,7 +7383,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); } P_SetTarget(&player->mo->tracer, NULL); @@ -8700,7 +8699,7 @@ void P_PlayerThink(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); } else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && player->panim != PA_ROLL && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); if (player->flashcount) player->flashcount--; @@ -9328,7 +9327,7 @@ void P_PlayerAfterThink(player_t *player) && ((!player->powers[pw_super] && player->panim != PA_ROLL) || player->mo->state == &states[player->mo->info->painstate]) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); if (player->pflags & PF_CARRIED && player->mo->tracer) { From a4badcfe5456ed08895939b8b87dd12cc6a5f73e Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 06:35:10 -0800 Subject: [PATCH 158/364] Revert the revert because it turns out Rob is a doofus player.dta was in a sort of mishmashed half designed for one SPR2 layout and half the other. This reverts commit cc0fbf1c1b3feec271e1be08b1ca5c343f701e0e. --- src/d_player.h | 2 +- src/dehacked.c | 4 +++- src/info.c | 8 ++++++-- src/info.h | 8 ++++++-- src/p_map.c | 6 +++--- src/p_mobj.c | 22 +++++++++++++++++----- src/p_user.c | 43 ++++++++++++++++++++++--------------------- 7 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e2a1081b0..2425ea1bd 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -166,7 +166,7 @@ typedef enum PA_RUN, PA_PAIN, PA_ROLL, - PA_JUMP, + PA_SPRING, PA_FALL, PA_ABILITY, PA_RIDE diff --git a/src/dehacked.c b/src/dehacked.c index 4dfd23a43..4222b4f7c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3759,6 +3759,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_DASH", "S_PLAY_GASP", "S_PLAY_JUMP", + "S_PLAY_SPRING", "S_PLAY_FALL", "S_PLAY_EDGE", "S_PLAY_RIDE", @@ -3783,6 +3784,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_SUPER_SPIN", "S_PLAY_SUPER_GASP", "S_PLAY_SUPER_JUMP", + "S_PLAY_SUPER_SPRING", "S_PLAY_SUPER_FALL", "S_PLAY_SUPER_EDGE", "S_PLAY_SUPER_RIDE", @@ -7683,7 +7685,7 @@ struct { {"PA_RUN",PA_RUN}, {"PA_PAIN",PA_PAIN}, {"PA_ROLL",PA_ROLL}, - {"PA_JUMP",PA_JUMP}, + {"PA_SPRING",PA_SPRING}, {"PA_FALL",PA_FALL}, {"PA_ABILITY",PA_ABILITY}, {"PA_RIDE",PA_RIDE}, diff --git a/src/info.c b/src/info.c index b22295fd1..10ce319bf 100644 --- a/src/info.c +++ b/src/info.c @@ -69,6 +69,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "DASH", "GASP", "JUMP", + "SPNG", "FALL", "EDGE", "RIDE", @@ -94,6 +95,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "SSPN", "SGSP", "SJMP", + "SSPG", "SFAL", "SEDG", "SRID", @@ -135,7 +137,8 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN {SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH {SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP - {SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP + {SPR_PLAY, SPR2_JUMP, 1, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP + {SPR_PLAY, SPR2_SPNG, 2, {NULL}, 0, 0, S_PLAY_SPRING}, // S_PLAY_SPRING {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL {SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE @@ -159,7 +162,8 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SDRN, 4, {NULL}, 0, 0, S_PLAY_SUPER_DRWN}, // S_PLAY_SUPER_DRWN {SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN {SPR_PLAY, SPR2_SGSP, 14, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP - {SPR_PLAY, SPR2_SJMP, 2, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP + {SPR_PLAY, SPR2_SJMP, 1, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP + {SPR_PLAY, SPR2_SSPG, 2, {NULL}, 0, 0, S_PLAY_SUPER_SPRING}, // S_PLAY_SUPER_SPRING {SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE {SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE diff --git a/src/info.h b/src/info.h index e313526b9..306b928e5 100644 --- a/src/info.h +++ b/src/info.h @@ -588,6 +588,7 @@ enum playersprite SPR2_DASH, SPR2_GASP, SPR2_JUMP, + SPR2_SPNG, // spring SPR2_FALL, SPR2_EDGE, SPR2_RIDE, @@ -613,6 +614,7 @@ enum playersprite SPR2_SSPN, SPR2_SGSP, SPR2_SJMP, + SPR2_SSPG, SPR2_SFAL, SPR2_SEDG, SPR2_SRID, @@ -649,7 +651,8 @@ typedef enum state S_PLAY_SPIN, S_PLAY_DASH, S_PLAY_GASP, - S_PLAY_JUMP, + S_PLAY_JUMP, // spin jump (todo: make jump separate from spring up for non-spin chars too?) + S_PLAY_SPRING, S_PLAY_FALL, S_PLAY_EDGE, S_PLAY_RIDE, @@ -673,7 +676,8 @@ typedef enum state S_PLAY_SUPER_DRWN, S_PLAY_SUPER_SPIN, S_PLAY_SUPER_GASP, - S_PLAY_SUPER_JUMP, + S_PLAY_SUPER_JUMP, // see note above + S_PLAY_SUPER_SPRING, S_PLAY_SUPER_FALL, S_PLAY_SUPER_EDGE, S_PLAY_SUPER_RIDE, diff --git a/src/p_map.c b/src/p_map.c index 214048fb3..2f9824641 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -199,7 +199,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) P_ResetPlayer(object->player); if (P_MobjFlip(object)*vertispeed > 0) - P_SetPlayerMobjState(object, S_PLAY_JUMP); + P_SetPlayerMobjState(object, S_PLAY_SPRING); else if (P_MobjFlip(object)*vertispeed < 0) P_SetPlayerMobjState(object, S_PLAY_FALL); else // horizontal spring @@ -213,7 +213,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (spring->info->painchance) { object->player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(object, S_PLAY_SPIN); + P_SetPlayerMobjState(object, S_PLAY_JUMP); } } return true; @@ -1929,7 +1929,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Don't 'step up' while springing, // Only step up "if needed". - if (thing->player->panim == PA_JUMP + if (thing->player->panim == PA_SPRING && P_MobjFlip(thing)*thing->momz > FixedMul(FRACUNIT, thing->scale)) maxstep = 0; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 9bf2049c6..159edd9fb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -163,7 +163,11 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case S_PLAY_GASP: return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_GASP); case S_PLAY_JUMP: + if (!(player->charflags & SF_SUPERSPIN)) + return true; return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_JUMP); + case S_PLAY_SPRING: + return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_SPRING); case S_PLAY_FALL: return P_SetPlayerMobjState(mobj, S_PLAY_SUPER_FALL); case S_PLAY_EDGE: @@ -209,12 +213,14 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case S_PLAY_SPIN: case S_PLAY_DASH: + case S_PLAY_JUMP: case S_PLAY_SUPER_SPIN: + case S_PLAY_SUPER_JUMP: player->panim = PA_ROLL; break; - case S_PLAY_JUMP: - case S_PLAY_SUPER_JUMP: - player->panim = PA_JUMP; + case S_PLAY_SPRING: + case S_PLAY_SUPER_SPRING: + player->panim = PA_SPRING; break; case S_PLAY_FALL: case S_PLAY_SUPER_FALL: @@ -317,9 +323,12 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) spr2 = SPR2_SPIN; break; case SPR2_GASP: - spr2 = SPR2_JUMP; + spr2 = SPR2_SPNG; break; case SPR2_JUMP: + spr2 = SPR2_SPIN; + break; + case SPR2_SPNG: // spring spr2 = SPR2_FALL; break; case SPR2_FALL: @@ -330,7 +339,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case SPR2_FLY: - spr2 = SPR2_JUMP; + spr2 = SPR2_SPNG; break; case SPR2_TIRE: spr2 = SPR2_FLY; @@ -379,6 +388,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case SPR2_SJMP: spr2 = SPR2_JUMP; break; + case SPR2_SSPG: + spr2 = SPR2_SPNG; + break; case SPR2_SFAL: spr2 = SPR2_FALL; break; diff --git a/src/p_user.c b/src/p_user.c index 51318f674..44c6f2af4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1598,7 +1598,7 @@ void P_DoPlayerExit(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } player->powers[pw_underwater] = 0; player->powers[pw_spacetime] = 0; @@ -2666,21 +2666,21 @@ static void P_DoClimbing(player_t *player) player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } if (skyclimber) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } else { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } if (cmd->sidemove != 0 || cmd->forwardmove != 0) @@ -2698,7 +2698,7 @@ static void P_DoClimbing(player_t *player) { player->climbing = 0; player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); } @@ -2709,7 +2709,7 @@ static void P_DoClimbing(player_t *player) localangle2 = player->mo->angle; if (player->climbing == 0) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); if (player->climbing && P_IsObjectOnGround(player->mo)) { @@ -3497,8 +3497,9 @@ static void P_DoSuperStuff(player_t *player) if (player->mo->health > 0) { - if ((player->pflags & PF_JUMPED || player->pflags & PF_SPINNING) - && player->mo->state-states != S_PLAY_DASH) + if (player->pflags & PF_JUMPED) + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + else if (player->pflags & PF_SPINNING && player->mo->state-states != S_PLAY_DASH) P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); else switch (player->mo->state-states) { @@ -3516,8 +3517,8 @@ static void P_DoSuperStuff(player_t *player) case S_PLAY_SUPER_PAIN: P_SetPlayerMobjState(player->mo, S_PLAY_PAIN); break; - case S_PLAY_SUPER_JUMP: - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + case S_PLAY_SUPER_SPRING: + P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); break; case S_PLAY_SUPER_FALL: P_SetPlayerMobjState(player->mo, S_PLAY_FALL); @@ -3737,9 +3738,9 @@ void P_DoJump(player_t *player, boolean soundandstate) S_StartSound(player->mo, sfx_jump); // Play jump sound! if (!(player->charability2 == CA2_SPINDASH)) - P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); + P_SetPlayerMobjState(player->mo, S_PLAY_SPRING); else - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } @@ -6516,10 +6517,10 @@ static void P_MovePlayer(player_t *player) } // If Springing, but travelling DOWNWARD, change back! - if (player->panim == PA_JUMP && P_MobjFlip(player->mo)*player->mo->momz < 0) + if (player->panim == PA_SPRING && P_MobjFlip(player->mo)*player->mo->momz < 0) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); // If Springing but on the ground, change back! - else if (onground && (player->panim == PA_JUMP || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz) + else if (onground && (player->panim == PA_SPRING || player->panim == PA_FALL || player->panim == PA_RIDE) && !player->mo->momz) P_SetPlayerMobjState(player->mo, S_PLAY_STND); // If you are stopped and are still walking, stand still! @@ -6558,7 +6559,7 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } player->pflags &= ~PF_GLIDING; @@ -6616,7 +6617,7 @@ static void P_MovePlayer(player_t *player) || (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } else { @@ -6686,7 +6687,7 @@ static void P_MovePlayer(player_t *player) else { player->pflags |= PF_JUMPED; - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } } player->powers[pw_tailsfly] = 0; @@ -7266,7 +7267,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); return; } @@ -7383,7 +7384,7 @@ static void P_DoRopeHang(player_t *player) if (!(player->pflags & PF_SLIDING) && (player->pflags & PF_JUMPED) && !(player->panim == PA_ROLL) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); } P_SetTarget(&player->mo->tracer, NULL); @@ -8699,7 +8700,7 @@ void P_PlayerThink(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); } else if ((player->pflags & PF_JUMPED) && !player->powers[pw_super] && player->panim != PA_ROLL && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); if (player->flashcount) player->flashcount--; @@ -9327,7 +9328,7 @@ void P_PlayerAfterThink(player_t *player) && ((!player->powers[pw_super] && player->panim != PA_ROLL) || player->mo->state == &states[player->mo->info->painstate]) && player->charability2 == CA2_SPINDASH) - P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); + P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); if (player->pflags & PF_CARRIED && player->mo->tracer) { From c2f40b6b00b4b9de6b093cb53fa02e8b88ad8865 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 07:37:58 -0800 Subject: [PATCH 159/364] Attempt to play nice to cmake. --- CMakeLists.txt | 3 ++- src/comptime.c | 2 +- src/config.h.in | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fb5cb28f..b8fe0ab57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,8 @@ set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary") include(GitUtilities) git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}") git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}") -set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}-<${SRB2_GIT_BRANCH}>") +set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}") +set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) ##### PACKAGE CONFIGURATION ##### diff --git a/src/comptime.c b/src/comptime.c index 9f1fe2f71..398eda074 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -9,7 +9,7 @@ #if (defined(CMAKECONFIG)) #include "config.h" -const char *compbranch = ""; // hell if I know what to do with cmake +const char *compbranch = SRB2_COMP_BRANCH; const char *comprevision = SRB2_COMP_REVISION; #elif (defined(COMPVERSION)) diff --git a/src/config.h.in b/src/config.h.in index 2ed7aec3e..5cd75fa5a 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -18,6 +18,7 @@ #define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" +#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}" #define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}" #define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}" From 06dea3ab781ca953493c5044e67f71e150f58203 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:31:48 -0800 Subject: [PATCH 160/364] Branch and revision information in builds Also makes comptime.bat work with git if able. Development builds will now show the branch and the SHA1 hash of the revision. Also been tested to work with subversion, where it displays "Subversion r####". You know, just in case. --- comptime.bat | 28 ++++++++++++++++++++++++---- comptime.sh | 10 +++++++--- src/comptime.c | 2 ++ src/d_netcmd.c | 4 ++++ src/doomdef.h | 8 +++++--- src/m_menu.c | 9 ++++++--- src/m_misc.c | 10 ++++------ 7 files changed, 52 insertions(+), 19 deletions(-) diff --git a/comptime.bat b/comptime.bat index 23ee7ea55..b8450ff64 100644 --- a/comptime.bat +++ b/comptime.bat @@ -1,10 +1,30 @@ @ECHO OFF -set REV=Unknown +set BRA=Unknown +set REV=illegal + copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul -SET REV=illegal -FOR /F "usebackq" %%s IN (`svnversion %1`) DO @SET REV=%%s + +if exist .git goto gitrev +if exist .svn goto svnrev +goto filwri + +:gitrev +set GIT=%2 +if "%GIT%"=="" set GIT=git +FOR /F "usebackq" %%s IN (`%GIT% rev-parse --abbrev-ref HEAD`) DO @SET BRA=%%s +FOR /F "usebackq" %%s IN (`%GIT% rev-parse HEAD`) DO @SET REV=%%s +set REV=%REV:~0,8% +goto filwri + +:svnrev +set BRA=Subversion +FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +goto filwri + +:filwri ECHO // Do not edit! This file was autogenerated > %1\comptime.h ECHO // by the %0 batch file >> %1\comptime.h ECHO // >> %1\comptime.h -ECHO const char* comprevision = "r%REV%"; >> %1\comptime.h +ECHO const char* compbranch = "%BRA%"; >> %1\comptime.h +ECHO const char* comprevision = "%REV%"; >> %1\comptime.h diff --git a/comptime.sh b/comptime.sh index 703bb2d35..71c5f08aa 100755 --- a/comptime.sh +++ b/comptime.sh @@ -5,13 +5,15 @@ if [ x"$1" != x ]; then fi versiongit() { - gitversion=`git describe` + gitbranch=`git rev-parse --abbrev-ref HEAD` + gitversion=`git rev-parse HEAD` cat < $path/comptime.h // Do not edit! This file was autogenerated -// by the $0 script with git svn +// by the $0 script with git // -const char* comprevision = "$gitversion"; +const char* compbranch = "$gitbranch"; +const char* comprevision = "${gitversion:0:8}"; EOF exit 0 } @@ -23,6 +25,7 @@ versionsvn() { // Do not edit! This file was autogenerated // by the $0 script with subversion // +const char* compbranch = "Subversion"; const char* comprevision = "r$svnrevision"; EOF exit 0 @@ -34,6 +37,7 @@ versionfake() { // Do not edit! This file was autogenerated // by the $0 script with an unknown or nonexist SCM // +const char* compbranch = "Unknown"; const char* comprevision = "illegal"; EOF } diff --git a/src/comptime.c b/src/comptime.c index a4dc5b0f9..9f1fe2f71 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -9,12 +9,14 @@ #if (defined(CMAKECONFIG)) #include "config.h" +const char *compbranch = ""; // hell if I know what to do with cmake const char *comprevision = SRB2_COMP_REVISION; #elif (defined(COMPVERSION)) #include "comptime.h" #else +const char *compbranch = "Unknown"; const char *comprevision = "illegal"; #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 10605f20f..02bc464e6 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3179,7 +3179,11 @@ static void Command_ListWADS_f(void) */ static void Command_Version_f(void) { +#ifdef DEVELOP + CONS_Printf("Sonic Robo Blast 2 %s-%s (%s %s)\n", compbranch, comprevision, compdate, comptime); +#else CONS_Printf("Sonic Robo Blast 2 %s (%s %s %s)\n", VERSIONSTRING, compdate, comptime, comprevision); +#endif } #ifdef UPDATE_ALERT diff --git a/src/doomdef.h b/src/doomdef.h index 92570f623..558a9e115 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -142,8 +142,10 @@ extern FILE *logstream; #ifdef DEVELOP #define VERSION 0 // Game version #define SUBVERSION 0 // more precise version number -#define VERSIONSTRING "Trunk" -#define VERSIONSTRINGW L"Trunk" +#define VERSIONSTRING "Development EXE" +#define VERSIONSTRINGW L"Development EXE" +// most interface strings are ignored in development mode. +// we use comprevision and compbranch instead. #else #define VERSION 201 // Game version #define SUBVERSION 14 // more precise version number @@ -426,7 +428,7 @@ INT32 I_GetKey(void); #endif // Compile date and time and revision. -extern const char *compdate, *comptime, *comprevision; +extern const char *compdate, *comptime, *comprevision, *compbranch; // Disabled code and code under testing // None of these that are disabled in the normal build are guaranteed to work perfectly diff --git a/src/m_menu.c b/src/m_menu.c index c7a9fcc16..65ea1cfe7 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2463,11 +2463,14 @@ void M_Drawer(void) V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, customversionstring); } else -#if VERSION > 0 || SUBVERSION > 0 + { +#ifdef DEVELOP // Development -- show revision / branch info + V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); + V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); +#else // Regular build V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); -#else // Trunk build, show revision info - V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s (%s)", VERSIONSTRING, comprevision)); #endif + } } } diff --git a/src/m_misc.c b/src/m_misc.c index 57b8c4585..eaafc0696 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1800,16 +1800,14 @@ UINT8 M_HighestBit(UINT32 num) const char *GetRevisionString(void) { - INT32 vinfo; - static char rev[8] = {0}; + static char rev[9] = {0}; if (rev[0]) return rev; - vinfo = atoi(&comprevision[1]); - if (vinfo) - snprintf(rev, 7, "r%d", vinfo); + if (comprevision[0] == 'r') + strncpy(rev, comprevision, 7); else - strcpy(rev, "rNULL"); + snprintf(rev, 7, "r%s", comprevision); rev[7] = '\0'; return rev; From ff21b571b44e122427453b279f85dfc1acd702f0 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:36:27 -0800 Subject: [PATCH 161/364] SVN needs the revision prefixed with 'r' --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index b8450ff64..119b3bb5c 100644 --- a/comptime.bat +++ b/comptime.bat @@ -20,6 +20,7 @@ goto filwri :svnrev set BRA=Subversion FOR /F "usebackq" %%s IN (`svnversion .`) DO @SET REV=%%s +set REV=r%REV% goto filwri :filwri From 420a27ce119599066fd9c72945bc49550c6135bd Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 07:37:58 -0800 Subject: [PATCH 162/364] Attempt to play nice to cmake. --- CMakeLists.txt | 3 ++- src/comptime.c | 2 +- src/config.h.in | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fb5cb28f..b8fe0ab57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,8 @@ set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary") include(GitUtilities) git_describe(SRB2_GIT_DESCRIBE "${CMAKE_SOURCE_DIR}") git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}") -set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}-<${SRB2_GIT_BRANCH}>") +set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}") +set(SRB2_COMP_REVISION "${SRB2_GIT_DESCRIBE}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) ##### PACKAGE CONFIGURATION ##### diff --git a/src/comptime.c b/src/comptime.c index 9f1fe2f71..398eda074 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -9,7 +9,7 @@ #if (defined(CMAKECONFIG)) #include "config.h" -const char *compbranch = ""; // hell if I know what to do with cmake +const char *compbranch = SRB2_COMP_BRANCH; const char *comprevision = SRB2_COMP_REVISION; #elif (defined(COMPVERSION)) diff --git a/src/config.h.in b/src/config.h.in index 2ed7aec3e..5cd75fa5a 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -18,6 +18,7 @@ #define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" +#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}" #define SRB2_GIT_DESCRIBE "${SRB2_GIT_DESCRIBE}" #define SRB2_GIT_BRANCH "${SRB2_GIT_BRANCH}" From a0df3cec7b42e839769b38fe3c6ad3c5819b4bc2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Oct 2015 20:30:29 +0100 Subject: [PATCH 163/364] Move finecosine[] declaration to where it really belongs in the source code --- src/r_main.c | 9 --------- src/tables.c | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 1170b3414..a4e72cba9 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -114,15 +114,6 @@ INT32 viewangletox[FINEANGLES/2]; // from clipangle to -clipangle. angle_t xtoviewangle[MAXVIDWIDTH+1]; -// UNUSED. -// The finetangentgent[angle+FINEANGLES/4] table -// holds the fixed_t tangent values for view angles, -// ranging from INT32_MIN to 0 to INT32_MAX. - -#if !(defined _NDS) || !(defined NONET) -fixed_t *finecosine = &finesine[FINEANGLES/4]; -#endif - lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; lighttable_t *scalelightfixed[MAXLIGHTSCALE]; lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; diff --git a/src/tables.c b/src/tables.c index 6f0446e01..47161e667 100644 --- a/src/tables.c +++ b/src/tables.c @@ -1960,10 +1960,10 @@ fixed_t finesine[10240] = 65531, 65531, 65532, 65532, 65533, 65533, 65534, 65534, 65534, 65535, 65535, 65535, 65535, 65535, 65535, 65535 }; + +fixed_t *finecosine = &finesine[FINEANGLES/4]; #endif - - angle_t tantoangle[2049] = { 0, 333772, 667544, 1001315, 1335086, 1668857, 2002626, 2336395, From d4f2d24921614003359ef9d6e1c877e618d766fd Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 10 Oct 2015 21:21:16 +0100 Subject: [PATCH 164/364] Fix up lib_finetangent so tan() returns values starting from "0" in Lua (finetangent itself hasn't been touched) Also fixed how the function went out of the array's bounds for ANGLE_180 and above (or negative angles) --- src/lua_mathlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 8ca2e17af..f4b5ca5fe 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -77,7 +77,9 @@ static int lib_finecosine(lua_State *L) static int lib_finetangent(lua_State *L) { - lua_pushfixed(L, FINETANGENT((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK)); + // HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should + // use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds + lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095)); return 1; } From 693058adae5a137c5f7310e98ac5a4fdca408fa0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Oct 2015 14:05:05 +0100 Subject: [PATCH 165/364] Replaced the old finetangent[] with a new more accurate one I made using a Python script. Actually uses 0 and 65536 now! (and also INT32_MIN) --- src/tables.c | 1024 +++++++++++++++++++++++++------------------------- 1 file changed, 512 insertions(+), 512 deletions(-) diff --git a/src/tables.c b/src/tables.c index 47161e667..deb5a6b19 100644 --- a/src/tables.c +++ b/src/tables.c @@ -162,518 +162,518 @@ angle_t FixedAngle(fixed_t fa) #if !(defined _NDS) || !(defined NONET) fixed_t finetangent[4096] = { - -170910304, -56965752, -34178904, -24413316, -18988036, -15535599, -13145455, -11392683, - -10052327, -8994149, -8137527, -7429880, -6835455, -6329090, -5892567, -5512368, - -5178251, -4882318, -4618375, -4381502, -4167737, -3973855, -3797206, -3635590, - -3487165, -3350381, -3223918, -3106651, -2997613, -2895966, -2800983, -2712030, - -2628549, -2550052, -2476104, -2406322, -2340362, -2277919, -2218719, -2162516, - -2109087, -2058233, -2009771, -1963536, -1919378, -1877161, -1836758, -1798063, - -1760956, -1725348, -1691149, -1658278, -1626658, -1596220, -1566898, -1538632, - -1511367, -1485049, -1459630, -1435065, -1411312, -1388330, -1366084, -1344537, - -1323658, -1303416, -1283783, -1264730, -1246234, -1228269, -1210813, -1193846, - -1177345, -1161294, -1145673, -1130465, -1115654, -1101225, -1087164, -1073455, - -1060087, -1047046, -1034322, -1021901, -1009774, -997931, -986361, -975054, - -964003, -953199, -942633, -932298, -922186, -912289, -902602, -893117, - -883829, -874730, -865817, -857081, -848520, -840127, -831898, -823827, - -815910, -808143, -800521, -793041, -785699, -778490, -771411, -764460, - -757631, -750922, -744331, -737853, -731486, -725227, -719074, -713023, - -707072, -701219, -695462, -689797, -684223, -678737, -673338, -668024, - -662792, -657640, -652568, -647572, -642651, -637803, -633028, -628323, - -623686, -619117, -614613, -610174, -605798, -601483, -597229, -593033, - -588896, -584815, -580789, -576818, -572901, -569035, -565221, -561456, - -557741, -554074, -550455, -546881, -543354, -539870, -536431, -533034, - -529680, -526366, -523094, -519861, -516667, -513512, -510394, -507313, - -504269, -501261, -498287, -495348, -492443, -489571, -486732, -483925, - -481150, -478406, -475692, -473009, -470355, -467730, -465133, -462565, - -460024, -457511, -455024, -452564, -450129, -447720, -445337, -442978, - -440643, -438332, -436045, -433781, -431540, -429321, -427125, -424951, - -422798, -420666, -418555, -416465, -414395, -412344, -410314, -408303, - -406311, -404338, -402384, -400448, -398530, -396630, -394747, -392882, - -391034, -389202, -387387, -385589, -383807, -382040, -380290, -378555, - -376835, -375130, -373440, -371765, -370105, -368459, -366826, -365208, - -363604, -362013, -360436, -358872, -357321, -355783, -354257, -352744, - -351244, -349756, -348280, -346816, -345364, -343924, -342495, -341078, - -339671, -338276, -336892, -335519, -334157, -332805, -331464, -330133, - -328812, -327502, -326201, -324910, -323629, -322358, -321097, -319844, - -318601, -317368, -316143, -314928, -313721, -312524, -311335, -310154, - -308983, -307819, -306664, -305517, -304379, -303248, -302126, -301011, - -299904, -298805, -297714, -296630, -295554, -294485, -293423, -292369, - -291322, -290282, -289249, -288223, -287204, -286192, -285186, -284188, - -283195, -282210, -281231, -280258, -279292, -278332, -277378, -276430, - -275489, -274553, -273624, -272700, -271782, -270871, -269965, -269064, - -268169, -267280, -266397, -265519, -264646, -263779, -262917, -262060, - -261209, -260363, -259522, -258686, -257855, -257029, -256208, -255392, - -254581, -253774, -252973, -252176, -251384, -250596, -249813, -249035, - -248261, -247492, -246727, -245966, -245210, -244458, -243711, -242967, - -242228, -241493, -240763, -240036, -239314, -238595, -237881, -237170, - -236463, -235761, -235062, -234367, -233676, -232988, -232304, -231624, - -230948, -230275, -229606, -228941, -228279, -227621, -226966, -226314, - -225666, -225022, -224381, -223743, -223108, -222477, -221849, -221225, - -220603, -219985, -219370, -218758, -218149, -217544, -216941, -216341, - -215745, -215151, -214561, -213973, -213389, -212807, -212228, -211652, - -211079, -210509, -209941, -209376, -208815, -208255, -207699, -207145, - -206594, -206045, -205500, -204956, -204416, -203878, -203342, -202809, - -202279, -201751, -201226, -200703, -200182, -199664, -199149, -198636, - -198125, -197616, -197110, -196606, -196105, -195606, -195109, -194614, - -194122, -193631, -193143, -192658, -192174, -191693, -191213, -190736, - -190261, -189789, -189318, -188849, -188382, -187918, -187455, -186995, - -186536, -186080, -185625, -185173, -184722, -184274, -183827, -183382, - -182939, -182498, -182059, -181622, -181186, -180753, -180321, -179891, - -179463, -179037, -178612, -178190, -177769, -177349, -176932, -176516, - -176102, -175690, -175279, -174870, -174463, -174057, -173653, -173251, - -172850, -172451, -172053, -171657, -171263, -170870, -170479, -170089, - -169701, -169315, -168930, -168546, -168164, -167784, -167405, -167027, - -166651, -166277, -165904, -165532, -165162, -164793, -164426, -164060, - -163695, -163332, -162970, -162610, -162251, -161893, -161537, -161182, - -160828, -160476, -160125, -159775, -159427, -159079, -158734, -158389, - -158046, -157704, -157363, -157024, -156686, -156349, -156013, -155678, - -155345, -155013, -154682, -154352, -154024, -153697, -153370, -153045, - -152722, -152399, -152077, -151757, -151438, -151120, -150803, -150487, - -150172, -149859, -149546, -149235, -148924, -148615, -148307, -148000, - -147693, -147388, -147084, -146782, -146480, -146179, -145879, -145580, - -145282, -144986, -144690, -144395, -144101, -143808, -143517, -143226, - -142936, -142647, -142359, -142072, -141786, -141501, -141217, -140934, - -140651, -140370, -140090, -139810, -139532, -139254, -138977, -138701, - -138426, -138152, -137879, -137607, -137335, -137065, -136795, -136526, - -136258, -135991, -135725, -135459, -135195, -134931, -134668, -134406, - -134145, -133884, -133625, -133366, -133108, -132851, -132594, -132339, - -132084, -131830, -131576, -131324, -131072, -130821, -130571, -130322, - -130073, -129825, -129578, -129332, -129086, -128841, -128597, -128353, - -128111, -127869, -127627, -127387, -127147, -126908, -126669, -126432, - -126195, -125959, -125723, -125488, -125254, -125020, -124787, -124555, - -124324, -124093, -123863, -123633, -123404, -123176, -122949, -122722, - -122496, -122270, -122045, -121821, -121597, -121374, -121152, -120930, - -120709, -120489, -120269, -120050, -119831, -119613, -119396, -119179, - -118963, -118747, -118532, -118318, -118104, -117891, -117678, -117466, - -117254, -117044, -116833, -116623, -116414, -116206, -115998, -115790, - -115583, -115377, -115171, -114966, -114761, -114557, -114354, -114151, - -113948, -113746, -113545, -113344, -113143, -112944, -112744, -112546, - -112347, -112150, -111952, -111756, -111560, -111364, -111169, -110974, - -110780, -110586, -110393, -110200, -110008, -109817, -109626, -109435, - -109245, -109055, -108866, -108677, -108489, -108301, -108114, -107927, - -107741, -107555, -107369, -107184, -107000, -106816, -106632, -106449, - -106266, -106084, -105902, -105721, -105540, -105360, -105180, -105000, - -104821, -104643, -104465, -104287, -104109, -103933, -103756, -103580, - -103404, -103229, -103054, -102880, -102706, -102533, -102360, -102187, - -102015, -101843, -101671, -101500, -101330, -101159, -100990, -100820, - -100651, -100482, -100314, -100146, -99979, -99812, -99645, -99479, - -99313, -99148, -98982, -98818, -98653, -98489, -98326, -98163, - -98000, -97837, -97675, -97513, -97352, -97191, -97030, -96870, - -96710, -96551, -96391, -96233, -96074, -95916, -95758, -95601, - -95444, -95287, -95131, -94975, -94819, -94664, -94509, -94354, - -94200, -94046, -93892, -93739, -93586, -93434, -93281, -93129, - -92978, -92826, -92675, -92525, -92375, -92225, -92075, -91926, - -91777, -91628, -91480, -91332, -91184, -91036, -90889, -90742, - -90596, -90450, -90304, -90158, -90013, -89868, -89724, -89579, - -89435, -89292, -89148, -89005, -88862, -88720, -88577, -88435, - -88294, -88152, -88011, -87871, -87730, -87590, -87450, -87310, - -87171, -87032, -86893, -86755, -86616, -86479, -86341, -86204, - -86066, -85930, -85793, -85657, -85521, -85385, -85250, -85114, - -84980, -84845, -84710, -84576, -84443, -84309, -84176, -84043, - -83910, -83777, -83645, -83513, -83381, -83250, -83118, -82987, - -82857, -82726, -82596, -82466, -82336, -82207, -82078, -81949, - -81820, -81691, -81563, -81435, -81307, -81180, -81053, -80925, - -80799, -80672, -80546, -80420, -80294, -80168, -80043, -79918, - -79793, -79668, -79544, -79420, -79296, -79172, -79048, -78925, - -78802, -78679, -78557, -78434, -78312, -78190, -78068, -77947, - -77826, -77705, -77584, -77463, -77343, -77223, -77103, -76983, - -76864, -76744, -76625, -76506, -76388, -76269, -76151, -76033, - -75915, -75797, -75680, -75563, -75446, -75329, -75213, -75096, - -74980, -74864, -74748, -74633, -74517, -74402, -74287, -74172, - -74058, -73944, -73829, -73715, -73602, -73488, -73375, -73262, - -73149, -73036, -72923, -72811, -72699, -72587, -72475, -72363, - -72252, -72140, -72029, -71918, -71808, -71697, -71587, -71477, - -71367, -71257, -71147, -71038, -70929, -70820, -70711, -70602, - -70494, -70385, -70277, -70169, -70061, -69954, -69846, -69739, - -69632, -69525, -69418, -69312, -69205, -69099, -68993, -68887, - -68781, -68676, -68570, -68465, -68360, -68255, -68151, -68046, - -67942, -67837, -67733, -67629, -67526, -67422, -67319, -67216, - -67113, -67010, -66907, -66804, -66702, -66600, -66498, -66396, - -66294, -66192, -66091, -65989, -65888, -65787, -65686, -65586, - -65485, -65385, -65285, -65185, -65085, -64985, -64885, -64786, - -64687, -64587, -64488, -64389, -64291, -64192, -64094, -63996, - -63897, -63799, -63702, -63604, -63506, -63409, -63312, -63215, - -63118, -63021, -62924, -62828, -62731, -62635, -62539, -62443, - -62347, -62251, -62156, -62060, -61965, -61870, -61775, -61680, - -61585, -61491, -61396, -61302, -61208, -61114, -61020, -60926, - -60833, -60739, -60646, -60552, -60459, -60366, -60273, -60181, - -60088, -59996, -59903, -59811, -59719, -59627, -59535, -59444, - -59352, -59261, -59169, -59078, -58987, -58896, -58805, -58715, - -58624, -58534, -58443, -58353, -58263, -58173, -58083, -57994, - -57904, -57815, -57725, -57636, -57547, -57458, -57369, -57281, - -57192, -57104, -57015, -56927, -56839, -56751, -56663, -56575, - -56487, -56400, -56312, -56225, -56138, -56051, -55964, -55877, - -55790, -55704, -55617, -55531, -55444, -55358, -55272, -55186, - -55100, -55015, -54929, -54843, -54758, -54673, -54587, -54502, - -54417, -54333, -54248, -54163, -54079, -53994, -53910, -53826, - -53741, -53657, -53574, -53490, -53406, -53322, -53239, -53156, - -53072, -52989, -52906, -52823, -52740, -52657, -52575, -52492, - -52410, -52327, -52245, -52163, -52081, -51999, -51917, -51835, - -51754, -51672, -51591, -51509, -51428, -51347, -51266, -51185, - -51104, -51023, -50942, -50862, -50781, -50701, -50621, -50540, - -50460, -50380, -50300, -50221, -50141, -50061, -49982, -49902, - -49823, -49744, -49664, -49585, -49506, -49427, -49349, -49270, - -49191, -49113, -49034, -48956, -48878, -48799, -48721, -48643, - -48565, -48488, -48410, -48332, -48255, -48177, -48100, -48022, - -47945, -47868, -47791, -47714, -47637, -47560, -47484, -47407, - -47331, -47254, -47178, -47102, -47025, -46949, -46873, -46797, - -46721, -46646, -46570, -46494, -46419, -46343, -46268, -46193, - -46118, -46042, -45967, -45892, -45818, -45743, -45668, -45593, - -45519, -45444, -45370, -45296, -45221, -45147, -45073, -44999, - -44925, -44851, -44778, -44704, -44630, -44557, -44483, -44410, - -44337, -44263, -44190, -44117, -44044, -43971, -43898, -43826, - -43753, -43680, -43608, -43535, -43463, -43390, -43318, -43246, - -43174, -43102, -43030, -42958, -42886, -42814, -42743, -42671, - -42600, -42528, -42457, -42385, -42314, -42243, -42172, -42101, - -42030, -41959, -41888, -41817, -41747, -41676, -41605, -41535, - -41465, -41394, -41324, -41254, -41184, -41113, -41043, -40973, - -40904, -40834, -40764, -40694, -40625, -40555, -40486, -40416, - -40347, -40278, -40208, -40139, -40070, -40001, -39932, -39863, - -39794, -39726, -39657, -39588, -39520, -39451, -39383, -39314, - -39246, -39178, -39110, -39042, -38973, -38905, -38837, -38770, - -38702, -38634, -38566, -38499, -38431, -38364, -38296, -38229, - -38161, -38094, -38027, -37960, -37893, -37826, -37759, -37692, - -37625, -37558, -37491, -37425, -37358, -37291, -37225, -37158, - -37092, -37026, -36959, -36893, -36827, -36761, -36695, -36629, - -36563, -36497, -36431, -36365, -36300, -36234, -36168, -36103, - -36037, -35972, -35907, -35841, -35776, -35711, -35646, -35580, - -35515, -35450, -35385, -35321, -35256, -35191, -35126, -35062, - -34997, -34932, -34868, -34803, -34739, -34675, -34610, -34546, - -34482, -34418, -34354, -34289, -34225, -34162, -34098, -34034, - -33970, -33906, -33843, -33779, -33715, -33652, -33588, -33525, - -33461, -33398, -33335, -33272, -33208, -33145, -33082, -33019, - -32956, -32893, -32830, -32767, -32705, -32642, -32579, -32516, - -32454, -32391, -32329, -32266, -32204, -32141, -32079, -32017, - -31955, -31892, -31830, -31768, -31706, -31644, -31582, -31520, - -31458, -31396, -31335, -31273, -31211, -31150, -31088, -31026, - -30965, -30904, -30842, -30781, -30719, -30658, -30597, -30536, - -30474, -30413, -30352, -30291, -30230, -30169, -30108, -30048, - -29987, -29926, -29865, -29805, -29744, -29683, -29623, -29562, - -29502, -29441, -29381, -29321, -29260, -29200, -29140, -29080, - -29020, -28959, -28899, -28839, -28779, -28719, -28660, -28600, - -28540, -28480, -28420, -28361, -28301, -28241, -28182, -28122, - -28063, -28003, -27944, -27884, -27825, -27766, -27707, -27647, - -27588, -27529, -27470, -27411, -27352, -27293, -27234, -27175, - -27116, -27057, -26998, -26940, -26881, -26822, -26763, -26705, - -26646, -26588, -26529, -26471, -26412, -26354, -26295, -26237, - -26179, -26120, -26062, -26004, -25946, -25888, -25830, -25772, - -25714, -25656, -25598, -25540, -25482, -25424, -25366, -25308, - -25251, -25193, -25135, -25078, -25020, -24962, -24905, -24847, - -24790, -24732, -24675, -24618, -24560, -24503, -24446, -24389, - -24331, -24274, -24217, -24160, -24103, -24046, -23989, -23932, - -23875, -23818, -23761, -23704, -23647, -23591, -23534, -23477, - -23420, -23364, -23307, -23250, -23194, -23137, -23081, -23024, - -22968, -22911, -22855, -22799, -22742, -22686, -22630, -22573, - -22517, -22461, -22405, -22349, -22293, -22237, -22181, -22125, - -22069, -22013, -21957, -21901, -21845, -21789, -21733, -21678, - -21622, -21566, -21510, -21455, -21399, -21343, -21288, -21232, - -21177, -21121, -21066, -21010, -20955, -20900, -20844, -20789, - -20734, -20678, -20623, -20568, -20513, -20457, -20402, -20347, - -20292, -20237, -20182, -20127, -20072, -20017, -19962, -19907, - -19852, -19797, -19742, -19688, -19633, -19578, -19523, -19469, - -19414, -19359, -19305, -19250, -19195, -19141, -19086, -19032, - -18977, -18923, -18868, -18814, -18760, -18705, -18651, -18597, - -18542, -18488, -18434, -18380, -18325, -18271, -18217, -18163, - -18109, -18055, -18001, -17946, -17892, -17838, -17784, -17731, - -17677, -17623, -17569, -17515, -17461, -17407, -17353, -17300, - -17246, -17192, -17138, -17085, -17031, -16977, -16924, -16870, - -16817, -16763, -16710, -16656, -16603, -16549, -16496, -16442, - -16389, -16335, -16282, -16229, -16175, -16122, -16069, -16015, - -15962, -15909, -15856, -15802, -15749, -15696, -15643, -15590, - -15537, -15484, -15431, -15378, -15325, -15272, -15219, -15166, - -15113, -15060, -15007, -14954, -14901, -14848, -14795, -14743, - -14690, -14637, -14584, -14531, -14479, -14426, -14373, -14321, - -14268, -14215, -14163, -14110, -14057, -14005, -13952, -13900, - -13847, -13795, -13742, -13690, -13637, -13585, -13533, -13480, - -13428, -13375, -13323, -13271, -13218, -13166, -13114, -13062, - -13009, -12957, -12905, -12853, -12800, -12748, -12696, -12644, - -12592, -12540, -12488, -12436, -12383, -12331, -12279, -12227, - -12175, -12123, -12071, -12019, -11967, -11916, -11864, -11812, - -11760, -11708, -11656, -11604, -11552, -11501, -11449, -11397, - -11345, -11293, -11242, -11190, -11138, -11086, -11035, -10983, - -10931, -10880, -10828, -10777, -10725, -10673, -10622, -10570, - -10519, -10467, -10415, -10364, -10312, -10261, -10209, -10158, - -10106, -10055, -10004, -9952, -9901, -9849, -9798, -9747, - -9695, -9644, -9592, -9541, -9490, -9438, -9387, -9336, - -9285, -9233, -9182, -9131, -9080, -9028, -8977, -8926, - -8875, -8824, -8772, -8721, -8670, -8619, -8568, -8517, - -8466, -8414, -8363, -8312, -8261, -8210, -8159, -8108, - -8057, -8006, -7955, -7904, -7853, -7802, -7751, -7700, - -7649, -7598, -7547, -7496, -7445, -7395, -7344, -7293, - -7242, -7191, -7140, -7089, -7038, -6988, -6937, -6886, - -6835, -6784, -6733, -6683, -6632, -6581, -6530, -6480, - -6429, -6378, -6327, -6277, -6226, -6175, -6124, -6074, - -6023, -5972, -5922, -5871, -5820, -5770, -5719, -5668, - -5618, -5567, -5517, -5466, -5415, -5365, -5314, -5264, - -5213, -5162, -5112, -5061, -5011, -4960, -4910, -4859, - -4808, -4758, -4707, -4657, -4606, -4556, -4505, -4455, - -4404, -4354, -4303, -4253, -4202, -4152, -4101, -4051, - -4001, -3950, -3900, -3849, -3799, -3748, -3698, -3648, - -3597, -3547, -3496, -3446, -3395, -3345, -3295, -3244, - -3194, -3144, -3093, -3043, -2992, -2942, -2892, -2841, - -2791, -2741, -2690, -2640, -2590, -2539, -2489, -2439, - -2388, -2338, -2288, -2237, -2187, -2137, -2086, -2036, - -1986, -1935, -1885, -1835, -1784, -1734, -1684, -1633, - -1583, -1533, -1483, -1432, -1382, -1332, -1281, -1231, - -1181, -1131, -1080, -1030, -980, -929, -879, -829, - -779, -728, -678, -628, -578, -527, -477, -427, - -376, -326, -276, -226, -175, -125, -75, -25, - 25, 75, 125, 175, 226, 276, 326, 376, - 427, 477, 527, 578, 628, 678, 728, 779, - 829, 879, 929, 980, 1030, 1080, 1131, 1181, - 1231, 1281, 1332, 1382, 1432, 1483, 1533, 1583, - 1633, 1684, 1734, 1784, 1835, 1885, 1935, 1986, - 2036, 2086, 2137, 2187, 2237, 2288, 2338, 2388, - 2439, 2489, 2539, 2590, 2640, 2690, 2741, 2791, - 2841, 2892, 2942, 2992, 3043, 3093, 3144, 3194, - 3244, 3295, 3345, 3395, 3446, 3496, 3547, 3597, - 3648, 3698, 3748, 3799, 3849, 3900, 3950, 4001, - 4051, 4101, 4152, 4202, 4253, 4303, 4354, 4404, - 4455, 4505, 4556, 4606, 4657, 4707, 4758, 4808, - 4859, 4910, 4960, 5011, 5061, 5112, 5162, 5213, - 5264, 5314, 5365, 5415, 5466, 5517, 5567, 5618, - 5668, 5719, 5770, 5820, 5871, 5922, 5972, 6023, - 6074, 6124, 6175, 6226, 6277, 6327, 6378, 6429, - 6480, 6530, 6581, 6632, 6683, 6733, 6784, 6835, - 6886, 6937, 6988, 7038, 7089, 7140, 7191, 7242, - 7293, 7344, 7395, 7445, 7496, 7547, 7598, 7649, - 7700, 7751, 7802, 7853, 7904, 7955, 8006, 8057, - 8108, 8159, 8210, 8261, 8312, 8363, 8414, 8466, - 8517, 8568, 8619, 8670, 8721, 8772, 8824, 8875, - 8926, 8977, 9028, 9080, 9131, 9182, 9233, 9285, - 9336, 9387, 9438, 9490, 9541, 9592, 9644, 9695, - 9747, 9798, 9849, 9901, 9952, 10004, 10055, 10106, - 10158, 10209, 10261, 10312, 10364, 10415, 10467, 10519, - 10570, 10622, 10673, 10725, 10777, 10828, 10880, 10931, - 10983, 11035, 11086, 11138, 11190, 11242, 11293, 11345, - 11397, 11449, 11501, 11552, 11604, 11656, 11708, 11760, - 11812, 11864, 11916, 11967, 12019, 12071, 12123, 12175, - 12227, 12279, 12331, 12383, 12436, 12488, 12540, 12592, - 12644, 12696, 12748, 12800, 12853, 12905, 12957, 13009, - 13062, 13114, 13166, 13218, 13271, 13323, 13375, 13428, - 13480, 13533, 13585, 13637, 13690, 13742, 13795, 13847, - 13900, 13952, 14005, 14057, 14110, 14163, 14215, 14268, - 14321, 14373, 14426, 14479, 14531, 14584, 14637, 14690, - 14743, 14795, 14848, 14901, 14954, 15007, 15060, 15113, - 15166, 15219, 15272, 15325, 15378, 15431, 15484, 15537, - 15590, 15643, 15696, 15749, 15802, 15856, 15909, 15962, - 16015, 16069, 16122, 16175, 16229, 16282, 16335, 16389, - 16442, 16496, 16549, 16603, 16656, 16710, 16763, 16817, - 16870, 16924, 16977, 17031, 17085, 17138, 17192, 17246, - 17300, 17353, 17407, 17461, 17515, 17569, 17623, 17677, - 17731, 17784, 17838, 17892, 17946, 18001, 18055, 18109, - 18163, 18217, 18271, 18325, 18380, 18434, 18488, 18542, - 18597, 18651, 18705, 18760, 18814, 18868, 18923, 18977, - 19032, 19086, 19141, 19195, 19250, 19305, 19359, 19414, - 19469, 19523, 19578, 19633, 19688, 19742, 19797, 19852, - 19907, 19962, 20017, 20072, 20127, 20182, 20237, 20292, - 20347, 20402, 20457, 20513, 20568, 20623, 20678, 20734, - 20789, 20844, 20900, 20955, 21010, 21066, 21121, 21177, - 21232, 21288, 21343, 21399, 21455, 21510, 21566, 21622, - 21678, 21733, 21789, 21845, 21901, 21957, 22013, 22069, - 22125, 22181, 22237, 22293, 22349, 22405, 22461, 22517, - 22573, 22630, 22686, 22742, 22799, 22855, 22911, 22968, - 23024, 23081, 23137, 23194, 23250, 23307, 23364, 23420, - 23477, 23534, 23591, 23647, 23704, 23761, 23818, 23875, - 23932, 23989, 24046, 24103, 24160, 24217, 24274, 24331, - 24389, 24446, 24503, 24560, 24618, 24675, 24732, 24790, - 24847, 24905, 24962, 25020, 25078, 25135, 25193, 25251, - 25308, 25366, 25424, 25482, 25540, 25598, 25656, 25714, - 25772, 25830, 25888, 25946, 26004, 26062, 26120, 26179, - 26237, 26295, 26354, 26412, 26471, 26529, 26588, 26646, - 26705, 26763, 26822, 26881, 26940, 26998, 27057, 27116, - 27175, 27234, 27293, 27352, 27411, 27470, 27529, 27588, - 27647, 27707, 27766, 27825, 27884, 27944, 28003, 28063, - 28122, 28182, 28241, 28301, 28361, 28420, 28480, 28540, - 28600, 28660, 28719, 28779, 28839, 28899, 28959, 29020, - 29080, 29140, 29200, 29260, 29321, 29381, 29441, 29502, - 29562, 29623, 29683, 29744, 29805, 29865, 29926, 29987, - 30048, 30108, 30169, 30230, 30291, 30352, 30413, 30474, - 30536, 30597, 30658, 30719, 30781, 30842, 30904, 30965, - 31026, 31088, 31150, 31211, 31273, 31335, 31396, 31458, - 31520, 31582, 31644, 31706, 31768, 31830, 31892, 31955, - 32017, 32079, 32141, 32204, 32266, 32329, 32391, 32454, - 32516, 32579, 32642, 32705, 32767, 32830, 32893, 32956, - 33019, 33082, 33145, 33208, 33272, 33335, 33398, 33461, - 33525, 33588, 33652, 33715, 33779, 33843, 33906, 33970, - 34034, 34098, 34162, 34225, 34289, 34354, 34418, 34482, - 34546, 34610, 34675, 34739, 34803, 34868, 34932, 34997, - 35062, 35126, 35191, 35256, 35321, 35385, 35450, 35515, - 35580, 35646, 35711, 35776, 35841, 35907, 35972, 36037, - 36103, 36168, 36234, 36300, 36365, 36431, 36497, 36563, - 36629, 36695, 36761, 36827, 36893, 36959, 37026, 37092, - 37158, 37225, 37291, 37358, 37425, 37491, 37558, 37625, - 37692, 37759, 37826, 37893, 37960, 38027, 38094, 38161, - 38229, 38296, 38364, 38431, 38499, 38566, 38634, 38702, - 38770, 38837, 38905, 38973, 39042, 39110, 39178, 39246, - 39314, 39383, 39451, 39520, 39588, 39657, 39726, 39794, - 39863, 39932, 40001, 40070, 40139, 40208, 40278, 40347, - 40416, 40486, 40555, 40625, 40694, 40764, 40834, 40904, - 40973, 41043, 41113, 41184, 41254, 41324, 41394, 41465, - 41535, 41605, 41676, 41747, 41817, 41888, 41959, 42030, - 42101, 42172, 42243, 42314, 42385, 42457, 42528, 42600, - 42671, 42743, 42814, 42886, 42958, 43030, 43102, 43174, - 43246, 43318, 43390, 43463, 43535, 43608, 43680, 43753, - 43826, 43898, 43971, 44044, 44117, 44190, 44263, 44337, - 44410, 44483, 44557, 44630, 44704, 44778, 44851, 44925, - 44999, 45073, 45147, 45221, 45296, 45370, 45444, 45519, - 45593, 45668, 45743, 45818, 45892, 45967, 46042, 46118, - 46193, 46268, 46343, 46419, 46494, 46570, 46646, 46721, - 46797, 46873, 46949, 47025, 47102, 47178, 47254, 47331, - 47407, 47484, 47560, 47637, 47714, 47791, 47868, 47945, - 48022, 48100, 48177, 48255, 48332, 48410, 48488, 48565, - 48643, 48721, 48799, 48878, 48956, 49034, 49113, 49191, - 49270, 49349, 49427, 49506, 49585, 49664, 49744, 49823, - 49902, 49982, 50061, 50141, 50221, 50300, 50380, 50460, - 50540, 50621, 50701, 50781, 50862, 50942, 51023, 51104, - 51185, 51266, 51347, 51428, 51509, 51591, 51672, 51754, - 51835, 51917, 51999, 52081, 52163, 52245, 52327, 52410, - 52492, 52575, 52657, 52740, 52823, 52906, 52989, 53072, - 53156, 53239, 53322, 53406, 53490, 53574, 53657, 53741, - 53826, 53910, 53994, 54079, 54163, 54248, 54333, 54417, - 54502, 54587, 54673, 54758, 54843, 54929, 55015, 55100, - 55186, 55272, 55358, 55444, 55531, 55617, 55704, 55790, - 55877, 55964, 56051, 56138, 56225, 56312, 56400, 56487, - 56575, 56663, 56751, 56839, 56927, 57015, 57104, 57192, - 57281, 57369, 57458, 57547, 57636, 57725, 57815, 57904, - 57994, 58083, 58173, 58263, 58353, 58443, 58534, 58624, - 58715, 58805, 58896, 58987, 59078, 59169, 59261, 59352, - 59444, 59535, 59627, 59719, 59811, 59903, 59996, 60088, - 60181, 60273, 60366, 60459, 60552, 60646, 60739, 60833, - 60926, 61020, 61114, 61208, 61302, 61396, 61491, 61585, - 61680, 61775, 61870, 61965, 62060, 62156, 62251, 62347, - 62443, 62539, 62635, 62731, 62828, 62924, 63021, 63118, - 63215, 63312, 63409, 63506, 63604, 63702, 63799, 63897, - 63996, 64094, 64192, 64291, 64389, 64488, 64587, 64687, - 64786, 64885, 64985, 65085, 65185, 65285, 65385, 65485, - 65586, 65686, 65787, 65888, 65989, 66091, 66192, 66294, - 66396, 66498, 66600, 66702, 66804, 66907, 67010, 67113, - 67216, 67319, 67422, 67526, 67629, 67733, 67837, 67942, - 68046, 68151, 68255, 68360, 68465, 68570, 68676, 68781, - 68887, 68993, 69099, 69205, 69312, 69418, 69525, 69632, - 69739, 69846, 69954, 70061, 70169, 70277, 70385, 70494, - 70602, 70711, 70820, 70929, 71038, 71147, 71257, 71367, - 71477, 71587, 71697, 71808, 71918, 72029, 72140, 72252, - 72363, 72475, 72587, 72699, 72811, 72923, 73036, 73149, - 73262, 73375, 73488, 73602, 73715, 73829, 73944, 74058, - 74172, 74287, 74402, 74517, 74633, 74748, 74864, 74980, - 75096, 75213, 75329, 75446, 75563, 75680, 75797, 75915, - 76033, 76151, 76269, 76388, 76506, 76625, 76744, 76864, - 76983, 77103, 77223, 77343, 77463, 77584, 77705, 77826, - 77947, 78068, 78190, 78312, 78434, 78557, 78679, 78802, - 78925, 79048, 79172, 79296, 79420, 79544, 79668, 79793, - 79918, 80043, 80168, 80294, 80420, 80546, 80672, 80799, - 80925, 81053, 81180, 81307, 81435, 81563, 81691, 81820, - 81949, 82078, 82207, 82336, 82466, 82596, 82726, 82857, - 82987, 83118, 83250, 83381, 83513, 83645, 83777, 83910, - 84043, 84176, 84309, 84443, 84576, 84710, 84845, 84980, - 85114, 85250, 85385, 85521, 85657, 85793, 85930, 86066, - 86204, 86341, 86479, 86616, 86755, 86893, 87032, 87171, - 87310, 87450, 87590, 87730, 87871, 88011, 88152, 88294, - 88435, 88577, 88720, 88862, 89005, 89148, 89292, 89435, - 89579, 89724, 89868, 90013, 90158, 90304, 90450, 90596, - 90742, 90889, 91036, 91184, 91332, 91480, 91628, 91777, - 91926, 92075, 92225, 92375, 92525, 92675, 92826, 92978, - 93129, 93281, 93434, 93586, 93739, 93892, 94046, 94200, - 94354, 94509, 94664, 94819, 94975, 95131, 95287, 95444, - 95601, 95758, 95916, 96074, 96233, 96391, 96551, 96710, - 96870, 97030, 97191, 97352, 97513, 97675, 97837, 98000, - 98163, 98326, 98489, 98653, 98818, 98982, 99148, 99313, - 99479, 99645, 99812, 99979, 100146, 100314, 100482, 100651, - 100820, 100990, 101159, 101330, 101500, 101671, 101843, 102015, - 102187, 102360, 102533, 102706, 102880, 103054, 103229, 103404, - 103580, 103756, 103933, 104109, 104287, 104465, 104643, 104821, - 105000, 105180, 105360, 105540, 105721, 105902, 106084, 106266, - 106449, 106632, 106816, 107000, 107184, 107369, 107555, 107741, - 107927, 108114, 108301, 108489, 108677, 108866, 109055, 109245, - 109435, 109626, 109817, 110008, 110200, 110393, 110586, 110780, - 110974, 111169, 111364, 111560, 111756, 111952, 112150, 112347, - 112546, 112744, 112944, 113143, 113344, 113545, 113746, 113948, - 114151, 114354, 114557, 114761, 114966, 115171, 115377, 115583, - 115790, 115998, 116206, 116414, 116623, 116833, 117044, 117254, - 117466, 117678, 117891, 118104, 118318, 118532, 118747, 118963, - 119179, 119396, 119613, 119831, 120050, 120269, 120489, 120709, - 120930, 121152, 121374, 121597, 121821, 122045, 122270, 122496, - 122722, 122949, 123176, 123404, 123633, 123863, 124093, 124324, - 124555, 124787, 125020, 125254, 125488, 125723, 125959, 126195, - 126432, 126669, 126908, 127147, 127387, 127627, 127869, 128111, - 128353, 128597, 128841, 129086, 129332, 129578, 129825, 130073, - 130322, 130571, 130821, 131072, 131324, 131576, 131830, 132084, - 132339, 132594, 132851, 133108, 133366, 133625, 133884, 134145, - 134406, 134668, 134931, 135195, 135459, 135725, 135991, 136258, - 136526, 136795, 137065, 137335, 137607, 137879, 138152, 138426, - 138701, 138977, 139254, 139532, 139810, 140090, 140370, 140651, - 140934, 141217, 141501, 141786, 142072, 142359, 142647, 142936, - 143226, 143517, 143808, 144101, 144395, 144690, 144986, 145282, - 145580, 145879, 146179, 146480, 146782, 147084, 147388, 147693, - 148000, 148307, 148615, 148924, 149235, 149546, 149859, 150172, - 150487, 150803, 151120, 151438, 151757, 152077, 152399, 152722, - 153045, 153370, 153697, 154024, 154352, 154682, 155013, 155345, - 155678, 156013, 156349, 156686, 157024, 157363, 157704, 158046, - 158389, 158734, 159079, 159427, 159775, 160125, 160476, 160828, - 161182, 161537, 161893, 162251, 162610, 162970, 163332, 163695, - 164060, 164426, 164793, 165162, 165532, 165904, 166277, 166651, - 167027, 167405, 167784, 168164, 168546, 168930, 169315, 169701, - 170089, 170479, 170870, 171263, 171657, 172053, 172451, 172850, - 173251, 173653, 174057, 174463, 174870, 175279, 175690, 176102, - 176516, 176932, 177349, 177769, 178190, 178612, 179037, 179463, - 179891, 180321, 180753, 181186, 181622, 182059, 182498, 182939, - 183382, 183827, 184274, 184722, 185173, 185625, 186080, 186536, - 186995, 187455, 187918, 188382, 188849, 189318, 189789, 190261, - 190736, 191213, 191693, 192174, 192658, 193143, 193631, 194122, - 194614, 195109, 195606, 196105, 196606, 197110, 197616, 198125, - 198636, 199149, 199664, 200182, 200703, 201226, 201751, 202279, - 202809, 203342, 203878, 204416, 204956, 205500, 206045, 206594, - 207145, 207699, 208255, 208815, 209376, 209941, 210509, 211079, - 211652, 212228, 212807, 213389, 213973, 214561, 215151, 215745, - 216341, 216941, 217544, 218149, 218758, 219370, 219985, 220603, - 221225, 221849, 222477, 223108, 223743, 224381, 225022, 225666, - 226314, 226966, 227621, 228279, 228941, 229606, 230275, 230948, - 231624, 232304, 232988, 233676, 234367, 235062, 235761, 236463, - 237170, 237881, 238595, 239314, 240036, 240763, 241493, 242228, - 242967, 243711, 244458, 245210, 245966, 246727, 247492, 248261, - 249035, 249813, 250596, 251384, 252176, 252973, 253774, 254581, - 255392, 256208, 257029, 257855, 258686, 259522, 260363, 261209, - 262060, 262917, 263779, 264646, 265519, 266397, 267280, 268169, - 269064, 269965, 270871, 271782, 272700, 273624, 274553, 275489, - 276430, 277378, 278332, 279292, 280258, 281231, 282210, 283195, - 284188, 285186, 286192, 287204, 288223, 289249, 290282, 291322, - 292369, 293423, 294485, 295554, 296630, 297714, 298805, 299904, - 301011, 302126, 303248, 304379, 305517, 306664, 307819, 308983, - 310154, 311335, 312524, 313721, 314928, 316143, 317368, 318601, - 319844, 321097, 322358, 323629, 324910, 326201, 327502, 328812, - 330133, 331464, 332805, 334157, 335519, 336892, 338276, 339671, - 341078, 342495, 343924, 345364, 346816, 348280, 349756, 351244, - 352744, 354257, 355783, 357321, 358872, 360436, 362013, 363604, - 365208, 366826, 368459, 370105, 371765, 373440, 375130, 376835, - 378555, 380290, 382040, 383807, 385589, 387387, 389202, 391034, - 392882, 394747, 396630, 398530, 400448, 402384, 404338, 406311, - 408303, 410314, 412344, 414395, 416465, 418555, 420666, 422798, - 424951, 427125, 429321, 431540, 433781, 436045, 438332, 440643, - 442978, 445337, 447720, 450129, 452564, 455024, 457511, 460024, - 462565, 465133, 467730, 470355, 473009, 475692, 478406, 481150, - 483925, 486732, 489571, 492443, 495348, 498287, 501261, 504269, - 507313, 510394, 513512, 516667, 519861, 523094, 526366, 529680, - 533034, 536431, 539870, 543354, 546881, 550455, 554074, 557741, - 561456, 565221, 569035, 572901, 576818, 580789, 584815, 588896, - 593033, 597229, 601483, 605798, 610174, 614613, 619117, 623686, - 628323, 633028, 637803, 642651, 647572, 652568, 657640, 662792, - 668024, 673338, 678737, 684223, 689797, 695462, 701219, 707072, - 713023, 719074, 725227, 731486, 737853, 744331, 750922, 757631, - 764460, 771411, 778490, 785699, 793041, 800521, 808143, 815910, - 823827, 831898, 840127, 848520, 857081, 865817, 874730, 883829, - 893117, 902602, 912289, 922186, 932298, 942633, 953199, 964003, - 975054, 986361, 997931, 1009774, 1021901, 1034322, 1047046, 1060087, - 1073455, 1087164, 1101225, 1115654, 1130465, 1145673, 1161294, 1177345, - 1193846, 1210813, 1228269, 1246234, 1264730, 1283783, 1303416, 1323658, - 1344537, 1366084, 1388330, 1411312, 1435065, 1459630, 1485049, 1511367, - 1538632, 1566898, 1596220, 1626658, 1658278, 1691149, 1725348, 1760956, - 1798063, 1836758, 1877161, 1919378, 1963536, 2009771, 2058233, 2109087, - 2162516, 2218719, 2277919, 2340362, 2406322, 2476104, 2550052, 2628549, - 2712030, 2800983, 2895966, 2997613, 3106651, 3223918, 3350381, 3487165, - 3635590, 3797206, 3973855, 4167737, 4381502, 4618375, 4882318, 5178251, - 5512368, 5892567, 6329090, 6835455, 7429880, 8137527, 8994149, 10052327, - 11392683, 13145455, 15535599, 18988036, 24413316, 34178904, 56965752, 170910304 + INT32_MIN, -85445642, -42722796, -28481836, -21361347, -17089048, -14240842, -12206405, + -10680573, -9493811, -8544398, -7767602, -7120270, -6572525, -6103026, -5696125, + -5340085, -5025930, -4746679, -4496821, -4271947, -4068489, -3883524, -3714643, + -3559833, -3417407, -3285935, -3164201, -3051161, -2945916, -2847685, -2755792, + -2669640, -2588709, -2512537, -2440718, -2372887, -2308722, -2247933, -2190260, + -2135471, -2083353, -2033716, -1986387, -1941209, -1898038, -1856743, -1817205, + -1779313, -1742967, -1708075, -1674550, -1642314, -1611294, -1581422, -1552635, + -1524876, -1498091, -1472229, -1447242, -1423088, -1399726, -1377116, -1355224, + -1334015, -1313459, -1293525, -1274185, -1255414, -1237186, -1219479, -1202270, + -1185538, -1169265, -1153430, -1138018, -1123011, -1108393, -1094149, -1080266, + -1066729, -1053527, -1040645, -1028074, -1015802, -1003818, -992112, -980675, + -969498, -958571, -947887, -937438, -927215, -917211, -907420, -897835, + -888449, -879257, -870251, -861428, -852780, -844303, -835992, -827843, + -819849, -812008, -804314, -796763, -789353, -782077, -774934, -767919, + -761030, -754261, -747612, -741077, -734655, -728343, -722137, -716035, + -710035, -704133, -698328, -692618, -686999, -681469, -676027, -670671, + -665398, -660206, -655094, -650060, -645102, -640218, -635407, -630667, + -625996, -621393, -616857, -612386, -607978, -603633, -599348, -595124, + -590957, -586848, -582795, -578797, -574853, -570962, -567122, -563332, + -559593, -555902, -552259, -548662, -545112, -541606, -538145, -534727, + -531351, -528018, -524725, -521472, -518259, -515084, -511948, -508849, + -505787, -502760, -499769, -496813, -493891, -491003, -488148, -485325, + -482534, -479774, -477045, -474347, -471678, -469038, -466428, -463845, + -461291, -458764, -456264, -453791, -451343, -448922, -446526, -444154, + -441807, -439485, -437186, -434910, -432658, -430428, -428221, -426035, + -423871, -421729, -419608, -417507, -415427, -413367, -411327, -409306, + -407305, -405323, -403359, -401414, -399487, -397578, -395686, -393812, + -391956, -390116, -388293, -386486, -384696, -382921, -381163, -379420, + -377693, -375981, -374283, -372601, -370933, -369280, -367641, -366016, + -364404, -362807, -361223, -359652, -358094, -356550, -355018, -353499, + -351993, -350499, -349017, -347547, -346089, -344643, -343208, -341785, + -340373, -338973, -337583, -336204, -334837, -333480, -332133, -330797, + -329471, -328156, -326850, -325554, -324269, -322993, -321726, -320469, + -319222, -317984, -316754, -315535, -314324, -313121, -311928, -310743, + -309567, -308400, -307240, -306090, -304947, -303812, -302686, -301567, + -300457, -299354, -298259, -297171, -296091, -295018, -293953, -292895, + -291845, -290801, -289765, -288735, -287713, -286697, -285688, -284686, + -283691, -282702, -281719, -280743, -279774, -278811, -277854, -276903, + -275959, -275020, -274088, -273161, -272241, -271326, -270417, -269514, + -268616, -267724, -266838, -265957, -265082, -264212, -263347, -262488, + -261634, -260785, -259941, -259103, -258270, -257441, -256618, -255799, + -254986, -254177, -253373, -252574, -251779, -250989, -250204, -249423, + -248647, -247876, -247109, -246346, -245588, -244834, -244084, -243338, + -242597, -241860, -241128, -240399, -239674, -238954, -238237, -237525, + -236816, -236112, -235411, -234714, -234021, -233331, -232646, -231964, + -231286, -230611, -229940, -229273, -228610, -227949, -227293, -226640, + -225990, -225344, -224701, -224061, -223425, -222792, -222163, -221536, + -220913, -220294, -219677, -219064, -218453, -217846, -217242, -216641, + -216043, -215448, -214856, -214267, -213681, -213097, -212517, -211940, + -211365, -210793, -210225, -209658, -209095, -208535, -207977, -207422, + -206869, -206319, -205772, -205228, -204686, -204147, -203610, -203076, + -202544, -202015, -201488, -200964, -200442, -199923, -199406, -198892, + -198380, -197870, -197363, -196858, -196355, -195855, -195357, -194861, + -194367, -193876, -193387, -192900, -192416, -191933, -191453, -190975, + -190499, -190025, -189553, -189083, -188615, -188150, -187686, -187225, + -186765, -186308, -185852, -185399, -184947, -184498, -184050, -183604, + -183160, -182718, -182278, -181840, -181404, -180969, -180537, -180106, + -179677, -179250, -178824, -178401, -177979, -177559, -177140, -176724, + -176309, -175896, -175484, -175074, -174666, -174260, -173855, -173452, + -173050, -172650, -172252, -171855, -171460, -171066, -170674, -170284, + -169895, -169508, -169122, -168738, -168355, -167974, -167594, -167216, + -166839, -166464, -166090, -165718, -165347, -164977, -164609, -164242, + -163877, -163513, -163151, -162790, -162430, -162072, -161715, -161359, + -161005, -160652, -160300, -159950, -159601, -159253, -158906, -158561, + -158217, -157875, -157533, -157193, -156855, -156517, -156181, -155845, + -155512, -155179, -154847, -154517, -154188, -153860, -153533, -153208, + -152883, -152560, -152238, -151917, -151597, -151279, -150961, -150645, + -150329, -150015, -149702, -149390, -149079, -148769, -148461, -148153, + -147846, -147541, -147236, -146933, -146630, -146329, -146029, -145729, + -145431, -145134, -144837, -144542, -144248, -143955, -143662, -143371, + -143081, -142791, -142503, -142215, -141929, -141643, -141359, -141075, + -140792, -140511, -140230, -139950, -139671, -139393, -139115, -138839, + -138564, -138289, -138016, -137743, -137471, -137200, -136930, -136661, + -136392, -136125, -135858, -135592, -135327, -135063, -134799, -134537, + -134275, -134014, -133754, -133495, -133237, -132979, -132722, -132466, + -132211, -131957, -131703, -131450, -131198, -130947, -130696, -130446, + -130197, -129949, -129701, -129455, -129209, -128963, -128719, -128475, + -128232, -127990, -127748, -127507, -127267, -127027, -126789, -126551, + -126313, -126077, -125841, -125605, -125371, -125137, -124904, -124671, + -124439, -124208, -123978, -123748, -123519, -123290, -123062, -122835, + -122609, -122383, -122158, -121933, -121709, -121486, -121263, -121041, + -120820, -120599, -120379, -120159, -119940, -119722, -119504, -119287, + -119071, -118855, -118639, -118425, -118211, -117997, -117784, -117572, + -117360, -117149, -116938, -116728, -116519, -116310, -116102, -115894, + -115687, -115480, -115274, -115069, -114864, -114659, -114455, -114252, + -114049, -113847, -113645, -113444, -113244, -113043, -112844, -112645, + -112446, -112248, -112051, -111854, -111658, -111462, -111266, -111071, + -110877, -110683, -110490, -110297, -110104, -109912, -109721, -109530, + -109340, -109150, -108960, -108771, -108583, -108395, -108207, -108020, + -107834, -107648, -107462, -107277, -107092, -106908, -106724, -106541, + -106358, -106175, -105993, -105812, -105631, -105450, -105270, -105090, + -104911, -104732, -104554, -104376, -104198, -104021, -103844, -103668, + -103492, -103317, -103142, -102967, -102793, -102619, -102446, -102273, + -102101, -101929, -101757, -101586, -101415, -101244, -101074, -100905, + -100736, -100567, -100398, -100230, -100063, -99895, -99729, -99562, + -99396, -99230, -99065, -98900, -98735, -98571, -98408, -98244, + -98081, -97918, -97756, -97594, -97433, -97271, -97111, -96950, + -96790, -96630, -96471, -96312, -96153, -95995, -95837, -95680, + -95522, -95365, -95209, -95053, -94897, -94741, -94586, -94431, + -94277, -94123, -93969, -93816, -93663, -93510, -93357, -93205, + -93053, -92902, -92751, -92600, -92450, -92300, -92150, -92000, + -91851, -91702, -91554, -91406, -91258, -91110, -90963, -90816, + -90669, -90523, -90377, -90231, -90086, -89941, -89796, -89651, + -89507, -89363, -89220, -89077, -88934, -88791, -88648, -88506, + -88365, -88223, -88082, -87941, -87800, -87660, -87520, -87380, + -87241, -87101, -86963, -86824, -86686, -86547, -86410, -86272, + -86135, -85998, -85861, -85725, -85589, -85453, -85317, -85182, + -85047, -84912, -84778, -84643, -84509, -84376, -84242, -84109, + -83976, -83843, -83711, -83579, -83447, -83315, -83184, -83053, + -82922, -82791, -82661, -82531, -82401, -82271, -82142, -82013, + -81884, -81756, -81627, -81499, -81371, -81244, -81116, -80989, + -80862, -80735, -80609, -80483, -80357, -80231, -80106, -79980, + -79855, -79731, -79606, -79482, -79358, -79234, -79110, -78987, + -78864, -78741, -78618, -78495, -78373, -78251, -78129, -78008, + -77886, -77765, -77644, -77524, -77403, -77283, -77163, -77043, + -76923, -76804, -76685, -76566, -76447, -76328, -76210, -76092, + -75974, -75856, -75739, -75621, -75504, -75387, -75271, -75154, + -75038, -74922, -74806, -74690, -74575, -74460, -74345, -74230, + -74115, -74001, -73886, -73772, -73659, -73545, -73431, -73318, + -73205, -73092, -72979, -72867, -72755, -72643, -72531, -72419, + -72307, -72196, -72085, -71974, -71863, -71752, -71642, -71532, + -71422, -71312, -71202, -71093, -70983, -70874, -70765, -70656, + -70548, -70439, -70331, -70223, -70115, -70007, -69900, -69793, + -69685, -69578, -69472, -69365, -69258, -69152, -69046, -68940, + -68834, -68728, -68623, -68518, -68413, -68308, -68203, -68098, + -67994, -67889, -67785, -67681, -67578, -67474, -67371, -67267, + -67164, -67061, -66958, -66856, -66753, -66651, -66549, -66447, + -66345, -66243, -66141, -66040, -65939, -65838, -65737, -65636, + -65536, -65435, -65335, -65235, -65135, -65035, -64935, -64836, + -64736, -64637, -64538, -64439, -64340, -64241, -64143, -64045, + -63946, -63848, -63750, -63653, -63555, -63458, -63360, -63263, + -63166, -63069, -62972, -62876, -62779, -62683, -62587, -62491, + -62395, -62299, -62204, -62108, -62013, -61918, -61822, -61728, + -61633, -61538, -61444, -61349, -61255, -61161, -61067, -60973, + -60879, -60786, -60692, -60599, -60506, -60413, -60320, -60227, + -60134, -60042, -59950, -59857, -59765, -59673, -59581, -59489, + -59398, -59306, -59215, -59124, -59033, -58942, -58851, -58760, + -58669, -58579, -58489, -58398, -58308, -58218, -58128, -58039, + -57949, -57859, -57770, -57681, -57592, -57503, -57414, -57325, + -57236, -57148, -57059, -56971, -56883, -56795, -56707, -56619, + -56531, -56444, -56356, -56269, -56181, -56094, -56007, -55920, + -55834, -55747, -55660, -55574, -55487, -55401, -55315, -55229, + -55143, -55057, -54972, -54886, -54801, -54715, -54630, -54545, + -54460, -54375, -54290, -54205, -54121, -54036, -53952, -53868, + -53784, -53699, -53615, -53532, -53448, -53364, -53281, -53197, + -53114, -53031, -52948, -52865, -52782, -52699, -52616, -52533, + -52451, -52369, -52286, -52204, -52122, -52040, -51958, -51876, + -51794, -51713, -51631, -51550, -51469, -51387, -51306, -51225, + -51144, -51063, -50983, -50902, -50822, -50741, -50661, -50581, + -50500, -50420, -50340, -50260, -50181, -50101, -50021, -49942, + -49862, -49783, -49704, -49625, -49546, -49467, -49388, -49309, + -49230, -49152, -49073, -48995, -48917, -48838, -48760, -48682, + -48604, -48526, -48449, -48371, -48293, -48216, -48138, -48061, + -47984, -47907, -47830, -47753, -47676, -47599, -47522, -47445, + -47369, -47292, -47216, -47140, -47063, -46987, -46911, -46835, + -46759, -46684, -46608, -46532, -46457, -46381, -46306, -46230, + -46155, -46080, -46005, -45930, -45855, -45780, -45705, -45631, + -45556, -45482, -45407, -45333, -45259, -45184, -45110, -45036, + -44962, -44888, -44815, -44741, -44667, -44594, -44520, -44447, + -44373, -44300, -44227, -44154, -44081, -44008, -43935, -43862, + -43789, -43717, -43644, -43571, -43499, -43427, -43354, -43282, + -43210, -43138, -43066, -42994, -42922, -42850, -42779, -42707, + -42635, -42564, -42492, -42421, -42350, -42279, -42207, -42136, + -42065, -41994, -41923, -41853, -41782, -41711, -41641, -41570, + -41500, -41429, -41359, -41289, -41219, -41148, -41078, -41008, + -40939, -40869, -40799, -40729, -40660, -40590, -40520, -40451, + -40382, -40312, -40243, -40174, -40105, -40036, -39967, -39898, + -39829, -39760, -39691, -39623, -39554, -39486, -39417, -39349, + -39280, -39212, -39144, -39076, -39007, -38939, -38871, -38804, + -38736, -38668, -38600, -38532, -38465, -38397, -38330, -38262, + -38195, -38128, -38060, -37993, -37926, -37859, -37792, -37725, + -37658, -37591, -37525, -37458, -37391, -37325, -37258, -37192, + -37125, -37059, -36993, -36926, -36860, -36794, -36728, -36662, + -36596, -36530, -36464, -36398, -36333, -36267, -36201, -36136, + -36070, -36005, -35939, -35874, -35809, -35743, -35678, -35613, + -35548, -35483, -35418, -35353, -35288, -35223, -35159, -35094, + -35029, -34965, -34900, -34836, -34771, -34707, -34642, -34578, + -34514, -34450, -34386, -34322, -34257, -34194, -34130, -34066, + -34002, -33938, -33874, -33811, -33747, -33684, -33620, -33557, + -33493, -33430, -33366, -33303, -33240, -33177, -33114, -33051, + -32988, -32925, -32862, -32799, -32736, -32673, -32610, -32548, + -32485, -32422, -32360, -32297, -32235, -32173, -32110, -32048, + -31986, -31923, -31861, -31799, -31737, -31675, -31613, -31551, + -31489, -31427, -31366, -31304, -31242, -31180, -31119, -31057, + -30996, -30934, -30873, -30811, -30750, -30689, -30627, -30566, + -30505, -30444, -30383, -30322, -30261, -30200, -30139, -30078, + -30017, -29956, -29896, -29835, -29774, -29714, -29653, -29593, + -29532, -29472, -29411, -29351, -29291, -29230, -29170, -29110, + -29050, -28989, -28929, -28869, -28809, -28749, -28689, -28630, + -28570, -28510, -28450, -28390, -28331, -28271, -28212, -28152, + -28092, -28033, -27974, -27914, -27855, -27795, -27736, -27677, + -27618, -27559, -27499, -27440, -27381, -27322, -27263, -27204, + -27145, -27087, -27028, -26969, -26910, -26851, -26793, -26734, + -26675, -26617, -26558, -26500, -26441, -26383, -26325, -26266, + -26208, -26150, -26091, -26033, -25975, -25917, -25859, -25801, + -25743, -25685, -25627, -25569, -25511, -25453, -25395, -25337, + -25280, -25222, -25164, -25106, -25049, -24991, -24934, -24876, + -24819, -24761, -24704, -24646, -24589, -24532, -24474, -24417, + -24360, -24303, -24246, -24188, -24131, -24074, -24017, -23960, + -23903, -23846, -23789, -23733, -23676, -23619, -23562, -23505, + -23449, -23392, -23335, -23279, -23222, -23166, -23109, -23053, + -22996, -22940, -22883, -22827, -22770, -22714, -22658, -22602, + -22545, -22489, -22433, -22377, -22321, -22265, -22209, -22153, + -22097, -22041, -21985, -21929, -21873, -21817, -21761, -21705, + -21650, -21594, -21538, -21483, -21427, -21371, -21316, -21260, + -21205, -21149, -21094, -21038, -20983, -20927, -20872, -20817, + -20761, -20706, -20651, -20595, -20540, -20485, -20430, -20375, + -20320, -20264, -20209, -20154, -20099, -20044, -19989, -19935, + -19880, -19825, -19770, -19715, -19660, -19605, -19551, -19496, + -19441, -19387, -19332, -19277, -19223, -19168, -19114, -19059, + -19005, -18950, -18896, -18841, -18787, -18732, -18678, -18624, + -18569, -18515, -18461, -18407, -18352, -18298, -18244, -18190, + -18136, -18082, -18028, -17974, -17919, -17865, -17811, -17758, + -17704, -17650, -17596, -17542, -17488, -17434, -17380, -17327, + -17273, -17219, -17165, -17112, -17058, -17004, -16951, -16897, + -16843, -16790, -16736, -16683, -16629, -16576, -16522, -16469, + -16415, -16362, -16309, -16255, -16202, -16149, -16095, -16042, + -15989, -15935, -15882, -15829, -15776, -15723, -15670, -15616, + -15563, -15510, -15457, -15404, -15351, -15298, -15245, -15192, + -15139, -15086, -15033, -14980, -14927, -14875, -14822, -14769, + -14716, -14663, -14611, -14558, -14505, -14452, -14400, -14347, + -14294, -14242, -14189, -14136, -14084, -14031, -13979, -13926, + -13874, -13821, -13769, -13716, -13664, -13611, -13559, -13506, + -13454, -13402, -13349, -13297, -13245, -13192, -13140, -13088, + -13035, -12983, -12931, -12879, -12827, -12774, -12722, -12670, + -12618, -12566, -12514, -12462, -12409, -12357, -12305, -12253, + -12201, -12149, -12097, -12045, -11993, -11941, -11890, -11838, + -11786, -11734, -11682, -11630, -11578, -11526, -11475, -11423, + -11371, -11319, -11268, -11216, -11164, -11112, -11061, -11009, + -10957, -10906, -10854, -10802, -10751, -10699, -10647, -10596, + -10544, -10493, -10441, -10390, -10338, -10287, -10235, -10184, + -10132, -10081, -10029, -9978, -9926, -9875, -9824, -9772, + -9721, -9669, -9618, -9567, -9515, -9464, -9413, -9362, + -9310, -9259, -9208, -9156, -9105, -9054, -9003, -8952, + -8900, -8849, -8798, -8747, -8696, -8645, -8593, -8542, + -8491, -8440, -8389, -8338, -8287, -8236, -8185, -8134, + -8083, -8032, -7981, -7930, -7879, -7828, -7777, -7726, + -7675, -7624, -7573, -7522, -7471, -7420, -7369, -7318, + -7267, -7216, -7166, -7115, -7064, -7013, -6962, -6911, + -6861, -6810, -6759, -6708, -6657, -6607, -6556, -6505, + -6454, -6403, -6353, -6302, -6251, -6201, -6150, -6099, + -6048, -5998, -5947, -5896, -5846, -5795, -5744, -5694, + -5643, -5592, -5542, -5491, -5441, -5390, -5339, -5289, + -5238, -5188, -5137, -5086, -5036, -4985, -4935, -4884, + -4834, -4783, -4733, -4682, -4632, -4581, -4531, -4480, + -4430, -4379, -4329, -4278, -4228, -4177, -4127, -4076, + -4026, -3975, -3925, -3874, -3824, -3774, -3723, -3673, + -3622, -3572, -3521, -3471, -3421, -3370, -3320, -3269, + -3219, -3169, -3118, -3068, -3018, -2967, -2917, -2866, + -2816, -2766, -2715, -2665, -2615, -2564, -2514, -2464, + -2413, -2363, -2313, -2262, -2212, -2162, -2111, -2061, + -2011, -1960, -1910, -1860, -1810, -1759, -1709, -1659, + -1608, -1558, -1508, -1457, -1407, -1357, -1307, -1256, + -1206, -1156, -1105, -1055, -1005, -955, -904, -854, + -804, -754, -703, -653, -603, -552, -502, -452, + -402, -351, -301, -251, -201, -150, -100, -50, + 0, 50, 100, 150, 201, 251, 301, 351, + 402, 452, 502, 552, 603, 653, 703, 754, + 804, 854, 904, 955, 1005, 1055, 1105, 1156, + 1206, 1256, 1307, 1357, 1407, 1457, 1508, 1558, + 1608, 1659, 1709, 1759, 1810, 1860, 1910, 1960, + 2011, 2061, 2111, 2162, 2212, 2262, 2313, 2363, + 2413, 2464, 2514, 2564, 2615, 2665, 2715, 2766, + 2816, 2866, 2917, 2967, 3018, 3068, 3118, 3169, + 3219, 3269, 3320, 3370, 3421, 3471, 3521, 3572, + 3622, 3673, 3723, 3774, 3824, 3874, 3925, 3975, + 4026, 4076, 4127, 4177, 4228, 4278, 4329, 4379, + 4430, 4480, 4531, 4581, 4632, 4682, 4733, 4783, + 4834, 4884, 4935, 4985, 5036, 5086, 5137, 5188, + 5238, 5289, 5339, 5390, 5441, 5491, 5542, 5592, + 5643, 5694, 5744, 5795, 5846, 5896, 5947, 5998, + 6048, 6099, 6150, 6201, 6251, 6302, 6353, 6403, + 6454, 6505, 6556, 6607, 6657, 6708, 6759, 6810, + 6861, 6911, 6962, 7013, 7064, 7115, 7166, 7216, + 7267, 7318, 7369, 7420, 7471, 7522, 7573, 7624, + 7675, 7726, 7777, 7828, 7879, 7930, 7981, 8032, + 8083, 8134, 8185, 8236, 8287, 8338, 8389, 8440, + 8491, 8542, 8593, 8645, 8696, 8747, 8798, 8849, + 8900, 8952, 9003, 9054, 9105, 9156, 9208, 9259, + 9310, 9362, 9413, 9464, 9515, 9567, 9618, 9669, + 9721, 9772, 9824, 9875, 9926, 9978, 10029, 10081, + 10132, 10184, 10235, 10287, 10338, 10390, 10441, 10493, + 10544, 10596, 10647, 10699, 10751, 10802, 10854, 10906, + 10957, 11009, 11061, 11112, 11164, 11216, 11268, 11319, + 11371, 11423, 11475, 11526, 11578, 11630, 11682, 11734, + 11786, 11838, 11890, 11941, 11993, 12045, 12097, 12149, + 12201, 12253, 12305, 12357, 12409, 12462, 12514, 12566, + 12618, 12670, 12722, 12774, 12827, 12879, 12931, 12983, + 13035, 13088, 13140, 13192, 13245, 13297, 13349, 13402, + 13454, 13506, 13559, 13611, 13664, 13716, 13769, 13821, + 13874, 13926, 13979, 14031, 14084, 14136, 14189, 14242, + 14294, 14347, 14400, 14452, 14505, 14558, 14611, 14663, + 14716, 14769, 14822, 14875, 14927, 14980, 15033, 15086, + 15139, 15192, 15245, 15298, 15351, 15404, 15457, 15510, + 15563, 15616, 15670, 15723, 15776, 15829, 15882, 15935, + 15989, 16042, 16095, 16149, 16202, 16255, 16309, 16362, + 16415, 16469, 16522, 16576, 16629, 16683, 16736, 16790, + 16843, 16897, 16951, 17004, 17058, 17112, 17165, 17219, + 17273, 17327, 17380, 17434, 17488, 17542, 17596, 17650, + 17704, 17758, 17811, 17865, 17919, 17974, 18028, 18082, + 18136, 18190, 18244, 18298, 18352, 18407, 18461, 18515, + 18569, 18624, 18678, 18732, 18787, 18841, 18896, 18950, + 19005, 19059, 19114, 19168, 19223, 19277, 19332, 19387, + 19441, 19496, 19551, 19605, 19660, 19715, 19770, 19825, + 19880, 19935, 19989, 20044, 20099, 20154, 20209, 20264, + 20320, 20375, 20430, 20485, 20540, 20595, 20651, 20706, + 20761, 20817, 20872, 20927, 20983, 21038, 21094, 21149, + 21205, 21260, 21316, 21371, 21427, 21483, 21538, 21594, + 21650, 21705, 21761, 21817, 21873, 21929, 21985, 22041, + 22097, 22153, 22209, 22265, 22321, 22377, 22433, 22489, + 22545, 22602, 22658, 22714, 22770, 22827, 22883, 22940, + 22996, 23053, 23109, 23166, 23222, 23279, 23335, 23392, + 23449, 23505, 23562, 23619, 23676, 23733, 23789, 23846, + 23903, 23960, 24017, 24074, 24131, 24188, 24246, 24303, + 24360, 24417, 24474, 24532, 24589, 24646, 24704, 24761, + 24819, 24876, 24934, 24991, 25049, 25106, 25164, 25222, + 25280, 25337, 25395, 25453, 25511, 25569, 25627, 25685, + 25743, 25801, 25859, 25917, 25975, 26033, 26091, 26150, + 26208, 26266, 26325, 26383, 26441, 26500, 26558, 26617, + 26675, 26734, 26793, 26851, 26910, 26969, 27028, 27087, + 27145, 27204, 27263, 27322, 27381, 27440, 27499, 27559, + 27618, 27677, 27736, 27795, 27855, 27914, 27974, 28033, + 28092, 28152, 28212, 28271, 28331, 28390, 28450, 28510, + 28570, 28630, 28689, 28749, 28809, 28869, 28929, 28989, + 29050, 29110, 29170, 29230, 29291, 29351, 29411, 29472, + 29532, 29593, 29653, 29714, 29774, 29835, 29896, 29956, + 30017, 30078, 30139, 30200, 30261, 30322, 30383, 30444, + 30505, 30566, 30627, 30689, 30750, 30811, 30873, 30934, + 30996, 31057, 31119, 31180, 31242, 31304, 31366, 31427, + 31489, 31551, 31613, 31675, 31737, 31799, 31861, 31923, + 31986, 32048, 32110, 32173, 32235, 32297, 32360, 32422, + 32485, 32548, 32610, 32673, 32736, 32799, 32862, 32925, + 32988, 33051, 33114, 33177, 33240, 33303, 33366, 33430, + 33493, 33557, 33620, 33684, 33747, 33811, 33874, 33938, + 34002, 34066, 34130, 34194, 34257, 34322, 34386, 34450, + 34514, 34578, 34642, 34707, 34771, 34836, 34900, 34965, + 35029, 35094, 35159, 35223, 35288, 35353, 35418, 35483, + 35548, 35613, 35678, 35743, 35809, 35874, 35939, 36005, + 36070, 36136, 36201, 36267, 36333, 36398, 36464, 36530, + 36596, 36662, 36728, 36794, 36860, 36926, 36993, 37059, + 37125, 37192, 37258, 37325, 37391, 37458, 37525, 37591, + 37658, 37725, 37792, 37859, 37926, 37993, 38060, 38128, + 38195, 38262, 38330, 38397, 38465, 38532, 38600, 38668, + 38736, 38804, 38871, 38939, 39007, 39076, 39144, 39212, + 39280, 39349, 39417, 39486, 39554, 39623, 39691, 39760, + 39829, 39898, 39967, 40036, 40105, 40174, 40243, 40312, + 40382, 40451, 40520, 40590, 40660, 40729, 40799, 40869, + 40939, 41008, 41078, 41148, 41219, 41289, 41359, 41429, + 41500, 41570, 41641, 41711, 41782, 41853, 41923, 41994, + 42065, 42136, 42207, 42279, 42350, 42421, 42492, 42564, + 42635, 42707, 42779, 42850, 42922, 42994, 43066, 43138, + 43210, 43282, 43354, 43427, 43499, 43571, 43644, 43717, + 43789, 43862, 43935, 44008, 44081, 44154, 44227, 44300, + 44373, 44447, 44520, 44594, 44667, 44741, 44815, 44888, + 44962, 45036, 45110, 45184, 45259, 45333, 45407, 45482, + 45556, 45631, 45705, 45780, 45855, 45930, 46005, 46080, + 46155, 46230, 46306, 46381, 46457, 46532, 46608, 46684, + 46759, 46835, 46911, 46987, 47063, 47140, 47216, 47292, + 47369, 47445, 47522, 47599, 47676, 47753, 47830, 47907, + 47984, 48061, 48138, 48216, 48293, 48371, 48449, 48526, + 48604, 48682, 48760, 48838, 48917, 48995, 49073, 49152, + 49230, 49309, 49388, 49467, 49546, 49625, 49704, 49783, + 49862, 49942, 50021, 50101, 50181, 50260, 50340, 50420, + 50500, 50581, 50661, 50741, 50822, 50902, 50983, 51063, + 51144, 51225, 51306, 51387, 51469, 51550, 51631, 51713, + 51794, 51876, 51958, 52040, 52122, 52204, 52286, 52369, + 52451, 52533, 52616, 52699, 52782, 52865, 52948, 53031, + 53114, 53197, 53281, 53364, 53448, 53532, 53615, 53699, + 53784, 53868, 53952, 54036, 54121, 54205, 54290, 54375, + 54460, 54545, 54630, 54715, 54801, 54886, 54972, 55057, + 55143, 55229, 55315, 55401, 55487, 55574, 55660, 55747, + 55834, 55920, 56007, 56094, 56181, 56269, 56356, 56444, + 56531, 56619, 56707, 56795, 56883, 56971, 57059, 57148, + 57236, 57325, 57414, 57503, 57592, 57681, 57770, 57859, + 57949, 58039, 58128, 58218, 58308, 58398, 58489, 58579, + 58669, 58760, 58851, 58942, 59033, 59124, 59215, 59306, + 59398, 59489, 59581, 59673, 59765, 59857, 59950, 60042, + 60134, 60227, 60320, 60413, 60506, 60599, 60692, 60786, + 60879, 60973, 61067, 61161, 61255, 61349, 61444, 61538, + 61633, 61728, 61822, 61918, 62013, 62108, 62204, 62299, + 62395, 62491, 62587, 62683, 62779, 62876, 62972, 63069, + 63166, 63263, 63360, 63458, 63555, 63653, 63750, 63848, + 63946, 64045, 64143, 64241, 64340, 64439, 64538, 64637, + 64736, 64836, 64935, 65035, 65135, 65235, 65335, 65435, + 65535, 65636, 65737, 65838, 65939, 66040, 66141, 66243, + 66345, 66447, 66549, 66651, 66753, 66856, 66958, 67061, + 67164, 67267, 67371, 67474, 67578, 67681, 67785, 67889, + 67994, 68098, 68203, 68308, 68413, 68518, 68623, 68728, + 68834, 68940, 69046, 69152, 69258, 69365, 69472, 69578, + 69685, 69793, 69900, 70007, 70115, 70223, 70331, 70439, + 70548, 70656, 70765, 70874, 70983, 71093, 71202, 71312, + 71422, 71532, 71642, 71752, 71863, 71974, 72085, 72196, + 72307, 72419, 72531, 72643, 72755, 72867, 72979, 73092, + 73205, 73318, 73431, 73545, 73659, 73772, 73886, 74001, + 74115, 74230, 74345, 74460, 74575, 74690, 74806, 74922, + 75038, 75154, 75271, 75387, 75504, 75621, 75739, 75856, + 75974, 76092, 76210, 76328, 76447, 76566, 76685, 76804, + 76923, 77043, 77163, 77283, 77403, 77524, 77644, 77765, + 77886, 78008, 78129, 78251, 78373, 78495, 78618, 78741, + 78864, 78987, 79110, 79234, 79358, 79482, 79606, 79731, + 79855, 79980, 80106, 80231, 80357, 80483, 80609, 80735, + 80862, 80989, 81116, 81244, 81371, 81499, 81627, 81756, + 81884, 82013, 82142, 82271, 82401, 82531, 82661, 82791, + 82922, 83053, 83184, 83315, 83447, 83579, 83711, 83843, + 83976, 84109, 84242, 84376, 84509, 84643, 84778, 84912, + 85047, 85182, 85317, 85453, 85589, 85725, 85861, 85998, + 86135, 86272, 86410, 86547, 86686, 86824, 86963, 87101, + 87241, 87380, 87520, 87660, 87800, 87941, 88082, 88223, + 88365, 88506, 88648, 88791, 88934, 89077, 89220, 89363, + 89507, 89651, 89796, 89941, 90086, 90231, 90377, 90523, + 90669, 90816, 90963, 91110, 91258, 91406, 91554, 91702, + 91851, 92000, 92150, 92300, 92450, 92600, 92751, 92902, + 93053, 93205, 93357, 93510, 93663, 93816, 93969, 94123, + 94277, 94431, 94586, 94741, 94897, 95053, 95209, 95365, + 95522, 95680, 95837, 95995, 96153, 96312, 96471, 96630, + 96790, 96950, 97111, 97271, 97433, 97594, 97756, 97918, + 98081, 98244, 98408, 98571, 98735, 98900, 99065, 99230, + 99396, 99562, 99729, 99895, 100063, 100230, 100398, 100567, + 100736, 100905, 101074, 101244, 101415, 101586, 101757, 101929, + 102101, 102273, 102446, 102619, 102793, 102967, 103142, 103317, + 103492, 103668, 103844, 104021, 104198, 104376, 104554, 104732, + 104911, 105090, 105270, 105450, 105631, 105812, 105993, 106175, + 106358, 106541, 106724, 106908, 107092, 107277, 107462, 107648, + 107834, 108020, 108207, 108395, 108583, 108771, 108960, 109150, + 109340, 109530, 109721, 109912, 110104, 110297, 110490, 110683, + 110877, 111071, 111266, 111462, 111658, 111854, 112051, 112248, + 112446, 112645, 112844, 113043, 113244, 113444, 113645, 113847, + 114049, 114252, 114455, 114659, 114864, 115069, 115274, 115480, + 115687, 115894, 116102, 116310, 116519, 116728, 116938, 117149, + 117360, 117572, 117784, 117997, 118211, 118425, 118639, 118855, + 119071, 119287, 119504, 119722, 119940, 120159, 120379, 120599, + 120820, 121041, 121263, 121486, 121709, 121933, 122158, 122383, + 122609, 122835, 123062, 123290, 123519, 123748, 123978, 124208, + 124439, 124671, 124904, 125137, 125371, 125605, 125841, 126077, + 126313, 126551, 126789, 127027, 127267, 127507, 127748, 127990, + 128232, 128475, 128719, 128963, 129209, 129455, 129701, 129949, + 130197, 130446, 130696, 130947, 131198, 131450, 131703, 131957, + 132211, 132466, 132722, 132979, 133237, 133495, 133754, 134014, + 134275, 134537, 134799, 135063, 135327, 135592, 135858, 136125, + 136392, 136661, 136930, 137200, 137471, 137743, 138016, 138289, + 138564, 138839, 139115, 139393, 139671, 139950, 140230, 140511, + 140792, 141075, 141359, 141643, 141929, 142215, 142503, 142791, + 143081, 143371, 143662, 143955, 144248, 144542, 144837, 145134, + 145431, 145729, 146029, 146329, 146630, 146933, 147236, 147541, + 147846, 148153, 148461, 148769, 149079, 149390, 149702, 150015, + 150329, 150645, 150961, 151279, 151597, 151917, 152238, 152560, + 152883, 153208, 153533, 153860, 154188, 154517, 154847, 155179, + 155512, 155845, 156181, 156517, 156855, 157193, 157533, 157875, + 158217, 158561, 158906, 159253, 159601, 159950, 160300, 160652, + 161005, 161359, 161715, 162072, 162430, 162790, 163151, 163513, + 163877, 164242, 164609, 164977, 165347, 165718, 166090, 166464, + 166839, 167216, 167594, 167974, 168355, 168738, 169122, 169508, + 169895, 170284, 170674, 171066, 171460, 171855, 172252, 172650, + 173050, 173452, 173855, 174260, 174666, 175074, 175484, 175896, + 176309, 176724, 177140, 177559, 177979, 178401, 178824, 179250, + 179677, 180106, 180537, 180969, 181404, 181840, 182278, 182718, + 183160, 183604, 184050, 184498, 184947, 185399, 185852, 186308, + 186765, 187225, 187686, 188150, 188615, 189083, 189553, 190025, + 190499, 190975, 191453, 191933, 192416, 192900, 193387, 193876, + 194367, 194861, 195357, 195855, 196355, 196858, 197363, 197870, + 198380, 198892, 199406, 199923, 200442, 200964, 201488, 202015, + 202544, 203076, 203610, 204147, 204686, 205228, 205772, 206319, + 206869, 207422, 207977, 208535, 209095, 209658, 210225, 210793, + 211365, 211940, 212517, 213097, 213681, 214267, 214856, 215448, + 216043, 216641, 217242, 217846, 218453, 219064, 219677, 220294, + 220913, 221536, 222163, 222792, 223425, 224061, 224701, 225344, + 225990, 226640, 227293, 227949, 228610, 229273, 229940, 230611, + 231286, 231964, 232646, 233331, 234021, 234714, 235411, 236112, + 236816, 237525, 238237, 238954, 239674, 240399, 241128, 241860, + 242597, 243338, 244084, 244834, 245588, 246346, 247109, 247876, + 248647, 249423, 250204, 250989, 251779, 252574, 253373, 254177, + 254986, 255799, 256618, 257441, 258270, 259103, 259941, 260785, + 261634, 262488, 263347, 264212, 265082, 265957, 266838, 267724, + 268616, 269514, 270417, 271326, 272241, 273161, 274088, 275020, + 275959, 276903, 277854, 278811, 279774, 280743, 281719, 282702, + 283691, 284686, 285688, 286697, 287713, 288735, 289765, 290801, + 291845, 292895, 293953, 295018, 296091, 297171, 298259, 299354, + 300457, 301567, 302686, 303812, 304947, 306090, 307240, 308400, + 309567, 310743, 311928, 313121, 314324, 315535, 316754, 317984, + 319222, 320469, 321726, 322993, 324269, 325554, 326850, 328156, + 329471, 330797, 332133, 333480, 334837, 336204, 337583, 338973, + 340373, 341785, 343208, 344643, 346089, 347547, 349017, 350499, + 351993, 353499, 355018, 356550, 358094, 359652, 361223, 362807, + 364404, 366016, 367641, 369280, 370933, 372601, 374283, 375981, + 377693, 379420, 381163, 382921, 384696, 386486, 388293, 390116, + 391956, 393812, 395686, 397578, 399487, 401414, 403359, 405323, + 407305, 409306, 411327, 413367, 415427, 417507, 419608, 421729, + 423871, 426035, 428221, 430428, 432658, 434910, 437186, 439485, + 441807, 444154, 446526, 448922, 451343, 453791, 456264, 458764, + 461291, 463845, 466428, 469038, 471678, 474347, 477045, 479774, + 482534, 485325, 488148, 491003, 493891, 496813, 499769, 502760, + 505787, 508849, 511948, 515084, 518259, 521472, 524725, 528018, + 531351, 534727, 538145, 541606, 545112, 548662, 552259, 555902, + 559593, 563332, 567122, 570962, 574853, 578797, 582795, 586848, + 590957, 595124, 599348, 603633, 607978, 612386, 616857, 621393, + 625996, 630667, 635407, 640218, 645102, 650060, 655094, 660206, + 665398, 670671, 676027, 681469, 686999, 692618, 698328, 704133, + 710035, 716035, 722137, 728343, 734655, 741077, 747612, 754261, + 761030, 767919, 774934, 782077, 789353, 796763, 804314, 812008, + 819849, 827843, 835992, 844303, 852780, 861428, 870251, 879257, + 888449, 897835, 907420, 917211, 927215, 937438, 947887, 958571, + 969498, 980675, 992112, 1003818, 1015802, 1028074, 1040645, 1053527, + 1066729, 1080266, 1094149, 1108393, 1123011, 1138018, 1153430, 1169265, + 1185538, 1202270, 1219479, 1237186, 1255414, 1274185, 1293525, 1313459, + 1334015, 1355224, 1377116, 1399726, 1423088, 1447242, 1472229, 1498091, + 1524876, 1552635, 1581422, 1611294, 1642314, 1674550, 1708075, 1742967, + 1779313, 1817205, 1856743, 1898038, 1941209, 1986387, 2033716, 2083353, + 2135471, 2190260, 2247933, 2308722, 2372887, 2440718, 2512537, 2588709, + 2669640, 2755792, 2847685, 2945916, 3051161, 3164201, 3285935, 3417407, + 3559833, 3714643, 3883524, 4068489, 4271947, 4496821, 4746679, 5025930, + 5340085, 5696125, 6103026, 6572525, 7120270, 7767602, 8544398, 9493811, + 10680573, 12206405, 14240842, 17089048, 21361347, 28481836, 42722796, 85445642 }; From 69550e98fe2f56fdd3c908ebc921b10a22f1caa7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 11 Oct 2015 21:01:04 +0100 Subject: [PATCH 166/364] Since cv_pointlimit is handled in P_CheckPointLimit, I've just created P_CheckTimeLimit for cv_timelimit. It helps make P_UpdateSpecials less messy-looking anyway. --- src/p_inter.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++- src/p_local.h | 1 + src/p_spec.c | 101 ++----------------------------------------- 3 files changed, 120 insertions(+), 99 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index e9512e960..709e0e2be 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1641,11 +1641,126 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit")); } +/** Checks if the level timer is over the timelimit and the round should end, + * unless you are in overtime. In which case leveltime may stretch out beyond + * timelimitintics and overtime's status will be checked here each tick. + * Verify that the value of ::cv_timelimit is greater than zero before + * calling this function. + * + * \sa cv_timelimit, P_CheckPointLimit, P_UpdateSpecials + */ +void P_CheckTimeLimit(void) +{ + INT32 i, k; + + if (!cv_timelimit.value) + return; + + if (!(multiplayer || netgame)) + return; + + if (G_PlatformGametype()) + return; + + if (leveltime < timelimitintics) + return; + + if (gameaction == ga_completed) + return; + + //Tagmode round end but only on the tic before the + //XD_EXITLEVEL packet is recieved by all players. + if (G_TagGametype()) + { + if (leveltime == (timelimitintics + 1)) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator + || (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT)) + continue; + + CONS_Printf(M_GetText("%s recieved double points for surviving the round.\n"), player_names[i]); + P_AddPlayerScore(&players[i], players[i].score); + } + } + + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); + } + + //Optional tie-breaker for Match/CTF + else if (cv_overtime.value) + { + INT32 playerarray[MAXPLAYERS]; + INT32 tempplayer = 0; + INT32 spectators = 0; + INT32 playercount = 0; + + //Figure out if we have enough participating players to care. + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && players[i].spectator) + spectators++; + } + + if ((D_NumPlayers() - spectators) > 1) + { + // Play the starpost sfx after the first second of overtime. + if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE))) + S_StartSound(NULL, sfx_strpst); + + // Normal Match + if (!G_GametypeHasTeams()) + { + //Store the nodes of participating players in an array. + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + { + playerarray[playercount] = i; + playercount++; + } + } + + //Sort 'em. + for (i = 1; i < playercount; i++) + { + for (k = i; k < playercount; k++) + { + if (players[playerarray[i-1]].score < players[playerarray[k]].score) + { + tempplayer = playerarray[i-1]; + playerarray[i-1] = playerarray[k]; + playerarray[k] = tempplayer; + } + } + } + + //End the round if the top players aren't tied. + if (players[playerarray[0]].score == players[playerarray[1]].score) + return; + } + else + { + //In team match and CTF, determining a tie is much simpler. =P + if (redscore == bluescore) + return; + } + } + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); + } + + if (server) + SendNetXCmd(XD_EXITLEVEL, NULL, 0); +} + /** Checks if a player's score is over the pointlimit and the round should end. * Verify that the value of ::cv_pointlimit is greater than zero before * calling this function. * - * \sa cv_pointlimit, P_UpdateSpecials + * \sa cv_pointlimit, P_CheckTimeLimit, P_UpdateSpecials */ void P_CheckPointLimit(void) { diff --git a/src/p_local.h b/src/p_local.h index 716676474..97b8865d4 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -380,6 +380,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss); void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); void P_PlayerFlagBurst(player_t *player, boolean toss); +void P_CheckTimeLimit(void); void P_CheckPointLimit(void); void P_CheckSurvivors(void); boolean P_CheckRacers(void); diff --git a/src/p_spec.c b/src/p_spec.c index 3f39bd08e..cac822ac8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4648,114 +4648,19 @@ void P_PlayerInSpecialSector(player_t *player) /** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up. * - * \sa cv_timelimit, P_CheckPointLimit + * \sa P_CheckTimeLimit, P_CheckPointLimit */ void P_UpdateSpecials(void) { anim_t *anim; - INT32 i, k; + INT32 i; INT32 pic; size_t j; levelflat_t *foundflats; // for flat animation // LEVEL TIMER - // Exit if the timer is equal to or greater the timelimit, unless you are - // in overtime. In which case leveltime may stretch out beyond timelimitintics - // and overtime's status will be checked here each tick. - if (cv_timelimit.value && timelimitintics <= leveltime && (multiplayer || netgame) - && G_RingSlingerGametype() && (gameaction != ga_completed)) - { - boolean pexit = false; - - //Tagmode round end but only on the tic before the - //XD_EXITLEVEL packet is recieved by all players. - if (G_TagGametype()) - { - if (leveltime == (timelimitintics + 1)) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator - || (players[i].pflags & PF_TAGGED) || (players[i].pflags & PF_TAGIT)) - continue; - - CONS_Printf(M_GetText("%s recieved double points for surviving the round.\n"), player_names[i]); - P_AddPlayerScore(&players[i], players[i].score); - } - } - - pexit = true; - } - - //Optional tie-breaker for Match/CTF - else if (G_RingSlingerGametype() && cv_overtime.value) - { - INT32 playerarray[MAXPLAYERS]; - INT32 tempplayer = 0; - INT32 spectators = 0; - INT32 playercount = 0; - - //Figure out if we have enough participating players to care. - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && players[i].spectator) - spectators++; - } - - if ((D_NumPlayers() - spectators) > 1) - { - // Play the starpost sfx after the first second of overtime. - if (gamestate == GS_LEVEL && (leveltime == (timelimitintics + TICRATE))) - S_StartSound(NULL, sfx_strpst); - - // Normal Match - if (!G_GametypeHasTeams()) - { - //Store the nodes of participating players in an array. - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && !players[i].spectator) - { - playerarray[playercount] = i; - playercount++; - } - } - - //Sort 'em. - for (i = 1; i < playercount; i++) - { - for (k = i; k < playercount; k++) - { - if (players[playerarray[i-1]].score < players[playerarray[k]].score) - { - tempplayer = playerarray[i-1]; - playerarray[i-1] = playerarray[k]; - playerarray[k] = tempplayer; - } - } - } - - //End the round if the top players aren't tied. - if (!(players[playerarray[0]].score == players[playerarray[1]].score)) - pexit = true; - } - else - { - //In team match and CTF, determining a tie is much simpler. =P - if (!(redscore == bluescore)) - pexit = true; - } - } - else - pexit = true; - } - else - pexit = true; - - if (server && pexit) - SendNetXCmd(XD_EXITLEVEL, NULL, 0); - } + P_CheckTimeLimit(); // POINT LIMIT P_CheckPointLimit(); From 734419d5495635c6a0d885ad374f5443594bc88b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Jan 2016 16:39:31 +0000 Subject: [PATCH 167/364] FF_TRANSSHIFT is meant for transmaps linked to states, not anything else! I'm surprised how the source code flew in the face of this fact for so long and just used it everywhere, that's just silly. Conflicts: src/f_wipe.c --- src/r_plane.c | 42 +++++++++++++----------------------------- src/r_segs.c | 48 ++++++++++++------------------------------------ src/r_splats.c | 2 +- src/r_things.c | 4 ++-- src/v_video.c | 6 +++--- 5 files changed, 31 insertions(+), 71 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index fa0e0eac3..cfc8ea592 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -750,31 +750,15 @@ void R_DrawSinglePlane(visplane_t *pl) // Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red) if (pl->polyobj->translucency >= 10) return; // Don't even draw it - else if (pl->polyobj->translucency == 9) - ds_transmap = ((tr_trans90)<polyobj->translucency == 8) - ds_transmap = ((tr_trans80)<polyobj->translucency == 7) - ds_transmap = ((tr_trans70)<polyobj->translucency == 6) - ds_transmap = ((tr_trans60)<polyobj->translucency == 5) - ds_transmap = ((tr_trans50)<polyobj->translucency == 4) - ds_transmap = ((tr_trans40)<polyobj->translucency == 3) - ds_transmap = ((tr_trans30)<polyobj->translucency == 2) - ds_transmap = ((tr_trans20)<polyobj->translucency == 1) - ds_transmap = ((tr_trans10)<polyobj->translucency <= 9 && pl->polyobj->translucency > 0) + ds_transmap = transtables + ((pl->polyobj->translucency-1)<<16); else // Opaque, but allow transparent flat pixels spanfunc = splatfunc; if (pl->extra_colormap && pl->extra_colormap->fog) light = (pl->lightlevel >> LIGHTSEGSHIFT); else - light = LIGHTLEVELS-1; + light = LIGHTLEVELS-1; } else #endif @@ -805,23 +789,23 @@ void R_DrawSinglePlane(visplane_t *pl) if (pl->ffloor->alpha < 12) return; // Don't even draw it else if (pl->ffloor->alpha < 38) - ds_transmap = ((tr_trans90)<ffloor->alpha < 64) - ds_transmap = ((tr_trans80)<ffloor->alpha < 89) - ds_transmap = ((tr_trans70)<ffloor->alpha < 115) - ds_transmap = ((tr_trans60)<ffloor->alpha < 140) - ds_transmap = ((tr_trans50)<ffloor->alpha < 166) - ds_transmap = ((tr_trans40)<ffloor->alpha < 192) - ds_transmap = ((tr_trans30)<ffloor->alpha < 217) - ds_transmap = ((tr_trans20)<ffloor->alpha < 243) - ds_transmap = ((tr_trans10)<special) { case 900: - dc_transmap = ((tr_trans10)<special-900)<<16); colfunc = fuzzcolfunc; break; case 909: @@ -354,7 +330,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (curline->polyseg->translucency >= NUMTRANSMAPS) return; - dc_transmap = ((curline->polyseg->translucency)<polyseg->translucency-1)<<16); colfunc = fuzzcolfunc; } @@ -733,23 +709,23 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->alpha < 12) return; // Don't even draw it else if (pfloor->alpha < 38) - dc_transmap = ((tr_trans90)<alpha < 64) - dc_transmap = ((tr_trans80)<alpha < 89) - dc_transmap = ((tr_trans70)<alpha < 115) - dc_transmap = ((tr_trans60)<alpha < 140) - dc_transmap = ((tr_trans50)<alpha < 166) - dc_transmap = ((tr_trans40)<alpha < 192) - dc_transmap = ((tr_trans30)<alpha < 217) - dc_transmap = ((tr_trans20)<alpha < 243) - dc_transmap = ((tr_trans10)<flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) - vis->transmap = ((tr_trans80-1)<transmap = transtables + ((tr_trans80-1)<<16); // because now the translucency is set through FF_TRANSMASK else if (thing->frame & FF_TRANSMASK) - vis->transmap = (thing->frame & FF_TRANSMASK) - 0x10000 + transtables; + vis->transmap = transtables + ((((thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)-1)<<16); if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW)) && (!vis->extra_colormap || !vis->extra_colormap->fog)) diff --git a/src/v_video.c b/src/v_video.c index 64bf825bd..8e05819e8 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -366,7 +366,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t } if (alphalevel) { - v_translevel = ((alphalevel)< Date: Mon, 12 Oct 2015 15:10:43 +0100 Subject: [PATCH 168/364] Partial undo of what I did last commit to make Inu happy again. Note: polyobj_t's "translucency" is apparently a SIGNED integer, so in theory it's possible to get polyobj flats to use the "spanfunc = splatfunc" line using negative values. If this is not meant to happen, this should probably be fixed asap Conflicts: src/f_wipe.c --- src/r_plane.c | 24 ++++++++++++------------ src/r_segs.c | 24 ++++++++++++------------ src/r_splats.c | 2 +- src/r_things.c | 4 ++-- src/v_video.c | 6 +++--- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index cfc8ea592..417f0360a 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -750,8 +750,8 @@ void R_DrawSinglePlane(visplane_t *pl) // Hacked up support for alpha value in software mode Tails 09-24-2002 (sidenote: ported to polys 10-15-2014, there was no time travel involved -Red) if (pl->polyobj->translucency >= 10) return; // Don't even draw it - else if (pl->polyobj->translucency <= 9 && pl->polyobj->translucency > 0) - ds_transmap = transtables + ((pl->polyobj->translucency-1)<<16); + else if (pl->polyobj->translucency > 0) + ds_transmap = transtables + ((pl->polyobj->translucency-1)<ffloor->alpha < 12) return; // Don't even draw it else if (pl->ffloor->alpha < 38) - ds_transmap = transtables + ((tr_trans90-1)<<16); + ds_transmap = transtables + ((tr_trans90-1)<ffloor->alpha < 64) - ds_transmap = transtables + ((tr_trans80-1)<<16); + ds_transmap = transtables + ((tr_trans80-1)<ffloor->alpha < 89) - ds_transmap = transtables + ((tr_trans70-1)<<16); + ds_transmap = transtables + ((tr_trans70-1)<ffloor->alpha < 115) - ds_transmap = transtables + ((tr_trans60-1)<<16); + ds_transmap = transtables + ((tr_trans60-1)<ffloor->alpha < 140) - ds_transmap = transtables + ((tr_trans50-1)<<16); + ds_transmap = transtables + ((tr_trans50-1)<ffloor->alpha < 166) - ds_transmap = transtables + ((tr_trans40-1)<<16); + ds_transmap = transtables + ((tr_trans40-1)<ffloor->alpha < 192) - ds_transmap = transtables + ((tr_trans30-1)<<16); + ds_transmap = transtables + ((tr_trans30-1)<ffloor->alpha < 217) - ds_transmap = transtables + ((tr_trans20-1)<<16); + ds_transmap = transtables + ((tr_trans20-1)<ffloor->alpha < 243) - ds_transmap = transtables + ((tr_trans10-1)<<16); + ds_transmap = transtables + ((tr_trans10-1)<special-900)<<16); + dc_transmap = transtables + ((ldef->special-900)<polyseg->translucency >= NUMTRANSMAPS) return; - dc_transmap = transtables + ((curline->polyseg->translucency-1)<<16); + dc_transmap = transtables + ((curline->polyseg->translucency-1)<alpha < 12) return; // Don't even draw it else if (pfloor->alpha < 38) - dc_transmap = transtables + ((tr_trans90-1)<<16); + dc_transmap = transtables + ((tr_trans90-1)<alpha < 64) - dc_transmap = transtables + ((tr_trans80-1)<<16); + dc_transmap = transtables + ((tr_trans80-1)<alpha < 89) - dc_transmap = transtables + ((tr_trans70-1)<<16); + dc_transmap = transtables + ((tr_trans70-1)<alpha < 115) - dc_transmap = transtables + ((tr_trans60-1)<<16); + dc_transmap = transtables + ((tr_trans60-1)<alpha < 140) - dc_transmap = transtables + ((tr_trans50-1)<<16); + dc_transmap = transtables + ((tr_trans50-1)<alpha < 166) - dc_transmap = transtables + ((tr_trans40-1)<<16); + dc_transmap = transtables + ((tr_trans40-1)<alpha < 192) - dc_transmap = transtables + ((tr_trans30-1)<<16); + dc_transmap = transtables + ((tr_trans30-1)<alpha < 217) - dc_transmap = transtables + ((tr_trans20-1)<<16); + dc_transmap = transtables + ((tr_trans20-1)<alpha < 243) - dc_transmap = transtables + ((tr_trans10-1)<<16); + dc_transmap = transtables + ((tr_trans10-1)<flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility) - vis->transmap = transtables + ((tr_trans80-1)<<16); // because now the translucency is set through FF_TRANSMASK + vis->transmap = transtables + ((tr_trans80-1)<frame & FF_TRANSMASK) - vis->transmap = transtables + ((((thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT)-1)<<16); + vis->transmap = transtables + (thing->frame & FF_TRANSMASK) - 0x10000; if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW)) && (!vis->extra_colormap || !vis->extra_colormap->fog)) diff --git a/src/v_video.c b/src/v_video.c index 8e05819e8..df81ac6d6 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -366,7 +366,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t } if (alphalevel) { - v_translevel = transtables + ((alphalevel-1)<<16); + v_translevel = transtables + ((alphalevel-1)< Date: Wed, 21 Oct 2015 15:32:50 +0100 Subject: [PATCH 169/364] From what I can tell, correcting this one value in finetangent[] shouldn't cause any harm at all, so... --- src/tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tables.c b/src/tables.c index deb5a6b19..3f881be7d 100644 --- a/src/tables.c +++ b/src/tables.c @@ -546,7 +546,7 @@ fixed_t finetangent[4096] = 63166, 63263, 63360, 63458, 63555, 63653, 63750, 63848, 63946, 64045, 64143, 64241, 64340, 64439, 64538, 64637, 64736, 64836, 64935, 65035, 65135, 65235, 65335, 65435, - 65535, 65636, 65737, 65838, 65939, 66040, 66141, 66243, + 65536, 65636, 65737, 65838, 65939, 66040, 66141, 66243, 66345, 66447, 66549, 66651, 66753, 66856, 66958, 67061, 67164, 67267, 67371, 67474, 67578, 67681, 67785, 67889, 67994, 68098, 68203, 68308, 68413, 68518, 68623, 68728, From 01ef2d3ca3da5fc95f4daa81be82b778d51f10e7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 21 Oct 2015 15:40:59 +0100 Subject: [PATCH 170/364] If this isn't an accidental copy+paste then I'd be very surprised --- src/g_game.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 917a86165..6d0ef5a5b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -297,9 +297,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"}, #if JOYAXISSET > 3 {7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"}, #endif -#if JOYAXISSET > 3 -{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"}, -#endif #if JOYAXISSET > 4 {7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"}, #endif From a52f31f30e132ac9b86662ef47ec31957e205943 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 21 Oct 2015 16:01:16 +0100 Subject: [PATCH 171/364] doomtype.h tweaks some of the mess in here really bothers me --- src/doomtype.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doomtype.h b/src/doomtype.h index ff4199775..8e7da6881 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -100,11 +100,13 @@ typedef long ssize_t; #if defined (_MSC_VER) || defined (__OS2__) // Microsoft VisualC++ +#ifdef _MSC_VER #if (_MSC_VER <= 1800) // MSVC 2013 and back #define snprintf _snprintf #if (_MSC_VER <= 1200) // MSVC 2012 and back #define vsnprintf _vsnprintf #endif +#endif #endif #define strncasecmp strnicmp #define strcasecmp stricmp @@ -177,6 +179,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz); // not the number of bytes in the buffer. #define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst) +// \note __BYTEBOOL__ used to be set above if "macintosh" was defined, +// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now? #ifndef __BYTEBOOL__ #define __BYTEBOOL__ @@ -193,7 +197,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #else typedef enum {false, true} boolean; #endif - //#endif // __cplusplus #endif // __BYTEBOOL__ /* 7.18.2.1 Limits of exact-width integer types */ From e31c7ae3faab2c1f05338910f141b8cc20497361 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 6 Nov 2015 14:23:06 +0000 Subject: [PATCH 172/364] Removed dummied-out Pope XVI code --- src/st_stuff.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 6e19b92ff..585db0c87 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1842,37 +1842,6 @@ static void ST_overlayDrawer(void) LUAh_GameHUD(stplyr); #endif -#if 0 // Pope XVI - if (!(netgame || multiplayer) && !modifiedgame && gamemap == 11 && ALL7EMERALDS(emeralds) - && stplyr->mo && stplyr->mo->subsector && stplyr->mo->subsector->sector-sectors == 1361) - { - if (grade & 2048) // NAGZ - { - V_DrawCenteredString(BASEVIDWIDTH/2, 70, 0, M_GetText("I, Pope Rededict XVI proclaim")); - V_DrawCenteredString(BASEVIDWIDTH/2, 80, 0, M_GetText("AJ & Amy")); - V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, M_GetText("Husband & Wife")); - V_DrawCenteredString(BASEVIDWIDTH/2, 100, 0, M_GetText("on this day")); - V_DrawCenteredString(BASEVIDWIDTH/2, 110, 0, M_GetText("May 16, 2009")); - - P_GivePlayerRings(stplyr, 9999); - } - else - { - V_DrawCenteredString(BASEVIDWIDTH/2, 60, 0, M_GetText("Oh... it's you again...")); - V_DrawCenteredString(BASEVIDWIDTH/2, 80, 0, M_GetText("Look, I wanted to apologize for the way")); - V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, M_GetText("I've acted in the past.")); - V_DrawCenteredString(BASEVIDWIDTH/2, 110, 0, M_GetText("I've seen the error of my ways")); - V_DrawCenteredString(BASEVIDWIDTH/2, 120, 0, M_GetText("and turned over a new leaf.")); - V_DrawCenteredString(BASEVIDWIDTH/2, 140, 0, M_GetText("Instead of sending people to hell,")); - V_DrawCenteredString(BASEVIDWIDTH/2, 150, 0, M_GetText("I now send them to heaven!")); - - P_LinedefExecute(4200, stplyr->mo, stplyr->mo->subsector->sector); - P_LinedefExecute(4201, stplyr->mo, stplyr->mo->subsector->sector); - stplyr->mo->momx = stplyr->mo->momy = 0; - } - } -#endif - // draw level title Tails if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer)) #ifdef HAVE_BLUA From 99fad846740c5543762fdb32f7ff17c02e3a0445 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Dec 2015 22:38:57 +0000 Subject: [PATCH 173/364] Added missing SHORT macros around these variables, they're needed for big-endian builds to use these properly ...I'm to blame for this particular slipup as it happens, surprise surprise --- src/p_saveg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 621abcb48..61f51e497 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -636,7 +636,7 @@ static void P_NetArchiveWorld(void) if (li->special != SHORT(mld->special)) diff |= LD_SPECIAL; - if (mld->special == 321 || mld->special == 322) // only reason li->callcount would be non-zero is if either of these are involved + if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved diff |= LD_CLLCOUNT; if (li->sidenum[0] != 0xffff) From 106287aca5a24ae6a9a6068d2781e30838b900e5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 14 Jan 2016 12:32:04 -0500 Subject: [PATCH 174/364] SDL: config.h.in is pre source tree, config.h for each cmake build --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7b75b4d34..db873765b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -21,7 +21,7 @@ /// \brief SRB2 system stuff for SDL #ifdef CMAKECONFIG -#include "../config.h" +#include "config.h" #else #include "../config.h.in" #endif From 071006bcb0fd4513d26ca1ffeed659ff552f43bd Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sat, 16 Jan 2016 11:35:34 -0800 Subject: [PATCH 175/364] Makefile can run comptime.bat from src\ too --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 119b3bb5c..9e127f001 100644 --- a/comptime.bat +++ b/comptime.bat @@ -6,6 +6,7 @@ copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul if exist .git goto gitrev +if exist ..\.git goto gitrev if exist .svn goto svnrev goto filwri From 6fd3036112cfc0edf02eaa51016dc7ed552855fa Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sat, 16 Jan 2016 11:35:34 -0800 Subject: [PATCH 176/364] Makefile can run comptime.bat from src\ too --- comptime.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/comptime.bat b/comptime.bat index 119b3bb5c..9e127f001 100644 --- a/comptime.bat +++ b/comptime.bat @@ -6,6 +6,7 @@ copy nul: /b +%1\comptime.c tmp.$$$ > nul move tmp.$$$ %1\comptime.c > nul if exist .git goto gitrev +if exist ..\.git goto gitrev if exist .svn goto svnrev goto filwri From af3c4755dc1c26c003d595474799560eba83b964 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 17 Jan 2016 19:43:26 +0000 Subject: [PATCH 177/364] All lumps with the "SOC_" prefix in their names are now read as SOCs. --- src/w_wad.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/w_wad.c b/src/w_wad.c index 9d6a11fb5..39bde4bb1 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -147,6 +147,16 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum) } #endif + { + lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo; + for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++) + if (memcmp(lump_p->name,"SOC_",4)==0) + { + CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfiles[wadnum]->filename); + DEH_LoadDehackedLumpPwad(wadnum, lump); + } + } + // Check for MAINCFG for (lump = 0;lump != INT16_MAX;lump++) { From c6a2bde7d97aef3ebfbc82678e5c37a22379a323 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 18 Jan 2016 19:46:00 +0000 Subject: [PATCH 178/364] Use modulo, not bitwise AND. My fault once again, whoops. The point here is ColorOpposite(MAXSKINCOLORS) would have given an actual result of its own since MAXSKINCOLORS & MAXSKINCOLORS is still MAXSKINCOLORS. This shouldn't happen though, as both Color_Opposite[MAXSKINCOLORS*2] and Color_Opposite[MAXSKINCOLOR*2+1] aren't defined. --- src/lua_mathlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index f4b5ca5fe..fd00180d5 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -166,7 +166,7 @@ static int lib_all7emeralds(lua_State *L) // Returns both color and frame numbers! static int lib_coloropposite(lua_State *L) { - int colornum = ((int)luaL_checkinteger(L, 1)) & MAXSKINCOLORS; + int colornum = ((int)luaL_checkinteger(L, 1)) % MAXSKINCOLORS; lua_pushinteger(L, Color_Opposite[colornum*2]); // push color lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame return 2; From 96913c4a479ad642d7759590d652b56a482ee2ee Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 20 Jan 2016 01:13:21 -0800 Subject: [PATCH 179/364] objectplace stability fix Objectplace reallocates the mapthings list to add one more mapthing. By itself there's no problem with this. But, mobj->spawnpoint is a pointer to the mapthing's location in the mapthings list. So by reallocating the mapthings list, all references to mobj->spawnpoints point to freed memory. ... Oops. Now when objectplace reallocates the mapthings list it actually corrects the locations of all mobj's spawnpoints to point to the new list. Hooray, you can use NiGHTS objectplace again if you really want to. --- src/m_cheat.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 4da9b3ba7..6eaf31c4a 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -880,12 +880,33 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling) { - mapthing_t *mt; + mapthing_t *mt = mapthings; + #ifdef HAVE_BLUA LUA_InvalidateMapthings(); #endif mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL); + + // as Z_Realloc can relocate mapthings, quickly go through thinker list and correct + // the spawnpoints of any objects that have them to the new location + if (mt != mapthings) + { + thinker_t *th; + mobj_t *mo; + + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + // get offset from mt, which points to old mapthings, then add new location + if (mo->spawnpoint) + mo->spawnpoint = (mo->spawnpoint - mt) + mapthings; + } + } + mt = (mapthings+nummapthings-1); mt->type = type; From 55f0e5cab5fe13bef38d7ad67c2f80226128769d Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 20 Jan 2016 01:13:21 -0800 Subject: [PATCH 180/364] objectplace stability fix Objectplace reallocates the mapthings list to add one more mapthing. By itself there's no problem with this. But, mobj->spawnpoint is a pointer to the mapthing's location in the mapthings list. So by reallocating the mapthings list, all references to mobj->spawnpoints point to freed memory. ... Oops. Now when objectplace reallocates the mapthings list it actually corrects the locations of all mobj's spawnpoints to point to the new list. Hooray, you can use NiGHTS objectplace again if you really want to. --- src/m_cheat.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index bc32e6cfa..473fbbf75 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -880,12 +880,33 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling) { - mapthing_t *mt; + mapthing_t *mt = mapthings; + #ifdef HAVE_BLUA LUA_InvalidateMapthings(); #endif mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL); + + // as Z_Realloc can relocate mapthings, quickly go through thinker list and correct + // the spawnpoints of any objects that have them to the new location + if (mt != mapthings) + { + thinker_t *th; + mobj_t *mo; + + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + // get offset from mt, which points to old mapthings, then add new location + if (mo->spawnpoint) + mo->spawnpoint = (mo->spawnpoint - mt) + mapthings; + } + } + mt = (mapthings+nummapthings-1); mt->type = type; From 79e3e2351d17f4f223d75295635122257219242d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 20 Jan 2016 14:56:52 +0000 Subject: [PATCH 181/364] Finally bothered to add in a method to obtain sector.lines' size internally to prevent going out of bounds. Admittedly I knew of this particular method from the start but wanted to avoid it in favour of a less-hacky looking method of getting sector.lines' size ...but there was none to be found at all. --- src/lua_maplib.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 1307540fb..77651b209 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -268,7 +268,7 @@ static int sectorlines_get(lua_State *L) { line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES)); size_t i; - //size_t numoflines; + size_t numoflines = 0; lua_settop(L, 2); if (!lua_isnumber(L, 2)) { @@ -286,21 +286,22 @@ static int sectorlines_get(lua_State *L) } } - /* \TODO: figure out how to find size of seclines array, rather than the size of a pointer! - Testing for sectors[0].lines in GFZ1 with a test Lua script: - sizeof(seclines) returns 4 - sizeof(*seclines) returns 4 - sizeof(**seclines) returns 84, presumably the size of line_t - You can probably see why I haven't been successful yet, hopefully - //CONS_Printf("sizeof(seclines): %d\n", sizeof(seclines)); - //CONS_Printf("sizeof(seclines[0]): %d\n", sizeof(seclines[0]));*/ + // check first linedef to figure which of its sectors owns this sector->lines pointer + // then check that sector's linecount to get a maximum index + //if (!seclines[0]) + //return luaL_error(L, "no lines found!"); // no first linedef????? + if (seclines[0]->frontsector->lines == seclines) + numoflines = seclines[0]->frontsector->linecount; + else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first + numoflines = seclines[0]->backsector->linecount; + //if neither sector has it then ??? - /*numoflines = sizeof(seclines) / sizeof(seclines[0]); if (!numoflines) - return luaL_error(L, "no lines found!");*/ + return luaL_error(L, "no lines found!"); + i = (size_t)lua_tointeger(L, 2); - /*if (i > numoflines) - return 0;*/ + if (i >= numoflines) + return 0; LUA_PushUserdata(L, seclines[i], META_LINE); return 1; } From 7d914913dd94400ad3369b152aa02d845774bd4b Mon Sep 17 00:00:00 2001 From: Sean Ryder Date: Wed, 20 Jan 2016 15:55:32 +0000 Subject: [PATCH 182/364] Tabbing --- src/hardware/hw_md2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e4b839b68..0745b9a00 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1115,8 +1115,8 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color) { UINT16 w = gpatch->width, h = gpatch->height; - UINT32 size = w*h; - RGBA_t *image, *blendimage, *cur, blendcolor; + UINT32 size = w*h; + RGBA_t *image, *blendimage, *cur, blendcolor; if (grmip->width == 0) { From 5abdb08a25da14e1378adb937a4418e92dfcc609 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 20 Jan 2016 16:03:17 +0000 Subject: [PATCH 183/364] #sector.lines now returns the number of linedefs in the sector --- src/lua_maplib.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 77651b209..d585c479f 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -306,6 +306,23 @@ static int sectorlines_get(lua_State *L) return 1; } +static int sectorlines_num(lua_State *L) +{ + line_t **seclines = *((line_t ***)luaL_checkudata(L, 1, META_SECTORLINES)); + size_t numoflines = 0; + // check first linedef to figure which of its sectors owns this sector->lines pointer + // then check that sector's linecount to get a maximum index + //if (!seclines[0]) + //return luaL_error(L, "no lines found!"); // no first linedef????? + if (seclines[0]->frontsector->lines == seclines) + numoflines = seclines[0]->frontsector->linecount; + else if (seclines[0]->backsector && seclines[0]->backsector->lines == seclines) // check backsector exists first + numoflines = seclines[0]->backsector->linecount; + //if neither sector has it then ??? + lua_pushinteger(L, numoflines); + return 1; +} + static int sector_get(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); @@ -1282,6 +1299,9 @@ int LUA_MapLib(lua_State *L) luaL_newmetatable(L, META_SECTORLINES); lua_pushcfunction(L, sectorlines_get); lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, sectorlines_num); + lua_setfield(L, -2, "__len"); lua_pop(L, 1); luaL_newmetatable(L, META_SECTOR); From 7d6dc3a5bb64e1ad8fe1ac091fbcff8c11ef7bcf Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 20 Jan 2016 09:25:28 -0800 Subject: [PATCH 184/364] fix bad lstring usage in map header lua This is not how you use pushlstring! This is actually sending uninitialized memory to Lua, which is making scripts have inconsistent results (duh?) c/o JTE: "Tell Red they're a doofus." --- src/lua_maplib.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 0a12478ca..85c3b094c 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1162,9 +1162,9 @@ static int mapheaderinfo_get(lua_State *L) //for (i = 0; i < 21; i++) // if (!header->lvlttl[i]) // break; - lua_pushlstring(L, header->lvlttl, 21); + lua_pushstring(L, header->lvlttl); } else if (fastcmp(field,"subttl")) - lua_pushlstring(L, header->subttl, 32); + lua_pushstring(L, header->subttl); else if (fastcmp(field,"actnum")) lua_pushinteger(L, header->actnum); else if (fastcmp(field,"typeoflevel")) @@ -1176,7 +1176,7 @@ static int mapheaderinfo_get(lua_State *L) else if (fastcmp(field,"musicslottrack")) lua_pushinteger(L, header->musicslottrack); else if (fastcmp(field,"forcecharacter")) - lua_pushlstring(L, header->forcecharacter, 16); + lua_pushstring(L, header->forcecharacter); else if (fastcmp(field,"weather")) lua_pushinteger(L, header->weather); else if (fastcmp(field,"skynum")) @@ -1188,11 +1188,11 @@ static int mapheaderinfo_get(lua_State *L) else if (fastcmp(field,"skybox_scalez")) lua_pushinteger(L, header->skybox_scalez); else if (fastcmp(field,"interscreen")) - lua_pushlstring(L, header->interscreen, 8); + lua_pushstring(L, header->interscreen); else if (fastcmp(field,"runsoc")) - lua_pushlstring(L, header->runsoc, 32); + lua_pushstring(L, header->runsoc); else if (fastcmp(field,"scriptname")) - lua_pushlstring(L, header->scriptname, 32); + lua_pushstring(L, header->scriptname); else if (fastcmp(field,"precutscenenum")) lua_pushinteger(L, header->precutscenenum); else if (fastcmp(field,"cutscenenum")) @@ -1221,7 +1221,7 @@ static int mapheaderinfo_get(lua_State *L) for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i); if(i < header->numCustomOptions) - lua_pushlstring(L, header->customopts[i].value, 255); + lua_pushstring(L, header->customopts[i].value); else lua_pushnil(L); } From 9d5718760dd287947392b09abe7ce5b2520ebce6 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 20 Jan 2016 09:42:35 -0800 Subject: [PATCH 185/364] interscreen is a lump name and thus needs lstring ... not just lstring though, but the behavior with i that is used elsewhere. --- src/lua_maplib.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 85c3b094c..6f28997ac 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1157,13 +1157,10 @@ static int mapheaderinfo_get(lua_State *L) { mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER)); const char *field = luaL_checkstring(L, 2); - //INT16 i; - if (fastcmp(field,"lvlttl")) { - //for (i = 0; i < 21; i++) - // if (!header->lvlttl[i]) - // break; + INT16 i; + if (fastcmp(field,"lvlttl")) lua_pushstring(L, header->lvlttl); - } else if (fastcmp(field,"subttl")) + else if (fastcmp(field,"subttl")) lua_pushstring(L, header->subttl); else if (fastcmp(field,"actnum")) lua_pushinteger(L, header->actnum); @@ -1187,9 +1184,12 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->skybox_scaley); else if (fastcmp(field,"skybox_scalez")) lua_pushinteger(L, header->skybox_scalez); - else if (fastcmp(field,"interscreen")) - lua_pushstring(L, header->interscreen); - else if (fastcmp(field,"runsoc")) + else if (fastcmp(field,"interscreen")) { + for (i = 0; i < 8; i++) + if (!header->interscreen[i]) + break; + lua_pushlstring(L, header->interscreen, i); + } else if (fastcmp(field,"runsoc")) lua_pushstring(L, header->runsoc); else if (fastcmp(field,"scriptname")) lua_pushstring(L, header->scriptname); From c33d20acff6b712acc293bc97327b3021786a184 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 21 Jan 2016 13:50:05 -0500 Subject: [PATCH 186/364] whitespace cleanup --- src/r_bsp.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index badf8bdac..c547713be 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -935,14 +935,14 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; - - floorcenterz = + + floorcenterz = #ifdef ESLOPE frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif frontsector->floorheight; - - ceilingcenterz = + + ceilingcenterz = #ifdef ESLOPE frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -953,8 +953,8 @@ static void R_Subsector(size_t num) *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : #endif *rover->bottomheight; - - planecenterz = + + planecenterz = #ifdef ESLOPE *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -966,7 +966,7 @@ static void R_Subsector(size_t num) { light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->bottomheight); - + ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover @@ -1002,8 +1002,8 @@ static void R_Subsector(size_t num) *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : #endif *rover->topheight; - - planecenterz = + + planecenterz = #ifdef ESLOPE *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -1014,7 +1014,7 @@ static void R_Subsector(size_t num) || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight); - + ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover From 6189d1a2cafcc6a9651151991f62aa07e5f8b585 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 21 Jan 2016 13:50:05 -0500 Subject: [PATCH 187/364] whitespace cleanup --- src/r_bsp.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index badf8bdac..c547713be 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -935,14 +935,14 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; - - floorcenterz = + + floorcenterz = #ifdef ESLOPE frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif frontsector->floorheight; - - ceilingcenterz = + + ceilingcenterz = #ifdef ESLOPE frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -953,8 +953,8 @@ static void R_Subsector(size_t num) *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : #endif *rover->bottomheight; - - planecenterz = + + planecenterz = #ifdef ESLOPE *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -966,7 +966,7 @@ static void R_Subsector(size_t num) { light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->bottomheight); - + ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover @@ -1002,8 +1002,8 @@ static void R_Subsector(size_t num) *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : #endif *rover->topheight; - - planecenterz = + + planecenterz = #ifdef ESLOPE *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -1014,7 +1014,7 @@ static void R_Subsector(size_t num) || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight); - + ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover From 3bfc4022413c3bad189f9ac3f55232a80785331e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 21 Jan 2016 13:52:45 -0500 Subject: [PATCH 188/364] whitespace cleanup --- src/console.c | 1 - src/dehacked.c | 1 - src/doomdef.h | 1 - src/hardware/hw_defs.h | 1 - src/m_menu.c | 1 - src/r_draw.c | 5 ++--- src/r_draw8.c | 1 - 7 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/console.c b/src/console.c index fe447b10a..ae95f161c 100644 --- a/src/console.c +++ b/src/console.c @@ -1472,4 +1472,3 @@ void CON_Drawer(void) else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS) CON_DrawHudlines(); } - diff --git a/src/dehacked.c b/src/dehacked.c index 4222b4f7c..241a523f8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8824,4 +8824,3 @@ void LUA_SetActionByName(void *state, const char *actiontocompare) } #endif // HAVE_BLUA - diff --git a/src/doomdef.h b/src/doomdef.h index 3fd24b0ae..757277865 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -506,4 +506,3 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; //#define REDSANALOG #endif // __DOOMDEF__ - diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 5a39fead1..52110121b 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -229,4 +229,3 @@ enum hwdfiltermode #endif //_HWR_DEFS_ - diff --git a/src/m_menu.c b/src/m_menu.c index 439950049..1010db909 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7409,4 +7409,3 @@ static void M_HandleFogColor(INT32 choice) } } #endif - diff --git a/src/r_draw.c b/src/r_draw.c index 4cc70b795..d1673c9a6 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -347,7 +347,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 3); } break; - + case SKINCOLOR_PEACH: // 11 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) @@ -362,7 +362,7 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U dest_colormap[starttranscolor + i] = (UINT8)(skinbasecolors[color - 1] + i - 7); // Darkest } break; - + case SKINCOLOR_RED: // 16 colors for (i = 0; i < SKIN_RAMP_LENGTH; i++) @@ -957,4 +957,3 @@ void R_DrawViewBorder(void) // ========================================================================== #include "r_draw16.c" - diff --git a/src/r_draw8.c b/src/r_draw8.c index d3f6e18d6..c42f5d869 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -1388,4 +1388,3 @@ void R_DrawColumnShadowed_8(void) if (dc_yl <= realyh) walldrawerfunc(); // R_DrawWallColumn_8 for the appropriate architecture } - From ccb0abb853233e414a1734bf2556f556d4580320 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 21 Jan 2016 20:19:43 +0000 Subject: [PATCH 189/364] Diagonal ring springs should now be able to face any angle --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0f25a8655..25ae8815a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9696,7 +9696,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Diagonal rings (handles both types) else if (mthing->type == 602 || mthing->type == 603) // Diagonal rings (5) { - angle_t angle = ANGLE_45 * (mthing->angle/45); + angle_t angle = FixedAngle(mthing->angle*FRACUNIT); mobjtype_t ringthing = MT_RING; INT32 iterations = 5; if (mthing->type == 603) From 674ff5115392fea76bd757e39d6312924f70739d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 21 Jan 2016 20:27:35 +0000 Subject: [PATCH 190/364] Fix shadowing in mapheaderinfo_get --- src/lua_maplib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 6f28997ac..38920c223 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1217,11 +1217,11 @@ static int mapheaderinfo_get(lua_State *L) else { // Read custom vars now // (note: don't include the "LUA." in your lua scripts!) - UINT8 i = 0; - for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i); + UINT8 j = 0; + for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j); - if(i < header->numCustomOptions) - lua_pushstring(L, header->customopts[i].value); + if(j < header->numCustomOptions) + lua_pushstring(L, header->customopts[j].value); else lua_pushnil(L); } From 181c875016a74a2e6161daaad089b45f6f2dd325 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 14 Jan 2016 12:32:04 -0500 Subject: [PATCH 191/364] SDL: config.h.in is pre source tree, config.h for each cmake build --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 4b45c373c..da4111538 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -21,7 +21,7 @@ /// \brief SRB2 system stuff for SDL #ifdef CMAKECONFIG -#include "../config.h" +#include "config.h" #else #include "../config.h.in" #endif From 80fb282334435ff7ee566e4ff08e46d4833b2b2a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 23 Jan 2016 18:59:17 +0000 Subject: [PATCH 192/364] Fixed math for calculating current texture in texture animations --- src/p_spec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index cac822ac8..81994d46c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4671,11 +4671,11 @@ void P_UpdateSpecials(void) // ANIMATE TEXTURES for (anim = anims; anim < lastanim; anim++) { - for (i = anim->basepic; i < anim->basepic + anim->numpics; i++) + for (i = 0; i < anim->numpics; i++) { pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics); if (anim->istexture) - texturetranslation[i] = pic; + texturetranslation[anim->basepic+i] = pic; } } From 3db1a1fe9f6a93bf6b1f37439c73bb28c9903fb4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 26 Jan 2016 23:30:53 -0500 Subject: [PATCH 193/364] add/test appveyor build --- appveyor.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..cf7fb8507 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,4 @@ +version: 1.0.{build} +os: MinGW +build_script: +- cmd: make -C src MINGW=1 \ No newline at end of file From b8cafea40aebd5680d0d3808dc8f9f2e05277efc Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 26 Jan 2016 23:56:22 -0500 Subject: [PATCH 194/364] appveyor: full path to make binary and no asm or png support --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cf7fb8507..871e13195 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,5 @@ version: 1.0.{build} os: MinGW build_script: -- cmd: make -C src MINGW=1 \ No newline at end of file +- cmd: C:\MinGW\bin\make.exe -C src MINGW=1 NOASM=1 NOPNG=1 + From 21c30a396c692915cea33d1b964bd9b3c250560c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 00:11:54 -0500 Subject: [PATCH 195/364] appveyor: allow one to RDP to system to debug build system --- .gitattributes | 2 ++ appveyor.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.gitattributes b/.gitattributes index 777bf189a..ef775b912 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,4 +29,6 @@ /libs/zlib/nintendods/README -whitespace /libs/zlib/watcom/watcom_f.mak -crlf -whitespace /libs/zlib/watcom/watcom_l.mak -crlf -whitespace +#Appveyor +/appveyor.yml -crlf -whitespace # Other diff --git a/appveyor.yml b/appveyor.yml index 871e13195..ee6e3e97f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,8 @@ version: 1.0.{build} os: MinGW + build_script: - cmd: C:\MinGW\bin\make.exe -C src MINGW=1 NOASM=1 NOPNG=1 +on_finish: +-ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 289b5506bff6b1a45aa8e54a044204e9c2e04d16 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 00:15:09 -0500 Subject: [PATCH 196/364] appveyor: whitespace? --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index ee6e3e97f..cf84de502 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,3 +6,4 @@ build_script: on_finish: -ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + From cbd85e6baff8608ad1a9044ce3d95bf91c47f7e2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 00:27:28 -0500 Subject: [PATCH 197/364] appveyor: spacing --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index cf84de502..e871bb3e8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,5 +5,5 @@ build_script: - cmd: C:\MinGW\bin\make.exe -C src MINGW=1 NOASM=1 NOPNG=1 on_finish: --ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 8ad8533880232163d96d7ed34593035717ad6c3c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:09:51 -0500 Subject: [PATCH 198/364] appveyor: found mingw64 32-bit target, do not build with UPX --- appveyor.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e871bb3e8..6c5317987 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,14 @@ version: 1.0.{build} os: MinGW +install: +- set PATH=C:\mingw64\bin;%PATH% +- set CC=i686-w64-mingw32-gcc +- set WINDRES=windres + build_script: -- cmd: C:\MinGW\bin\make.exe -C src MINGW=1 NOASM=1 NOPNG=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 on_finish: -- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 113a3cd6fc53736ddb90960a88ee71ecc51ddb1e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:16:42 -0500 Subject: [PATCH 199/364] appveyor: try again --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6c5317987..b965a1130 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,12 @@ -version: 1.0.{build} +version: 2.1.14.{branch}-{build} os: MinGW install: -- set PATH=C:\mingw64\bin;%PATH% - set CC=i686-w64-mingw32-gcc - set WINDRES=windres build_script: +- set Path=C:\mingw64\bin;%Path% - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 on_finish: From 85de668d1a4ea54f9fcb0c183206f562f8c80419 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:21:29 -0500 Subject: [PATCH 200/364] appveyor: move set to before_build, and drop gcc and make version --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index b965a1130..69d4be7e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,8 +5,12 @@ install: - set CC=i686-w64-mingw32-gcc - set WINDRES=windres +before_build: +- set Path=c:\mingw64\bin;%Path% +- i686-w64-mingw32-gcc --version +- mingw32-make --version + build_script: -- set Path=C:\mingw64\bin;%Path% - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 on_finish: From 6e1b9549fc9739f863d8c70c02df05c9fef5392d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:24:32 -0500 Subject: [PATCH 201/364] appveyor: fullpath to binaries --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 69d4be7e4..81f71cc8c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,8 +7,8 @@ install: before_build: - set Path=c:\mingw64\bin;%Path% -- i686-w64-mingw32-gcc --version -- mingw32-make --version +- c:\mingw64\bin\i686-w64-mingw32-gcc --version +- c:\mingw64\bin\mingw32-make --version build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 From 443562c3c01cfb96f3fa10e29f125e81e5b3954a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:26:36 -0500 Subject: [PATCH 202/364] appveyor: why is this failing --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 81f71cc8c..20644c556 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,5 +14,5 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 on_finish: -#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 1a72f2f1db9220e21fafd38114e0864056065008 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:32:53 -0500 Subject: [PATCH 203/364] appveyor: wrong path... --- appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 20644c556..a0cbfae47 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,13 +6,13 @@ install: - set WINDRES=windres before_build: -- set Path=c:\mingw64\bin;%Path% -- c:\mingw64\bin\i686-w64-mingw32-gcc --version -- c:\mingw64\bin\mingw32-make --version +- set Path=c:\msys64\mingw32\bin;%Path% +- i686-w64-mingw32-gcc --version +- mingw32-make --version build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 on_finish: -- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From d0ce9170da8b6b4b2598883ec3938fb8016fd6d2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 27 Jan 2016 01:39:12 -0500 Subject: [PATCH 204/364] appveyor: build for GCC 5.2 --- appveyor.yml | 2 +- src/Makefile.cfg | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a0cbfae47..6c727568b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ before_build: - mingw32-make --version build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 on_finish: #- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 1ea96df92..d6af0d8a7 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,6 +7,22 @@ # and other things # +ifdef GCC53 +GCC52=1 +endif + +ifdef GCC52 +GCC51=1 +endif + +ifdef GCC51 +GCC49=1 +endif + +ifdef GCC49 +GCC48=1 +endif + ifdef GCC48 GCC47=1 endif From 5bf43171aeaec30e2ff4b2f6b697e2c4051d44d4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 10:29:02 -0500 Subject: [PATCH 205/364] appveyor: let try SDL2 builds --- appveyor.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6c727568b..ccd9d5770 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,18 +1,36 @@ version: 2.1.14.{branch}-{build} os: MinGW +cache: + SDL2-devel-2.0.4-mingw.tar.gz + +environment: + CC=i686-w64-mingw32-gcc + WINDRES=windres + MINGW_SDK=c:\msys64\mingw32 + SDL2_URL=http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz + SDL2_ARCHIVE=SDL2-devel-2.0.4-mingw.tar.gz + SDL2_MOVE=SDL2-2.0.4\i686-w64-mingw32 + install: -- set CC=i686-w64-mingw32-gcc -- set WINDRES=windres +- if not exist "%SDL2_ARCHIVE%" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%" +- 7z x -y "%MINGW_ARCHIVE%" -o%TMP% > nul +- robocopy /S %TMP%\%SDL2_MOVE% %MINGW_SDK% +- ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config +- ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake +- ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\pkgconfig\sdl2.pc before_build: -- set Path=c:\msys64\mingw32\bin;%Path% +- set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 DEBUGMODE=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 DEBUGMODE=1 on_finish: -#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 9422b994e4b0fc4612c3b6d8d05ce4f3f21eaf80 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 10:30:35 -0500 Subject: [PATCH 206/364] appveyor: fixup env block --- appveyor.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ccd9d5770..0236459ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,12 +5,12 @@ cache: SDL2-devel-2.0.4-mingw.tar.gz environment: - CC=i686-w64-mingw32-gcc - WINDRES=windres - MINGW_SDK=c:\msys64\mingw32 - SDL2_URL=http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz - SDL2_ARCHIVE=SDL2-devel-2.0.4-mingw.tar.gz - SDL2_MOVE=SDL2-2.0.4\i686-w64-mingw32 + CC: i686-w64-mingw32-gcc + WINDRES: windres + MINGW_SDK: c:\msys64\mingw32 + SDL2_URL: http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz + SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar.gz + SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32 install: - if not exist "%SDL2_ARCHIVE%" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%" From e5dbd3cb9dc5cf2f8bbcb0e4ae291343c60ec717 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 10:40:28 -0500 Subject: [PATCH 207/364] appveyor: copy and paste mistake on extracting archive comannd --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0236459ab..a8eb76a2d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ environment: install: - if not exist "%SDL2_ARCHIVE%" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%" -- 7z x -y "%MINGW_ARCHIVE%" -o%TMP% > nul +- 7z x -y "%SDL2_ARCHIVE%" -o%TMP% >null - robocopy /S %TMP%\%SDL2_MOVE% %MINGW_SDK% - ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config - ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake @@ -32,5 +32,6 @@ build_script: #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 DEBUGMODE=1 on_finish: +- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 9e1ba2e972057f6032c629dff4e6762b4f93d938 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 10:44:52 -0500 Subject: [PATCH 208/364] appvenyor: self note only --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a8eb76a2d..5c596d40a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,6 +32,6 @@ build_script: #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 DEBUGMODE=1 on_finish: -- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: +#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 46f9e4a9615807084e5657ea638f5e69c4c0f0fa Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 10:52:40 -0500 Subject: [PATCH 209/364] appveyor: we need to run 7zip twice --- appveyor.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5c596d40a..c4fcb64ed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,12 +9,13 @@ environment: WINDRES: windres MINGW_SDK: c:\msys64\mingw32 SDL2_URL: http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz - SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar.gz + SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32 install: -- if not exist "%SDL2_ARCHIVE%" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%" -- 7z x -y "%SDL2_ARCHIVE%" -o%TMP% >null +- if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" +- 7z x -y "%SDL2_ARCHIVE%,gz" -o%TMP% >null +- 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null - robocopy /S %TMP%\%SDL2_MOVE% %MINGW_SDK% - ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config - ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake From ffe193ca3ead0af14f87695b4a4bdd5a193a94ff Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 10:55:38 -0500 Subject: [PATCH 210/364] appveyor: mistakes are easy to make --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c4fcb64ed..766894ba5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ environment: install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" -- 7z x -y "%SDL2_ARCHIVE%,gz" -o%TMP% >null +- 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null - robocopy /S %TMP%\%SDL2_MOVE% %MINGW_SDK% - ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config From 53aa9322071bedd59876ed3870e4e99a68f54a36 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:03:08 -0500 Subject: [PATCH 211/364] appveyor: ingore robocopy errorcode --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 766894ba5..001b14a89 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null -- robocopy /S %TMP%\%SDL2_MOVE% %MINGW_SDK% +- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% && exit 0 - ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config - ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake - ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\pkgconfig\sdl2.pc From e0f373381938d957c65598ae24556eb71815ab99 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:05:09 -0500 Subject: [PATCH 212/364] appveyor: hehe, OR --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 001b14a89..db27725da 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null -- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% && exit 0 +- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 - ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config - ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake - ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\pkgconfig\sdl2.pc From d76e21b54660c2efec99384538ed90b28eb513e3 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 28 Jan 2016 08:15:34 -0800 Subject: [PATCH 213/364] fix bind out of bounds / keystring misreading --- src/console.c | 2 +- src/g_input.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/console.c b/src/console.c index e77c400b3..fcac0e6de 100644 --- a/src/console.c +++ b/src/console.c @@ -202,7 +202,7 @@ static void CONS_Bind_f(void) } key = G_KeyStringtoNum(COM_Argv(1)); - if (!key) + if (key <= 0 || key >= NUMINPUTS) { CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n")); return; diff --git a/src/g_input.c b/src/g_input.c index f12ddb711..79e6fb94b 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1042,13 +1042,13 @@ INT32 G_KeyStringtoNum(const char *keystr) if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z') return keystr[0]; + if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9') + return atoi(&keystr[3]); + for (j = 0; j < NUMKEYNAMES; j++) if (!stricmp(keynames[j].name, keystr)) return keynames[j].keynum; - if (strlen(keystr) > 3) - return atoi(&keystr[3]); - return 0; } From 5ace352e71fcbb95eb55fd398b250b515916f88b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:16:24 -0500 Subject: [PATCH 214/364] appveyor: manually set SDL flags --- appveyor.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index db27725da..c1e5e1082 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,12 +16,14 @@ install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null -- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 -- ps: (Get-Content %TMP%\%SDL2_MOVE%\bin\sdl2-config) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\bin\sdl2-config -- ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake -- ps: (Get-Content %TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", "%MINGW_SDK%" } | Set-Content %MINGW_SDK%\lib\pkgconfig\sdl2.pc +#- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 +#- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config") +#- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake") +#- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") before_build: +- set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main +- set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version From 89786ff7fd396b3fbe37823222bb4a591f19c6da Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:22:46 -0500 Subject: [PATCH 215/364] appveyor: include the SDL header in depend step: --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c1e5e1082..5bac1b656 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,6 +22,7 @@ install: #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") before_build: +- set CPPFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 - set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main - set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows - set Path=%MINGW_SDK%\bin;%Path% @@ -36,5 +37,5 @@ build_script: on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: -- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From f0842d2200a91d9d1744df70a27da9c4089d2fe6 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:33:36 -0500 Subject: [PATCH 216/364] appveyor: add debug and sdl mixer --- appveyor.yml | 17 ++++++++++++----- src/Makefile | 8 ++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5bac1b656..848755cb4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,7 @@ os: MinGW cache: SDL2-devel-2.0.4-mingw.tar.gz + SDL2_mixer-devel-2.0.1-mingw.tar.gz environment: CC: i686-w64-mingw32-gcc @@ -11,20 +12,26 @@ environment: SDL2_URL: http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32 + SDL2_MIXER_URL=https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz + SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar + SDL2_MIXER_MOVE: SDL2_mixer-2.0.1/i686-w64-mingw32 install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" +- if not exist "%SDL2_MIXER_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_MIXER_URL%" -FileName "%SDL2_MIXER_ARCHIVE%.gz" - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null +- 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null +- 7z x -y "%TMP%\%SSDL2_MIXER_ARCHIVE%" -o%TMP% >null #- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config") #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake") #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") before_build: -- set CPPFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -- set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -- set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows +- set CPPFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 +- set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 +- set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows -L%TMP%\%SDL2_MIXER_MOVE%\lib - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version @@ -32,8 +39,8 @@ before_build: build_script: #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 DEBUGMODE=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 DEBUGMODE=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: diff --git a/src/Makefile b/src/Makefile index d4cc64a4b..8474a7e87 100644 --- a/src/Makefile +++ b/src/Makefile @@ -703,13 +703,13 @@ $(OBJDIR)/depend.dep: @echo "Creating dependency file, depend.dep" @echo > comptime.h -$(MKDIR) $(OBJDIR) - $(CC) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped - $(CC) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped + $(CC) $(CPPFLAGS) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped + $(CC) $(CPPFLAGS) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped ifndef NOHW - $(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped + $(CC) $(CPPFLAGS) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped endif ifndef NO_LUA - $(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped + $(CC) $(CPPFLAGS) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped endif @sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep $(REMOVE) $(OBJDIR)/depend.ped From 50846880a61e4f6392bb4444bbf00fa9a1cd6497 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:34:19 -0500 Subject: [PATCH 217/364] appveyor: not = for envs --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 848755cb4..f55741afe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,7 @@ environment: SDL2_URL: http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32 - SDL2_MIXER_URL=https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz + SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar SDL2_MIXER_MOVE: SDL2_mixer-2.0.1/i686-w64-mingw32 From 4230225a0c570b239c4f128940f3d53e49987cfa Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:36:51 -0500 Subject: [PATCH 218/364] appveor: SDL, not SSDL --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f55741afe..81f27df45 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ install: - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null - 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null -- 7z x -y "%TMP%\%SSDL2_MIXER_ARCHIVE%" -o%TMP% >null +- 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null #- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config") #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake") From 7a09a82489c1e8c292ef456cbfb83c1e6d362c63 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:41:02 -0500 Subject: [PATCH 219/364] new flags: DEPFLAGS, to tell the depend step where are the headers --- appveyor.yml | 2 +- src/Makefile | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 81f27df45..f7af70272 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,7 @@ install: #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") before_build: -- set CPPFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 +- set DEPFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 - set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 - set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows -L%TMP%\%SDL2_MIXER_MOVE%\lib - set Path=%MINGW_SDK%\bin;%Path% diff --git a/src/Makefile b/src/Makefile index 8474a7e87..2c1de64d5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -703,13 +703,13 @@ $(OBJDIR)/depend.dep: @echo "Creating dependency file, depend.dep" @echo > comptime.h -$(MKDIR) $(OBJDIR) - $(CC) $(CPPFLAGS) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped - $(CC) $(CPPFLAGS) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped + $(CC) $(DEPFLAGS) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped + $(CC) $(DEPFLAGS) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped ifndef NOHW - $(CC) $(CPPFLAGS) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped + $(CC) $(DEPFLAGS) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped endif ifndef NO_LUA - $(CC) $(CPPFLAGS) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped + $(CC) $(DEPFLAGS) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped endif @sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep $(REMOVE) $(OBJDIR)/depend.ped From 2176b21e62f0fd82ada5f4fb4d5e7afbea749b89 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:49:23 -0500 Subject: [PATCH 220/364] ignore noreturns --- src/Makefile.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index d6af0d8a7..0e38a05c0 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -159,6 +159,9 @@ ifndef MINGW ifdef GCC45 WFLAGS+=-Wunsuffixed-float-constants endif +ifdef GCC46 +WFLAGS+=-Wno-suggest-attribute=noreturn +endif endif ifdef NOLDWARNING LDFLAGS+=-Wl,--as-needed @@ -171,6 +174,7 @@ ifdef GCC43 endif WFLAGS+=$(OLDWFLAGS) + #indicate platform and what interface use with ifndef WINCE ifndef XBOX From d762c4023ed4b1b1127c0960313c03c61c54b201 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 11:52:33 -0500 Subject: [PATCH 221/364] appveyor: show us all the commands --- appveyor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f7af70272..9f37a5f12 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,10 +37,10 @@ before_build: - mingw32-make --version build_script: -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 DEBUGMODE=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 ECHO=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 DEBUGMODE=1 ECHO=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 ECHO=1 on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: From 3c35ed60d3d9310077c3ebbde9e1595f025d7bb3 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 12:03:56 -0500 Subject: [PATCH 222/364] appveyor: fixup cache list --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9f37a5f12..eb2db8b86 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,8 +2,8 @@ version: 2.1.14.{branch}-{build} os: MinGW cache: - SDL2-devel-2.0.4-mingw.tar.gz - SDL2_mixer-devel-2.0.1-mingw.tar.gz +- SDL2-devel-2.0.4-mingw.tar.gz +- SDL2_mixer-devel-2.0.1-mingw.tar.gz environment: CC: i686-w64-mingw32-gcc From 7fdb5cfcfb045e6bfc2c3e4421adcdeca589bc82 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 12:06:00 -0500 Subject: [PATCH 223/364] move disabled warning out of mingw --- src/Makefile.cfg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 0e38a05c0..fa8896a7c 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -155,13 +155,14 @@ WFLAGS+=-Wformat-security ifndef GCC29 #WFLAGS+=-Winit-self endif +ifdef GCC46 +WFLAGS+=-Wno-suggest-attribute=noreturn +endif + ifndef MINGW ifdef GCC45 WFLAGS+=-Wunsuffixed-float-constants endif -ifdef GCC46 -WFLAGS+=-Wno-suggest-attribute=noreturn -endif endif ifdef NOLDWARNING LDFLAGS+=-Wl,--as-needed From 10e1aaaf856c40282d646d04c3b9d3c61cd91b26 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 12:08:08 -0500 Subject: [PATCH 224/364] appveyor: no need for DEPFLAGS --- appveyor.yml | 1 - src/Makefile | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index eb2db8b86..51411d45e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,6 @@ install: #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") before_build: -- set DEPFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 - set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 - set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows -L%TMP%\%SDL2_MIXER_MOVE%\lib - set Path=%MINGW_SDK%\bin;%Path% diff --git a/src/Makefile b/src/Makefile index 2c1de64d5..d4cc64a4b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -703,13 +703,13 @@ $(OBJDIR)/depend.dep: @echo "Creating dependency file, depend.dep" @echo > comptime.h -$(MKDIR) $(OBJDIR) - $(CC) $(DEPFLAGS) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped - $(CC) $(DEPFLAGS) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped + $(CC) $(CFLAGS) -MM *.c > $(OBJDIR)/depend.ped + $(CC) $(CFLAGS) -MM $(INTERFACE)/*.c >> $(OBJDIR)/depend.ped ifndef NOHW - $(CC) $(DEPFLAGS) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped + $(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped endif ifndef NO_LUA - $(CC) $(DEPFLAGS) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped + $(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped endif @sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep $(REMOVE) $(OBJDIR)/depend.ped From 4d0e1a8a1c76dfb9aeb9fd7817de3d0bf190540a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 12:12:04 -0500 Subject: [PATCH 225/364] appveyor: do not echo the full command --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 51411d45e..f58a242d5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -38,8 +38,8 @@ before_build: build_script: #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 ECHO=1 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 DEBUGMODE=1 ECHO=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 ECHO=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: From 67b6d618a48e40082e40d04b12fdfa84710f79d1 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 12:15:42 -0500 Subject: [PATCH 226/364] appveyor: build with/without the mixer and with/without OpenGL --- appveyor.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f58a242d5..a9dae4fb4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,10 +36,23 @@ before_build: - mingw32-make --version build_script: -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 ECHO=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 DEBUGMODE=1 ECHO=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 NOMIXER=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 NOMIXER=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 NOMIXER=1 + on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: From 0d327c7c16a0d4a8521911d4a16f10dfd2d00a6a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 21:15:51 -0500 Subject: [PATCH 227/364] kill logical-not-parentheses warning in g_game.c g_game.c: In function 'G_CheckDemoStatus': g_game.c:5588:22: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] if (!modeattacking == ATTACKING_RECORD) ^ --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index c59f23c07..de3b26f0a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5585,7 +5585,7 @@ boolean G_CheckDemoStatus(void) free(demobuffer); demorecording = false; - if (!modeattacking == ATTACKING_RECORD) + if (modeattacking != ATTACKING_RECORD) { if (saved) CONS_Printf(M_GetText("Demo %s recorded\n"), demoname); From 050ce857c439bf0726de978e43a2dce2496f3d0e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 21:31:18 -0500 Subject: [PATCH 228/364] let not care for main() being noreturn --- src/sdl/i_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 976f7eb35..489ee4c06 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -240,8 +240,8 @@ int main(int argc, char **argv) #endif // return to OS -#ifndef __GNUC__ +//#ifndef __GNUC__ return 0; -#endif +//#endif } #endif From c47ff7b3c6f22710e1478d789bd9399b6026690a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 28 Jan 2016 21:37:41 -0500 Subject: [PATCH 229/364] let make the main() entry point noreturns --- src/sdl/i_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 489ee4c06..d3f94f13d 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -141,8 +141,10 @@ void XBoxStartup() myargv = NULL; #else #ifdef FORCESDLMAIN +FUNCNORETURN int SDL_main(int argc, char **argv) #else +FUNCNORETURN int main(int argc, char **argv) #endif { @@ -240,8 +242,8 @@ int main(int argc, char **argv) #endif // return to OS -//#ifndef __GNUC__ +#ifndef __GNUC__ return 0; -//#endif +#endif } #endif From e8cf4cdaac49f81adc420cf25e1db0a8ec4ef556 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 00:33:11 -0500 Subject: [PATCH 230/364] SDL2: compile SDL with SDL_main for Win32 --- src/sdl/i_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index d3f94f13d..c157a6be7 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -55,6 +55,10 @@ PSP_MAIN_THREAD_STACK_SIZE_KB(256); #include "i_ttf.h" #endif +#if defined (_WIN32) && !defined (main) +#define SDLMAIN +#endif + #ifdef SDLMAIN #include "SDL_main.h" #elif defined(FORCESDLMAIN) @@ -132,7 +136,6 @@ static inline VOID MakeCodeWritable(VOID) \return int */ -FUNCNORETURN #if defined (_XBOX) && defined (__GNUC__) void XBoxStartup() { From b5af756c22e2c74daead4fb81c18bfb0a1be1f95 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 00:53:34 -0500 Subject: [PATCH 231/364] appveyor: let stop build the whole mess --- appveyor.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a9dae4fb4..b589bc209 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,22 +36,22 @@ before_build: - mingw32-make --version build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 NOMIXER=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 NOMIXER=1 -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 NOMIXER=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 NOMIXER=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 NOMIXER=1 +#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 NOMIXER=1 on_finish: From 0728bc6de28771014d815e95b3bbe3d82a1d5f60 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 00:58:40 -0500 Subject: [PATCH 232/364] appveyor: errormode for all --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b589bc209..43275c8b4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,9 +36,9 @@ before_build: - mingw32-make --version build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 cleandep >nul|| exit 0 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean From c7503b35b83bb9daa63758161d8b63ffffcb2462 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 01:05:41 -0500 Subject: [PATCH 233/364] appveyor: need to see what the depend step is not working --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 43275c8b4..41f5fb3d1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,7 +36,7 @@ before_build: - mingw32-make --version build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 cleandep >nul|| exit 0 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 clean #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 From 13866a5b7ec0b2a02126aff7fa48643d092dcbc7 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 01:23:26 -0500 Subject: [PATCH 234/364] appveyor: fixup SDL2_MIXER_MOVE --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 41f5fb3d1..cd09e2c84 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ environment: SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32 SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar - SDL2_MIXER_MOVE: SDL2_mixer-2.0.1/i686-w64-mingw32 + SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32 install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" @@ -23,6 +23,7 @@ install: - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null - 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null + #- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config") #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake") From f30dae216274e82efddc4151f930a169697e7a52 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 01:33:37 -0500 Subject: [PATCH 235/364] appveyor: need a copy of sed --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cd09e2c84..054dc0cc6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,15 +23,15 @@ install: - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null - 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null - -#- robocopy /S /xx /ns /nc /nfl /ndl /np %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 +#- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MOVE% %MINGW_SDK% | exit 0 +#- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0 #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config") #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake") #- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") before_build: -- set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 -- set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows -L%TMP%\%SDL2_MIXER_MOVE%\lib +#- set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 +#- set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows -L%TMP%\%SDL2_MIXER_MOVE%\lib - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version @@ -57,5 +57,5 @@ build_script: on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: -#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From ca34268a13e9a3157a2f0159923c1274067bf2dd Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 01:52:55 -0500 Subject: [PATCH 236/364] appveyor: let instal the SDL2 and SDL2_mixer to the Mingw toolchain --- appveyor.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 054dc0cc6..9f46a8b2d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,15 +23,15 @@ install: - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null - 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null -#- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MOVE% %MINGW_SDK% | exit 0 -#- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0 -#- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config") -#- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake") -#- ps: (Get-Content [System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc")) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%") } | Set-Content [System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc") +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0 +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config")) +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake")) +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc")) +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MIXER_MOVE%\lib\pkgconfig\SDL2_mixer.pc")))| ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\SDL2_mixer.pc")) before_build: -#- set SDL_CFLAGS=-I%TMP%\%SDL2_MOVE%\include\SDL2 -Dmain=SDL_main -I%TMP%\%SDL2_MIXER_MOVE%\include\SDL2 -#- set SDL_LDFLAGS=-L%TMP%\%SDL2_MOVE%\lib -lmingw32 -lSDL2main -lSDL2 -mwindows -L%TMP%\%SDL2_MIXER_MOVE%\lib +- set SDL_PKGCONFIG=sdl2.pc - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version @@ -57,5 +57,5 @@ build_script: on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: -- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 0e483fc17b09dfca77941e41d248cd96b9ea910d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 01:55:39 -0500 Subject: [PATCH 237/364] appveyor: or not? --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9f46a8b2d..d3747af94 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,7 +31,7 @@ install: - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MIXER_MOVE%\lib\pkgconfig\SDL2_mixer.pc")))| ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\SDL2_mixer.pc")) before_build: -- set SDL_PKGCONFIG=sdl2.pc +- set SDL_PKGCONFIG=%MINGW_SDK%\lib\pkgconfig\sdl2.pc - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version @@ -57,5 +57,4 @@ build_script: on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: -#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - +- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 62702edebe4e42105f066c542b348076538a2e4b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 01:57:57 -0500 Subject: [PATCH 238/364] appveyor: I hope I do not need to debug this build xml again --- appveyor.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d3747af94..858794439 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,16 +18,17 @@ environment: install: - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" -- if not exist "%SDL2_MIXER_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_MIXER_URL%" -FileName "%SDL2_MIXER_ARCHIVE%.gz" - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null -- 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null -- 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null - robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 -- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0 - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config")) - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake")) - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc")) + +- if not exist "%SDL2_MIXER_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_MIXER_URL%" -FileName "%SDL2_MIXER_ARCHIVE%.gz" +- 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null +- 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0 - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MIXER_MOVE%\lib\pkgconfig\SDL2_mixer.pc")))| ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\SDL2_mixer.pc")) before_build: @@ -37,7 +38,7 @@ before_build: - mingw32-make --version build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ECHO=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 #- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 @@ -57,4 +58,4 @@ build_script: on_finish: #- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: -- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) From 94d36fbe5bf017663d048504661f2bba0e0f817c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 02:07:36 -0500 Subject: [PATCH 239/364] apveyor: no debug dump --- appveyor.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 858794439..cfc9edf32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,21 +39,7 @@ before_build: build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOMIXER=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 DEBUGMODE=1 NOMIXER=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 clean -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 NOMIXER=1 -#- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOHW=1 DEBUGMODE=1 NOMIXER=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOOBJDUMP=1 ERRORMODE=1 on_finish: From d7925104b95a196aa14a6b1e7c3218fd4a87bb55 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 11:09:46 -0500 Subject: [PATCH 240/364] appveyor: push build to FTP server --- appveyor.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cfc9edf32..74add4148 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,6 @@ version: 2.1.14.{branch}-{build} os: MinGW -cache: -- SDL2-devel-2.0.4-mingw.tar.gz -- SDL2_mixer-devel-2.0.1-mingw.tar.gz - environment: CC: i686-w64-mingw32-gcc WINDRES: windres @@ -16,7 +12,12 @@ environment: SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32 +cache: +- SDL2-devel-2.0.4-mingw.tar.gz +- SDL2_mixer-devel-2.0.1-mingw.tar.gz + install: +#Download SDL2 - if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" - 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null @@ -24,7 +25,7 @@ install: - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config")) - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake")) - ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc")) - +#Download SDL2_Mixer - if not exist "%SDL2_MIXER_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_MIXER_URL%" -FileName "%SDL2_MIXER_ARCHIVE%.gz" - 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null - 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null @@ -39,7 +40,25 @@ before_build: build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 NOOBJDUMP=1 ERRORMODE=1 +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 + +test: off + +artifacts: + - path: bin\Mingw\$(configuration) + +deploy: + - provider: FTP + protocol: ftps + host: + secure: NsLJEPIBvmwCOj8Tg8RoRQ== + username: + secure: z/r81kkL3Mm6wxjuN0sW1w== + password: + secure: Hbn6Uy3lT0YZ88yFJ3aW4w== + folder: + application: + active_mode: false on_finish: From 4b8167d823ed180af310d3db05e0733fe5a200cb Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 11:27:33 -0500 Subject: [PATCH 241/364] appveyor: let push a 7z in the after build step --- appveyor.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 74add4148..ad0ca9e13 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,10 +42,11 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 -test: off +after_build: +- cmd: 7z a Build.7z -w bin\Mingw\Release +- appveyor PushArtifact Build.7z -artifacts: - - path: bin\Mingw\$(configuration) +test: off deploy: - provider: FTP From 5582d715d49e340512b19ce5fcfba4e8496820cf Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 11:39:16 -0500 Subject: [PATCH 242/364] appveyor: let have the build bot have the right username --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index ad0ca9e13..a26082484 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -54,7 +54,7 @@ deploy: host: secure: NsLJEPIBvmwCOj8Tg8RoRQ== username: - secure: z/r81kkL3Mm6wxjuN0sW1w== + secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= password: secure: Hbn6Uy3lT0YZ88yFJ3aW4w== folder: From ba1cb80ff7b610bcb5c12ae34f1eefad2d8d13da Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 11:42:40 -0500 Subject: [PATCH 243/364] appveyor: name each 7z by version" --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a26082484..09ea7cec6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,8 +43,8 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: -- cmd: 7z a Build.7z -w bin\Mingw\Release -- appveyor PushArtifact Build.7z +- cmd: 7z a $(appveyor_build_version).7z bin\Mingw\Release -x!.gitignore +- appveyor PushArtifact $(appveyor_build_version).7z test: off From 343c8a949857bb20d5cffb7f012688dae374cced Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 11:55:00 -0500 Subject: [PATCH 244/364] appveyor: or not, let try this naming --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 09ea7cec6..7105a64bc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,8 +43,8 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: -- cmd: 7z a $(appveyor_build_version).7z bin\Mingw\Release -x!.gitignore -- appveyor PushArtifact $(appveyor_build_version).7z +- cmd: 7z a Build-{build}.7z bin\Mingw\Release -x!.gitignore +- appveyor PushArtifact Build-{build}.7z test: off @@ -57,7 +57,7 @@ deploy: secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= password: secure: Hbn6Uy3lT0YZ88yFJ3aW4w== - folder: + folder: {branch} application: active_mode: false From 38952028612041228141f511c75489de012ba04a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 12:00:05 -0500 Subject: [PATCH 245/364] appveyor: let include the commit id --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7105a64bc..2f35afadc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,8 +43,8 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: -- cmd: 7z a Build-{build}.7z bin\Mingw\Release -x!.gitignore -- appveyor PushArtifact Build-{build}.7z +- cmd: 7z a %APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z bin\Mingw\Release -x!.gitignore +- appveyor PushArtifact %APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z test: off @@ -57,7 +57,7 @@ deploy: secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= password: secure: Hbn6Uy3lT0YZ88yFJ3aW4w== - folder: {branch} + folder: appveyor application: active_mode: false From 01f2f4d444f0276e9c62991dd24e962043e2de31 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 12:08:41 -0500 Subject: [PATCH 246/364] appveyor: move naming of 7z to env block --- appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2f35afadc..581c628fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,7 @@ environment: SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32 + BUILD_ARCHIVE: %APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z cache: - SDL2-devel-2.0.4-mingw.tar.gz @@ -43,8 +44,8 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: -- cmd: 7z a %APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z bin\Mingw\Release -x!.gitignore -- appveyor PushArtifact %APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z +- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -x!.gitignore +- appveyor PushArtifact %BUILD_ARCHIVE% test: off From b3ee8591f2e3afd6a67594706207eddca1066ada Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 12:36:48 -0500 Subject: [PATCH 247/364] appveyor: ok, let set the var in after build step --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 581c628fb..bd695fdea 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,6 @@ environment: SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32 - BUILD_ARCHIVE: %APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z cache: - SDL2-devel-2.0.4-mingw.tar.gz @@ -44,6 +43,7 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: +- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7 - cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -x!.gitignore - appveyor PushArtifact %BUILD_ARCHIVE% From 0f83c2aeb521f1d2fc0cffe289d14c49379535f1 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 12:53:39 -0500 Subject: [PATCH 248/364] appveyor: 7z, not 7 --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index bd695fdea..adc57d483 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,7 +43,7 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: -- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7 +- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z - cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -x!.gitignore - appveyor PushArtifact %BUILD_ARCHIVE% From deca16f923a0cd801c32b59e1d977906e66ad876 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 29 Jan 2016 18:38:41 -0500 Subject: [PATCH 249/364] appveyor: let use short commits --- appveyor.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index adc57d483..70f186667 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,8 +43,10 @@ build_script: - cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 after_build: -- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%APPVEYOR_REPO_COMMIT%.7z -- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -x!.gitignore +- cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt +- cmd: set /P GITSHORT=<%TMP%/gitshort.txt +- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%.7z +- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore - appveyor PushArtifact %BUILD_ARCHIVE% test: off From f50098669278de89d00198916a16717e53117f3d Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Fri, 29 Jan 2016 16:01:05 -0800 Subject: [PATCH 250/364] use RGB for screen texture, not RGBA the screen texture does not need an alpha channel. the fact that it had one made OGL copy the topmost pixel of the screen texture's alpha channel. which, naturally results in the screen becoming partially transparent and letting you see the working texture in the background. --- src/hardware/r_opengl/r_opengl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 76543e259..a407a9e45 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2364,7 +2364,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void) Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); #ifndef KOS_GL_COMPATIBILITY - pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); + pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); #endif tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now @@ -2392,7 +2392,7 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void) Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); #ifndef KOS_GL_COMPATIBILITY - pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); + pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); #endif tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now From cd198d6809d171ac242b0bfe7db768a04e135003 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 30 Jan 2016 17:19:05 +0000 Subject: [PATCH 251/364] merge SOC_****, MAINCFG and OBJCTCFG searches into one big search for any of them This makes it so that it doesn't matter what order you place SOC lumps within a WAD... relative to other SOC lumps at least, anyway --- src/w_wad.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 39bde4bb1..dc994e848 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -150,31 +150,21 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum) { lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo; for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++) - if (memcmp(lump_p->name,"SOC_",4)==0) + if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump { CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfiles[wadnum]->filename); DEH_LoadDehackedLumpPwad(wadnum, lump); } - } - - // Check for MAINCFG - for (lump = 0;lump != INT16_MAX;lump++) - { - lump = W_CheckNumForNamePwad("MAINCFG", wadnum, lump); - if (lump == INT16_MAX) - break; - CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename); - DEH_LoadDehackedLumpPwad(wadnum, lump); - } - - // Check for OBJCTCFG - for (lump = 0;lump < INT16_MAX;lump++) - { - lump = W_CheckNumForNamePwad("OBJCTCFG", wadnum, lump); - if (lump == INT16_MAX) - break; - CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename); - DEH_LoadDehackedLumpPwad(wadnum, lump); + else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG + { + CONS_Printf(M_GetText("Loading main config from %s\n"), wadfiles[wadnum]->filename); + DEH_LoadDehackedLumpPwad(wadnum, lump); + } + else if (memcmp(lump_p->name,"OBJCTCFG",8)==0) // Check for OBJCTCFG + { + CONS_Printf(M_GetText("Loading object config from %s\n"), wadfiles[wadnum]->filename); + DEH_LoadDehackedLumpPwad(wadnum, lump); + } } #ifdef SCANTHINGS From 8b56cd76c747e8fb2b708755d39a302d95ad7ec6 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 15:08:16 +0000 Subject: [PATCH 252/364] doomtype.h tweaks some of the mess in here really bothers me (cherry-picking this commit of mine from next since it only fixes a small oversight with compiling and adds a comment) --- src/doomtype.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doomtype.h b/src/doomtype.h index ff4199775..8e7da6881 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -100,11 +100,13 @@ typedef long ssize_t; #if defined (_MSC_VER) || defined (__OS2__) // Microsoft VisualC++ +#ifdef _MSC_VER #if (_MSC_VER <= 1800) // MSVC 2013 and back #define snprintf _snprintf #if (_MSC_VER <= 1200) // MSVC 2012 and back #define vsnprintf _vsnprintf #endif +#endif #endif #define strncasecmp strnicmp #define strcasecmp stricmp @@ -177,6 +179,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz); // not the number of bytes in the buffer. #define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst) +// \note __BYTEBOOL__ used to be set above if "macintosh" was defined, +// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now? #ifndef __BYTEBOOL__ #define __BYTEBOOL__ @@ -193,7 +197,6 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #else typedef enum {false, true} boolean; #endif - //#endif // __cplusplus #endif // __BYTEBOOL__ /* 7.18.2.1 Limits of exact-width integer types */ From 9e29b69a290841205c75680c4cc92e2fe670272b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 16:49:04 +0000 Subject: [PATCH 253/364] Remove unused "firstnewseg" variable --- src/r_bsp.c | 1 - src/r_bsp.h | 1 - src/r_segs.c | 2 -- 3 files changed, 4 deletions(-) diff --git a/src/r_bsp.c b/src/r_bsp.c index e967e28ce..acb0630c3 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -31,7 +31,6 @@ sector_t *backsector; // 896 drawsegs! So too bad here's a limit removal a-la-Boom drawseg_t *drawsegs = NULL; drawseg_t *ds_p = NULL; -drawseg_t *firstnewseg = NULL; // indicates doors closed wrt automap bugfix: INT32 doorclosed; diff --git a/src/r_bsp.h b/src/r_bsp.h index 20a80d89a..14b11ea77 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -30,7 +30,6 @@ extern INT32 checkcoord[12][4]; extern drawseg_t *drawsegs; extern drawseg_t *ds_p; -extern drawseg_t *firstnewseg; extern INT32 doorclosed; typedef void (*drawfunc_t)(INT32 start, INT32 stop); diff --git a/src/r_segs.c b/src/r_segs.c index 7467f5324..3171bced6 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1407,13 +1407,11 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (ds_p == drawsegs+maxdrawsegs) { size_t pos = ds_p - drawsegs; - size_t pos2 = firstnewseg - drawsegs; size_t newmax = maxdrawsegs ? maxdrawsegs*2 : 128; if (firstseg) firstseg = (drawseg_t *)(firstseg - drawsegs); drawsegs = Z_Realloc(drawsegs, newmax*sizeof (*drawsegs), PU_STATIC, NULL); ds_p = drawsegs + pos; - firstnewseg = drawsegs + pos2; maxdrawsegs = newmax; if (firstseg) firstseg = drawsegs + (size_t)firstseg; From deb958a79632840fba16ee1fc590ba9164210d5f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 17:06:03 +0000 Subject: [PATCH 254/364] Remove unused "INVERSECOLORMAP" macro --- src/p_user.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 6844d2cba..d527c29c9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -51,9 +51,6 @@ #include "hardware/hw_main.h" #endif -// Index of the special effects (INVUL inverse) map. -#define INVERSECOLORMAP 32 - #if 0 static void P_NukeAllPlayers(player_t *player); #endif From 2d94b2a85fd3def4d70140f068f898a9981a132b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 17:10:57 +0000 Subject: [PATCH 255/364] keys.h doesn't need to be included twice here lol --- src/g_input.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/g_input.c b/src/g_input.c index f12ddb711..fd6354b26 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -16,7 +16,6 @@ #include "g_input.h" #include "keys.h" #include "hu_stuff.h" // need HUFONT start & end -#include "keys.h" #include "d_net.h" #include "console.h" From 2e58f6c4d9728569b8e66ac04444fc225fe4ec3a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 23 Jan 2016 19:58:57 +0000 Subject: [PATCH 256/364] Fixed that odd bug where PolyObjects sometimes leave a vertex or two in their control sectors Turns out the seg-searching code falsely assumed it'd find frontfacing segs first, who knew? --- src/p_polyobj.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index f790fa768..23e7092be 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -427,6 +427,8 @@ newseg: // seg's ending vertex. for (i = 0; i < numsegs; ++i) { + if (segs[i].side != 0) // needs to be frontfacing + continue; if (segs[i].v1->x == seg->v2->x && segs[i].v1->y == seg->v2->y) { // Make sure you didn't already add this seg... @@ -593,6 +595,9 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id) seg_t *seg = &segs[i]; INT32 polyID, parentID; + if (seg->side != 0) // needs to be frontfacing + continue; + if (seg->linedef->special != POLYOBJ_START_LINE) continue; From dafe0ccd11b321546dbf5728d510c98f51db2ce0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 21:53:14 +0000 Subject: [PATCH 257/364] Added v.width(), v.height() and v.renderer() to Lua's drawer/video library --- src/lua_hudlib.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 5a83d95b5..fa15b9be7 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -16,7 +16,9 @@ #include "r_local.h" #include "st_stuff.h" // hudinfo[] #include "g_game.h" +#include "i_video.h" // rendermode #include "p_local.h" // camera_t +#include "screen.h" // screen width/height #include "v_video.h" #include "w_wad.h" #include "z_zone.h" @@ -510,6 +512,30 @@ static int libd_getColormap(lua_State *L) return 1; } +static int libd_width(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, vid.width); // push screen width + return 1; +} + +static int libd_height(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, vid.height); // push screen height + return 1; +} + +static int libd_renderer(lua_State *L) +{ + HUDONLY + if (rendermode == render_opengl) // OpenGL renderer + lua_pushliteral(L, "opengl"); + else // Software renderer + lua_pushliteral(L, "software"); + return 1; +} + static luaL_Reg lib_draw[] = { {"patchExists", libd_patchExists}, {"cachePatch", libd_cachePatch}, @@ -521,6 +547,9 @@ static luaL_Reg lib_draw[] = { {"drawString", libd_drawString}, {"stringWidth", libd_stringWidth}, {"getColormap", libd_getColormap}, + {"width", libd_width}, + {"height", libd_height}, + {"renderer", libd_renderer}, {NULL, NULL} }; From 04528eb3e64e931588e33c48d58a2c3201875e00 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 22:15:17 +0000 Subject: [PATCH 258/364] MonsterIestyn: what about render_none? --- src/lua_hudlib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index fa15b9be7..0ba7b3d25 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -529,10 +529,11 @@ static int libd_height(lua_State *L) static int libd_renderer(lua_State *L) { HUDONLY - if (rendermode == render_opengl) // OpenGL renderer - lua_pushliteral(L, "opengl"); - else // Software renderer - lua_pushliteral(L, "software"); + switch (rendermode) { + case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer + case render_soft: lua_pushliteral(L, "software"); break; // Software renderer + default: lua_pushliteral(L, "none"); break; // render_none (for dedicated), in case there's any reason this should be run + } return 1; } From d1b89c9320f98cfe2bf514fe7dbd1890c4f21403 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 31 Jan 2016 22:52:02 +0000 Subject: [PATCH 259/364] Quick fix for another drawer lib function while I'm here, cough --- src/lua_hudlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 0ba7b3d25..325f00b01 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -488,7 +488,7 @@ static int libd_getColormap(lua_State *L) INT32 skinnum = TC_DEFAULT; skincolors_t color = luaL_optinteger(L, 2, 0); UINT8* colormap = NULL; - //HUDSAFE + HUDONLY if (lua_isnoneornil(L, 1)) ; // defaults to TC_DEFAULT else if (lua_type(L, 1) == LUA_TNUMBER) // skin number From 937c8f936b3dadd94568e2c4d496a5516c4695e2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 31 Jan 2016 20:15:10 -0500 Subject: [PATCH 260/364] appveyor: updated to GCC 5.3 --- appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 70f186667..1ce41a817 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,10 +37,11 @@ before_build: - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version +- set SRB2_MFLAGS="-C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC53=1" build_script: -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean -- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 +- cmd: mingw32-make.exe %SRB2_MFLAGS% SDL=1 clean +- cmd: mingw32-make.exe %SRB2_MFLAGS% SDL=1 ERRORMODE=1 after_build: - cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt From 2b41a40076492cb31962ca8b4b2de4fa3edf446f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 31 Jan 2016 20:25:32 -0500 Subject: [PATCH 261/364] appveyor: no quote? --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1ce41a817..4edcd7a7f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,7 +37,7 @@ before_build: - set Path=%MINGW_SDK%\bin;%Path% - i686-w64-mingw32-gcc --version - mingw32-make --version -- set SRB2_MFLAGS="-C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC53=1" +- set SRB2_MFLAGS=-C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC53=1 build_script: - cmd: mingw32-make.exe %SRB2_MFLAGS% SDL=1 clean From 0455b572dc456331ad9bd397664773966f412d52 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 28 Jan 2016 18:06:20 +0000 Subject: [PATCH 262/364] Removed weird test for water planes in HWR_Subsector It crashes when you try to test it anyway, lol --- src/hardware/hw_main.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index db812c0df..b0186049a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2856,7 +2856,6 @@ static void HWR_AddPolyObjectPlanes(void) // : Draw one or more line segments. // Notes : Sets gr_cursectorlight to the light of the parent sector, to modulate wall textures // -----------------+ -static lumpnum_t doomwaterflat; //set by R_InitFlats hack static void HWR_Subsector(size_t num) { INT16 count; @@ -2867,7 +2866,6 @@ static void HWR_Subsector(size_t num) INT32 ceilinglightlevel; INT32 locFloorHeight, locCeilingHeight; INT32 light = 0; - fixed_t wh; extracolormap_t *floorcolormap; extracolormap_t *ceilingcolormap; @@ -3193,26 +3191,6 @@ static void HWR_Subsector(size_t num) } } -//20/08/99: Changed by Hurdler (taken from faB's code) -#ifdef DOPLANES - // -------------------- WATER IN DEV. TEST ------------------------ - //dck hack : use abs(tag) for waterheight - //ilag : Since we changed to UINT16 for sector tags, simulate INT16 - if (gr_frontsector->tag > 32767) - { - wh = ((65535-gr_frontsector->tag) < gr_frontsector->floorheight && - wh < gr_frontsector->ceilingheight) - { - HWR_GetFlat(doomwaterflat); - HWR_RenderPlane(gr_frontsector, - &extrasubsectors[num], wh, PF_Translucent, - gr_frontsector->lightlevel, doomwaterflat, - NULL, 255, false, gr_frontsector->lightlist[light].extra_colormap); - } - } - // -------------------- WATER IN DEV. TEST ------------------------ -#endif sub->validcount = validcount; } @@ -5513,11 +5491,6 @@ void HWR_Startup(void) HWR_AddEngineCommands(); HWR_InitTextureCache(); - // for test water translucent surface - doomwaterflat = W_CheckNumForName("FWATER1"); - if (doomwaterflat == LUMPERROR) // if FWATER1 not found (in doom shareware) - doomwaterflat = W_GetNumForName("WATER0"); - HWR_InitMD2(); #ifdef ALAM_LIGHTING From 662d40511d56fe1514524547376a86647bc2c0a5 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 18:02:36 -0500 Subject: [PATCH 263/364] travis: let start building with travis --- .travis.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..e69de29bb From 69937b41d25decffa67850ec5ff82881e44d0898 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 18:39:06 -0500 Subject: [PATCH 264/364] travis: simple build config --- .travis.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.travis.yml b/.travis.yml index e69de29bb..a1052d7db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: c + +os: + - linux + #- osx + +compiler: + - gcc + - clang + +addons: + apt: + packages: + - libsdl-mixer2-dev + - libpng-dev + - libglu1-dev + +before_install: + - $(CC) --version + - cmake --version + +before_script: + - mkdir build + - cd build + - cmake .. From 0003cea547eb9f47e81c1c236c0ab82acd05b597 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 18:43:18 -0500 Subject: [PATCH 265/364] travis-ci: we need sudo --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index a1052d7db..b1cd1f401 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: c +sudo: required + os: - linux #- osx From 14440675608a10518293d080deca55a2ab0e78b0 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 18:50:02 -0500 Subject: [PATCH 266/364] travis: use the correct packages --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b1cd1f401..f25a67cc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,11 @@ compiler: addons: apt: packages: - - libsdl-mixer2-dev + - libsdl2-mixer-dev - libpng-dev - - libglu1-dev + - ibgl1-mesa-dev before_install: - - $(CC) --version - cmake --version before_script: From 522d2049de962411e29d171fe29987f7ed40804b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 19:08:02 -0500 Subject: [PATCH 267/364] travis: add cmake 3.x package --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index f25a67cc5..f8052143f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,11 @@ compiler: addons: apt: + sources: + - george-edison55-precise-backports packages: + - cmake + - cmake-data - libsdl2-mixer-dev - libpng-dev - ibgl1-mesa-dev From 45b181f889fe750b3c84772e2b93368d8f79cc66 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 19:26:59 -0500 Subject: [PATCH 268/364] travis: switch to trusty for linux os --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8052143f..4711df7d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ language: c -sudo: required +matrix: + include: + - os: linux + dist: trusty + sudo: required os: - linux @@ -19,7 +23,7 @@ addons: - cmake-data - libsdl2-mixer-dev - libpng-dev - - ibgl1-mesa-dev + - libgl1-mesa-dev before_install: - cmake --version From 0bd16a5a0c6cdbfc011f098ea609f95038b09657 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 19:30:03 -0500 Subject: [PATCH 269/364] travis: drop osx --- .travis.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4711df7d4..524c44720 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,5 @@ -language: c - -matrix: - include: - - os: linux - dist: trusty - sudo: required - -os: - - linux - #- osx +sudo: required +dist: trusty compiler: - gcc From 5e5c73fe18a8a30c97b9b54e0f3119dae18d3a6b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 20:50:35 -0500 Subject: [PATCH 270/364] travis: add SRB2 2.1.14 files --- .travis.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 524c44720..6ce5cb083 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,25 @@ compiler: addons: apt: - sources: - - george-edison55-precise-backports packages: - - cmake - - cmake-data - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev + - p7zip before_install: - cmake --version before_script: + - curl http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -o cache/SRB2-v2114-Installer.exe + - 7z x cache/SRB2-v2114-Installer.exe -o assets - mkdir build - cd build - cmake .. + +install: false + +cache: + - ccache + directories: + - cache From a743f155ac62663d333f8a3ddfee3af0e943885b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:00:46 -0500 Subject: [PATCH 271/364] travis: addd libgme to list --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6ce5cb083..e077597ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ addons: - libsdl2-mixer-dev - libpng-dev - libgl1-mesa-dev + - libgme-dev - p7zip before_install: From b6cc13fd2e8955a248985061b11901a3b70c5edd Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:07:46 -0500 Subject: [PATCH 272/364] travis: drop test --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e077597ee..cf3a03f7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,6 @@ before_script: - cd build - cmake .. -install: false - cache: - ccache directories: From 152c106cbda0db3fa9381a643539e568ba1e882e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:09:14 -0500 Subject: [PATCH 273/364] travis: restore language --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index cf3a03f7c..ab5cdea9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +language: c + sudo: required dist: trusty @@ -24,6 +26,8 @@ before_script: - cd build - cmake .. +install: false + cache: - ccache directories: From 59d111b17d443b3be5cc4bc8534cf4b327b930e8 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:11:00 -0500 Subject: [PATCH 274/364] travis: restore missing config? --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab5cdea9a..8feb76d79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,9 +26,3 @@ before_script: - cd build - cmake .. -install: false - -cache: - - ccache - directories: - - cache From e913ca0ca6ea332177a83aa4af8f14ab54e16690 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:15:32 -0500 Subject: [PATCH 275/364] travis: use wget and create cache folder --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8feb76d79..987565745 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,13 +14,14 @@ addons: - libpng-dev - libgl1-mesa-dev - libgme-dev - - p7zip + - p7zip-full before_install: - cmake --version before_script: - - curl http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -o cache/SRB2-v2114-Installer.exe + - make cache + - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O cache/SRB2-v2114-Installer.exe - 7z x cache/SRB2-v2114-Installer.exe -o assets - mkdir build - cd build From ae75e3ee61922527f778adde2b6650e64e11212e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:21:28 -0500 Subject: [PATCH 276/364] travis: mkdir , not make and cache the cccahe --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 987565745..fdcb52477 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,10 +20,14 @@ before_install: - cmake --version before_script: - - make cache + - mkdir cache - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O cache/SRB2-v2114-Installer.exe - 7z x cache/SRB2-v2114-Installer.exe -o assets - mkdir build - cd build - cmake .. +cache: + directories: + - $HOME/.ccache + - cache From a979e37586e083ac987e9ecfcdfa36b525ac9340 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:28:19 -0500 Subject: [PATCH 277/364] travis: no space on 7z command --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fdcb52477..264429170 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ before_install: before_script: - mkdir cache - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O cache/SRB2-v2114-Installer.exe - - 7z x cache/SRB2-v2114-Installer.exe -o assets + - 7z x cache/SRB2-v2114-Installer.exe -oassets - mkdir build - cd build - cmake .. From 4d5f16330acbd98d17dbaf21a146be2ebe5f9691 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:33:00 -0500 Subject: [PATCH 278/364] travis: just run make --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 264429170..896b7a786 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,8 @@ before_script: - cd build - cmake .. +script: make + cache: directories: - $HOME/.ccache From 864baeda050c9f8650b2e0b0fe27c831aad24529 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 21:49:24 -0500 Subject: [PATCH 279/364] cmake: fixed up to handle Clang and AppleClang --- src/CMakeLists.txt | 6 +++--- src/sdl/CMakeLists.txt | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6859e27c3..3405e85d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -166,7 +166,7 @@ set(SRB2_CORE_GAME_SOURCES p_tick.h ) -if(NOT CLANG) +if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c) endif() @@ -404,7 +404,7 @@ endif() # Compatibility flag with later versions of GCC # We should really fix our code to not need this -if(NOT CLANG AND NOT MSVC) +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields) endif() @@ -429,4 +429,4 @@ endif() if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE}) message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(") -endif() \ No newline at end of file +endif() diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index b3fa5390c..eb832797e 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -117,7 +117,7 @@ if(${SDL2_FOUND}) add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES}) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME}) - if(CLANG) + if((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) add_framework(CoreFoundation SRB2SDL2) add_framework(SDL2 SRB2SDL2) add_framework(SDL2_mixer SRB2SDL2) @@ -224,7 +224,7 @@ if(${SDL2_FOUND}) endif() #### Installation #### - if (CLANG) + if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") install(TARGETS SRB2SDL2 BUNDLE DESTINATION . ) @@ -265,7 +265,7 @@ if(${SDL2_FOUND}) # Mac bundle fixup - if(CLANG) + if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") install(CODE " include(BundleUtilities) fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/Sonic Robo Blast 2.app\" @@ -279,4 +279,4 @@ if(${SDL2_FOUND}) else() message(WARNING "SDL2 was not found, so the SDL2 target will not be available.") set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE) -endif() \ No newline at end of file +endif() From f4886657c1e4cbbe29b472c4a088ec71e3ade6d7 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 22:12:12 -0500 Subject: [PATCH 280/364] clang: fixup a few clang warnings --- src/info.c | 2 +- src/m_menu.c | 2 +- src/p_enemy.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/info.c b/src/info.c index fb30258c3..17384086a 100644 --- a/src/info.c +++ b/src/info.c @@ -4225,7 +4225,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MT_GOOP, // painchance sfx_dmpain, // painsound S_EGGMOBILE2_PAIN2, // meleestate - MT_EGGMOBILE2_POGO, // missilestate + (mobjtype_t)MT_EGGMOBILE2_POGO, // missilestate S_EGGMOBILE2_DIE1, // deathstate S_EGGMOBILE2_FLEE1,// xdeathstate sfx_cybdth, // deathsound diff --git a/src/m_menu.c b/src/m_menu.c index c7a9fcc16..1e7745535 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6071,7 +6071,7 @@ static void M_RoomMenu(INT32 choice) for (i = 0; room_list[i].header.buffer[0]; i++) { - if(room_list[i].name != '\0') + if(*room_list[i].name != '\0') { MP_RoomMenu[i+1].text = room_list[i].name; roomIds[i] = room_list[i].id; diff --git a/src/p_enemy.c b/src/p_enemy.c index 18a4ec5ff..6ac4e8968 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -6352,7 +6352,7 @@ void A_Boss2PogoTarget(mobj_t *actor) if (actor->info->missilestate) // spawn the pogo stick collision box { - mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, actor->info->missilestate); + mobj_t *pogo = P_SpawnMobj(actor->x, actor->y, actor->z - mobjinfo[actor->info->missilestate].height, (mobjtype_t)actor->info->missilestate); pogo->target = actor; } From 68054a49e344af2e4854da344408c8daf08f675f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 22:32:14 -0500 Subject: [PATCH 281/364] clang: cleanup --- src/f_finale.c | 2 +- src/info.c | 2 +- src/m_misc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index f541995d4..466e208a5 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -603,7 +603,7 @@ static void F_IntroDrawScene(void) if (finalecount-84 < 58) { // Pure Fat is driving up! int ftime = (finalecount-84); - x = (-189<lvlttl) + if (gamestate == GS_LEVEL && mapheaderinfo[gamemap-1]->lvlttl[0] != '\0') snprintf(lvlttltext, 48, "%s%s%s", mapheaderinfo[gamemap-1]->lvlttl, (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE", From 07fc74eaf50ce8ce47e0b48bc522f5ab0a3c4639 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 22:38:40 -0500 Subject: [PATCH 282/364] clang: fixup a few clang warnings --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 4 ++++ src/b_bot.c | 2 +- src/p_map.c | 4 ++-- src/p_user.c | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fb5cb28f..8deeb37e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,10 +80,7 @@ endif() if(${CMAKE_SYSTEM} MATCHES "Darwin") add_definitions(-DMACOSX) - if(${CMAKE_C_COMPILER_ID} MATCHES "Clang") - set(CLANG ON) endif() -endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3405e85d4..d9e25dbb8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -408,6 +408,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields) endif() +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value) +endif() + add_definitions(-DCMAKECONFIG) #add_library(SRB2Core STATIC diff --git a/src/b_bot.c b/src/b_bot.c index 5e62e58e6..3072b1d75 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -49,7 +49,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG)) { cmd->forwardmove = sonic->player->cmd.forwardmove; - cmd->angleturn = abs(tails->angle - sonic->angle)>>16; + cmd->angleturn = abs((tails->angle - sonic->angle))>>16; if (sonic->angle < tails->angle) cmd->angleturn = -cmd->angleturn; } else if (dist > FixedMul(512*FRACUNIT, tails->scale)) diff --git a/src/p_map.c b/src/p_map.c index 62cbf7b77..1aa8bc391 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2507,8 +2507,8 @@ isblocking: climbangle += (ANGLE_90 * (whichside ? -1 : 1)); - if (((!slidemo->player->climbing && abs(slidemo->angle - ANGLE_90 - climbline) < ANGLE_45) - || (slidemo->player->climbing == 1 && abs(slidemo->angle - climbline) < ANGLE_135)) + if (((!slidemo->player->climbing && abs((slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45) + || (slidemo->player->climbing == 1 && abs((slidemo->angle - climbline)) < ANGLE_135)) && P_IsClimbingValid(slidemo->player, climbangle)) { slidemo->angle = climbangle; diff --git a/src/p_user.c b/src/p_user.c index 6844d2cba..dacef733b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7902,9 +7902,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player == &players[consoleplayer]) { if (focusangle >= localangle) - localangle += abs(focusangle - localangle)>>5; + localangle += abs((focusangle - localangle))>>5; else - localangle -= abs(focusangle - localangle)>>5; + localangle -= abs((focusangle - localangle))>>5; } } else if (P_AnalogMove(player)) // Analog From 7c1f1d9c8e52b80500221ec8e0cf28b55a8abb16 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 22:54:50 -0500 Subject: [PATCH 283/364] travis: compile with warnings as errors, skip absolute-value warnings --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 896b7a786..dfc1aef89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ language: c sudo: required dist: trusty +env: +- CFLAGS=-Wno-absolute-value -Werror + compiler: - gcc - clang From 6d26a60cbefc20b53cc0daf65181ac998cd27582 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 23:19:38 -0500 Subject: [PATCH 284/364] travis: cache 7z SFX --- .travis.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index dfc1aef89..7a9c7c372 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: c - sudo: required dist: trusty @@ -10,6 +9,10 @@ compiler: - gcc - clang +cache: + directories: + - $HOME/srb2_cache + addons: apt: packages: @@ -19,20 +22,12 @@ addons: - libgme-dev - p7zip-full -before_install: - - cmake --version - before_script: - mkdir cache - - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O cache/SRB2-v2114-Installer.exe - - 7z x cache/SRB2-v2114-Installer.exe -oassets + - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O $HOME/srb2_cache/SRB2-v2114-Installer.exe + - 7z x $HOME/srb2_cache/SRB2-v2114-Installer.exe -oassets - mkdir build - cd build - cmake .. script: make - -cache: - directories: - - $HOME/.ccache - - cache From e9048aec4845c9e2d7c30cf93977c38ecf629ada Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 5 Feb 2016 23:22:06 -0500 Subject: [PATCH 285/364] travis: premake the cache folder --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7a9c7c372..c6a3ce799 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ addons: - p7zip-full before_script: - - mkdir cache + - mkdir $HOME/srb2_cache - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O $HOME/srb2_cache/SRB2-v2114-Installer.exe - 7z x $HOME/srb2_cache/SRB2-v2114-Installer.exe -oassets - mkdir build From bac39b1bc037d4075ee0c0fc687f2980f6d223ee Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 6 Feb 2016 12:31:37 -0500 Subject: [PATCH 286/364] debian: untested update for Debian packages --- {bin/Resources => assets}/debian/README.Debian | 0 {bin/Resources => assets}/debian/README.source | 0 {bin/Resources => assets}/debian/changelog | 6 ++++++ {bin/Resources => assets}/debian/compat | 0 {bin/Resources => assets}/debian/control | 0 {bin/Resources => assets}/debian/copyright | 0 {bin/Resources => assets}/debian/rules | 4 ++-- {bin/Resources => assets}/debian/source/format | 0 debian/control | 14 ++++++++++---- debian/rules | 2 +- 10 files changed, 19 insertions(+), 7 deletions(-) rename {bin/Resources => assets}/debian/README.Debian (100%) rename {bin/Resources => assets}/debian/README.source (100%) rename {bin/Resources => assets}/debian/changelog (51%) rename {bin/Resources => assets}/debian/compat (100%) rename {bin/Resources => assets}/debian/control (100%) rename {bin/Resources => assets}/debian/copyright (100%) rename {bin/Resources => assets}/debian/rules (95%) rename {bin/Resources => assets}/debian/source/format (100%) diff --git a/bin/Resources/debian/README.Debian b/assets/debian/README.Debian similarity index 100% rename from bin/Resources/debian/README.Debian rename to assets/debian/README.Debian diff --git a/bin/Resources/debian/README.source b/assets/debian/README.source similarity index 100% rename from bin/Resources/debian/README.source rename to assets/debian/README.source diff --git a/bin/Resources/debian/changelog b/assets/debian/changelog similarity index 51% rename from bin/Resources/debian/changelog rename to assets/debian/changelog index 0c514d4d2..05c29fffe 100644 --- a/bin/Resources/debian/changelog +++ b/assets/debian/changelog @@ -1,3 +1,9 @@ +srb2-data (2.1.14~1) unstable; urgency=low + + * Updated for SRB2 v2.1.14 + + -- Alam Arias Sat, 06 Feb 2016 11:00:00 +0500 + srb2-data (2.0.6-2) maverick; urgency=high * Initial proper release.. diff --git a/bin/Resources/debian/compat b/assets/debian/compat similarity index 100% rename from bin/Resources/debian/compat rename to assets/debian/compat diff --git a/bin/Resources/debian/control b/assets/debian/control similarity index 100% rename from bin/Resources/debian/control rename to assets/debian/control diff --git a/bin/Resources/debian/copyright b/assets/debian/copyright similarity index 100% rename from bin/Resources/debian/copyright rename to assets/debian/copyright diff --git a/bin/Resources/debian/rules b/assets/debian/rules similarity index 95% rename from bin/Resources/debian/rules rename to assets/debian/rules index 514d8e07c..d86f92af2 100755 --- a/bin/Resources/debian/rules +++ b/assets/debian/rules @@ -37,7 +37,7 @@ RM := rm -rf DIR := $(shell pwd) PACKAGE := $(shell cat $(DIR)/debian/control | grep 'Package:' | sed -e 's/Package: //g') -DATAFILES := drill.dta music.dta soar.dta zones.dta player.dta rings.wpn srb2.wad +DATAFILES := srb2.srb zones.dta player.dta rings.dta music.dta DATADIR := usr/games/SRB2 RESOURCEDIR := . @@ -48,7 +48,7 @@ build: # This will need to be updated every time SRB2 official version is # Copy data files to their install locations, and add data files to include-binaries for file in $(DATAFILES); do \ - $(WGET) http://alam.srb2.org/SRB2/2.0.6-Final/Resources/$$file; \ + $(WGET) http://alam.srb2.org/SRB2/2.1.14-Final/Resources/$$file; \ if test "$$file" = "srb2.wad"; then \ $(INSTALL) $(RESOURCEDIR)/$$file $(DIR)/debian/tmp/$(DATADIR)/srb2.srb; \ else \ diff --git a/bin/Resources/debian/source/format b/assets/debian/source/format similarity index 100% rename from bin/Resources/debian/source/format rename to assets/debian/source/format diff --git a/debian/control b/debian/control index c64a85c48..b3e95b587 100644 --- a/debian/control +++ b/debian/control @@ -4,13 +4,19 @@ Source: srb2 Section: games Priority: extra Maintainer: Callum Dickinson -Build-Depends: debhelper (>= 7.0.50~), libsdl1.2-dev (>= 1.2.7), libsdl-mixer1.2-dev (>= 1.2.7), libpng12-dev (>= 1.2.7), libglu1-dev | libglu-dev, libosmesa6-dev | libgl-dev, nasm [i386] +Build-Depends: debhelper (>= 7.0.50~), + libsdl2-dev, + libsdl2-mixer-dev, + libpng12-dev (>= 1.2.7), + libglu1-dev | libglu-dev, + libosmesa6-dev | libgl-dev, + nasm [i386] Standards-Version: 3.8.4 Homepage: http://www.srb2.org Package: srb2 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.0.6) +Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.4) Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy @@ -22,8 +28,8 @@ Description: A cross-platform 3D Sonic fangame Package: srb2-dbg Architecture: any -# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.0.6), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (= 2.0.6), srb2 +# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.4), srb2 but dh_shlibdeps is being an asshat +Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.4), srb2 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy diff --git a/debian/rules b/debian/rules index 33ade54c8..50572f1da 100755 --- a/debian/rules +++ b/debian/rules @@ -62,7 +62,7 @@ DBGDIR = usr/lib/debug/$(PKGDIR) PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)") OS = LINUX=1 NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1") -MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl PNG_PKGCONFIG=libpng NOOBJDUMP=1 +MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_PKGCONFIG=sdl2 PNG_PKGCONFIG=libpng NOOBJDUMP=1 MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)" MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)" # FIXME pkg-config dir hacks From 5d5956b650e8779a32da839170d06ff08eeb294e Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 6 Feb 2016 14:42:02 -0500 Subject: [PATCH 287/364] debian: depend on srb2-data 2.1.14, not 2.1.4 --- debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index b3e95b587..63b075f17 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,7 @@ Homepage: http://www.srb2.org Package: srb2 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.4) +Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14) Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy @@ -28,8 +28,8 @@ Description: A cross-platform 3D Sonic fangame Package: srb2-dbg Architecture: any -# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.4), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.4), srb2 +# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat +Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy From 5c09c31584a1b7355652da288a8fe8bd726c3ba2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 6 Feb 2016 14:56:16 -0500 Subject: [PATCH 288/364] Debian: only just make srb2 depend on srb2-data (2.1.14-1)) --- debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index 63b075f17..ecc4829cf 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,7 @@ Homepage: http://www.srb2.org Package: srb2 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14) +Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14-1) Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy @@ -28,8 +28,8 @@ Description: A cross-platform 3D Sonic fangame Package: srb2-dbg Architecture: any -# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2 +# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14-1), srb2 but dh_shlibdeps is being an asshat +Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14-1), srb2 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy From f9d23370b6b3a763d0ed1cc41389088257aa293f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 6 Feb 2016 17:10:55 -0500 Subject: [PATCH 289/364] debian: the data package should be native --- assets/debian/changelog | 3 ++- assets/debian/source/format | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/debian/changelog b/assets/debian/changelog index 05c29fffe..f9ba9b5ed 100644 --- a/assets/debian/changelog +++ b/assets/debian/changelog @@ -2,7 +2,8 @@ srb2-data (2.1.14~1) unstable; urgency=low * Updated for SRB2 v2.1.14 - -- Alam Arias Sat, 06 Feb 2016 11:00:00 +0500 + -- Alam Arias Sat, 6 Jan 2016 11:00:00 -0500 + srb2-data (2.0.6-2) maverick; urgency=high diff --git a/assets/debian/source/format b/assets/debian/source/format index 163aaf8d8..89ae9db8f 100644 --- a/assets/debian/source/format +++ b/assets/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) From 5d32ccffcfa80bd70272b4a4340a868a58efb57c Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 17:25:27 -0500 Subject: [PATCH 290/364] fix pkgconfig path for Debian Jessie --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 50572f1da..59d9a954e 100755 --- a/debian/rules +++ b/debian/rules @@ -66,9 +66,9 @@ MAKEARGS = $(OS) $(NONX86) $(PREFIX) EXENAME=$(EXENAME) DBGNAME=$(DBGNAME) SDL_P MENUFILE1 = ?package($(PACKAGE)):needs="X11" section="$(SECTION)" MENUFILE2 = title="$(TITLE)" command="/$(PKGDIR)/$(PACKAGE)" # FIXME pkg-config dir hacks -export PKG_CONFIG_LIBDIR = /usr/$(CROSS_COMPILE_HOST)/lib/pkgconfig +export PKG_CONFIG_LIBDIR = /usr/lib/$(CROSS_COMPILE_HOST)/pkgconfig BINDIR := $(DIR)/bin/Linux/Release -LDFLAGS += "-Wl,-rpath=/usr/$(CROSS_COMPILE_HOST)/lib/" +LDFLAGS += "-Wl,-rpath=/usr/lib/$(CROSS_COMPILE_HOST)" build: $(MKDIR) $(BINDIR)/debug From b6203d0412ae5a0953de91915ddc644e7d7f535f Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 17:26:09 -0500 Subject: [PATCH 291/364] Create srb2 --- debian/srb2 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 debian/srb2 diff --git a/debian/srb2 b/debian/srb2 new file mode 100644 index 000000000..26928ee99 --- /dev/null +++ b/debian/srb2 @@ -0,0 +1,7 @@ +Name=Sonic Robo Blast 2 +Exec=srb2 +Comment=SRB2 +Icon=/usr/share/pixmaps/srb2.png +Terminal=false +Type=Application +Categories=games;application; From c8e7cffa1d31d8d393a577511597201cf8109a4d Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 17:33:27 -0500 Subject: [PATCH 292/364] try install of banner image --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index 59d9a954e..996d19d4b 100755 --- a/debian/rules +++ b/debian/rules @@ -100,6 +100,7 @@ binary: binary-arch dh_installdocs # dh_installexamples dh_install --sourcedir=$(DIR)/debian/tmp + dh_install --sourcedir=$(DIR)/srb2.png /usr/share/pixmaps/ dh_installmenu # dh_installdebconf # dh_installlogrotate From 4f59bf53033b380d1b1a382a60dbae3cb344cbe8 Mon Sep 17 00:00:00 2001 From: ProfessorKaos64 Date: Sat, 6 Feb 2016 17:36:21 -0500 Subject: [PATCH 293/364] add artwork for BPM --- srb2.png | Bin 0 -> 156839 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 srb2.png diff --git a/srb2.png b/srb2.png new file mode 100644 index 0000000000000000000000000000000000000000..9c13eae9a5d1ca26167abfe56486e2e7a642cd6c GIT binary patch literal 156839 zcmXt;Ra9Hu7KMRQ+=>==EgoEpyHniV-QC?iNYLQ!QlPlITY=)miaXr=4|ill&UrXF zvi9C{errZ6D@vgv5gi>pFGK~F+{uOPrdJ~O+GZ6IH8CUR2ZP#^!j3cAZu zA$t&=q_th4ppdctdqYEI=YECkgm;rskbwXF2?2)!yU*F(vJHFrm(}54JBR?;1e$Kq;T|F=t z5NomqHjC~cdw6`V1W za=3e*&%;`D#m>3{z}SpTnc6%WlD1RtKBHvK6&g4?3`pj9tRrpqvAUXFVWEC5LdGJV zq#%FeY{nl^b1a=xS@BCwF3dHBdDZL!MsDZociVdVzTtD|t;4=1HOy(D z-`^4H8T;Nn2H!oxmJjttNGkt)Mw3ZvYT?_Njb^wa8@OWZ4;Wq_haxZNhR@vI`mP0I z-1jV-A26b4TJgu}RvoAJ%;lv8ttBGzT#F8@rHc=BxEYy{Nsmn&(VdnTpG2iWhiFMs zW7>tQ6|!{)EsC(-#TH<+kcH}XupkC{$>wdcLX$H?6l*yQm(dh z?%xieIvA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KY#kP7m>gk%s>Jgkw0gFTy>!nB6`Ng}UK|s_G2u2~7 z9~6K`9)^@s@o+5B*0R&fNR?(%w%oiKaQCieBaNw)V%$h7t=a8m++8dwq+&e|zh)D- zY$bl?k&isacP05wOmR>#*vnke8B2z{&X(=$<}XiMdOJ=NIDM;J`LqsiI8$`f80yp3 z6-6KX&?6qk$WqfxB)WA)E9^O0MAQ$Qj#62AyK!gKo=}e^k$`kF;`EhbMTm-rp_76r z;|MI3qX_i2Q^MSlX!bulbv9W*|5{2s3YosKbdc%&ifr3;a%VD<-mW7c<-4vxu07F1 zw@yamg}yTgs5P?E?0$UYX0)LTb*?9lIlK0FuS*1RQkUXkjUPFghzLBq?)V*>*Q}CE zqCtS4cr5oD7WXTXwUFMn^9ye0&g|U_JeCJe)9TJmOLfxXM;_&ILzE}XHb2K_*Ir_t zE|F66`})78DI|ky8M0%DpXLAgfyZyn-{i#~Pcc8DL1@A}VDkFHrOEhWWm+!_#pDeq z+tH121gKKuhaU3>6=CYr%pC!&nM$sNmLL9S4^e@;0MpZ&I0<-or&xu)r@a7UENL&G zm%EvbZ3OFU*$RR@xW8n2VrUvD$8J$bM-DxXQ^@k~GeW;@Tgb;E0yjIWDn*tB2mx6yB#eCoP!_KH(aKWSnq~256qo5Dz@}q~l3#y@`i&m- z{W)sZkUzKizIC$o{({lo2pv1OuXhWnOR4eGfUVw;sj}3I`j4Mzb{6d29ln+p+nMjo bk8A!v$wO)E=fNMA00000NkvXXu0mjfyU|>T literal 0 HcmV?d00001 From 5c1dff79748681e118bf76b9e053e670f4309d58 Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 17:41:53 -0500 Subject: [PATCH 294/364] Next attempt at install banner/desktop shortcut --- debian/rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 996d19d4b..95140ce10 100755 --- a/debian/rules +++ b/debian/rules @@ -83,6 +83,9 @@ binary-arch: $(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR) $(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE) $(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE) + # Install desktop file and banner image + $(INSTALL) $(DIR)/srb2.png $(DIR)/debian/tmp/usr/share/pixmaps + $(INSTALL) $(DIR)/debian/srb2.desktop $(DIR)/debian/tmp/usr/share/applications # add compiled binaries to include-binaries echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries @@ -100,7 +103,6 @@ binary: binary-arch dh_installdocs # dh_installexamples dh_install --sourcedir=$(DIR)/debian/tmp - dh_install --sourcedir=$(DIR)/srb2.png /usr/share/pixmaps/ dh_installmenu # dh_installdebconf # dh_installlogrotate From 7768ec821adba9971caf6242fe483d241f3fa048 Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 18:08:53 -0500 Subject: [PATCH 295/364] add missing dirs --- debian/rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/rules b/debian/rules index 95140ce10..30315e4f8 100755 --- a/debian/rules +++ b/debian/rules @@ -59,6 +59,8 @@ DBGNAME = debug/$(EXENAME) PKGDIR = usr/games DBGDIR = usr/lib/debug/$(PKGDIR) +PIXMAPS_DIR = usr/share/pixmaps +DESKTOP_DIR = usr/share/applications PREFIX = $(shell test "$(CROSS_COMPILE_BUILD)" != "$(CROSS_COMPILE_HOST)" && echo "PREFIX=$(CROSS_COMPILE_HOST)") OS = LINUX=1 NONX86 = $(shell test "`echo $(CROSS_COMPILE_HOST) | grep 'i[3-6]86'`" || echo "NONX86=1") @@ -80,7 +82,11 @@ binary-indep: echo "no need to do any arch-independent stuff" binary-arch: + # create ddirs $(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DBGDIR) + $(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(DESKTOP_DIR) + $(MKDIR) $(DIR)/debian/tmp/$(PKGDIR) $(DIR)/debian/tmp/$(PIXMAPS_DIR) + # install main binaries $(INSTALL) $(BINDIR)/$(EXENAME) $(DIR)/debian/tmp/$(PKGDIR)/$(PACKAGE) $(INSTALL) $(BINDIR)/$(DBGNAME) $(DIR)/debian/tmp/$(DBGDIR)/$(PACKAGE) # Install desktop file and banner image From d213791054cfa50ca3adf57b0b8f7d0628e110ed Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 18:13:14 -0500 Subject: [PATCH 296/364] Rename srb2 to srb2.desktop --- debian/{srb2 => srb2.desktop} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename debian/{srb2 => srb2.desktop} (100%) diff --git a/debian/srb2 b/debian/srb2.desktop similarity index 100% rename from debian/srb2 rename to debian/srb2.desktop From 40dff2c123f746eb765f40609af31fd97dc908df Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 22:00:59 -0500 Subject: [PATCH 297/364] missing space for "proper" Debian formatting --- assets/debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/debian/changelog b/assets/debian/changelog index f9ba9b5ed..a316b7df7 100644 --- a/assets/debian/changelog +++ b/assets/debian/changelog @@ -9,4 +9,4 @@ srb2-data (2.0.6-2) maverick; urgency=high * Initial proper release.. - -- Callum Dickinson Sat, 29 Jan 2011 01:18:42 +1300 + -- Callum Dickinson Sat, 29 Jan 2011 01:18:42 +1300 From 3ae9892064744ee715e27ee6aa243d020f8df843 Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 22:08:32 -0500 Subject: [PATCH 298/364] missing install section for new desktop/png file --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index 30315e4f8..97ec70c55 100755 --- a/debian/rules +++ b/debian/rules @@ -97,6 +97,8 @@ binary-arch: echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries # Generate install folder files echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install + echo $(DESKTOP_DIR) > $(DIR)/debian/$(PACKAGE).install + echo $(PIXMAPS_DIR) > $(DIR)/debian/$(PACKAGE).install echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install binary: binary-arch From 1082ae6ba5f811b5bb09d43eeae2a7c99e55e2ee Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 22:17:14 -0500 Subject: [PATCH 299/364] Missing append, --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 97ec70c55..e49784a0f 100755 --- a/debian/rules +++ b/debian/rules @@ -97,8 +97,8 @@ binary-arch: echo $(BINDIR)/$(EXENAME) >> $(DIR)/debian/source/include-binaries # Generate install folder files echo $(PKGDIR) > $(DIR)/debian/$(PACKAGE).install - echo $(DESKTOP_DIR) > $(DIR)/debian/$(PACKAGE).install - echo $(PIXMAPS_DIR) > $(DIR)/debian/$(PACKAGE).install + echo $(DESKTOP_DIR) >> $(DIR)/debian/$(PACKAGE).install + echo $(PIXMAPS_DIR) >> $(DIR)/debian/$(PACKAGE).install echo $(DBGDIR) > $(DIR)/debian/$(DBGPKG).install binary: binary-arch From c8ae630dfe98e921a8590a57af0ef61fdbba5ea0 Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 22:29:01 -0500 Subject: [PATCH 300/364] Fix desktop file --- debian/srb2.desktop | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/srb2.desktop b/debian/srb2.desktop index 26928ee99..661832b93 100644 --- a/debian/srb2.desktop +++ b/debian/srb2.desktop @@ -1,7 +1,10 @@ +[Desktop Entry] Name=Sonic Robo Blast 2 +Comment=A free 3D Sonic the Hedgehog fan-game built using a modified ver. of the Doom Legacy source port +Encoding=UTF-8 Exec=srb2 -Comment=SRB2 Icon=/usr/share/pixmaps/srb2.png Terminal=false Type=Application -Categories=games;application; +StartupNotify=false +Categories=Application;Game; From 865676d34183268330e03aee28ec9a88baf4359e Mon Sep 17 00:00:00 2001 From: mikeyd Date: Sat, 6 Feb 2016 22:46:52 -0500 Subject: [PATCH 301/364] loose the revision, pkgs switched to native format --- debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index ecc4829cf..63b075f17 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,7 @@ Homepage: http://www.srb2.org Package: srb2 Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14-1) +Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14) Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy @@ -28,8 +28,8 @@ Description: A cross-platform 3D Sonic fangame Package: srb2-dbg Architecture: any -# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14-1), srb2 but dh_shlibdeps is being an asshat -Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14-1), srb2 +# FIXME: should be Depends: ${shlibs:Depends}, ${misc:Depends}, srb2-data (= 2.1.14), srb2 but dh_shlibdeps is being an asshat +Depends: libc6, ${misc:Depends}, srb2-data (= 2.1.14), srb2 Description: A cross-platform 3D Sonic fangame Sonic Robo Blast 2 is a 3D open-source Sonic the Hedgehog fangame built using a modified version of the Doom Legacy From 6b626f1b27162d6d553a3e8053d56e13bac70f60 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 7 Feb 2016 20:53:27 -0500 Subject: [PATCH 302/364] build: cmake is messly --- src/sdl/Makefile.cfg | 6 ++++++ src/sdl/i_main.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sdl/Makefile.cfg b/src/sdl/Makefile.cfg index 3b92a9fb8..b54f7057c 100644 --- a/src/sdl/Makefile.cfg +++ b/src/sdl/Makefile.cfg @@ -119,6 +119,12 @@ ifdef SDL_NET SDL_LDFLAGS+=-lSDL2_net endif +ifdef MINGW +ifndef NOSDLMAIN + SDLMAIN=1 +endif +endif + ifdef SDLMAIN OPTS+=-DSDLMAIN else diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index c157a6be7..74b61339b 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -56,7 +56,7 @@ PSP_MAIN_THREAD_STACK_SIZE_KB(256); #endif #if defined (_WIN32) && !defined (main) -#define SDLMAIN +//#define SDLMAIN #endif #ifdef SDLMAIN From 914c6c9d9807569be1d33e48ec3c3837e3132c3b Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Sun, 7 Feb 2016 21:45:16 -0500 Subject: [PATCH 303/364] Whitespace cleanup. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8deeb37e5..59557ef42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,7 @@ endif() if(${CMAKE_SYSTEM} MATCHES "Darwin") add_definitions(-DMACOSX) - endif() +endif() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") From 66175d87b89ee2ef919ad1ef66872f3b96683c16 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 8 Feb 2016 20:10:32 +0000 Subject: [PATCH 304/364] removed unused macros from doomdef.h --- src/doomdef.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 4a6d6e576..e4b426ebc 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -206,13 +206,6 @@ extern FILE *logstream; // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". #define MODVERSION 19 - - - - -// some tests, enable or disable it if it run or not -#define SPLITSCREEN - // ========================================================================= // The maximum number of players, multiplayer/networking. @@ -348,11 +341,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG; #include "m_swap.h" // Things that used to be in dstrings.h -#define DEVMAPS "devmaps" -#define DEVDATA "devdata" - #define SAVEGAMENAME "srb2sav" - char savegamename[256]; // m_misc.h From 1bdd4cf641a1116097c7081f365962c80b8bf3a3 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 9 Feb 2016 02:39:16 -0800 Subject: [PATCH 305/364] backport state-animations from internal master to public next most other code in the branch did not come along for the ride. --- src/dehacked.c | 614 +++-------------------------------- src/info.c | 802 ++++++++-------------------------------------- src/info.h | 613 +++-------------------------------- src/lua_mobjlib.c | 8 + src/p_local.h | 1 + src/p_mobj.c | 159 +++++---- src/p_mobj.h | 4 +- src/p_pspr.h | 6 +- src/p_saveg.c | 11 + src/p_tick.c | 2 + 10 files changed, 341 insertions(+), 1879 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 44ef998ac..a29f3875e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4588,30 +4588,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_MSSHIELD_F12", // Ring - "S_RING1", - "S_RING2", - "S_RING3", - "S_RING4", - "S_RING5", - "S_RING6", - "S_RING7", - "S_RING8", - "S_RING9", - "S_RING10", - "S_RING11", - "S_RING12", - "S_RING13", - "S_RING14", - "S_RING15", - "S_RING16", - "S_RING17", - "S_RING18", - "S_RING19", - "S_RING20", - "S_RING21", - "S_RING22", - "S_RING23", - "S_RING24", + "S_RING", // Blue Sphere for special stages "S_BLUEBALL", @@ -4627,39 +4604,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_GRAVWELLRED3", // Individual Team Rings - "S_TEAMRING1", - "S_TEAMRING2", - "S_TEAMRING3", - "S_TEAMRING4", - "S_TEAMRING5", - "S_TEAMRING6", - "S_TEAMRING7", - "S_TEAMRING8", - "S_TEAMRING9", - "S_TEAMRING10", - "S_TEAMRING11", - "S_TEAMRING12", - "S_TEAMRING13", - "S_TEAMRING14", - "S_TEAMRING15", - "S_TEAMRING16", - "S_TEAMRING17", - "S_TEAMRING18", - "S_TEAMRING19", - "S_TEAMRING20", - "S_TEAMRING21", - "S_TEAMRING22", - "S_TEAMRING23", - "S_TEAMRING24", + "S_TEAMRING", // Special Stage Token - "S_EMMY1", - "S_EMMY2", - "S_EMMY3", - "S_EMMY4", - "S_EMMY5", - "S_EMMY6", - "S_EMMY7", + "S_EMMY", // Special Stage Token "S_TOKEN", @@ -4813,40 +4761,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPIKED2", // Starpost - "S_STARPOST1", - "S_STARPOST2", - "S_STARPOST3", - "S_STARPOST4", - "S_STARPOST5", - "S_STARPOST6", - "S_STARPOST7", - "S_STARPOST8", - "S_STARPOST9", - "S_STARPOST10", - "S_STARPOST11", - "S_STARPOST12", - "S_STARPOST13", - "S_STARPOST14", - "S_STARPOST15", - "S_STARPOST16", - "S_STARPOST17", - "S_STARPOST18", - "S_STARPOST19", - "S_STARPOST20", - "S_STARPOST21", - "S_STARPOST22", - "S_STARPOST23", - "S_STARPOST24", - "S_STARPOST25", - "S_STARPOST26", - "S_STARPOST27", - "S_STARPOST28", - "S_STARPOST29", - "S_STARPOST30", - "S_STARPOST31", - "S_STARPOST32", - "S_STARPOST33", - "S_STARPOST34", + "S_STARPOST_IDLE", + "S_STARPOST_FLASH", + "S_STARPOST_SPIN", // Big floating mine "S_BIGMINE1", @@ -5454,38 +5371,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PITY10", // Invincibility Sparkles - "S_IVSP1", - "S_IVSP2", - "S_IVSP3", - "S_IVSP4", - "S_IVSP5", - "S_IVSP6", - "S_IVSP7", - "S_IVSP8", - "S_IVSP9", - "S_IVSP10", - "S_IVSP11", - "S_IVSP12", - "S_IVSP13", - "S_IVSP14", - "S_IVSP15", - "S_IVSP16", - "S_IVSP17", - "S_IVSP18", - "S_IVSP19", - "S_IVSP20", - "S_IVSP21", - "S_IVSP22", - "S_IVSP23", - "S_IVSP24", - "S_IVSP25", - "S_IVSP26", - "S_IVSP27", - "S_IVSP28", - "S_IVSP29", - "S_IVSP30", - "S_IVSP31", - "S_IVSP32", + "S_IVSP", // Super Sonic Spark "S_SSPK1", @@ -5672,283 +5558,17 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RRNG6", "S_RRNG7", - // Bounce Ring - "S_BOUNCERING1", - "S_BOUNCERING2", - "S_BOUNCERING3", - "S_BOUNCERING4", - "S_BOUNCERING5", - "S_BOUNCERING6", - "S_BOUNCERING7", - "S_BOUNCERING8", - "S_BOUNCERING9", - "S_BOUNCERING10", - "S_BOUNCERING11", - "S_BOUNCERING12", - "S_BOUNCERING13", - "S_BOUNCERING14", - "S_BOUNCERING15", - "S_BOUNCERING16", - "S_BOUNCERING17", - "S_BOUNCERING18", - "S_BOUNCERING19", - "S_BOUNCERING20", - "S_BOUNCERING21", - "S_BOUNCERING22", - "S_BOUNCERING23", - "S_BOUNCERING24", - "S_BOUNCERING25", - "S_BOUNCERING26", - "S_BOUNCERING27", - "S_BOUNCERING28", - "S_BOUNCERING29", - "S_BOUNCERING30", - "S_BOUNCERING31", - "S_BOUNCERING32", - "S_BOUNCERING33", - "S_BOUNCERING34", - "S_BOUNCERING35", - - // Rail Ring - "S_RAILRING1", - "S_RAILRING2", - "S_RAILRING3", - "S_RAILRING4", - "S_RAILRING5", - "S_RAILRING6", - "S_RAILRING7", - "S_RAILRING8", - "S_RAILRING9", - "S_RAILRING10", - "S_RAILRING11", - "S_RAILRING12", - "S_RAILRING13", - "S_RAILRING14", - "S_RAILRING15", - "S_RAILRING16", - "S_RAILRING17", - "S_RAILRING18", - "S_RAILRING19", - "S_RAILRING20", - "S_RAILRING21", - "S_RAILRING22", - "S_RAILRING23", - "S_RAILRING24", - "S_RAILRING25", - "S_RAILRING26", - "S_RAILRING27", - "S_RAILRING28", - "S_RAILRING29", - "S_RAILRING30", - "S_RAILRING31", - "S_RAILRING32", - "S_RAILRING33", - "S_RAILRING34", - "S_RAILRING35", - - // Infinity ring - "S_INFINITYRING1", - "S_INFINITYRING2", - "S_INFINITYRING3", - "S_INFINITYRING4", - "S_INFINITYRING5", - "S_INFINITYRING6", - "S_INFINITYRING7", - "S_INFINITYRING8", - "S_INFINITYRING9", - "S_INFINITYRING10", - "S_INFINITYRING11", - "S_INFINITYRING12", - "S_INFINITYRING13", - "S_INFINITYRING14", - "S_INFINITYRING15", - "S_INFINITYRING16", - "S_INFINITYRING17", - "S_INFINITYRING18", - "S_INFINITYRING19", - "S_INFINITYRING20", - "S_INFINITYRING21", - "S_INFINITYRING22", - "S_INFINITYRING23", - "S_INFINITYRING24", - "S_INFINITYRING25", - "S_INFINITYRING26", - "S_INFINITYRING27", - "S_INFINITYRING28", - "S_INFINITYRING29", - "S_INFINITYRING30", - "S_INFINITYRING31", - "S_INFINITYRING32", - "S_INFINITYRING33", - "S_INFINITYRING34", - "S_INFINITYRING35", - - // Automatic Ring - "S_AUTOMATICRING1", - "S_AUTOMATICRING2", - "S_AUTOMATICRING3", - "S_AUTOMATICRING4", - "S_AUTOMATICRING5", - "S_AUTOMATICRING6", - "S_AUTOMATICRING7", - "S_AUTOMATICRING8", - "S_AUTOMATICRING9", - "S_AUTOMATICRING10", - "S_AUTOMATICRING11", - "S_AUTOMATICRING12", - "S_AUTOMATICRING13", - "S_AUTOMATICRING14", - "S_AUTOMATICRING15", - "S_AUTOMATICRING16", - "S_AUTOMATICRING17", - "S_AUTOMATICRING18", - "S_AUTOMATICRING19", - "S_AUTOMATICRING20", - "S_AUTOMATICRING21", - "S_AUTOMATICRING22", - "S_AUTOMATICRING23", - "S_AUTOMATICRING24", - "S_AUTOMATICRING25", - "S_AUTOMATICRING26", - "S_AUTOMATICRING27", - "S_AUTOMATICRING28", - "S_AUTOMATICRING29", - "S_AUTOMATICRING30", - "S_AUTOMATICRING31", - "S_AUTOMATICRING32", - "S_AUTOMATICRING33", - "S_AUTOMATICRING34", - "S_AUTOMATICRING35", - - // Explosion Ring - "S_EXPLOSIONRING1", - "S_EXPLOSIONRING2", - "S_EXPLOSIONRING3", - "S_EXPLOSIONRING4", - "S_EXPLOSIONRING5", - "S_EXPLOSIONRING6", - "S_EXPLOSIONRING7", - "S_EXPLOSIONRING8", - "S_EXPLOSIONRING9", - "S_EXPLOSIONRING10", - "S_EXPLOSIONRING11", - "S_EXPLOSIONRING12", - "S_EXPLOSIONRING13", - "S_EXPLOSIONRING14", - "S_EXPLOSIONRING15", - "S_EXPLOSIONRING16", - "S_EXPLOSIONRING17", - "S_EXPLOSIONRING18", - "S_EXPLOSIONRING19", - "S_EXPLOSIONRING20", - "S_EXPLOSIONRING21", - "S_EXPLOSIONRING22", - "S_EXPLOSIONRING23", - "S_EXPLOSIONRING24", - "S_EXPLOSIONRING25", - "S_EXPLOSIONRING26", - "S_EXPLOSIONRING27", - "S_EXPLOSIONRING28", - "S_EXPLOSIONRING29", - "S_EXPLOSIONRING30", - "S_EXPLOSIONRING31", - "S_EXPLOSIONRING32", - "S_EXPLOSIONRING33", - "S_EXPLOSIONRING34", - "S_EXPLOSIONRING35", - - // Scatter Ring - "S_SCATTERRING1", - "S_SCATTERRING2", - "S_SCATTERRING3", - "S_SCATTERRING4", - "S_SCATTERRING5", - "S_SCATTERRING6", - "S_SCATTERRING7", - "S_SCATTERRING8", - "S_SCATTERRING9", - "S_SCATTERRING10", - "S_SCATTERRING11", - "S_SCATTERRING12", - "S_SCATTERRING13", - "S_SCATTERRING14", - "S_SCATTERRING15", - "S_SCATTERRING16", - "S_SCATTERRING17", - "S_SCATTERRING18", - "S_SCATTERRING19", - "S_SCATTERRING20", - "S_SCATTERRING21", - "S_SCATTERRING22", - "S_SCATTERRING23", - "S_SCATTERRING24", - "S_SCATTERRING25", - "S_SCATTERRING26", - "S_SCATTERRING27", - "S_SCATTERRING28", - "S_SCATTERRING29", - "S_SCATTERRING30", - "S_SCATTERRING31", - "S_SCATTERRING32", - "S_SCATTERRING33", - "S_SCATTERRING34", - "S_SCATTERRING35", - - // Grenade Ring - "S_GRENADERING1", - "S_GRENADERING2", - "S_GRENADERING3", - "S_GRENADERING4", - "S_GRENADERING5", - "S_GRENADERING6", - "S_GRENADERING7", - "S_GRENADERING8", - "S_GRENADERING9", - "S_GRENADERING10", - "S_GRENADERING11", - "S_GRENADERING12", - "S_GRENADERING13", - "S_GRENADERING14", - "S_GRENADERING15", - "S_GRENADERING16", - "S_GRENADERING17", - "S_GRENADERING18", - "S_GRENADERING19", - "S_GRENADERING20", - "S_GRENADERING21", - "S_GRENADERING22", - "S_GRENADERING23", - "S_GRENADERING24", - "S_GRENADERING25", - "S_GRENADERING26", - "S_GRENADERING27", - "S_GRENADERING28", - "S_GRENADERING29", - "S_GRENADERING30", - "S_GRENADERING31", - "S_GRENADERING32", - "S_GRENADERING33", - "S_GRENADERING34", - "S_GRENADERING35", + // Weapon Ring Ammo + "S_BOUNCERINGAMMO", + "S_RAILRINGAMMO", + "S_INFINITYRINGAMMO", + "S_AUTOMATICRINGAMMO", + "S_EXPLOSIONRINGAMMO", + "S_SCATTERRINGAMMO", + "S_GRENADERINGAMMO", // Weapon pickup - "S_BOUNCEPICKUP1", - "S_BOUNCEPICKUP2", - "S_BOUNCEPICKUP3", - "S_BOUNCEPICKUP4", - "S_BOUNCEPICKUP5", - "S_BOUNCEPICKUP6", - "S_BOUNCEPICKUP7", - "S_BOUNCEPICKUP8", - "S_BOUNCEPICKUP9", - "S_BOUNCEPICKUP10", - "S_BOUNCEPICKUP11", - "S_BOUNCEPICKUP12", - "S_BOUNCEPICKUP13", - "S_BOUNCEPICKUP14", - "S_BOUNCEPICKUP15", - "S_BOUNCEPICKUP16", - + "S_BOUNCEPICKUP", "S_BOUNCEPICKUPFADE1", "S_BOUNCEPICKUPFADE2", "S_BOUNCEPICKUPFADE3", @@ -5958,23 +5578,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BOUNCEPICKUPFADE7", "S_BOUNCEPICKUPFADE8", - "S_RAILPICKUP1", - "S_RAILPICKUP2", - "S_RAILPICKUP3", - "S_RAILPICKUP4", - "S_RAILPICKUP5", - "S_RAILPICKUP6", - "S_RAILPICKUP7", - "S_RAILPICKUP8", - "S_RAILPICKUP9", - "S_RAILPICKUP10", - "S_RAILPICKUP11", - "S_RAILPICKUP12", - "S_RAILPICKUP13", - "S_RAILPICKUP14", - "S_RAILPICKUP15", - "S_RAILPICKUP16", - + "S_RAILPICKUP", "S_RAILPICKUPFADE1", "S_RAILPICKUPFADE2", "S_RAILPICKUPFADE3", @@ -5984,23 +5588,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_RAILPICKUPFADE7", "S_RAILPICKUPFADE8", - "S_AUTOPICKUP1", - "S_AUTOPICKUP2", - "S_AUTOPICKUP3", - "S_AUTOPICKUP4", - "S_AUTOPICKUP5", - "S_AUTOPICKUP6", - "S_AUTOPICKUP7", - "S_AUTOPICKUP8", - "S_AUTOPICKUP9", - "S_AUTOPICKUP10", - "S_AUTOPICKUP11", - "S_AUTOPICKUP12", - "S_AUTOPICKUP13", - "S_AUTOPICKUP14", - "S_AUTOPICKUP15", - "S_AUTOPICKUP16", - + "S_AUTOPICKUP", "S_AUTOPICKUPFADE1", "S_AUTOPICKUPFADE2", "S_AUTOPICKUPFADE3", @@ -6010,23 +5598,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_AUTOPICKUPFADE7", "S_AUTOPICKUPFADE8", - "S_EXPLODEPICKUP1", - "S_EXPLODEPICKUP2", - "S_EXPLODEPICKUP3", - "S_EXPLODEPICKUP4", - "S_EXPLODEPICKUP5", - "S_EXPLODEPICKUP6", - "S_EXPLODEPICKUP7", - "S_EXPLODEPICKUP8", - "S_EXPLODEPICKUP9", - "S_EXPLODEPICKUP10", - "S_EXPLODEPICKUP11", - "S_EXPLODEPICKUP12", - "S_EXPLODEPICKUP13", - "S_EXPLODEPICKUP14", - "S_EXPLODEPICKUP15", - "S_EXPLODEPICKUP16", - + "S_EXPLODEPICKUP", "S_EXPLODEPICKUPFADE1", "S_EXPLODEPICKUPFADE2", "S_EXPLODEPICKUPFADE3", @@ -6036,23 +5608,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EXPLODEPICKUPFADE7", "S_EXPLODEPICKUPFADE8", - "S_SCATTERPICKUP1", - "S_SCATTERPICKUP2", - "S_SCATTERPICKUP3", - "S_SCATTERPICKUP4", - "S_SCATTERPICKUP5", - "S_SCATTERPICKUP6", - "S_SCATTERPICKUP7", - "S_SCATTERPICKUP8", - "S_SCATTERPICKUP9", - "S_SCATTERPICKUP10", - "S_SCATTERPICKUP11", - "S_SCATTERPICKUP12", - "S_SCATTERPICKUP13", - "S_SCATTERPICKUP14", - "S_SCATTERPICKUP15", - "S_SCATTERPICKUP16", - + "S_SCATTERPICKUP", "S_SCATTERPICKUPFADE1", "S_SCATTERPICKUPFADE2", "S_SCATTERPICKUPFADE3", @@ -6062,23 +5618,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SCATTERPICKUPFADE7", "S_SCATTERPICKUPFADE8", - "S_GRENADEPICKUP1", - "S_GRENADEPICKUP2", - "S_GRENADEPICKUP3", - "S_GRENADEPICKUP4", - "S_GRENADEPICKUP5", - "S_GRENADEPICKUP6", - "S_GRENADEPICKUP7", - "S_GRENADEPICKUP8", - "S_GRENADEPICKUP9", - "S_GRENADEPICKUP10", - "S_GRENADEPICKUP11", - "S_GRENADEPICKUP12", - "S_GRENADEPICKUP13", - "S_GRENADEPICKUP14", - "S_GRENADEPICKUP15", - "S_GRENADEPICKUP16", - + "S_GRENADEPICKUP", "S_GRENADEPICKUPFADE1", "S_GRENADEPICKUPFADE2", "S_GRENADEPICKUPFADE3", @@ -6459,101 +5999,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ROCKSPAWN", - "S_ROCKCRUMBLEA1", - "S_ROCKCRUMBLEA2", - "S_ROCKCRUMBLEA3", - "S_ROCKCRUMBLEA4", - "S_ROCKCRUMBLEA5", - - "S_ROCKCRUMBLEB1", - "S_ROCKCRUMBLEB2", - "S_ROCKCRUMBLEB3", - "S_ROCKCRUMBLEB4", - "S_ROCKCRUMBLEB5", - - "S_ROCKCRUMBLEC1", - "S_ROCKCRUMBLEC2", - "S_ROCKCRUMBLEC3", - "S_ROCKCRUMBLEC4", - "S_ROCKCRUMBLEC5", - - "S_ROCKCRUMBLED1", - "S_ROCKCRUMBLED2", - "S_ROCKCRUMBLED3", - "S_ROCKCRUMBLED4", - "S_ROCKCRUMBLED5", - - "S_ROCKCRUMBLEE1", - "S_ROCKCRUMBLEE2", - "S_ROCKCRUMBLEE3", - "S_ROCKCRUMBLEE4", - "S_ROCKCRUMBLEE5", - - "S_ROCKCRUMBLEF1", - "S_ROCKCRUMBLEF2", - "S_ROCKCRUMBLEF3", - "S_ROCKCRUMBLEF4", - "S_ROCKCRUMBLEF5", - - "S_ROCKCRUMBLEG1", - "S_ROCKCRUMBLEG2", - "S_ROCKCRUMBLEG3", - "S_ROCKCRUMBLEG4", - "S_ROCKCRUMBLEG5", - - "S_ROCKCRUMBLEH1", - "S_ROCKCRUMBLEH2", - "S_ROCKCRUMBLEH3", - "S_ROCKCRUMBLEH4", - "S_ROCKCRUMBLEH5", - - "S_ROCKCRUMBLEI1", - "S_ROCKCRUMBLEI2", - "S_ROCKCRUMBLEI3", - "S_ROCKCRUMBLEI4", - "S_ROCKCRUMBLEI5", - - "S_ROCKCRUMBLEJ1", - "S_ROCKCRUMBLEJ2", - "S_ROCKCRUMBLEJ3", - "S_ROCKCRUMBLEJ4", - "S_ROCKCRUMBLEJ5", - - "S_ROCKCRUMBLEK1", - "S_ROCKCRUMBLEK2", - "S_ROCKCRUMBLEK3", - "S_ROCKCRUMBLEK4", - "S_ROCKCRUMBLEK5", - - "S_ROCKCRUMBLEL1", - "S_ROCKCRUMBLEL2", - "S_ROCKCRUMBLEL3", - "S_ROCKCRUMBLEL4", - "S_ROCKCRUMBLEL5", - - "S_ROCKCRUMBLEM1", - "S_ROCKCRUMBLEM2", - "S_ROCKCRUMBLEM3", - "S_ROCKCRUMBLEM4", - "S_ROCKCRUMBLEM5", - - "S_ROCKCRUMBLEN1", - "S_ROCKCRUMBLEN2", - "S_ROCKCRUMBLEN3", - "S_ROCKCRUMBLEN4", - "S_ROCKCRUMBLEN5", - - "S_ROCKCRUMBLEO1", - "S_ROCKCRUMBLEO2", - "S_ROCKCRUMBLEO3", - "S_ROCKCRUMBLEO4", - "S_ROCKCRUMBLEO5", - - "S_ROCKCRUMBLEP1", - "S_ROCKCRUMBLEP2", - "S_ROCKCRUMBLEP3", - "S_ROCKCRUMBLEP4", - "S_ROCKCRUMBLEP5", + "S_ROCKCRUMBLEA", + "S_ROCKCRUMBLEB", + "S_ROCKCRUMBLEC", + "S_ROCKCRUMBLED", + "S_ROCKCRUMBLEE", + "S_ROCKCRUMBLEF", + "S_ROCKCRUMBLEG", + "S_ROCKCRUMBLEH", + "S_ROCKCRUMBLEI", + "S_ROCKCRUMBLEJ", + "S_ROCKCRUMBLEK", + "S_ROCKCRUMBLEL", + "S_ROCKCRUMBLEM", + "S_ROCKCRUMBLEN", + "S_ROCKCRUMBLEO", + "S_ROCKCRUMBLEP", "S_SRB1_CRAWLA1", "S_SRB1_CRAWLA2", @@ -7484,6 +6945,7 @@ struct { // Frame settings {"FF_FRAMEMASK",FF_FRAMEMASK}, + {"FF_ANIMATE",FF_ANIMATE}, {"FF_FULLBRIGHT",FF_FULLBRIGHT}, {"FF_TRANSMASK",FF_TRANSMASK}, {"FF_TRANSSHIFT",FF_TRANSSHIFT}, diff --git a/src/info.c b/src/info.c index 9e04b4e34..9f75f188d 100644 --- a/src/info.c +++ b/src/info.c @@ -60,6 +60,7 @@ char sprnames[NUMSPRITES + 1][5] = state_t states[NUMSTATES] = { // frame is masked through FF_FRAMEMASK + // FF_ANIMATE (0x4000) makes simple state animations (var1 #frames, var2 tic delay) // FF_FULLBRIGHT (0x8000) activates the fullbright colormap // use FF_TRANS10 - FF_TRANS90 for easy translucency // (or tr_trans10<frame); break; + case mobj_anim_duration: + lua_pushinteger(L, mo->anim_duration); + break; case mobj_touching_sectorlist: return UNIMPLEMENTED; case mobj_subsector: @@ -406,6 +411,9 @@ static int mobj_set(lua_State *L) case mobj_frame: mo->frame = (UINT32)luaL_checkinteger(L, 3); break; + case mobj_anim_duration: + mo->anim_duration = (UINT16)luaL_checkinteger(L, 3); + break; case mobj_touching_sectorlist: return UNIMPLEMENTED; case mobj_subsector: diff --git a/src/p_local.h b/src/p_local.h index 97b8865d4..d035925c8 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -212,6 +212,7 @@ void P_RemoveSavegameMobj(mobj_t *th); boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); void P_RunShields(void); +void P_RunOverlays(void); void P_MobjThinker(mobj_t *mobj); boolean P_RailThinker(mobj_t *mobj); void P_PushableThinker(mobj_t *mobj); diff --git a/src/p_mobj.c b/src/p_mobj.c index 25ae8815a..323e5ce95 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -79,11 +79,33 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum) actioncachehead.prev = newaction; } +// +// P_CycleStateAnimation +// +FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj) +{ + // var2 determines delay between animation frames + if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0) + return; + mobj->anim_duration = (UINT16)mobj->state->var2; + + // compare the current sprite frame to the one we started from + // if more than var1 away from it, swap back to the original + // else just advance by one + if ((mobj->frame & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) < (UINT32)mobj->state->var1) + ++mobj->frame; + else + mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK); +} + // // P_CycleMobjState // static void P_CycleMobjState(mobj_t *mobj) { + // state animations + P_CycleStateAnimation(mobj); + // cycle through states, // calling action functions at transitions if (mobj->tics != -1) @@ -102,6 +124,9 @@ static void P_CycleMobjState(mobj_t *mobj) // static void P_CyclePlayerMobjState(mobj_t *mobj) { + // state animations + P_CycleStateAnimation(mobj); + // cycle through states, // calling action functions at transitions if (mobj->tics != -1) @@ -279,6 +304,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) mobj->sprite = st->sprite; mobj->frame = st->frame; + mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set // Modified handling. // Call action functions when the state is set @@ -346,6 +372,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state) mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; + mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set // Modified handling. // Call action functions when the state is set @@ -399,6 +426,8 @@ boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state) mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; + mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set + return true; } @@ -416,6 +445,8 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state) mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; + mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set + return true; } @@ -3716,6 +3747,8 @@ void P_NullPrecipThinker(precipmobj_t *mobj) void P_SnowThinker(precipmobj_t *mobj) { + P_CycleStateAnimation((mobj_t *)mobj); + // adjust height if ((mobj->z += mobj->momz) <= mobj->floorz) mobj->z = mobj->ceilingz; @@ -3723,6 +3756,8 @@ void P_SnowThinker(precipmobj_t *mobj) void P_RainThinker(precipmobj_t *mobj) { + P_CycleStateAnimation((mobj_t *)mobj); + if (mobj->state != &states[S_RAIN1]) { // cycle through states, @@ -5833,8 +5868,6 @@ INT32 numshields = 0; void P_RunShields(void) { INT32 i; - mobj_t *mo, *next; - fixed_t destx,desty,zoffs; // run shields for (i = 0; i < numshields; i++) @@ -5843,60 +5876,6 @@ void P_RunShields(void) P_SetTarget(&shields[i], NULL); } numshields = 0; - - // run overlays - next = NULL; - for (mo = overlaycap; mo; mo = next) - { - I_Assert(!P_MobjWasRemoved(mo)); - - // grab next in chain, then unset the chain target - next = mo->hnext; - P_SetTarget(&mo->hnext, NULL); - - if (!mo->target) - continue; - if (!splitscreen /*&& rendermode != render_soft*/) - { - angle_t viewingangle; - - if (players[displayplayer].awayviewtics) - viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); - else if (!camera.chase && players[displayplayer].mo) - viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y); - else - viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y); - - if (mo->state->var1) - viewingangle += ANGLE_180; - destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale)); - desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale)); - } - else - { - destx = mo->target->x; - desty = mo->target->y; - } - - mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP); - mo->scale = mo->destscale = mo->target->scale; - zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale); - mo->angle = mo->target->angle; - - P_UnsetThingPosition(mo); - mo->x = destx; - mo->y = desty; - if (mo->eflags & MFE_VERTICALFLIP) - mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs; - else - mo->z = mo->target->z + zoffs; - if (mo->state->var1) - P_SetUnderlayPosition(mo); - else - P_SetThingPosition(mo); - P_CheckPosition(mo, mo->x, mo->y); - } - P_SetTarget(&overlaycap, NULL); } static boolean P_AddShield(mobj_t *thing) @@ -5933,6 +5912,71 @@ static boolean P_AddShield(mobj_t *thing) return true; } +void P_RunOverlays(void) +{ + // run overlays + mobj_t *mo, *next = NULL; + fixed_t destx,desty,zoffs; + + for (mo = overlaycap; mo; mo = next) + { + I_Assert(!P_MobjWasRemoved(mo)); + + // grab next in chain, then unset the chain target + next = mo->hnext; + P_SetTarget(&mo->hnext, NULL); + + if (!mo->target) + continue; + if (!splitscreen /*&& rendermode != render_soft*/) + { + angle_t viewingangle; + + if (players[displayplayer].awayviewtics) + viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].awayviewmobj->x, players[displayplayer].awayviewmobj->y); + else if (!camera.chase && players[displayplayer].mo) + viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, players[displayplayer].mo->x, players[displayplayer].mo->y); + else + viewingangle = R_PointToAngle2(mo->target->x, mo->target->y, camera.x, camera.y); + + if (!(mo->state->frame & FF_ANIMATE) && mo->state->var1) + viewingangle += ANGLE_180; + destx = mo->target->x + P_ReturnThrustX(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale)); + desty = mo->target->y + P_ReturnThrustY(mo->target, viewingangle, FixedMul(FRACUNIT/4, mo->scale)); + } + else + { + destx = mo->target->x; + desty = mo->target->y; + } + + mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP) | (mo->target->eflags & MFE_VERTICALFLIP); + mo->scale = mo->destscale = mo->target->scale; + mo->angle = mo->target->angle; + + if (!(mo->state->frame & FF_ANIMATE)) + zoffs = FixedMul(((signed)mo->state->var2)*FRACUNIT, mo->scale); + // if you're using FF_ANIMATE on an overlay, + // then you're on your own. + else + zoffs = 0; + + P_UnsetThingPosition(mo); + mo->x = destx; + mo->y = desty; + if (mo->eflags & MFE_VERTICALFLIP) + mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs; + else + mo->z = mo->target->z + zoffs; + if (mo->state->var1) + P_SetUnderlayPosition(mo); + else + P_SetThingPosition(mo); + P_CheckPosition(mo, mo->x, mo->y); + } + P_SetTarget(&overlaycap, NULL); +} + // Called only when MT_OVERLAY thinks. static void P_AddOverlay(mobj_t *thing) { @@ -7502,6 +7546,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits.. + mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set + mobj->friction = ORIG_FRICTION; mobj->movefactor = ORIG_FRICTION_FACTOR; @@ -7727,6 +7773,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits.. + mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set // set subsector and/or block links P_SetPrecipitationThingPosition(mobj); diff --git a/src/p_mobj.h b/src/p_mobj.h index 224a8ca5b..6198f5bec 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -270,6 +270,7 @@ typedef struct mobj_s angle_t angle; // orientation spritenum_t sprite; // used to find patch_t and flip value UINT32 frame; // frame number, plus bits see p_pspr.h + UINT16 anim_duration; // for FF_ANIMATE states struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears @@ -383,7 +384,8 @@ typedef struct precipmobj_s // More drawing info: to determine current sprite. angle_t angle; // orientation spritenum_t sprite; // used to find patch_t and flip value - INT32 frame; // frame number, plus bits see p_pspr.h + UINT32 frame; // frame number, plus bits see p_pspr.h + UINT16 anim_duration; // for FF_ANIMATE states struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears diff --git a/src/p_pspr.h b/src/p_pspr.h index e0b57675c..53ad30abd 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -36,9 +36,11 @@ #endif /// \brief Frame flags: only the frame number -#define FF_FRAMEMASK 0x7fff +#define FF_FRAMEMASK 0x3fff +/// \brief Frame flags: Simple stateless animation +#define FF_ANIMATE 0x4000 /// \brief Frame flags: frame always appears full bright -#define FF_FULLBRIGHT 0x8000 // +#define FF_FULLBRIGHT 0x8000 /// \brief Frame flags: 0 = no trans(opaque), 1-15 = transl. table #define FF_TRANSMASK 0xf0000 /// \brief shift for FF_TRANSMASK diff --git a/src/p_saveg.c b/src/p_saveg.c index 61f51e497..565ff0bd0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1058,6 +1058,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff |= MD_SPRITE; if (mobj->frame != mobj->state->frame) diff |= MD_FRAME; + if (mobj->anim_duration != (UINT16)mobj->state->var2) + diff |= MD_FRAME; if (mobj->eflags) diff |= MD_EFLAGS; if (mobj->player) @@ -1178,7 +1180,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) if (diff & MD_SPRITE) WRITEUINT16(save_p, mobj->sprite); if (diff & MD_FRAME) + { WRITEUINT32(save_p, mobj->frame); + WRITEUINT16(save_p, mobj->anim_duration); + } if (diff & MD_EFLAGS) WRITEUINT16(save_p, mobj->eflags); if (diff & MD_PLAYER) @@ -2004,9 +2009,15 @@ static void LoadMobjThinker(actionf_p1 thinker) else mobj->sprite = mobj->state->sprite; if (diff & MD_FRAME) + { mobj->frame = READUINT32(save_p); + mobj->anim_duration = READUINT16(save_p); + } else + { mobj->frame = mobj->state->frame; + mobj->anim_duration = (UINT16)mobj->state->var2; + } if (diff & MD_EFLAGS) mobj->eflags = READUINT16(save_p); if (diff & MD_PLAYER) diff --git a/src/p_tick.c b/src/p_tick.c index 2973505f3..c72ab5b67 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -631,6 +631,7 @@ void P_Ticker(boolean run) // Run shield positioning P_RunShields(); + P_RunOverlays(); P_UpdateSpecials(); P_RespawnSpecials(); @@ -742,6 +743,7 @@ void P_PreTicker(INT32 frames) // Run shield positioning P_RunShields(); + P_RunOverlays(); P_UpdateSpecials(); P_RespawnSpecials(); From 58e685353a3575e71869f691de6a2e793cb1ec1e Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 5 Jan 2016 05:03:00 -0800 Subject: [PATCH 306/364] Attempt 2 at special stage fades. More basic in execution. --- src/dehacked.c | 12 ++++++++++-- src/f_finale.h | 3 ++- src/f_wipe.c | 1 + src/p_setup.c | 51 +++++++++++++++++++++++++++++++++++++------------- 4 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 44ef998ac..f7ec8ed51 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3187,6 +3187,12 @@ static void readwipes(MYFILE *f) else if (fastcmp(pword, "FINAL")) wipeoffset = wipe_gameend_final; } + else if (fastncmp(word, "SPECLEVEL_", 10)) + { + pword = word + 10; + if (fastcmp(pword, "TOWHITE")) + wipeoffset = wipe_speclevel_towhite; + } if (wipeoffset < 0) { @@ -3194,9 +3200,11 @@ static void readwipes(MYFILE *f) continue; } - if (value == UINT8_MAX // Cannot disable non-toblack wipes (or the level toblack wipe) - && (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_level_final)) + if (value == UINT8_MAX + && (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_speclevel_towhite)) { + // Cannot disable non-toblack wipes + // (or the level toblack wipe, or the special towhite wipe) deh_warning("Wipes: can't disable wipe of type '%s'", word); continue; } diff --git a/src/f_finale.h b/src/f_finale.h index 97a26f4c4..e263a3797 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -90,6 +90,7 @@ enum // custom intermissions wipe_specinter_toblack, wipe_multinter_toblack, + wipe_speclevel_towhite, wipe_level_final, wipe_intermission_final, @@ -108,7 +109,7 @@ enum NUMWIPEDEFS }; -#define WIPEFINALSHIFT 12 +#define WIPEFINALSHIFT 13 extern UINT8 wipedefs[NUMWIPEDEFS]; #endif diff --git a/src/f_wipe.c b/src/f_wipe.c index 6f14e577a..e0578949e 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -58,6 +58,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 0, // wipe_specinter_toblack 0, // wipe_multinter_toblack + 0, // wipe_speclevel_towhite 0, // wipe_level_final 0, // wipe_intermission_final diff --git a/src/p_setup.c b/src/p_setup.c index 3491669c7..dc0e4ffd5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2369,7 +2369,7 @@ boolean P_SetupLevel(boolean skipprecip) // use gamemap to get map number. // 99% of the things already did, so. // Map header should always be in place at this point - INT32 i, loadprecip = 1; + INT32 i, loadprecip = 1, ranspecialwipe = 0; INT32 loademblems = 1; INT32 fromnetsave = 0; boolean loadedbm = false; @@ -2442,6 +2442,28 @@ boolean P_SetupLevel(boolean skipprecip) // will be set by player think. players[consoleplayer].viewz = 1; + // Special stage fade to white + // This is handled BEFORE sounds are stopped. + if (rendermode != render_none && G_IsSpecialStage(gamemap)) + { + tic_t starttime = I_GetTime(); + tic_t endtime = starttime + (3*TICRATE)/2; + + S_StartSound(NULL, sfx_s3kaf); + + F_WipeStartScreen(); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); + + F_WipeEndScreen(); + F_RunWipe(wipedefs[wipe_speclevel_towhite], false); + + // Hold on white for extra effect. + while (I_GetTime() < endtime) + I_Sleep(); + + ranspecialwipe = 1; + } + // Make sure all sounds are stopped before Z_FreeTags. S_StopSounds(); S_ClearSfx(); @@ -2451,25 +2473,28 @@ boolean P_SetupLevel(boolean skipprecip) S_Start(); // Let's fade to black here - if (rendermode != render_none) + // But only if we didn't do the special stage wipe + if (rendermode != render_none && !ranspecialwipe) { F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeEndScreen(); F_RunWipe(wipedefs[wipe_level_toblack], false); + } + // Print "SPEEDING OFF TO [ZONE] [ACT 1]..." + if (rendermode != render_none) + { // Don't include these in the fade! - { - char tx[64]; - V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to...")); - snprintf(tx, 63, "%s%s%s", - mapheaderinfo[gamemap-1]->lvlttl, - (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE", - (mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : ""); - V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx); - I_UpdateNoVsync(); - } + char tx[64]; + V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to...")); + snprintf(tx, 63, "%s%s%s", + mapheaderinfo[gamemap-1]->lvlttl, + (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE", + (mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : ""); + V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx); + I_UpdateNoVsync(); } #ifdef HAVE_BLUA @@ -2767,7 +2792,7 @@ boolean P_SetupLevel(boolean skipprecip) // Remove the loading shit from the screen if (rendermode != render_none) - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (ranspecialwipe) ? 0 : 31); if (precache || dedicated) R_PrecacheLevel(); From 8c17dac589215ad71d501a52aaff96b57f26021f Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 7 Jan 2016 19:48:20 -0800 Subject: [PATCH 307/364] The concept of "music slots" doesn't exist anymore. Use whatever names you want for your music. So long as you prefix the lumps with O_ or D_, it doesn't matter anymore. DISCLAIMER: Linedef type 413 (change music) and Lua scripting is not tested. (cherry picked from commit 025ca413a2a01a8ec7c104748c2f510e350aa457) # Conflicts: # src/p_user.c --- src/d_netcmd.c | 47 +- src/dehacked.c | 97 ++-- src/doomstat.h | 22 +- src/f_finale.c | 22 +- src/g_game.c | 17 +- src/lua_baselib.c | 7 +- src/lua_maplib.c | 8 +- src/m_menu.c | 16 +- src/p_enemy.c | 8 +- src/p_inter.c | 4 +- src/p_saveg.c | 2 +- src/p_setup.c | 31 +- src/p_spec.c | 17 +- src/p_user.c | 26 +- src/s_sound.c | 562 ++++++++++----------- src/s_sound.h | 16 +- src/sdl/mixer_sound.c | 1 + src/sounds.c | 1061 ---------------------------------------- src/sounds.h | 1086 ----------------------------------------- src/y_inter.c | 8 +- 20 files changed, 431 insertions(+), 2627 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 02bc464e6..9916e524f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1854,10 +1854,10 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) if (paused) { if (!menuactive || netgame) - S_PauseSound(); + S_PauseAudio(); } else - S_ResumeSound(); + S_ResumeAudio(); } } @@ -3761,46 +3761,53 @@ static void Command_Displayplayer_f(void) static void Command_Tunes_f(void) { const char *tunearg; - UINT16 tune, track = 0; + UINT16 tunenum, track = 0; const size_t argc = COM_Argc(); if (argc < 2) //tunes slot ... { - CONS_Printf("tunes :\n"); + CONS_Printf("tunes :\n"); CONS_Printf(M_GetText("Play a music slot at a set speed (\"1\" being normal speed).\n")); CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n")); - CONS_Printf(M_GetText("The current tune is: %d\nThe current track is: %d\n"), - (mapmusic & MUSIC_SONGMASK), ((mapmusic & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT)); + CONS_Printf(M_GetText("The current tune is: %s\nThe current track is: %d\n"), + mapmusname, (mapmusflags & MUSIC_TRACKMASK)); return; } tunearg = COM_Argv(1); - tune = (UINT16)atoi(tunearg); + tunenum = (UINT16)atoi(tunearg); track = 0; - if (!strcasecmp(tunearg, "default")) + if (!strcasecmp(tunearg, "none")) { - tune = mapheaderinfo[gamemap-1]->musicslot; - track = mapheaderinfo[gamemap-1]->musicslottrack; + S_StopMusic(); + return; } - else if (toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') - tune = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); - - if (tune >= NUMMUSIC) + else if (!strcasecmp(tunearg, "default")) { - CONS_Alert(CONS_NOTICE, M_GetText("Valid slots are 1 to %d, or 0 to stop music\n"), NUMMUSIC - 1); + tunearg = mapheaderinfo[gamemap-1]->musname; + track = mapheaderinfo[gamemap-1]->mustrack; + } + else if (tunearg[3] == 0 && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') + tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); + + if (tunenum && tunenum >= 1036) + { + CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n")); return; } if (argc > 3) track = (UINT16)atoi(COM_Argv(3))-1; - mapmusic = tune | (track << MUSIC_TRACKSHIFT); - - if (tune == mus_None) - S_StopMusic(); + if (tunenum) + snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum)); else - S_ChangeMusic(mapmusic, true); + strncpy(mapmusname, tunearg, 7); + mapmusname[6] = 0; + mapmusflags = (track & MUSIC_TRACKMASK); + + S_ChangeMusic(mapmusname, mapmusflags, true); if (argc > 2) { diff --git a/src/dehacked.c b/src/dehacked.c index 44ef998ac..6f07ce8e0 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -65,7 +65,6 @@ static mobjtype_t get_mobjtype(const char *word); static statenum_t get_state(const char *word); static spritenum_t get_sprite(const char *word); static sfxenum_t get_sfx(const char *word); -static UINT16 get_mus(const char *word); static hudnum_t get_huditem(const char *word); #ifndef HAVE_BLUA static powertype_t get_power(const char *word); @@ -1164,19 +1163,34 @@ static void readlevelheader(MYFILE *f, INT32 num) mapheaderinfo[num-1]->typeoflevel = tol; } } - else if (fastcmp(word, "MUSICSLOT")) + else if (fastcmp(word, "MUSIC")) { + if (fastcmp(word2, "NONE")) + mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string + else + { + deh_strlcpy(mapheaderinfo[num-1]->musname, word2, + sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num)); + } + } + else if (fastcmp(word, "MUSICSLOT")) + { // Backwards compatibility? // Convert to map number if (word2[0] >= 'A' && word2[0] <= 'Z' && word2[2] == '\0') i = M_MapNumber(word2[0], word2[1]); - if (i) // it's just a number - mapheaderinfo[num-1]->musicslot = (UINT16)i; - else // No? Okay, now we'll get technical. - mapheaderinfo[num-1]->musicslot = get_mus(word2); // accepts all of O_CHRSEL, mus_chrsel, or just plain ChrSel + if (!i) + mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string + else if (i > 1035) + deh_warning("Level header %d: musicslot out of range (0 - 1035)\n", num); + else // it's just a number + { + snprintf(mapheaderinfo[num-1]->musname, 7, va("%sM", G_BuildMapName(i))); + mapheaderinfo[num-1]->musname[6] = 0; + } } - else if (fastcmp(word, "MUSICSLOTTRACK")) - mapheaderinfo[num-1]->musicslottrack = ((UINT16)i - 1); + else if (fastcmp(word, "MUSICTRACK")) + mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); @@ -1443,10 +1457,16 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) else deh_warning("CutSceneScene %d: unknown word '%s'", num, word); } - else if (fastcmp(word, "MUSICSLOT")) + else if (fastcmp(word, "MUSIC")) { - DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musicslot), UNDO_NONE); - cutscenes[num]->scene[scenenum].musicslot = get_mus(word2); // accepts all of O_MAP01M, mus_map01m, or just plain MAP01M + DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE); + strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7); + cutscenes[num]->scene[scenenum].musswitch[6] = 0; + } + else if (fastcmp(word, "MUSICTRACK")) + { + DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE); + cutscenes[num]->scene[scenenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; } else if (fastcmp(word, "MUSICLOOP")) { @@ -7958,22 +7978,6 @@ static sfxenum_t get_sfx(const char *word) return sfx_None; } -static UINT16 get_mus(const char *word) -{ // Returns the value of SFX_ enumerations - UINT16 i; - if (*word >= '0' && *word <= '9') - return atoi(word); - if (fastncmp("MUS_",word,4)) - word += 4; // take off the MUS_ - else if (fastncmp("O_",word,2) || fastncmp("D_",word,2)) - word += 2; // take off the O_ or D_ - for (i = 0; i < NUMMUSIC; i++) - if (S_music[i].name && fasticmp(word, S_music[i].name)) - return i; - deh_warning("Couldn't find music named 'MUS_%s'",word); - return mus_None; -} - static hudnum_t get_huditem(const char *word) { // Returns the value of HUD_ enumerations hudnum_t i; @@ -8172,11 +8176,6 @@ static fixed_t find_const(const char **rword) free(word); return r; } - else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) { - r = get_mus(word); - free(word); - return r; - } else if (fastncmp("PW_",word,3)) { r = get_power(word); free(word); @@ -8546,33 +8545,6 @@ static inline int lib_getenum(lua_State *L) if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word); return 0; } - else if (!mathlib && fastncmp("mus_",word,4)) { - p = word+4; - for (i = 0; i < NUMMUSIC; i++) - if (S_music[i].name && fastcmp(p, S_music[i].name)) { - lua_pushinteger(L, i); - return 1; - } - return 0; - } - else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS! - p = word+4; - for (i = 0; i < NUMMUSIC; i++) - if (S_music[i].name && fasticmp(p, S_music[i].name)) { - lua_pushinteger(L, i); - return 1; - } - return luaL_error(L, "music '%s' could not be found.\n", word); - } - else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) { - p = word+2; - for (i = 0; i < NUMMUSIC; i++) - if (S_music[i].name && fasticmp(p, S_music[i].name)) { - lua_pushinteger(L, i); - return 1; - } - return luaL_error(L, "music '%s' could not be found.\n", word); - } else if (!mathlib && fastncmp("pw_",word,3)) { p = word+3; for (i = 0; i < NUMPOWERS; i++) @@ -8724,8 +8696,11 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"globallevelskynum")) { lua_pushinteger(L, globallevelskynum); return 1; - } else if (fastcmp(word,"mapmusic")) { - lua_pushinteger(L, mapmusic); + } else if (fastcmp(word,"mapmusname")) { + lua_pushstring(L, mapmusname); + return 1; + } else if (fastcmp(word,"mapmusflags")) { + lua_pushinteger(L, mapmusflags); return 1; } else if (fastcmp(word,"server")) { if ((!multiplayer || !netgame) && !playeringame[serverplayer]) diff --git a/src/doomstat.h b/src/doomstat.h index 44cf6feaa..ffdbcaecd 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -31,15 +31,11 @@ // Selected by user. extern INT16 gamemap; - -// ----------------xxxxxxxxxxxxxxxx = music slot -// -xxxxxxxxxxxxxxx---------------- = track slot -// x------------------------------- = reset music bit -extern UINT32 mapmusic; -#define MUSIC_TRACKSHIFT 16 -#define MUSIC_SONGMASK 0x0000FFFF -#define MUSIC_TRACKMASK 0x7FFF0000 -#define MUSIC_RELOADRESET 0x80000000 +extern char mapmusname[7]; +extern UINT16 mapmusflags; +#define MUSIC_TRACKMASK 0x0FFF // ----************ +#define MUSIC_RELOADRESET 0x8000 // *--------------- +// Use other bits if necessary. extern INT16 maptol; extern UINT8 globalweather; @@ -146,11 +142,13 @@ typedef struct UINT16 xcoord[8]; UINT16 ycoord[8]; UINT16 picduration[8]; - UINT16 musicslot; UINT8 musicloop; UINT16 textxpos; UINT16 textypos; + char musswitch[7]; + UINT16 musswitchflags; + UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0 UINT8 fadeoutid; // ID of the second fade, to the new screen @@ -218,8 +216,8 @@ typedef struct UINT8 actnum; ///< Act number or 0 for none. UINT16 typeoflevel; ///< Combination of typeoflevel flags. INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. - UINT16 musicslot; ///< Music slot number to play. 0 for no music. - UINT16 musicslottrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. + char musname[7]; ///< Music track to play. "" for no music. + UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. INT16 skynum; ///< Sky number to use. diff --git a/src/f_finale.c b/src/f_finale.c index a85fd11cb..efe39f294 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -559,7 +559,7 @@ static void F_IntroDrawScene(void) if (finalecount < 4) S_StopMusic(); if (finalecount == 4) - S_ChangeMusic(mus_stjr, false); + S_ChangeMusicInternal("stjr", false); x = (BASEVIDWIDTH<scene[scenenum].xcoord[picnum]; picypos = cutscenes[cutnum]->scene[scenenum].ycoord[picnum]; - if (cutscenes[cutnum]->scene[scenenum].musicslot != 0) - S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop); + if (cutscenes[cutnum]->scene[scenenum].musswitch[0]) + S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musswitch, + cutscenes[cutnum]->scene[scenenum].musswitchflags, + cutscenes[cutnum]->scene[scenenum].musicloop); // Fade to the next dofadenow = true; @@ -1774,8 +1776,10 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset animtimer = cutscenes[cutnum]->scene[0].picduration[0]; // Picture duration stoptimer = 0; - if (cutscenes[cutnum]->scene[scenenum].musicslot != 0) - S_ChangeMusic(cutscenes[cutnum]->scene[scenenum].musicslot, cutscenes[cutnum]->scene[scenenum].musicloop); + if (cutscenes[cutnum]->scene[0].musswitch[0]) + S_ChangeMusic(cutscenes[cutnum]->scene[0].musswitch, + cutscenes[cutnum]->scene[0].musswitchflags, + cutscenes[cutnum]->scene[0].musicloop); else S_StopMusic(); } diff --git a/src/g_game.c b/src/g_game.c index 72cfe4a57..088536436 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -69,8 +69,10 @@ static void G_DoStartContinue(void); static void G_DoContinued(void); static void G_DoWorldDone(void); +char mapmusname[7]; // Music name +UINT16 mapmusflags; // Track and reset bit + INT16 gamemap = 1; -UINT32 mapmusic; // music, track, and reset bit INT16 maptol; UINT8 globalweather = 0; INT32 curWeather = PRECIP_NONE; @@ -2182,12 +2184,13 @@ void G_PlayerReborn(INT32 player) if (p-players == consoleplayer) { - if (mapmusic & MUSIC_RELOADRESET) // TODO: Might not need this here + if (mapmusflags & MUSIC_RELOADRESET) { - mapmusic = mapheaderinfo[gamemap-1]->musicslot - | (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT); + strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7); + mapmusname[6] = 0; + mapmusflags = mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK; } - S_ChangeMusic(mapmusic, true); + S_ChangeMusic(mapmusname, mapmusflags, true); } if (gametype == GT_COOP) @@ -3521,7 +3524,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean if (paused) { paused = false; - S_ResumeSound(); + S_ResumeAudio(); } if (netgame || multiplayer) // Nice try, haxor. @@ -3595,7 +3598,7 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean globalweather = mapheaderinfo[gamemap-1]->weather; // Don't carry over custom music change to another map. - mapmusic |= MUSIC_RELOADRESET; + mapmusflags |= MUSIC_RELOADRESET; ultimatemode = pultmode; playerdeadview = false; diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 5e2d31b10..386270959 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1636,9 +1636,10 @@ static int lib_sStopSound(lua_State *L) static int lib_sChangeMusic(lua_State *L) { - UINT32 music_num = (UINT32)luaL_checkinteger(L, 1); + const char *music_name = luaL_checkstring(L, 1); boolean looping = (boolean)lua_opttrueboolean(L, 2); player_t *player = NULL; + UINT16 music_flags = 0; NOHUD if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) { @@ -1646,8 +1647,10 @@ static int lib_sChangeMusic(lua_State *L) if (!player) return LUA_ErrInvalid(L, "player_t"); } + music_flags = (UINT16)luaL_optinteger(L, 4, 0); + if (!player || P_IsLocalPlayer(player)) - S_ChangeMusic(music_num, looping); + S_ChangeMusic(music_name, music_flags, looping); return 0; } diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 38920c223..5f77b2b5c 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1168,10 +1168,10 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->typeoflevel); else if (fastcmp(field,"nextlevel")) lua_pushinteger(L, header->nextlevel); - else if (fastcmp(field,"musicslot")) - lua_pushinteger(L, header->musicslot); - else if (fastcmp(field,"musicslottrack")) - lua_pushinteger(L, header->musicslottrack); + else if (fastcmp(field,"musname")) + lua_pushlstring(L, header->musname, 6); + else if (fastcmp(field,"mustrack")) + lua_pushinteger(L, header->mustrack); else if (fastcmp(field,"forcecharacter")) lua_pushstring(L, header->forcecharacter); else if (fastcmp(field,"weather")) diff --git a/src/m_menu.c b/src/m_menu.c index 65ea1cfe7..e53b32582 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4751,7 +4751,7 @@ static void M_SetupChoosePlayer(INT32 choice) if (Playing() == false) { S_StopMusic(); - S_ChangeMusic(mus_chrsel, true); + S_ChangeMusicInternal("chrsel", true); } SP_PlayerDef.prevMenu = currentMenu; @@ -5202,7 +5202,7 @@ void M_DrawTimeAttackMenu(void) lumpnum_t lumpnum; char beststr[40]; - S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback + S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); @@ -5365,7 +5365,7 @@ static void M_TimeAttack(INT32 choice) itemOn = tastart; // "Start" is selected. G_SetGamestate(GS_TIMEATTACK); - S_ChangeMusic(mus_racent, true); + S_ChangeMusicInternal("racent", true); } // Drawing function for Nights Attack @@ -5375,7 +5375,7 @@ void M_DrawNightsAttackMenu(void) lumpnum_t lumpnum; char beststr[40]; - S_ChangeMusic(mus_racent, true); // Eww, but needed for when user hits escape during demo playback + S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); @@ -5498,7 +5498,7 @@ static void M_NightsAttack(INT32 choice) itemOn = nastart; // "Start" is selected. G_SetGamestate(GS_TIMEATTACK); - S_ChangeMusic(mus_racent, true); + S_ChangeMusicInternal("racent", true); } // Player has selected the "START" from the nights attack screen @@ -5732,7 +5732,7 @@ static void M_ModeAttackEndGame(INT32 choice) itemOn = currentMenu->lastOn; G_SetGamestate(GS_TIMEATTACK); modeattacking = ATTACKING_NONE; - S_ChangeMusic(mus_racent, true); + S_ChangeMusicInternal("racent", true); // Update replay availability. CV_AddValue(&cv_nextmap, 1); CV_AddValue(&cv_nextmap, -1); @@ -6944,7 +6944,7 @@ static void M_ToggleDigital(void) if (nodigimusic) return; S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_StopMusic(); - S_ChangeMusic(mus_lclear, false); + S_ChangeMusicInternal("lclear", false); M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING); } else @@ -6971,7 +6971,7 @@ static void M_ToggleMIDI(void) I_InitMIDIMusic(); if (nomidimusic) return; S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); - S_ChangeMusic(mus_lclear, false); + S_ChangeMusicInternal("lclear", false); M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING); } else diff --git a/src/p_enemy.c b/src/p_enemy.c index df5297271..101760642 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3063,12 +3063,8 @@ void A_Invincibility(mobj_t *actor) { S_StopMusic(); if (mariomode) - { - S_ChangeMusic(mus_minvnc, false); G_GhostAddColor(GHC_INVINCIBLE); - } - else - S_ChangeMusic(mus_invinc, false); + S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false); } } @@ -3104,7 +3100,7 @@ void A_SuperSneakers(mobj_t *actor) else { S_StopMusic(); - S_ChangeMusic(mus_shoes, false); + S_ChangeMusicInternal("shoes", false); } } } diff --git a/src/p_inter.c b/src/p_inter.c index 709e0e2be..61d397d6c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2073,7 +2073,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) if (P_IsLocalPlayer(target->player) && target->player == &players[consoleplayer]) { S_StopMusic(); // Stop the Music! Tails 03-14-2000 - S_ChangeMusic(mus_gmover, false); // Yousa dead now, Okieday? Tails 03-14-2000 + S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000 } } } @@ -2461,7 +2461,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source) && player->nightstime < 10*TICRATE) { //S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH - S_ChangeMusic(mus_drown,false); + S_ChangeMusicInternal("drown",false); } } } diff --git a/src/p_saveg.c b/src/p_saveg.c index 61f51e497..67c66cb6c 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3192,7 +3192,7 @@ static inline boolean P_NetUnArchiveMisc(void) // tell the sound code to reset the music since we're skipping what // normally sets this flag - mapmusic |= MUSIC_RELOADRESET; + mapmusflags |= MUSIC_RELOADRESET; G_SetGamestate(READINT16(save_p)); diff --git a/src/p_setup.c b/src/p_setup.c index 3491669c7..3a51d90b3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -180,10 +180,11 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->typeoflevel = 0; DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE); mapheaderinfo[num]->nextlevel = (INT16)(i + 1); - DEH_WriteUndoline("MUSICSLOT", va("%d", mapheaderinfo[num]->musicslot), UNDO_NONE); - mapheaderinfo[num]->musicslot = mus_map01m + num; - DEH_WriteUndoline("MUSICSLOTTRACK", va("%d", mapheaderinfo[num]->musicslottrack), UNDO_NONE); - mapheaderinfo[num]->musicslottrack = 0; + DEH_WriteUndoline("MUSIC", mapheaderinfo[num]->musname, UNDO_NONE); + snprintf(mapheaderinfo[num]->musname, 7, va("%sM", G_BuildMapName(i))); + mapheaderinfo[num]->musname[6] = 0; + DEH_WriteUndoline("MUSICTRACK", va("%d", mapheaderinfo[num]->mustrack), UNDO_NONE); + mapheaderinfo[num]->mustrack = 0; DEH_WriteUndoline("FORCECHARACTER", va("%d", mapheaderinfo[num]->forcecharacter), UNDO_NONE); mapheaderinfo[num]->forcecharacter[0] = '\0'; DEH_WriteUndoline("WEATHER", va("%d", mapheaderinfo[num]->weather), UNDO_NONE); @@ -1439,6 +1440,21 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum) #endif case 413: // Change music + { + char process[8+1]; + + sd->toptexture = sd->midtexture = sd->bottomtexture = 0; + if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0') + { + M_Memcpy(process,msd->bottomtexture,8); + process[8] = '\0'; + sd->bottomtexture = get_number(process)-1; + } + M_Memcpy(process,msd->toptexture,8); + sd->text = Z_Malloc(strlen(process)+1, PU_LEVEL, NULL); + M_Memcpy(sd->text, process, strlen(process)+1); + break; + } case 414: // Play SFX { sd->toptexture = sd->midtexture = sd->bottomtexture = 0; @@ -1449,13 +1465,6 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum) process[8] = '\0'; sd->toptexture = get_number(process); } - if (sd->special == 413 && (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')) - { - char process[8+1]; - M_Memcpy(process,msd->bottomtexture,8); - process[8] = '\0'; - sd->bottomtexture = get_number(process)-1; - } break; } diff --git a/src/p_spec.c b/src/p_spec.c index 81994d46c..ef3425e04 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2390,20 +2390,19 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // console player only unless NOCLIMB is set if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player))) { - UINT16 musicnum = (UINT16)sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS; UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture; - mapmusic = musicnum | (tracknum << MUSIC_TRACKSHIFT); - if (!(line->flags & ML_BLOCKMONSTERS)) - mapmusic |= MUSIC_RELOADRESET; + strncpy(mapmusname, line->text, 7); + mapmusname[6] = 0; - if (musicnum >= NUMMUSIC || musicnum == mus_None) - S_StopMusic(); - else - S_ChangeMusic(mapmusic, !(line->flags & ML_EFFECT4)); + mapmusflags = tracknum & MUSIC_TRACKMASK; + if (!(line->flags & ML_BLOCKMONSTERS)) + mapmusflags |= MUSIC_RELOADRESET; + + S_ChangeMusic(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4)); // Except, you can use the ML_BLOCKMONSTERS flag to change this behavior. - // if (mapmusic & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn. + // if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn. } break; diff --git a/src/p_user.c b/src/p_user.c index f015c17f4..ef281406f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -962,7 +962,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player)) { S_StopMusic(); - S_ChangeMusic(mus_supers, true); + S_ChangeMusicInternal("supers", true); } S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi @@ -1098,7 +1098,7 @@ void P_PlayLivesJingle(player_t *player) if (player) player->powers[pw_extralife] = extralifetics + 1; S_StopMusic(); // otherwise it won't restart if this is done twice in a row - S_ChangeMusic(mus_xtlife, false); + S_ChangeMusicInternal("xtlife", false); } } @@ -1116,21 +1116,21 @@ void P_RestoreMusic(player_t *player) return; S_SpeedMusic(1.0f); if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) - S_ChangeMusic(mus_supers, true); + S_ChangeMusicInternal("supers", true); else if (player->powers[pw_invulnerability] > 1) - S_ChangeMusic((mariomode) ? mus_minvnc : mus_invinc, false); + S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false); else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super]) { if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC) { S_SpeedMusic(1.4f); - S_ChangeMusic(mapmusic, true); + S_ChangeMusic(mapmusname, mapmusflags, true); } else - S_ChangeMusic(mus_shoes, true); + S_ChangeMusicInternal("shoes", true); } else - S_ChangeMusic(mapmusic, true); + S_ChangeMusic(mapmusname, mapmusflags, true); } // @@ -2039,7 +2039,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player) mobj_t *killer; if ((netgame || multiplayer) && P_IsLocalPlayer(player)) - S_ChangeMusic(mapmusic, true); + S_ChangeMusic(mapmusname, mapmusflags, true); killer = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NULL); killer->threshold = 42; // Special flag that it was drowning which killed you. @@ -2048,7 +2048,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player) else if (player->powers[pw_spacetime] == 1) { if ((netgame || multiplayer) && P_IsLocalPlayer(player)) - S_ChangeMusic(mapmusic, true); + S_ChangeMusic(mapmusname, mapmusflags, true); P_DamageMobj(player->mo, NULL, NULL, 10000); } @@ -2083,7 +2083,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player) && player == &players[consoleplayer]) { S_StopMusic(); - S_ChangeMusic(mus_drown, false); + S_ChangeMusicInternal("drown", false); } if (player->powers[pw_underwater] == 25*TICRATE + 1) @@ -5592,7 +5592,7 @@ static void P_NiGHTSMovement(player_t *player) } else if (P_IsLocalPlayer(player) && player->nightstime == 10*TICRATE) // S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH - S_ChangeMusic(mus_drown,false); + S_ChangeMusicInternal("drown",false); if (player->mo->z < player->mo->floorz) @@ -7731,7 +7731,7 @@ static void P_DeathThink(player_t *player) // Return to level music if (netgame && player->deadtimer == gameovertics && P_IsLocalPlayer(player)) - S_ChangeMusic(mapmusic, true); + S_ChangeMusic(mapmusname, mapmusflags, true); } if (!player->mo) @@ -8717,7 +8717,7 @@ void P_PlayerThink(player_t *player) if (countdown == 11*TICRATE - 1) { if (P_IsLocalPlayer(player)) - S_ChangeMusic(mus_drown, false); + S_ChangeMusicInternal("drown", false); } // If you've hit the countdown and you haven't made diff --git a/src/s_sound.c b/src/s_sound.c index 14a8cc425..1e5f79aa0 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -141,14 +141,6 @@ typedef struct static channel_t *channels = NULL; static INT32 numofchannels = 0; -// whether songs are mus_paused -static boolean mus_paused = 0; - -// music currently being played -musicinfo_t *mus_playing = 0; - -static INT32 nextcleanup; - // // Internals. // @@ -307,47 +299,6 @@ static void SetChannelsNum(void) channels[i].sfxinfo = 0; } -// -// Initializes sound stuff, including volume -// Sets channels, SFX and music volume, -// allocates channel buffer, sets S_sfx lookup. -// -void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume) -{ - INT32 i; - - if (dedicated) - return; - - S_SetSfxVolume(sfxVolume); - S_SetDigMusicVolume(digMusicVolume); - S_SetMIDIMusicVolume(midiMusicVolume); - - SetChannelsNum(); - - // no sounds are playing, and they are not mus_paused - mus_paused = 0; - - // Note that sounds have not been cached (yet). - for (i = 1; i < NUMSFX; i++) - { - S_sfx[i].usefulness = -1; // for I_GetSfx() - S_sfx[i].lumpnum = LUMPERROR; - } - - // precache sounds if requested by cmdline, or precachesound var true - if (!nosound && (M_CheckParm("-precachesound") || precachesound.value)) - { - // Initialize external data (all sounds) at start, keep static. - CONS_Printf(M_GetText("Loading sounds... ")); - - for (i = 1; i < NUMSFX; i++) - if (S_sfx[i].name) - S_sfx[i].data = I_GetSfx(&S_sfx[i]); - - CONS_Printf(M_GetText(" pre-cached all sound data\n")); - } -} // Retrieve the lump number of sfx // @@ -371,12 +322,6 @@ lumpnum_t S_GetSfxLumpNum(sfxinfo_t *sfx) return W_GetNumForName("dsthok"); } -// -// Per level startup code. -// Kills playing sounds at start of level, -// determines music if any, changes music. -// - // Stop all sounds, load level info, THEN start sounds. void S_StopSounds(void) { @@ -442,22 +387,6 @@ void S_StopSoundByNum(sfxenum_t sfxnum) } } -void S_Start(void) -{ - if (mapmusic & MUSIC_RELOADRESET) - { - mapmusic = mapheaderinfo[gamemap-1]->musicslot - | (mapheaderinfo[gamemap-1]->musicslottrack << MUSIC_TRACKSHIFT); - } - - mus_paused = 0; - - if (cv_resetmusic.value) - S_StopMusic(); - S_ChangeMusic(mapmusic, true); - nextcleanup = 15; -} - void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) { INT32 sep, pitch, priority, cnum; @@ -745,43 +674,6 @@ void S_StopSound(void *origin) } } -// -// Stop and resume music, during game PAUSE. -// -void S_PauseSound(void) -{ - if (!nodigimusic) - I_PauseSong(0); - - if (mus_playing && !mus_paused) - { - I_PauseSong(mus_playing->handle); - mus_paused = true; - } - - // pause cd music -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) - I_PauseCD(); -#else - I_StopCD(); -#endif -} - -void S_ResumeSound(void) -{ - if (!nodigimusic) - I_ResumeSong(0); - else - if (mus_playing && mus_paused) - { - I_ResumeSong(mus_playing->handle); - mus_paused = false; - } - - // resume cd music - I_ResumeCD(); -} - // // Updates music & sounds // @@ -883,38 +775,6 @@ void S_UpdateSounds(void) } } - // Clean up unused data. -#if 0 - { - static tic_t nextcleanup = 0; - size_t i; - sfxinfo_t *sfx; - - if (!gametic) nextcleanup = 0; - if (gametic > nextcleanup) - { - for (i = 1; i < NUMSFX; i++) - { - if (S_sfx[i].usefulness == 0) - { - S_sfx[i].usefulness--; - - // don't forget to unlock it !!! - // __dmpi_unlock_.... - //Z_ChangeTag(S_sfx[i].data, PU_CACHE); - I_FreeSfx(S_sfx+i); - //S_sfx[i].data = 0; - - CONS_Debug(DBG_GAMELOGIC, "flushed sfx %.6s\n", S_sfx[i].name); - } - } - nextcleanup = gametic + 15; - } - } -#endif - - // FIXTHIS: nextcleanup is probably unused - for (cnum = 0; cnum < numofchannels; cnum++) { c = &channels[cnum]; @@ -984,37 +844,6 @@ void S_UpdateSounds(void) I_UpdateSound(); } -void S_SetDigMusicVolume(INT32 volume) -{ - if (volume < 0 || volume > 31) - CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n"); - - CV_SetValue(&cv_digmusicvolume, volume&31); - actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var - -#ifdef DJGPPDOS - I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this. -#endif - - if (!nodigimusic) - I_SetDigMusicVolume(volume&31); -} - -void S_SetMIDIMusicVolume(INT32 volume) -{ - if (volume < 0 || volume > 31) - CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n"); - - CV_SetValue(&cv_midimusicvolume, volume&0x1f); - actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var - -#ifdef DJGPPDOS - I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this. -#endif - - I_SetMIDIMusicVolume(volume&0x1f); -} - void S_SetSfxVolume(INT32 volume) { if (volume < 0 || volume > 31) @@ -1031,137 +860,6 @@ void S_SetSfxVolume(INT32 volume) #endif } -static boolean S_MIDIMusic(musicinfo_t *music, boolean looping) -{ - if (nomidimusic) - return true; // no error - - if (music_disabled) - return true; // no error - - // get lumpnum if neccessary - if (!music->lumpnum) - { - if (W_CheckNumForName(va("d_%s", music->name)) == LUMPERROR) - return false; - music->lumpnum = W_GetNumForName(va("d_%s", music->name)); - } - - // load & register it - music->data = W_CacheLumpNum(music->lumpnum, PU_MUSIC); -#if defined (macintosh) && !defined (HAVE_SDL) - music->handle = I_RegisterSong(music_num); -#else - music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum)); -#endif - -#ifdef MUSSERV - if (msg_id != -1) - { - struct musmsg msg_buffer; - - msg_buffer.msg_type = 6; - memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text)); - sprintf(msg_buffer.msg_text, "d_%s", music->name); - msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT); - } -#endif - - // play it - if (!I_PlaySong(music->handle, looping)) - return false; - - mus_playing = music; - return true; -} - -static boolean S_DigMusic(musicinfo_t *music, boolean looping) -{ - if (nodigimusic) - return false; // try midi - - if (digital_disabled) - return false; // try midi - - if (!I_StartDigSong(music->name, looping)) - return false; - - mus_playing = music; - return true; -} - -void S_ChangeMusic(UINT32 mslotnum, boolean looping) -{ - musicinfo_t *music; - musicenum_t music_num = (signed)(mslotnum & MUSIC_SONGMASK); - INT32 track_num = (mslotnum & MUSIC_TRACKMASK) >> MUSIC_TRACKSHIFT; - -#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X) - S_ClearSfx(); -#endif - - if (nomidimusic && nodigimusic) - return; - - if (music_disabled && digital_disabled) - return; - - // No Music - if (music_num == mus_None) - { - S_StopMusic(); - return; - } - - if (music_num >= NUMMUSIC) - { - CONS_Alert(CONS_ERROR, "Bad music number %d\n", music_num); - return; - } - else - music = &S_music[music_num]; - - if (mus_playing != music) - { - S_StopMusic(); // shutdown old music - if (!S_DigMusic(music, looping) && !S_MIDIMusic(music, looping)) - { - CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), music->name); - return; - } - } - I_SetSongTrack(track_num); -} - -boolean S_SpeedMusic(float speed) -{ - return I_SetSongSpeed(speed); -} - -void S_StopMusic(void) -{ - if (!mus_playing) - return; - - if (mus_paused) - I_ResumeSong(mus_playing->handle); - - if (!nodigimusic) - I_StopDigSong(); - - S_SpeedMusic(1.0f); - I_StopSong(mus_playing->handle); - I_UnRegisterSong(mus_playing->handle); - -#ifndef HAVE_SDL //SDL uses RWOPS - Z_ChangeTag(mus_playing->data, PU_CACHE); -#endif - - mus_playing->data = NULL; - mus_playing = NULL; - -} - void S_ClearSfx(void) { #ifndef DJGPPDOS @@ -1452,3 +1150,263 @@ void S_StartSoundName(void *mo, const char *soundname) S_StartSound(mo, soundnum); } + +/// ------------------------ +/// Music +/// ------------------------ + +#define music_playing (music_name[0]) // String is empty if no music is playing + +static char music_name[7]; // up to 6-character name +static lumpnum_t music_lumpnum; // lump number of music (used??) +static void *music_data; // music raw data +static INT32 music_handle; // once registered, the handle for the music + +static boolean mus_paused = 0; // whether songs are mus_paused + +static boolean S_MIDIMusic(const char *mname, boolean looping) +{ + lumpnum_t mlumpnum; + void *mdata; + INT32 mhandle; + + if (nomidimusic || music_disabled) + return false; // didn't search. + + if (W_CheckNumForName(va("d_%s", mname)) == LUMPERROR) + return false; + mlumpnum = W_GetNumForName(va("d_%s", mname)); + + // load & register it + mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC); + mhandle = I_RegisterSong(mdata, W_LumpLength(mlumpnum)); + +#ifdef MUSSERV + if (msg_id != -1) + { + struct musmsg msg_buffer; + + msg_buffer.msg_type = 6; + memset(msg_buffer.msg_text, 0, sizeof (msg_buffer.msg_text)); + sprintf(msg_buffer.msg_text, "d_%s", mname); + msgsnd(msg_id, (struct msgbuf*)&msg_buffer, sizeof (msg_buffer.msg_text), IPC_NOWAIT); + } +#endif + + // play it + if (!I_PlaySong(mhandle, looping)) + return false; + + strncpy(music_name, mname, 7); + music_name[6] = 0; + music_lumpnum = mlumpnum; + music_data = mdata; + music_handle = mhandle; + return true; +} + +static boolean S_DigMusic(const char *mname, boolean looping) +{ + if (nodigimusic || digital_disabled) + return false; // try midi + + if (!I_StartDigSong(mname, looping)) + return false; + + strncpy(music_name, mname, 7); + music_name[6] = 0; + music_lumpnum = LUMPERROR; + music_data = NULL; + music_handle = 0; + return true; +} + +void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping) +{ +#if defined (DC) || defined (_WIN32_WCE) || defined (PSP) || defined(GP2X) + S_ClearSfx(); +#endif + + if ((nomidimusic || music_disabled) && (nodigimusic || digital_disabled)) + return; + + // No Music (empty string) + if (mmusic[0] == 0) + { + S_StopMusic(); + return; + } + + if (strncmp(music_name, mmusic, 6)) + { + S_StopMusic(); // shutdown old music + if (!S_DigMusic(mmusic, looping) && !S_MIDIMusic(mmusic, looping)) + { + CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic); + return; + } + } + I_SetSongTrack(mflags & MUSIC_TRACKMASK); +} + +boolean S_SpeedMusic(float speed) +{ + return I_SetSongSpeed(speed); +} + +void S_StopMusic(void) +{ + if (!music_playing) + return; + + if (mus_paused) + I_ResumeSong(music_handle); + + if (!nodigimusic) + I_StopDigSong(); + + S_SpeedMusic(1.0f); + I_StopSong(music_handle); + I_UnRegisterSong(music_handle); + +#ifndef HAVE_SDL //SDL uses RWOPS + Z_ChangeTag(music_data, PU_CACHE); +#endif + + music_data = NULL; + music_name[0] = 0; +} + +void S_SetDigMusicVolume(INT32 volume) +{ + if (volume < 0 || volume > 31) + CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n"); + + CV_SetValue(&cv_digmusicvolume, volume&31); + actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var + +#ifdef DJGPPDOS + I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this. +#endif + if (!nodigimusic) + I_SetDigMusicVolume(volume&31); +} + +void S_SetMIDIMusicVolume(INT32 volume) +{ + if (volume < 0 || volume > 31) + CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n"); + + CV_SetValue(&cv_midimusicvolume, volume&0x1f); + actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var + +#ifdef DJGPPDOS + I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this. +#endif + I_SetMIDIMusicVolume(volume&0x1f); +} + +/// ------------------------ +/// Init & Others +/// ------------------------ + +// +// Initializes sound stuff, including volume +// Sets channels, SFX and music volume, +// allocates channel buffer, sets S_sfx lookup. +// +void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume) +{ + INT32 i; + + if (dedicated) + return; + + S_SetSfxVolume(sfxVolume); + S_SetDigMusicVolume(digMusicVolume); + S_SetMIDIMusicVolume(midiMusicVolume); + + SetChannelsNum(); + + // no sounds are playing, and they are not mus_paused + mus_paused = 0; + + // Note that sounds have not been cached (yet). + for (i = 1; i < NUMSFX; i++) + { + S_sfx[i].usefulness = -1; // for I_GetSfx() + S_sfx[i].lumpnum = LUMPERROR; + } + + // precache sounds if requested by cmdline, or precachesound var true + if (!nosound && (M_CheckParm("-precachesound") || precachesound.value)) + { + // Initialize external data (all sounds) at start, keep static. + CONS_Printf(M_GetText("Loading sounds... ")); + + for (i = 1; i < NUMSFX; i++) + if (S_sfx[i].name) + S_sfx[i].data = I_GetSfx(&S_sfx[i]); + + CONS_Printf(M_GetText(" pre-cached all sound data\n")); + } +} + + +// +// Per level startup code. +// Kills playing sounds at start of level, +// determines music if any, changes music. +// +void S_Start(void) +{ + if (mapmusflags & MUSIC_RELOADRESET) + { + strncpy(mapmusname, mapheaderinfo[gamemap-1]->musname, 7); + mapmusname[6] = 0; + mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); + } + + mus_paused = 0; + + if (cv_resetmusic.value) + S_StopMusic(); + S_ChangeMusic(mapmusname, mapmusflags, true); +} + +// +// Stop and resume music, during game PAUSE. +// +void S_PauseAudio(void) +{ + if (!nodigimusic) + I_PauseSong(0); + + if (music_playing && !mus_paused) + { + I_PauseSong(music_handle); + mus_paused = true; + } + + // pause cd music +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) + I_PauseCD(); +#else + I_StopCD(); +#endif +} + +void S_ResumeAudio(void) +{ + if (!nodigimusic) + I_ResumeSong(0); + else + if (music_playing && mus_paused) + { + I_ResumeSong(music_handle); + mus_paused = false; + } + + // resume cd music + I_ResumeCD(); +} diff --git a/src/s_sound.h b/src/s_sound.h index 6589ca598..12787536b 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -48,9 +48,6 @@ typedef enum extern consvar_t play_mode; #endif -//in case you're wondering why: I need to define this as extern so P_RestoreMusic can get to it so we don't do stupid song/speed changes -extern musicinfo_t *mus_playing; - typedef enum { SF_TOTALLYSINGLE = 1, // Only play one of these sounds at a time...GLOBALLY @@ -100,11 +97,12 @@ void S_StartSoundAtVolume(const void *origin, sfxenum_t sound_id, INT32 volume); // Stop sound for thing at void S_StopSound(void *origin); -// Start music using from sounds.h, and set whether looping -// note: music slot is first 16 bits for songnum, -// next 15 bits for tracknum (gme, other formats with more than one track) +// Start music track, arbitrary, given its name, and set whether looping +// note: music flags 12 bits for tracknum (gme, other formats with more than one track) +// 13-15 aren't used yet // and the last bit we ignore (internal game flag for resetting music on reload) -void S_ChangeMusic(UINT32 mslotnum, boolean looping); +#define S_ChangeMusicInternal(a,b) S_ChangeMusic(a,0,b) +void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping); // Set Speed of Music boolean S_SpeedMusic(float speed); @@ -113,8 +111,8 @@ boolean S_SpeedMusic(float speed); void S_StopMusic(void); // Stop and resume music, during game PAUSE. -void S_PauseSound(void); -void S_ResumeSound(void); +void S_PauseAudio(void); +void S_ResumeAudio(void); // // Updates music & sounds diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 71969209c..2ce546153 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -374,6 +374,7 @@ void I_FreeSfx(sfxinfo_t *sfx) if (sfx->data) Mix_FreeChunk(sfx->data); sfx->data = NULL; + sfx->lumpnum = LUMPERROR; } INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) diff --git a/src/sounds.c b/src/sounds.c index 1ec86e7bc..97bdf23ec 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -20,1067 +20,6 @@ #include "w_wad.h" #include "lua_script.h" -// -// Information about all the music -// - -musicinfo_t S_music[NUMMUSIC] = -{ - {NULL, 0, NULL, -1}, - {"map01m", 0, NULL, -1}, - {"map02m", 0, NULL, -1}, - {"map03m", 0, NULL, -1}, - {"map04m", 0, NULL, -1}, - {"map05m", 0, NULL, -1}, - {"map06m", 0, NULL, -1}, - {"map07m", 0, NULL, -1}, - {"map08m", 0, NULL, -1}, - {"map09m", 0, NULL, -1}, - {"map10m", 0, NULL, -1}, - {"map11m", 0, NULL, -1}, - {"map12m", 0, NULL, -1}, - {"map13m", 0, NULL, -1}, - {"map14m", 0, NULL, -1}, - {"map15m", 0, NULL, -1}, - {"map16m", 0, NULL, -1}, - {"map17m", 0, NULL, -1}, - {"map18m", 0, NULL, -1}, - {"map19m", 0, NULL, -1}, - {"map20m", 0, NULL, -1}, - {"map21m", 0, NULL, -1}, - {"map22m", 0, NULL, -1}, - {"map23m", 0, NULL, -1}, - {"map24m", 0, NULL, -1}, - {"map25m", 0, NULL, -1}, - {"map26m", 0, NULL, -1}, - {"map27m", 0, NULL, -1}, - {"map28m", 0, NULL, -1}, - {"map29m", 0, NULL, -1}, - {"map30m", 0, NULL, -1}, - {"map31m", 0, NULL, -1}, - {"map32m", 0, NULL, -1}, - {"map33m", 0, NULL, -1}, - {"map34m", 0, NULL, -1}, - {"map35m", 0, NULL, -1}, - {"map36m", 0, NULL, -1}, - {"map37m", 0, NULL, -1}, - {"map38m", 0, NULL, -1}, - {"map39m", 0, NULL, -1}, - {"map40m", 0, NULL, -1}, - {"map41m", 0, NULL, -1}, - {"map42m", 0, NULL, -1}, - {"map43m", 0, NULL, -1}, - {"map44m", 0, NULL, -1}, - {"map45m", 0, NULL, -1}, - {"map46m", 0, NULL, -1}, - {"map47m", 0, NULL, -1}, - {"map48m", 0, NULL, -1}, - {"map49m", 0, NULL, -1}, - {"map50m", 0, NULL, -1}, - {"map51m", 0, NULL, -1}, - {"map52m", 0, NULL, -1}, - {"map53m", 0, NULL, -1}, - {"map54m", 0, NULL, -1}, - {"map55m", 0, NULL, -1}, - {"map56m", 0, NULL, -1}, - {"map57m", 0, NULL, -1}, - {"map58m", 0, NULL, -1}, - {"map59m", 0, NULL, -1}, - {"map60m", 0, NULL, -1}, - {"map61m", 0, NULL, -1}, - {"map62m", 0, NULL, -1}, - {"map63m", 0, NULL, -1}, - {"map64m", 0, NULL, -1}, - {"map65m", 0, NULL, -1}, - {"map66m", 0, NULL, -1}, - {"map67m", 0, NULL, -1}, - {"map68m", 0, NULL, -1}, - {"map69m", 0, NULL, -1}, - {"map70m", 0, NULL, -1}, - {"map71m", 0, NULL, -1}, - {"map72m", 0, NULL, -1}, - {"map73m", 0, NULL, -1}, - {"map74m", 0, NULL, -1}, - {"map75m", 0, NULL, -1}, - {"map76m", 0, NULL, -1}, - {"map77m", 0, NULL, -1}, - {"map78m", 0, NULL, -1}, - {"map79m", 0, NULL, -1}, - {"map80m", 0, NULL, -1}, - {"map81m", 0, NULL, -1}, - {"map82m", 0, NULL, -1}, - {"map83m", 0, NULL, -1}, - {"map84m", 0, NULL, -1}, - {"map85m", 0, NULL, -1}, - {"map86m", 0, NULL, -1}, - {"map87m", 0, NULL, -1}, - {"map88m", 0, NULL, -1}, - {"map89m", 0, NULL, -1}, - {"map90m", 0, NULL, -1}, - {"map91m", 0, NULL, -1}, - {"map92m", 0, NULL, -1}, - {"map93m", 0, NULL, -1}, - {"map94m", 0, NULL, -1}, - {"map95m", 0, NULL, -1}, - {"map96m", 0, NULL, -1}, - {"map97m", 0, NULL, -1}, - {"map98m", 0, NULL, -1}, - {"map99m", 0, NULL, -1}, - {"mapa0m", 0, NULL, -1}, - {"mapa1m", 0, NULL, -1}, - {"mapa2m", 0, NULL, -1}, - {"mapa3m", 0, NULL, -1}, - {"mapa4m", 0, NULL, -1}, - {"mapa5m", 0, NULL, -1}, - {"mapa6m", 0, NULL, -1}, - {"mapa7m", 0, NULL, -1}, - {"mapa8m", 0, NULL, -1}, - {"mapa9m", 0, NULL, -1}, - {"mapaam", 0, NULL, -1}, - {"mapabm", 0, NULL, -1}, - {"mapacm", 0, NULL, -1}, - {"mapadm", 0, NULL, -1}, - {"mapaem", 0, NULL, -1}, - {"mapafm", 0, NULL, -1}, - {"mapagm", 0, NULL, -1}, - {"mapahm", 0, NULL, -1}, - {"mapaim", 0, NULL, -1}, - {"mapajm", 0, NULL, -1}, - {"mapakm", 0, NULL, -1}, - {"mapalm", 0, NULL, -1}, - {"mapamm", 0, NULL, -1}, - {"mapanm", 0, NULL, -1}, - {"mapaom", 0, NULL, -1}, - {"mapapm", 0, NULL, -1}, - {"mapaqm", 0, NULL, -1}, - {"maparm", 0, NULL, -1}, - {"mapasm", 0, NULL, -1}, - {"mapatm", 0, NULL, -1}, - {"mapaum", 0, NULL, -1}, - {"mapavm", 0, NULL, -1}, - {"mapawm", 0, NULL, -1}, - {"mapaxm", 0, NULL, -1}, - {"mapaym", 0, NULL, -1}, - {"mapazm", 0, NULL, -1}, - {"mapb0m", 0, NULL, -1}, - {"mapb1m", 0, NULL, -1}, - {"mapb2m", 0, NULL, -1}, - {"mapb3m", 0, NULL, -1}, - {"mapb4m", 0, NULL, -1}, - {"mapb5m", 0, NULL, -1}, - {"mapb6m", 0, NULL, -1}, - {"mapb7m", 0, NULL, -1}, - {"mapb8m", 0, NULL, -1}, - {"mapb9m", 0, NULL, -1}, - {"mapbam", 0, NULL, -1}, - {"mapbbm", 0, NULL, -1}, - {"mapbcm", 0, NULL, -1}, - {"mapbdm", 0, NULL, -1}, - {"mapbem", 0, NULL, -1}, - {"mapbfm", 0, NULL, -1}, - {"mapbgm", 0, NULL, -1}, - {"mapbhm", 0, NULL, -1}, - {"mapbim", 0, NULL, -1}, - {"mapbjm", 0, NULL, -1}, - {"mapbkm", 0, NULL, -1}, - {"mapblm", 0, NULL, -1}, - {"mapbmm", 0, NULL, -1}, - {"mapbnm", 0, NULL, -1}, - {"mapbom", 0, NULL, -1}, - {"mapbpm", 0, NULL, -1}, - {"mapbqm", 0, NULL, -1}, - {"mapbrm", 0, NULL, -1}, - {"mapbsm", 0, NULL, -1}, - {"mapbtm", 0, NULL, -1}, - {"mapbum", 0, NULL, -1}, - {"mapbvm", 0, NULL, -1}, - {"mapbwm", 0, NULL, -1}, - {"mapbxm", 0, NULL, -1}, - {"mapbym", 0, NULL, -1}, - {"mapbzm", 0, NULL, -1}, - {"mapc0m", 0, NULL, -1}, - {"mapc1m", 0, NULL, -1}, - {"mapc2m", 0, NULL, -1}, - {"mapc3m", 0, NULL, -1}, - {"mapc4m", 0, NULL, -1}, - {"mapc5m", 0, NULL, -1}, - {"mapc6m", 0, NULL, -1}, - {"mapc7m", 0, NULL, -1}, - {"mapc8m", 0, NULL, -1}, - {"mapc9m", 0, NULL, -1}, - {"mapcam", 0, NULL, -1}, - {"mapcbm", 0, NULL, -1}, - {"mapccm", 0, NULL, -1}, - {"mapcdm", 0, NULL, -1}, - {"mapcem", 0, NULL, -1}, - {"mapcfm", 0, NULL, -1}, - {"mapcgm", 0, NULL, -1}, - {"mapchm", 0, NULL, -1}, - {"mapcim", 0, NULL, -1}, - {"mapcjm", 0, NULL, -1}, - {"mapckm", 0, NULL, -1}, - {"mapclm", 0, NULL, -1}, - {"mapcmm", 0, NULL, -1}, - {"mapcnm", 0, NULL, -1}, - {"mapcom", 0, NULL, -1}, - {"mapcpm", 0, NULL, -1}, - {"mapcqm", 0, NULL, -1}, - {"mapcrm", 0, NULL, -1}, - {"mapcsm", 0, NULL, -1}, - {"mapctm", 0, NULL, -1}, - {"mapcum", 0, NULL, -1}, - {"mapcvm", 0, NULL, -1}, - {"mapcwm", 0, NULL, -1}, - {"mapcxm", 0, NULL, -1}, - {"mapcym", 0, NULL, -1}, - {"mapczm", 0, NULL, -1}, - {"mapd0m", 0, NULL, -1}, - {"mapd1m", 0, NULL, -1}, - {"mapd2m", 0, NULL, -1}, - {"mapd3m", 0, NULL, -1}, - {"mapd4m", 0, NULL, -1}, - {"mapd5m", 0, NULL, -1}, - {"mapd6m", 0, NULL, -1}, - {"mapd7m", 0, NULL, -1}, - {"mapd8m", 0, NULL, -1}, - {"mapd9m", 0, NULL, -1}, - {"mapdam", 0, NULL, -1}, - {"mapdbm", 0, NULL, -1}, - {"mapdcm", 0, NULL, -1}, - {"mapddm", 0, NULL, -1}, - {"mapdem", 0, NULL, -1}, - {"mapdfm", 0, NULL, -1}, - {"mapdgm", 0, NULL, -1}, - {"mapdhm", 0, NULL, -1}, - {"mapdim", 0, NULL, -1}, - {"mapdjm", 0, NULL, -1}, - {"mapdkm", 0, NULL, -1}, - {"mapdlm", 0, NULL, -1}, - {"mapdmm", 0, NULL, -1}, - {"mapdnm", 0, NULL, -1}, - {"mapdom", 0, NULL, -1}, - {"mapdpm", 0, NULL, -1}, - {"mapdqm", 0, NULL, -1}, - {"mapdrm", 0, NULL, -1}, - {"mapdsm", 0, NULL, -1}, - {"mapdtm", 0, NULL, -1}, - {"mapdum", 0, NULL, -1}, - {"mapdvm", 0, NULL, -1}, - {"mapdwm", 0, NULL, -1}, - {"mapdxm", 0, NULL, -1}, - {"mapdym", 0, NULL, -1}, - {"mapdzm", 0, NULL, -1}, - {"mape0m", 0, NULL, -1}, - {"mape1m", 0, NULL, -1}, - {"mape2m", 0, NULL, -1}, - {"mape3m", 0, NULL, -1}, - {"mape4m", 0, NULL, -1}, - {"mape5m", 0, NULL, -1}, - {"mape6m", 0, NULL, -1}, - {"mape7m", 0, NULL, -1}, - {"mape8m", 0, NULL, -1}, - {"mape9m", 0, NULL, -1}, - {"mapeam", 0, NULL, -1}, - {"mapebm", 0, NULL, -1}, - {"mapecm", 0, NULL, -1}, - {"mapedm", 0, NULL, -1}, - {"mapeem", 0, NULL, -1}, - {"mapefm", 0, NULL, -1}, - {"mapegm", 0, NULL, -1}, - {"mapehm", 0, NULL, -1}, - {"mapeim", 0, NULL, -1}, - {"mapejm", 0, NULL, -1}, - {"mapekm", 0, NULL, -1}, - {"mapelm", 0, NULL, -1}, - {"mapemm", 0, NULL, -1}, - {"mapenm", 0, NULL, -1}, - {"mapeom", 0, NULL, -1}, - {"mapepm", 0, NULL, -1}, - {"mapeqm", 0, NULL, -1}, - {"maperm", 0, NULL, -1}, - {"mapesm", 0, NULL, -1}, - {"mapetm", 0, NULL, -1}, - {"mapeum", 0, NULL, -1}, - {"mapevm", 0, NULL, -1}, - {"mapewm", 0, NULL, -1}, - {"mapexm", 0, NULL, -1}, - {"mapeym", 0, NULL, -1}, - {"mapezm", 0, NULL, -1}, - {"mapf0m", 0, NULL, -1}, - {"mapf1m", 0, NULL, -1}, - {"mapf2m", 0, NULL, -1}, - {"mapf3m", 0, NULL, -1}, - {"mapf4m", 0, NULL, -1}, - {"mapf5m", 0, NULL, -1}, - {"mapf6m", 0, NULL, -1}, - {"mapf7m", 0, NULL, -1}, - {"mapf8m", 0, NULL, -1}, - {"mapf9m", 0, NULL, -1}, - {"mapfam", 0, NULL, -1}, - {"mapfbm", 0, NULL, -1}, - {"mapfcm", 0, NULL, -1}, - {"mapfdm", 0, NULL, -1}, - {"mapfem", 0, NULL, -1}, - {"mapffm", 0, NULL, -1}, - {"mapfgm", 0, NULL, -1}, - {"mapfhm", 0, NULL, -1}, - {"mapfim", 0, NULL, -1}, - {"mapfjm", 0, NULL, -1}, - {"mapfkm", 0, NULL, -1}, - {"mapflm", 0, NULL, -1}, - {"mapfmm", 0, NULL, -1}, - {"mapfnm", 0, NULL, -1}, - {"mapfom", 0, NULL, -1}, - {"mapfpm", 0, NULL, -1}, - {"mapfqm", 0, NULL, -1}, - {"mapfrm", 0, NULL, -1}, - {"mapfsm", 0, NULL, -1}, - {"mapftm", 0, NULL, -1}, - {"mapfum", 0, NULL, -1}, - {"mapfvm", 0, NULL, -1}, - {"mapfwm", 0, NULL, -1}, - {"mapfxm", 0, NULL, -1}, - {"mapfym", 0, NULL, -1}, - {"mapfzm", 0, NULL, -1}, - {"mapg0m", 0, NULL, -1}, - {"mapg1m", 0, NULL, -1}, - {"mapg2m", 0, NULL, -1}, - {"mapg3m", 0, NULL, -1}, - {"mapg4m", 0, NULL, -1}, - {"mapg5m", 0, NULL, -1}, - {"mapg6m", 0, NULL, -1}, - {"mapg7m", 0, NULL, -1}, - {"mapg8m", 0, NULL, -1}, - {"mapg9m", 0, NULL, -1}, - {"mapgam", 0, NULL, -1}, - {"mapgbm", 0, NULL, -1}, - {"mapgcm", 0, NULL, -1}, - {"mapgdm", 0, NULL, -1}, - {"mapgem", 0, NULL, -1}, - {"mapgfm", 0, NULL, -1}, - {"mapggm", 0, NULL, -1}, - {"mapghm", 0, NULL, -1}, - {"mapgim", 0, NULL, -1}, - {"mapgjm", 0, NULL, -1}, - {"mapgkm", 0, NULL, -1}, - {"mapglm", 0, NULL, -1}, - {"mapgmm", 0, NULL, -1}, - {"mapgnm", 0, NULL, -1}, - {"mapgom", 0, NULL, -1}, - {"mapgpm", 0, NULL, -1}, - {"mapgqm", 0, NULL, -1}, - {"mapgrm", 0, NULL, -1}, - {"mapgsm", 0, NULL, -1}, - {"mapgtm", 0, NULL, -1}, - {"mapgum", 0, NULL, -1}, - {"mapgvm", 0, NULL, -1}, - {"mapgwm", 0, NULL, -1}, - {"mapgxm", 0, NULL, -1}, - {"mapgym", 0, NULL, -1}, - {"mapgzm", 0, NULL, -1}, - {"maph0m", 0, NULL, -1}, - {"maph1m", 0, NULL, -1}, - {"maph2m", 0, NULL, -1}, - {"maph3m", 0, NULL, -1}, - {"maph4m", 0, NULL, -1}, - {"maph5m", 0, NULL, -1}, - {"maph6m", 0, NULL, -1}, - {"maph7m", 0, NULL, -1}, - {"maph8m", 0, NULL, -1}, - {"maph9m", 0, NULL, -1}, - {"mapham", 0, NULL, -1}, - {"maphbm", 0, NULL, -1}, - {"maphcm", 0, NULL, -1}, - {"maphdm", 0, NULL, -1}, - {"maphem", 0, NULL, -1}, - {"maphfm", 0, NULL, -1}, - {"maphgm", 0, NULL, -1}, - {"maphhm", 0, NULL, -1}, - {"maphim", 0, NULL, -1}, - {"maphjm", 0, NULL, -1}, - {"maphkm", 0, NULL, -1}, - {"maphlm", 0, NULL, -1}, - {"maphmm", 0, NULL, -1}, - {"maphnm", 0, NULL, -1}, - {"maphom", 0, NULL, -1}, - {"maphpm", 0, NULL, -1}, - {"maphqm", 0, NULL, -1}, - {"maphrm", 0, NULL, -1}, - {"maphsm", 0, NULL, -1}, - {"maphtm", 0, NULL, -1}, - {"maphum", 0, NULL, -1}, - {"maphvm", 0, NULL, -1}, - {"maphwm", 0, NULL, -1}, - {"maphxm", 0, NULL, -1}, - {"maphym", 0, NULL, -1}, - {"maphzm", 0, NULL, -1}, - {"mapi0m", 0, NULL, -1}, - {"mapi1m", 0, NULL, -1}, - {"mapi2m", 0, NULL, -1}, - {"mapi3m", 0, NULL, -1}, - {"mapi4m", 0, NULL, -1}, - {"mapi5m", 0, NULL, -1}, - {"mapi6m", 0, NULL, -1}, - {"mapi7m", 0, NULL, -1}, - {"mapi8m", 0, NULL, -1}, - {"mapi9m", 0, NULL, -1}, - {"mapiam", 0, NULL, -1}, - {"mapibm", 0, NULL, -1}, - {"mapicm", 0, NULL, -1}, - {"mapidm", 0, NULL, -1}, - {"mapiem", 0, NULL, -1}, - {"mapifm", 0, NULL, -1}, - {"mapigm", 0, NULL, -1}, - {"mapihm", 0, NULL, -1}, - {"mapiim", 0, NULL, -1}, - {"mapijm", 0, NULL, -1}, - {"mapikm", 0, NULL, -1}, - {"mapilm", 0, NULL, -1}, - {"mapimm", 0, NULL, -1}, - {"mapinm", 0, NULL, -1}, - {"mapiom", 0, NULL, -1}, - {"mapipm", 0, NULL, -1}, - {"mapiqm", 0, NULL, -1}, - {"mapirm", 0, NULL, -1}, - {"mapism", 0, NULL, -1}, - {"mapitm", 0, NULL, -1}, - {"mapium", 0, NULL, -1}, - {"mapivm", 0, NULL, -1}, - {"mapiwm", 0, NULL, -1}, - {"mapixm", 0, NULL, -1}, - {"mapiym", 0, NULL, -1}, - {"mapizm", 0, NULL, -1}, - {"mapj0m", 0, NULL, -1}, - {"mapj1m", 0, NULL, -1}, - {"mapj2m", 0, NULL, -1}, - {"mapj3m", 0, NULL, -1}, - {"mapj4m", 0, NULL, -1}, - {"mapj5m", 0, NULL, -1}, - {"mapj6m", 0, NULL, -1}, - {"mapj7m", 0, NULL, -1}, - {"mapj8m", 0, NULL, -1}, - {"mapj9m", 0, NULL, -1}, - {"mapjam", 0, NULL, -1}, - {"mapjbm", 0, NULL, -1}, - {"mapjcm", 0, NULL, -1}, - {"mapjdm", 0, NULL, -1}, - {"mapjem", 0, NULL, -1}, - {"mapjfm", 0, NULL, -1}, - {"mapjgm", 0, NULL, -1}, - {"mapjhm", 0, NULL, -1}, - {"mapjim", 0, NULL, -1}, - {"mapjjm", 0, NULL, -1}, - {"mapjkm", 0, NULL, -1}, - {"mapjlm", 0, NULL, -1}, - {"mapjmm", 0, NULL, -1}, - {"mapjnm", 0, NULL, -1}, - {"mapjom", 0, NULL, -1}, - {"mapjpm", 0, NULL, -1}, - {"mapjqm", 0, NULL, -1}, - {"mapjrm", 0, NULL, -1}, - {"mapjsm", 0, NULL, -1}, - {"mapjtm", 0, NULL, -1}, - {"mapjum", 0, NULL, -1}, - {"mapjvm", 0, NULL, -1}, - {"mapjwm", 0, NULL, -1}, - {"mapjxm", 0, NULL, -1}, - {"mapjym", 0, NULL, -1}, - {"mapjzm", 0, NULL, -1}, - {"mapk0m", 0, NULL, -1}, - {"mapk1m", 0, NULL, -1}, - {"mapk2m", 0, NULL, -1}, - {"mapk3m", 0, NULL, -1}, - {"mapk4m", 0, NULL, -1}, - {"mapk5m", 0, NULL, -1}, - {"mapk6m", 0, NULL, -1}, - {"mapk7m", 0, NULL, -1}, - {"mapk8m", 0, NULL, -1}, - {"mapk9m", 0, NULL, -1}, - {"mapkam", 0, NULL, -1}, - {"mapkbm", 0, NULL, -1}, - {"mapkcm", 0, NULL, -1}, - {"mapkdm", 0, NULL, -1}, - {"mapkem", 0, NULL, -1}, - {"mapkfm", 0, NULL, -1}, - {"mapkgm", 0, NULL, -1}, - {"mapkhm", 0, NULL, -1}, - {"mapkim", 0, NULL, -1}, - {"mapkjm", 0, NULL, -1}, - {"mapkkm", 0, NULL, -1}, - {"mapklm", 0, NULL, -1}, - {"mapkmm", 0, NULL, -1}, - {"mapknm", 0, NULL, -1}, - {"mapkom", 0, NULL, -1}, - {"mapkpm", 0, NULL, -1}, - {"mapkqm", 0, NULL, -1}, - {"mapkrm", 0, NULL, -1}, - {"mapksm", 0, NULL, -1}, - {"mapktm", 0, NULL, -1}, - {"mapkum", 0, NULL, -1}, - {"mapkvm", 0, NULL, -1}, - {"mapkwm", 0, NULL, -1}, - {"mapkxm", 0, NULL, -1}, - {"mapkym", 0, NULL, -1}, - {"mapkzm", 0, NULL, -1}, - {"mapl0m", 0, NULL, -1}, - {"mapl1m", 0, NULL, -1}, - {"mapl2m", 0, NULL, -1}, - {"mapl3m", 0, NULL, -1}, - {"mapl4m", 0, NULL, -1}, - {"mapl5m", 0, NULL, -1}, - {"mapl6m", 0, NULL, -1}, - {"mapl7m", 0, NULL, -1}, - {"mapl8m", 0, NULL, -1}, - {"mapl9m", 0, NULL, -1}, - {"maplam", 0, NULL, -1}, - {"maplbm", 0, NULL, -1}, - {"maplcm", 0, NULL, -1}, - {"mapldm", 0, NULL, -1}, - {"maplem", 0, NULL, -1}, - {"maplfm", 0, NULL, -1}, - {"maplgm", 0, NULL, -1}, - {"maplhm", 0, NULL, -1}, - {"maplim", 0, NULL, -1}, - {"mapljm", 0, NULL, -1}, - {"maplkm", 0, NULL, -1}, - {"mapllm", 0, NULL, -1}, - {"maplmm", 0, NULL, -1}, - {"maplnm", 0, NULL, -1}, - {"maplom", 0, NULL, -1}, - {"maplpm", 0, NULL, -1}, - {"maplqm", 0, NULL, -1}, - {"maplrm", 0, NULL, -1}, - {"maplsm", 0, NULL, -1}, - {"mapltm", 0, NULL, -1}, - {"maplum", 0, NULL, -1}, - {"maplvm", 0, NULL, -1}, - {"maplwm", 0, NULL, -1}, - {"maplxm", 0, NULL, -1}, - {"maplym", 0, NULL, -1}, - {"maplzm", 0, NULL, -1}, - {"mapm0m", 0, NULL, -1}, - {"mapm1m", 0, NULL, -1}, - {"mapm2m", 0, NULL, -1}, - {"mapm3m", 0, NULL, -1}, - {"mapm4m", 0, NULL, -1}, - {"mapm5m", 0, NULL, -1}, - {"mapm6m", 0, NULL, -1}, - {"mapm7m", 0, NULL, -1}, - {"mapm8m", 0, NULL, -1}, - {"mapm9m", 0, NULL, -1}, - {"mapmam", 0, NULL, -1}, - {"mapmbm", 0, NULL, -1}, - {"mapmcm", 0, NULL, -1}, - {"mapmdm", 0, NULL, -1}, - {"mapmem", 0, NULL, -1}, - {"mapmfm", 0, NULL, -1}, - {"mapmgm", 0, NULL, -1}, - {"mapmhm", 0, NULL, -1}, - {"mapmim", 0, NULL, -1}, - {"mapmjm", 0, NULL, -1}, - {"mapmkm", 0, NULL, -1}, - {"mapmlm", 0, NULL, -1}, - {"mapmmm", 0, NULL, -1}, - {"mapmnm", 0, NULL, -1}, - {"mapmom", 0, NULL, -1}, - {"mapmpm", 0, NULL, -1}, - {"mapmqm", 0, NULL, -1}, - {"mapmrm", 0, NULL, -1}, - {"mapmsm", 0, NULL, -1}, - {"mapmtm", 0, NULL, -1}, - {"mapmum", 0, NULL, -1}, - {"mapmvm", 0, NULL, -1}, - {"mapmwm", 0, NULL, -1}, - {"mapmxm", 0, NULL, -1}, - {"mapmym", 0, NULL, -1}, - {"mapmzm", 0, NULL, -1}, - {"mapn0m", 0, NULL, -1}, - {"mapn1m", 0, NULL, -1}, - {"mapn2m", 0, NULL, -1}, - {"mapn3m", 0, NULL, -1}, - {"mapn4m", 0, NULL, -1}, - {"mapn5m", 0, NULL, -1}, - {"mapn6m", 0, NULL, -1}, - {"mapn7m", 0, NULL, -1}, - {"mapn8m", 0, NULL, -1}, - {"mapn9m", 0, NULL, -1}, - {"mapnam", 0, NULL, -1}, - {"mapnbm", 0, NULL, -1}, - {"mapncm", 0, NULL, -1}, - {"mapndm", 0, NULL, -1}, - {"mapnem", 0, NULL, -1}, - {"mapnfm", 0, NULL, -1}, - {"mapngm", 0, NULL, -1}, - {"mapnhm", 0, NULL, -1}, - {"mapnim", 0, NULL, -1}, - {"mapnjm", 0, NULL, -1}, - {"mapnkm", 0, NULL, -1}, - {"mapnlm", 0, NULL, -1}, - {"mapnmm", 0, NULL, -1}, - {"mapnnm", 0, NULL, -1}, - {"mapnom", 0, NULL, -1}, - {"mapnpm", 0, NULL, -1}, - {"mapnqm", 0, NULL, -1}, - {"mapnrm", 0, NULL, -1}, - {"mapnsm", 0, NULL, -1}, - {"mapntm", 0, NULL, -1}, - {"mapnum", 0, NULL, -1}, - {"mapnvm", 0, NULL, -1}, - {"mapnwm", 0, NULL, -1}, - {"mapnxm", 0, NULL, -1}, - {"mapnym", 0, NULL, -1}, - {"mapnzm", 0, NULL, -1}, - {"mapo0m", 0, NULL, -1}, - {"mapo1m", 0, NULL, -1}, - {"mapo2m", 0, NULL, -1}, - {"mapo3m", 0, NULL, -1}, - {"mapo4m", 0, NULL, -1}, - {"mapo5m", 0, NULL, -1}, - {"mapo6m", 0, NULL, -1}, - {"mapo7m", 0, NULL, -1}, - {"mapo8m", 0, NULL, -1}, - {"mapo9m", 0, NULL, -1}, - {"mapoam", 0, NULL, -1}, - {"mapobm", 0, NULL, -1}, - {"mapocm", 0, NULL, -1}, - {"mapodm", 0, NULL, -1}, - {"mapoem", 0, NULL, -1}, - {"mapofm", 0, NULL, -1}, - {"mapogm", 0, NULL, -1}, - {"mapohm", 0, NULL, -1}, - {"mapoim", 0, NULL, -1}, - {"mapojm", 0, NULL, -1}, - {"mapokm", 0, NULL, -1}, - {"mapolm", 0, NULL, -1}, - {"mapomm", 0, NULL, -1}, - {"maponm", 0, NULL, -1}, - {"mapoom", 0, NULL, -1}, - {"mapopm", 0, NULL, -1}, - {"mapoqm", 0, NULL, -1}, - {"maporm", 0, NULL, -1}, - {"maposm", 0, NULL, -1}, - {"mapotm", 0, NULL, -1}, - {"mapoum", 0, NULL, -1}, - {"mapovm", 0, NULL, -1}, - {"mapowm", 0, NULL, -1}, - {"mapoxm", 0, NULL, -1}, - {"mapoym", 0, NULL, -1}, - {"mapozm", 0, NULL, -1}, - {"mapp0m", 0, NULL, -1}, - {"mapp1m", 0, NULL, -1}, - {"mapp2m", 0, NULL, -1}, - {"mapp3m", 0, NULL, -1}, - {"mapp4m", 0, NULL, -1}, - {"mapp5m", 0, NULL, -1}, - {"mapp6m", 0, NULL, -1}, - {"mapp7m", 0, NULL, -1}, - {"mapp8m", 0, NULL, -1}, - {"mapp9m", 0, NULL, -1}, - {"mappam", 0, NULL, -1}, - {"mappbm", 0, NULL, -1}, - {"mappcm", 0, NULL, -1}, - {"mappdm", 0, NULL, -1}, - {"mappem", 0, NULL, -1}, - {"mappfm", 0, NULL, -1}, - {"mappgm", 0, NULL, -1}, - {"mapphm", 0, NULL, -1}, - {"mappim", 0, NULL, -1}, - {"mappjm", 0, NULL, -1}, - {"mappkm", 0, NULL, -1}, - {"mapplm", 0, NULL, -1}, - {"mappmm", 0, NULL, -1}, - {"mappnm", 0, NULL, -1}, - {"mappom", 0, NULL, -1}, - {"mapppm", 0, NULL, -1}, - {"mappqm", 0, NULL, -1}, - {"mapprm", 0, NULL, -1}, - {"mappsm", 0, NULL, -1}, - {"mapptm", 0, NULL, -1}, - {"mappum", 0, NULL, -1}, - {"mappvm", 0, NULL, -1}, - {"mappwm", 0, NULL, -1}, - {"mappxm", 0, NULL, -1}, - {"mappym", 0, NULL, -1}, - {"mappzm", 0, NULL, -1}, - {"mapq0m", 0, NULL, -1}, - {"mapq1m", 0, NULL, -1}, - {"mapq2m", 0, NULL, -1}, - {"mapq3m", 0, NULL, -1}, - {"mapq4m", 0, NULL, -1}, - {"mapq5m", 0, NULL, -1}, - {"mapq6m", 0, NULL, -1}, - {"mapq7m", 0, NULL, -1}, - {"mapq8m", 0, NULL, -1}, - {"mapq9m", 0, NULL, -1}, - {"mapqam", 0, NULL, -1}, - {"mapqbm", 0, NULL, -1}, - {"mapqcm", 0, NULL, -1}, - {"mapqdm", 0, NULL, -1}, - {"mapqem", 0, NULL, -1}, - {"mapqfm", 0, NULL, -1}, - {"mapqgm", 0, NULL, -1}, - {"mapqhm", 0, NULL, -1}, - {"mapqim", 0, NULL, -1}, - {"mapqjm", 0, NULL, -1}, - {"mapqkm", 0, NULL, -1}, - {"mapqlm", 0, NULL, -1}, - {"mapqmm", 0, NULL, -1}, - {"mapqnm", 0, NULL, -1}, - {"mapqom", 0, NULL, -1}, - {"mapqpm", 0, NULL, -1}, - {"mapqqm", 0, NULL, -1}, - {"mapqrm", 0, NULL, -1}, - {"mapqsm", 0, NULL, -1}, - {"mapqtm", 0, NULL, -1}, - {"mapqum", 0, NULL, -1}, - {"mapqvm", 0, NULL, -1}, - {"mapqwm", 0, NULL, -1}, - {"mapqxm", 0, NULL, -1}, - {"mapqym", 0, NULL, -1}, - {"mapqzm", 0, NULL, -1}, - {"mapr0m", 0, NULL, -1}, - {"mapr1m", 0, NULL, -1}, - {"mapr2m", 0, NULL, -1}, - {"mapr3m", 0, NULL, -1}, - {"mapr4m", 0, NULL, -1}, - {"mapr5m", 0, NULL, -1}, - {"mapr6m", 0, NULL, -1}, - {"mapr7m", 0, NULL, -1}, - {"mapr8m", 0, NULL, -1}, - {"mapr9m", 0, NULL, -1}, - {"mapram", 0, NULL, -1}, - {"maprbm", 0, NULL, -1}, - {"maprcm", 0, NULL, -1}, - {"maprdm", 0, NULL, -1}, - {"maprem", 0, NULL, -1}, - {"maprfm", 0, NULL, -1}, - {"maprgm", 0, NULL, -1}, - {"maprhm", 0, NULL, -1}, - {"maprim", 0, NULL, -1}, - {"maprjm", 0, NULL, -1}, - {"maprkm", 0, NULL, -1}, - {"maprlm", 0, NULL, -1}, - {"maprmm", 0, NULL, -1}, - {"maprnm", 0, NULL, -1}, - {"maprom", 0, NULL, -1}, - {"maprpm", 0, NULL, -1}, - {"maprqm", 0, NULL, -1}, - {"maprrm", 0, NULL, -1}, - {"maprsm", 0, NULL, -1}, - {"maprtm", 0, NULL, -1}, - {"maprum", 0, NULL, -1}, - {"maprvm", 0, NULL, -1}, - {"maprwm", 0, NULL, -1}, - {"maprxm", 0, NULL, -1}, - {"maprym", 0, NULL, -1}, - {"maprzm", 0, NULL, -1}, - {"maps0m", 0, NULL, -1}, - {"maps1m", 0, NULL, -1}, - {"maps2m", 0, NULL, -1}, - {"maps3m", 0, NULL, -1}, - {"maps4m", 0, NULL, -1}, - {"maps5m", 0, NULL, -1}, - {"maps6m", 0, NULL, -1}, - {"maps7m", 0, NULL, -1}, - {"maps8m", 0, NULL, -1}, - {"maps9m", 0, NULL, -1}, - {"mapsam", 0, NULL, -1}, - {"mapsbm", 0, NULL, -1}, - {"mapscm", 0, NULL, -1}, - {"mapsdm", 0, NULL, -1}, - {"mapsem", 0, NULL, -1}, - {"mapsfm", 0, NULL, -1}, - {"mapsgm", 0, NULL, -1}, - {"mapshm", 0, NULL, -1}, - {"mapsim", 0, NULL, -1}, - {"mapsjm", 0, NULL, -1}, - {"mapskm", 0, NULL, -1}, - {"mapslm", 0, NULL, -1}, - {"mapsmm", 0, NULL, -1}, - {"mapsnm", 0, NULL, -1}, - {"mapsom", 0, NULL, -1}, - {"mapspm", 0, NULL, -1}, - {"mapsqm", 0, NULL, -1}, - {"mapsrm", 0, NULL, -1}, - {"mapssm", 0, NULL, -1}, - {"mapstm", 0, NULL, -1}, - {"mapsum", 0, NULL, -1}, - {"mapsvm", 0, NULL, -1}, - {"mapswm", 0, NULL, -1}, - {"mapsxm", 0, NULL, -1}, - {"mapsym", 0, NULL, -1}, - {"mapszm", 0, NULL, -1}, - {"mapt0m", 0, NULL, -1}, - {"mapt1m", 0, NULL, -1}, - {"mapt2m", 0, NULL, -1}, - {"mapt3m", 0, NULL, -1}, - {"mapt4m", 0, NULL, -1}, - {"mapt5m", 0, NULL, -1}, - {"mapt6m", 0, NULL, -1}, - {"mapt7m", 0, NULL, -1}, - {"mapt8m", 0, NULL, -1}, - {"mapt9m", 0, NULL, -1}, - {"maptam", 0, NULL, -1}, - {"maptbm", 0, NULL, -1}, - {"maptcm", 0, NULL, -1}, - {"maptdm", 0, NULL, -1}, - {"maptem", 0, NULL, -1}, - {"maptfm", 0, NULL, -1}, - {"maptgm", 0, NULL, -1}, - {"mapthm", 0, NULL, -1}, - {"maptim", 0, NULL, -1}, - {"maptjm", 0, NULL, -1}, - {"maptkm", 0, NULL, -1}, - {"maptlm", 0, NULL, -1}, - {"maptmm", 0, NULL, -1}, - {"maptnm", 0, NULL, -1}, - {"maptom", 0, NULL, -1}, - {"maptpm", 0, NULL, -1}, - {"maptqm", 0, NULL, -1}, - {"maptrm", 0, NULL, -1}, - {"maptsm", 0, NULL, -1}, - {"mapttm", 0, NULL, -1}, - {"maptum", 0, NULL, -1}, - {"maptvm", 0, NULL, -1}, - {"maptwm", 0, NULL, -1}, - {"maptxm", 0, NULL, -1}, - {"maptym", 0, NULL, -1}, - {"maptzm", 0, NULL, -1}, - {"mapu0m", 0, NULL, -1}, - {"mapu1m", 0, NULL, -1}, - {"mapu2m", 0, NULL, -1}, - {"mapu3m", 0, NULL, -1}, - {"mapu4m", 0, NULL, -1}, - {"mapu5m", 0, NULL, -1}, - {"mapu6m", 0, NULL, -1}, - {"mapu7m", 0, NULL, -1}, - {"mapu8m", 0, NULL, -1}, - {"mapu9m", 0, NULL, -1}, - {"mapuam", 0, NULL, -1}, - {"mapubm", 0, NULL, -1}, - {"mapucm", 0, NULL, -1}, - {"mapudm", 0, NULL, -1}, - {"mapuem", 0, NULL, -1}, - {"mapufm", 0, NULL, -1}, - {"mapugm", 0, NULL, -1}, - {"mapuhm", 0, NULL, -1}, - {"mapuim", 0, NULL, -1}, - {"mapujm", 0, NULL, -1}, - {"mapukm", 0, NULL, -1}, - {"mapulm", 0, NULL, -1}, - {"mapumm", 0, NULL, -1}, - {"mapunm", 0, NULL, -1}, - {"mapuom", 0, NULL, -1}, - {"mapupm", 0, NULL, -1}, - {"mapuqm", 0, NULL, -1}, - {"mapurm", 0, NULL, -1}, - {"mapusm", 0, NULL, -1}, - {"maputm", 0, NULL, -1}, - {"mapuum", 0, NULL, -1}, - {"mapuvm", 0, NULL, -1}, - {"mapuwm", 0, NULL, -1}, - {"mapuxm", 0, NULL, -1}, - {"mapuym", 0, NULL, -1}, - {"mapuzm", 0, NULL, -1}, - {"mapv0m", 0, NULL, -1}, - {"mapv1m", 0, NULL, -1}, - {"mapv2m", 0, NULL, -1}, - {"mapv3m", 0, NULL, -1}, - {"mapv4m", 0, NULL, -1}, - {"mapv5m", 0, NULL, -1}, - {"mapv6m", 0, NULL, -1}, - {"mapv7m", 0, NULL, -1}, - {"mapv8m", 0, NULL, -1}, - {"mapv9m", 0, NULL, -1}, - {"mapvam", 0, NULL, -1}, - {"mapvbm", 0, NULL, -1}, - {"mapvcm", 0, NULL, -1}, - {"mapvdm", 0, NULL, -1}, - {"mapvem", 0, NULL, -1}, - {"mapvfm", 0, NULL, -1}, - {"mapvgm", 0, NULL, -1}, - {"mapvhm", 0, NULL, -1}, - {"mapvim", 0, NULL, -1}, - {"mapvjm", 0, NULL, -1}, - {"mapvkm", 0, NULL, -1}, - {"mapvlm", 0, NULL, -1}, - {"mapvmm", 0, NULL, -1}, - {"mapvnm", 0, NULL, -1}, - {"mapvom", 0, NULL, -1}, - {"mapvpm", 0, NULL, -1}, - {"mapvqm", 0, NULL, -1}, - {"mapvrm", 0, NULL, -1}, - {"mapvsm", 0, NULL, -1}, - {"mapvtm", 0, NULL, -1}, - {"mapvum", 0, NULL, -1}, - {"mapvvm", 0, NULL, -1}, - {"mapvwm", 0, NULL, -1}, - {"mapvxm", 0, NULL, -1}, - {"mapvym", 0, NULL, -1}, - {"mapvzm", 0, NULL, -1}, - {"mapw0m", 0, NULL, -1}, - {"mapw1m", 0, NULL, -1}, - {"mapw2m", 0, NULL, -1}, - {"mapw3m", 0, NULL, -1}, - {"mapw4m", 0, NULL, -1}, - {"mapw5m", 0, NULL, -1}, - {"mapw6m", 0, NULL, -1}, - {"mapw7m", 0, NULL, -1}, - {"mapw8m", 0, NULL, -1}, - {"mapw9m", 0, NULL, -1}, - {"mapwam", 0, NULL, -1}, - {"mapwbm", 0, NULL, -1}, - {"mapwcm", 0, NULL, -1}, - {"mapwdm", 0, NULL, -1}, - {"mapwem", 0, NULL, -1}, - {"mapwfm", 0, NULL, -1}, - {"mapwgm", 0, NULL, -1}, - {"mapwhm", 0, NULL, -1}, - {"mapwim", 0, NULL, -1}, - {"mapwjm", 0, NULL, -1}, - {"mapwkm", 0, NULL, -1}, - {"mapwlm", 0, NULL, -1}, - {"mapwmm", 0, NULL, -1}, - {"mapwnm", 0, NULL, -1}, - {"mapwom", 0, NULL, -1}, - {"mapwpm", 0, NULL, -1}, - {"mapwqm", 0, NULL, -1}, - {"mapwrm", 0, NULL, -1}, - {"mapwsm", 0, NULL, -1}, - {"mapwtm", 0, NULL, -1}, - {"mapwum", 0, NULL, -1}, - {"mapwvm", 0, NULL, -1}, - {"mapwwm", 0, NULL, -1}, - {"mapwxm", 0, NULL, -1}, - {"mapwym", 0, NULL, -1}, - {"mapwzm", 0, NULL, -1}, - {"mapx0m", 0, NULL, -1}, - {"mapx1m", 0, NULL, -1}, - {"mapx2m", 0, NULL, -1}, - {"mapx3m", 0, NULL, -1}, - {"mapx4m", 0, NULL, -1}, - {"mapx5m", 0, NULL, -1}, - {"mapx6m", 0, NULL, -1}, - {"mapx7m", 0, NULL, -1}, - {"mapx8m", 0, NULL, -1}, - {"mapx9m", 0, NULL, -1}, - {"mapxam", 0, NULL, -1}, - {"mapxbm", 0, NULL, -1}, - {"mapxcm", 0, NULL, -1}, - {"mapxdm", 0, NULL, -1}, - {"mapxem", 0, NULL, -1}, - {"mapxfm", 0, NULL, -1}, - {"mapxgm", 0, NULL, -1}, - {"mapxhm", 0, NULL, -1}, - {"mapxim", 0, NULL, -1}, - {"mapxjm", 0, NULL, -1}, - {"mapxkm", 0, NULL, -1}, - {"mapxlm", 0, NULL, -1}, - {"mapxmm", 0, NULL, -1}, - {"mapxnm", 0, NULL, -1}, - {"mapxom", 0, NULL, -1}, - {"mapxpm", 0, NULL, -1}, - {"mapxqm", 0, NULL, -1}, - {"mapxrm", 0, NULL, -1}, - {"mapxsm", 0, NULL, -1}, - {"mapxtm", 0, NULL, -1}, - {"mapxum", 0, NULL, -1}, - {"mapxvm", 0, NULL, -1}, - {"mapxwm", 0, NULL, -1}, - {"mapxxm", 0, NULL, -1}, - {"mapxym", 0, NULL, -1}, - {"mapxzm", 0, NULL, -1}, - {"mapy0m", 0, NULL, -1}, - {"mapy1m", 0, NULL, -1}, - {"mapy2m", 0, NULL, -1}, - {"mapy3m", 0, NULL, -1}, - {"mapy4m", 0, NULL, -1}, - {"mapy5m", 0, NULL, -1}, - {"mapy6m", 0, NULL, -1}, - {"mapy7m", 0, NULL, -1}, - {"mapy8m", 0, NULL, -1}, - {"mapy9m", 0, NULL, -1}, - {"mapyam", 0, NULL, -1}, - {"mapybm", 0, NULL, -1}, - {"mapycm", 0, NULL, -1}, - {"mapydm", 0, NULL, -1}, - {"mapyem", 0, NULL, -1}, - {"mapyfm", 0, NULL, -1}, - {"mapygm", 0, NULL, -1}, - {"mapyhm", 0, NULL, -1}, - {"mapyim", 0, NULL, -1}, - {"mapyjm", 0, NULL, -1}, - {"mapykm", 0, NULL, -1}, - {"mapylm", 0, NULL, -1}, - {"mapymm", 0, NULL, -1}, - {"mapynm", 0, NULL, -1}, - {"mapyom", 0, NULL, -1}, - {"mapypm", 0, NULL, -1}, - {"mapyqm", 0, NULL, -1}, - {"mapyrm", 0, NULL, -1}, - {"mapysm", 0, NULL, -1}, - {"mapytm", 0, NULL, -1}, - {"mapyum", 0, NULL, -1}, - {"mapyvm", 0, NULL, -1}, - {"mapywm", 0, NULL, -1}, - {"mapyxm", 0, NULL, -1}, - {"mapyym", 0, NULL, -1}, - {"mapyzm", 0, NULL, -1}, - {"mapz0m", 0, NULL, -1}, - {"mapz1m", 0, NULL, -1}, - {"mapz2m", 0, NULL, -1}, - {"mapz3m", 0, NULL, -1}, - {"mapz4m", 0, NULL, -1}, - {"mapz5m", 0, NULL, -1}, - {"mapz6m", 0, NULL, -1}, - {"mapz7m", 0, NULL, -1}, - {"mapz8m", 0, NULL, -1}, - {"mapz9m", 0, NULL, -1}, - {"mapzam", 0, NULL, -1}, - {"mapzbm", 0, NULL, -1}, - {"mapzcm", 0, NULL, -1}, - {"mapzdm", 0, NULL, -1}, - {"mapzem", 0, NULL, -1}, - {"mapzfm", 0, NULL, -1}, - {"mapzgm", 0, NULL, -1}, - {"mapzhm", 0, NULL, -1}, - {"mapzim", 0, NULL, -1}, - {"mapzjm", 0, NULL, -1}, - {"mapzkm", 0, NULL, -1}, - {"mapzlm", 0, NULL, -1}, - {"mapzmm", 0, NULL, -1}, - {"mapznm", 0, NULL, -1}, - {"mapzom", 0, NULL, -1}, - {"mapzpm", 0, NULL, -1}, - {"mapzqm", 0, NULL, -1}, - {"mapzrm", 0, NULL, -1}, - {"mapzsm", 0, NULL, -1}, - {"mapztm", 0, NULL, -1}, - {"mapzum", 0, NULL, -1}, - {"mapzvm", 0, NULL, -1}, - {"mapzwm", 0, NULL, -1}, - {"mapzxm", 0, NULL, -1}, - {"mapzym", 0, NULL, -1}, - {"mapzzm", 0, NULL, -1}, - - {"titles", 0, NULL, -1}, // Title screen - {"read_m", 0, NULL, -1}, // Intro - {"lclear", 0, NULL, -1}, // Level clear - {"invinc", 0, NULL, -1}, // Invincibility - {"shoes", 0, NULL, -1}, // Super sneakers - {"minvnc", 0, NULL, -1}, // Mario invincibility - {"drown", 0, NULL, -1}, // Drowning - {"gmover", 0, NULL, -1}, // Game over - {"xtlife", 0, NULL, -1}, // Extra life - {"contsc", 0, NULL, -1}, // Continue screen - {"supers", 0, NULL, -1}, // Super Sonic - {"chrsel", 0, NULL, -1}, // Character select - {"credit", 0, NULL, -1}, // Credits - {"racent", 0, NULL, -1}, // Race Results - {"stjr", 0, NULL, -1}, // Sonic Team Jr. Presents -}; - - // // Information about all the sfx // diff --git a/src/sounds.h b/src/sounds.h index c5851a346..4388d02cf 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -86,1095 +86,9 @@ struct sfxinfo_struct lumpnum_t lumpnum; }; -// -// MusicInfo struct. -// -typedef struct -{ - // up to 6-character name - const char *name; - - // lump number of music - lumpnum_t lumpnum; - - // music data - void *data; - - // music handle once registered - INT32 handle; -} musicinfo_t; - // the complete set of sound effects extern sfxinfo_t S_sfx[]; -// the complete set of music -extern musicinfo_t S_music[]; - -// -// Identifiers for all music in game. -// - -// Music list (don't edit this comment!) -typedef enum -{ - mus_None, - mus_map01m, - mus_map02m, - mus_map03m, - mus_map04m, - mus_map05m, - mus_map06m, - mus_map07m, - mus_map08m, - mus_map09m, - mus_map10m, - mus_map11m, - mus_map12m, - mus_map13m, - mus_map14m, - mus_map15m, - mus_map16m, - mus_map17m, - mus_map18m, - mus_map19m, - mus_map20m, - mus_map21m, - mus_map22m, - mus_map23m, - mus_map24m, - mus_map25m, - mus_map26m, - mus_map27m, - mus_map28m, - mus_map29m, - mus_map30m, - mus_map31m, - mus_map32m, - mus_map33m, - mus_map34m, - mus_map35m, - mus_map36m, - mus_map37m, - mus_map38m, - mus_map39m, - mus_map40m, - mus_map41m, - mus_map42m, - mus_map43m, - mus_map44m, - mus_map45m, - mus_map46m, - mus_map47m, - mus_map48m, - mus_map49m, - mus_map50m, - mus_map51m, - mus_map52m, - mus_map53m, - mus_map54m, - mus_map55m, - mus_map56m, - mus_map57m, - mus_map58m, - mus_map59m, - mus_map60m, - mus_map61m, - mus_map62m, - mus_map63m, - mus_map64m, - mus_map65m, - mus_map66m, - mus_map67m, - mus_map68m, - mus_map69m, - mus_map70m, - mus_map71m, - mus_map72m, - mus_map73m, - mus_map74m, - mus_map75m, - mus_map76m, - mus_map77m, - mus_map78m, - mus_map79m, - mus_map80m, - mus_map81m, - mus_map82m, - mus_map83m, - mus_map84m, - mus_map85m, - mus_map86m, - mus_map87m, - mus_map88m, - mus_map89m, - mus_map90m, - mus_map91m, - mus_map92m, - mus_map93m, - mus_map94m, - mus_map95m, - mus_map96m, - mus_map97m, - mus_map98m, - mus_map99m, - mus_mapa0m, - mus_mapa1m, - mus_mapa2m, - mus_mapa3m, - mus_mapa4m, - mus_mapa5m, - mus_mapa6m, - mus_mapa7m, - mus_mapa8m, - mus_mapa9m, - mus_mapaam, - mus_mapabm, - mus_mapacm, - mus_mapadm, - mus_mapaem, - mus_mapafm, - mus_mapagm, - mus_mapahm, - mus_mapaim, - mus_mapajm, - mus_mapakm, - mus_mapalm, - mus_mapamm, - mus_mapanm, - mus_mapaom, - mus_mapapm, - mus_mapaqm, - mus_maparm, - mus_mapasm, - mus_mapatm, - mus_mapaum, - mus_mapavm, - mus_mapawm, - mus_mapaxm, - mus_mapaym, - mus_mapazm, - mus_mapb0m, - mus_mapb1m, - mus_mapb2m, - mus_mapb3m, - mus_mapb4m, - mus_mapb5m, - mus_mapb6m, - mus_mapb7m, - mus_mapb8m, - mus_mapb9m, - mus_mapbam, - mus_mapbbm, - mus_mapbcm, - mus_mapbdm, - mus_mapbem, - mus_mapbfm, - mus_mapbgm, - mus_mapbhm, - mus_mapbim, - mus_mapbjm, - mus_mapbkm, - mus_mapblm, - mus_mapbmm, - mus_mapbnm, - mus_mapbom, - mus_mapbpm, - mus_mapbqm, - mus_mapbrm, - mus_mapbsm, - mus_mapbtm, - mus_mapbum, - mus_mapbvm, - mus_mapbwm, - mus_mapbxm, - mus_mapbym, - mus_mapbzm, - mus_mapc0m, - mus_mapc1m, - mus_mapc2m, - mus_mapc3m, - mus_mapc4m, - mus_mapc5m, - mus_mapc6m, - mus_mapc7m, - mus_mapc8m, - mus_mapc9m, - mus_mapcam, - mus_mapcbm, - mus_mapccm, - mus_mapcdm, - mus_mapcem, - mus_mapcfm, - mus_mapcgm, - mus_mapchm, - mus_mapcim, - mus_mapcjm, - mus_mapckm, - mus_mapclm, - mus_mapcmm, - mus_mapcnm, - mus_mapcom, - mus_mapcpm, - mus_mapcqm, - mus_mapcrm, - mus_mapcsm, - mus_mapctm, - mus_mapcum, - mus_mapcvm, - mus_mapcwm, - mus_mapcxm, - mus_mapcym, - mus_mapczm, - mus_mapd0m, - mus_mapd1m, - mus_mapd2m, - mus_mapd3m, - mus_mapd4m, - mus_mapd5m, - mus_mapd6m, - mus_mapd7m, - mus_mapd8m, - mus_mapd9m, - mus_mapdam, - mus_mapdbm, - mus_mapdcm, - mus_mapddm, - mus_mapdem, - mus_mapdfm, - mus_mapdgm, - mus_mapdhm, - mus_mapdim, - mus_mapdjm, - mus_mapdkm, - mus_mapdlm, - mus_mapdmm, - mus_mapdnm, - mus_mapdom, - mus_mapdpm, - mus_mapdqm, - mus_mapdrm, - mus_mapdsm, - mus_mapdtm, - mus_mapdum, - mus_mapdvm, - mus_mapdwm, - mus_mapdxm, - mus_mapdym, - mus_mapdzm, - mus_mape0m, - mus_mape1m, - mus_mape2m, - mus_mape3m, - mus_mape4m, - mus_mape5m, - mus_mape6m, - mus_mape7m, - mus_mape8m, - mus_mape9m, - mus_mapeam, - mus_mapebm, - mus_mapecm, - mus_mapedm, - mus_mapeem, - mus_mapefm, - mus_mapegm, - mus_mapehm, - mus_mapeim, - mus_mapejm, - mus_mapekm, - mus_mapelm, - mus_mapemm, - mus_mapenm, - mus_mapeom, - mus_mapepm, - mus_mapeqm, - mus_maperm, - mus_mapesm, - mus_mapetm, - mus_mapeum, - mus_mapevm, - mus_mapewm, - mus_mapexm, - mus_mapeym, - mus_mapezm, - mus_mapf0m, - mus_mapf1m, - mus_mapf2m, - mus_mapf3m, - mus_mapf4m, - mus_mapf5m, - mus_mapf6m, - mus_mapf7m, - mus_mapf8m, - mus_mapf9m, - mus_mapfam, - mus_mapfbm, - mus_mapfcm, - mus_mapfdm, - mus_mapfem, - mus_mapffm, - mus_mapfgm, - mus_mapfhm, - mus_mapfim, - mus_mapfjm, - mus_mapfkm, - mus_mapflm, - mus_mapfmm, - mus_mapfnm, - mus_mapfom, - mus_mapfpm, - mus_mapfqm, - mus_mapfrm, - mus_mapfsm, - mus_mapftm, - mus_mapfum, - mus_mapfvm, - mus_mapfwm, - mus_mapfxm, - mus_mapfym, - mus_mapfzm, - mus_mapg0m, - mus_mapg1m, - mus_mapg2m, - mus_mapg3m, - mus_mapg4m, - mus_mapg5m, - mus_mapg6m, - mus_mapg7m, - mus_mapg8m, - mus_mapg9m, - mus_mapgam, - mus_mapgbm, - mus_mapgcm, - mus_mapgdm, - mus_mapgem, - mus_mapgfm, - mus_mapggm, - mus_mapghm, - mus_mapgim, - mus_mapgjm, - mus_mapgkm, - mus_mapglm, - mus_mapgmm, - mus_mapgnm, - mus_mapgom, - mus_mapgpm, - mus_mapgqm, - mus_mapgrm, - mus_mapgsm, - mus_mapgtm, - mus_mapgum, - mus_mapgvm, - mus_mapgwm, - mus_mapgxm, - mus_mapgym, - mus_mapgzm, - mus_maph0m, - mus_maph1m, - mus_maph2m, - mus_maph3m, - mus_maph4m, - mus_maph5m, - mus_maph6m, - mus_maph7m, - mus_maph8m, - mus_maph9m, - mus_mapham, - mus_maphbm, - mus_maphcm, - mus_maphdm, - mus_maphem, - mus_maphfm, - mus_maphgm, - mus_maphhm, - mus_maphim, - mus_maphjm, - mus_maphkm, - mus_maphlm, - mus_maphmm, - mus_maphnm, - mus_maphom, - mus_maphpm, - mus_maphqm, - mus_maphrm, - mus_maphsm, - mus_maphtm, - mus_maphum, - mus_maphvm, - mus_maphwm, - mus_maphxm, - mus_maphym, - mus_maphzm, - mus_mapi0m, - mus_mapi1m, - mus_mapi2m, - mus_mapi3m, - mus_mapi4m, - mus_mapi5m, - mus_mapi6m, - mus_mapi7m, - mus_mapi8m, - mus_mapi9m, - mus_mapiam, - mus_mapibm, - mus_mapicm, - mus_mapidm, - mus_mapiem, - mus_mapifm, - mus_mapigm, - mus_mapihm, - mus_mapiim, - mus_mapijm, - mus_mapikm, - mus_mapilm, - mus_mapimm, - mus_mapinm, - mus_mapiom, - mus_mapipm, - mus_mapiqm, - mus_mapirm, - mus_mapism, - mus_mapitm, - mus_mapium, - mus_mapivm, - mus_mapiwm, - mus_mapixm, - mus_mapiym, - mus_mapizm, - mus_mapj0m, - mus_mapj1m, - mus_mapj2m, - mus_mapj3m, - mus_mapj4m, - mus_mapj5m, - mus_mapj6m, - mus_mapj7m, - mus_mapj8m, - mus_mapj9m, - mus_mapjam, - mus_mapjbm, - mus_mapjcm, - mus_mapjdm, - mus_mapjem, - mus_mapjfm, - mus_mapjgm, - mus_mapjhm, - mus_mapjim, - mus_mapjjm, - mus_mapjkm, - mus_mapjlm, - mus_mapjmm, - mus_mapjnm, - mus_mapjom, - mus_mapjpm, - mus_mapjqm, - mus_mapjrm, - mus_mapjsm, - mus_mapjtm, - mus_mapjum, - mus_mapjvm, - mus_mapjwm, - mus_mapjxm, - mus_mapjym, - mus_mapjzm, - mus_mapk0m, - mus_mapk1m, - mus_mapk2m, - mus_mapk3m, - mus_mapk4m, - mus_mapk5m, - mus_mapk6m, - mus_mapk7m, - mus_mapk8m, - mus_mapk9m, - mus_mapkam, - mus_mapkbm, - mus_mapkcm, - mus_mapkdm, - mus_mapkem, - mus_mapkfm, - mus_mapkgm, - mus_mapkhm, - mus_mapkim, - mus_mapkjm, - mus_mapkkm, - mus_mapklm, - mus_mapkmm, - mus_mapknm, - mus_mapkom, - mus_mapkpm, - mus_mapkqm, - mus_mapkrm, - mus_mapksm, - mus_mapktm, - mus_mapkum, - mus_mapkvm, - mus_mapkwm, - mus_mapkxm, - mus_mapkym, - mus_mapkzm, - mus_mapl0m, - mus_mapl1m, - mus_mapl2m, - mus_mapl3m, - mus_mapl4m, - mus_mapl5m, - mus_mapl6m, - mus_mapl7m, - mus_mapl8m, - mus_mapl9m, - mus_maplam, - mus_maplbm, - mus_maplcm, - mus_mapldm, - mus_maplem, - mus_maplfm, - mus_maplgm, - mus_maplhm, - mus_maplim, - mus_mapljm, - mus_maplkm, - mus_mapllm, - mus_maplmm, - mus_maplnm, - mus_maplom, - mus_maplpm, - mus_maplqm, - mus_maplrm, - mus_maplsm, - mus_mapltm, - mus_maplum, - mus_maplvm, - mus_maplwm, - mus_maplxm, - mus_maplym, - mus_maplzm, - mus_mapm0m, - mus_mapm1m, - mus_mapm2m, - mus_mapm3m, - mus_mapm4m, - mus_mapm5m, - mus_mapm6m, - mus_mapm7m, - mus_mapm8m, - mus_mapm9m, - mus_mapmam, - mus_mapmbm, - mus_mapmcm, - mus_mapmdm, - mus_mapmem, - mus_mapmfm, - mus_mapmgm, - mus_mapmhm, - mus_mapmim, - mus_mapmjm, - mus_mapmkm, - mus_mapmlm, - mus_mapmmm, - mus_mapmnm, - mus_mapmom, - mus_mapmpm, - mus_mapmqm, - mus_mapmrm, - mus_mapmsm, - mus_mapmtm, - mus_mapmum, - mus_mapmvm, - mus_mapmwm, - mus_mapmxm, - mus_mapmym, - mus_mapmzm, - mus_mapn0m, - mus_mapn1m, - mus_mapn2m, - mus_mapn3m, - mus_mapn4m, - mus_mapn5m, - mus_mapn6m, - mus_mapn7m, - mus_mapn8m, - mus_mapn9m, - mus_mapnam, - mus_mapnbm, - mus_mapncm, - mus_mapndm, - mus_mapnem, - mus_mapnfm, - mus_mapngm, - mus_mapnhm, - mus_mapnim, - mus_mapnjm, - mus_mapnkm, - mus_mapnlm, - mus_mapnmm, - mus_mapnnm, - mus_mapnom, - mus_mapnpm, - mus_mapnqm, - mus_mapnrm, - mus_mapnsm, - mus_mapntm, - mus_mapnum, - mus_mapnvm, - mus_mapnwm, - mus_mapnxm, - mus_mapnym, - mus_mapnzm, - mus_mapo0m, - mus_mapo1m, - mus_mapo2m, - mus_mapo3m, - mus_mapo4m, - mus_mapo5m, - mus_mapo6m, - mus_mapo7m, - mus_mapo8m, - mus_mapo9m, - mus_mapoam, - mus_mapobm, - mus_mapocm, - mus_mapodm, - mus_mapoem, - mus_mapofm, - mus_mapogm, - mus_mapohm, - mus_mapoim, - mus_mapojm, - mus_mapokm, - mus_mapolm, - mus_mapomm, - mus_maponm, - mus_mapoom, - mus_mapopm, - mus_mapoqm, - mus_maporm, - mus_maposm, - mus_mapotm, - mus_mapoum, - mus_mapovm, - mus_mapowm, - mus_mapoxm, - mus_mapoym, - mus_mapozm, - mus_mapp0m, - mus_mapp1m, - mus_mapp2m, - mus_mapp3m, - mus_mapp4m, - mus_mapp5m, - mus_mapp6m, - mus_mapp7m, - mus_mapp8m, - mus_mapp9m, - mus_mappam, - mus_mappbm, - mus_mappcm, - mus_mappdm, - mus_mappem, - mus_mappfm, - mus_mappgm, - mus_mapphm, - mus_mappim, - mus_mappjm, - mus_mappkm, - mus_mapplm, - mus_mappmm, - mus_mappnm, - mus_mappom, - mus_mapppm, - mus_mappqm, - mus_mapprm, - mus_mappsm, - mus_mapptm, - mus_mappum, - mus_mappvm, - mus_mappwm, - mus_mappxm, - mus_mappym, - mus_mappzm, - mus_mapq0m, - mus_mapq1m, - mus_mapq2m, - mus_mapq3m, - mus_mapq4m, - mus_mapq5m, - mus_mapq6m, - mus_mapq7m, - mus_mapq8m, - mus_mapq9m, - mus_mapqam, - mus_mapqbm, - mus_mapqcm, - mus_mapqdm, - mus_mapqem, - mus_mapqfm, - mus_mapqgm, - mus_mapqhm, - mus_mapqim, - mus_mapqjm, - mus_mapqkm, - mus_mapqlm, - mus_mapqmm, - mus_mapqnm, - mus_mapqom, - mus_mapqpm, - mus_mapqqm, - mus_mapqrm, - mus_mapqsm, - mus_mapqtm, - mus_mapqum, - mus_mapqvm, - mus_mapqwm, - mus_mapqxm, - mus_mapqym, - mus_mapqzm, - mus_mapr0m, - mus_mapr1m, - mus_mapr2m, - mus_mapr3m, - mus_mapr4m, - mus_mapr5m, - mus_mapr6m, - mus_mapr7m, - mus_mapr8m, - mus_mapr9m, - mus_mapram, - mus_maprbm, - mus_maprcm, - mus_maprdm, - mus_maprem, - mus_maprfm, - mus_maprgm, - mus_maprhm, - mus_maprim, - mus_maprjm, - mus_maprkm, - mus_maprlm, - mus_maprmm, - mus_maprnm, - mus_maprom, - mus_maprpm, - mus_maprqm, - mus_maprrm, - mus_maprsm, - mus_maprtm, - mus_maprum, - mus_maprvm, - mus_maprwm, - mus_maprxm, - mus_maprym, - mus_maprzm, - mus_maps0m, - mus_maps1m, - mus_maps2m, - mus_maps3m, - mus_maps4m, - mus_maps5m, - mus_maps6m, - mus_maps7m, - mus_maps8m, - mus_maps9m, - mus_mapsam, - mus_mapsbm, - mus_mapscm, - mus_mapsdm, - mus_mapsem, - mus_mapsfm, - mus_mapsgm, - mus_mapshm, - mus_mapsim, - mus_mapsjm, - mus_mapskm, - mus_mapslm, - mus_mapsmm, - mus_mapsnm, - mus_mapsom, - mus_mapspm, - mus_mapsqm, - mus_mapsrm, - mus_mapssm, - mus_mapstm, - mus_mapsum, - mus_mapsvm, - mus_mapswm, - mus_mapsxm, - mus_mapsym, - mus_mapszm, - mus_mapt0m, - mus_mapt1m, - mus_mapt2m, - mus_mapt3m, - mus_mapt4m, - mus_mapt5m, - mus_mapt6m, - mus_mapt7m, - mus_mapt8m, - mus_mapt9m, - mus_maptam, - mus_maptbm, - mus_maptcm, - mus_maptdm, - mus_maptem, - mus_maptfm, - mus_maptgm, - mus_mapthm, - mus_maptim, - mus_maptjm, - mus_maptkm, - mus_maptlm, - mus_maptmm, - mus_maptnm, - mus_maptom, - mus_maptpm, - mus_maptqm, - mus_maptrm, - mus_maptsm, - mus_mapttm, - mus_maptum, - mus_maptvm, - mus_maptwm, - mus_maptxm, - mus_maptym, - mus_maptzm, - mus_mapu0m, - mus_mapu1m, - mus_mapu2m, - mus_mapu3m, - mus_mapu4m, - mus_mapu5m, - mus_mapu6m, - mus_mapu7m, - mus_mapu8m, - mus_mapu9m, - mus_mapuam, - mus_mapubm, - mus_mapucm, - mus_mapudm, - mus_mapuem, - mus_mapufm, - mus_mapugm, - mus_mapuhm, - mus_mapuim, - mus_mapujm, - mus_mapukm, - mus_mapulm, - mus_mapumm, - mus_mapunm, - mus_mapuom, - mus_mapupm, - mus_mapuqm, - mus_mapurm, - mus_mapusm, - mus_maputm, - mus_mapuum, - mus_mapuvm, - mus_mapuwm, - mus_mapuxm, - mus_mapuym, - mus_mapuzm, - mus_mapv0m, - mus_mapv1m, - mus_mapv2m, - mus_mapv3m, - mus_mapv4m, - mus_mapv5m, - mus_mapv6m, - mus_mapv7m, - mus_mapv8m, - mus_mapv9m, - mus_mapvam, - mus_mapvbm, - mus_mapvcm, - mus_mapvdm, - mus_mapvem, - mus_mapvfm, - mus_mapvgm, - mus_mapvhm, - mus_mapvim, - mus_mapvjm, - mus_mapvkm, - mus_mapvlm, - mus_mapvmm, - mus_mapvnm, - mus_mapvom, - mus_mapvpm, - mus_mapvqm, - mus_mapvrm, - mus_mapvsm, - mus_mapvtm, - mus_mapvum, - mus_mapvvm, - mus_mapvwm, - mus_mapvxm, - mus_mapvym, - mus_mapvzm, - mus_mapw0m, - mus_mapw1m, - mus_mapw2m, - mus_mapw3m, - mus_mapw4m, - mus_mapw5m, - mus_mapw6m, - mus_mapw7m, - mus_mapw8m, - mus_mapw9m, - mus_mapwam, - mus_mapwbm, - mus_mapwcm, - mus_mapwdm, - mus_mapwem, - mus_mapwfm, - mus_mapwgm, - mus_mapwhm, - mus_mapwim, - mus_mapwjm, - mus_mapwkm, - mus_mapwlm, - mus_mapwmm, - mus_mapwnm, - mus_mapwom, - mus_mapwpm, - mus_mapwqm, - mus_mapwrm, - mus_mapwsm, - mus_mapwtm, - mus_mapwum, - mus_mapwvm, - mus_mapwwm, - mus_mapwxm, - mus_mapwym, - mus_mapwzm, - mus_mapx0m, - mus_mapx1m, - mus_mapx2m, - mus_mapx3m, - mus_mapx4m, - mus_mapx5m, - mus_mapx6m, - mus_mapx7m, - mus_mapx8m, - mus_mapx9m, - mus_mapxam, - mus_mapxbm, - mus_mapxcm, - mus_mapxdm, - mus_mapxem, - mus_mapxfm, - mus_mapxgm, - mus_mapxhm, - mus_mapxim, - mus_mapxjm, - mus_mapxkm, - mus_mapxlm, - mus_mapxmm, - mus_mapxnm, - mus_mapxom, - mus_mapxpm, - mus_mapxqm, - mus_mapxrm, - mus_mapxsm, - mus_mapxtm, - mus_mapxum, - mus_mapxvm, - mus_mapxwm, - mus_mapxxm, - mus_mapxym, - mus_mapxzm, - mus_mapy0m, - mus_mapy1m, - mus_mapy2m, - mus_mapy3m, - mus_mapy4m, - mus_mapy5m, - mus_mapy6m, - mus_mapy7m, - mus_mapy8m, - mus_mapy9m, - mus_mapyam, - mus_mapybm, - mus_mapycm, - mus_mapydm, - mus_mapyem, - mus_mapyfm, - mus_mapygm, - mus_mapyhm, - mus_mapyim, - mus_mapyjm, - mus_mapykm, - mus_mapylm, - mus_mapymm, - mus_mapynm, - mus_mapyom, - mus_mapypm, - mus_mapyqm, - mus_mapyrm, - mus_mapysm, - mus_mapytm, - mus_mapyum, - mus_mapyvm, - mus_mapywm, - mus_mapyxm, - mus_mapyym, - mus_mapyzm, - mus_mapz0m, - mus_mapz1m, - mus_mapz2m, - mus_mapz3m, - mus_mapz4m, - mus_mapz5m, - mus_mapz6m, - mus_mapz7m, - mus_mapz8m, - mus_mapz9m, - mus_mapzam, - mus_mapzbm, - mus_mapzcm, - mus_mapzdm, - mus_mapzem, - mus_mapzfm, - mus_mapzgm, - mus_mapzhm, - mus_mapzim, - mus_mapzjm, - mus_mapzkm, - mus_mapzlm, - mus_mapzmm, - mus_mapznm, - mus_mapzom, - mus_mapzpm, - mus_mapzqm, - mus_mapzrm, - mus_mapzsm, - mus_mapztm, - mus_mapzum, - mus_mapzvm, - mus_mapzwm, - mus_mapzxm, - mus_mapzym, - mus_mapzzm, - - mus_titles, // title screen - mus_read_m, // intro - mus_lclear, // level clear - mus_invinc, // invincibility - mus_shoes, // super sneakers - mus_minvnc, // Mario invincibility - mus_drown, // drowning - mus_gmover, // game over - mus_xtlife, // extra life - mus_contsc, // continue screen - mus_supers, // Super Sonic - mus_chrsel, // character select - mus_credit, // credits - mus_racent, // Race Results - mus_stjr, // Sonic Team Jr. Presents - - NUMMUSIC -} musicenum_t; -// Note: song number should be a UINT16, as mapmusic only uses 16 bits for music slot number. -// (the rest is track number and an internal reload flag) - // // Identifiers for all sfx in game. // diff --git a/src/y_inter.c b/src/y_inter.c index 2f2edf7ca..104c1004d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -632,7 +632,7 @@ void Y_Ticker(void) boolean anybonuses = false; if (!intertic) // first time only - S_ChangeMusic(mus_lclear, false); // don't loop it + S_ChangeMusicInternal("lclear", false); // don't loop it if (intertic < TICRATE) // one second pause before tally begins return; @@ -693,7 +693,7 @@ void Y_Ticker(void) if (!intertic) // first time only { - S_ChangeMusic(mus_lclear, false); // don't loop it + S_ChangeMusicInternal("lclear", false); // don't loop it tallydonetic = 0; } @@ -754,7 +754,7 @@ void Y_Ticker(void) else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match { if (!intertic) // first time only - S_ChangeMusic(mus_racent, true); // loop it + S_ChangeMusicInternal("racent", true); // loop it // If a player has left or joined, recalculate scores. if (data.match.numplayers != D_NumPlayers()) @@ -763,7 +763,7 @@ void Y_Ticker(void) else if (intertype == int_race || intertype == int_classicrace) // race { if (!intertic) // first time only - S_ChangeMusic(mus_racent, true); // loop it + S_ChangeMusicInternal("racent", true); // loop it // Don't bother recalcing for race. It doesn't make as much sense. } From caab150c9240a37925f38ae4d34f4278ca7c35d2 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 7 Jan 2016 20:41:58 -0800 Subject: [PATCH 308/364] Fixed LD413 (cherry picked from commit 1e4c2f8aad3d2d48eb408f400fde8e259b40fe18) --- src/p_setup.c | 12 ++++++++++-- src/p_spec.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 3a51d90b3..000a3a65c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1451,8 +1451,16 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum) sd->bottomtexture = get_number(process)-1; } M_Memcpy(process,msd->toptexture,8); - sd->text = Z_Malloc(strlen(process)+1, PU_LEVEL, NULL); - M_Memcpy(sd->text, process, strlen(process)+1); + process[8] = '\0'; + sd->text = Z_Malloc(7, PU_LEVEL, NULL); + + // If they type in O_ or D_ and their music name, just shrug, + // then copy the rest instead. + if ((process[0] == 'O' || process[0] == 'D') && process[7]) + M_Memcpy(sd->text, process+2, 6); + else // Assume it's a proper music name. + M_Memcpy(sd->text, process, 6); + sd->text[6] = 0; break; } case 414: // Play SFX diff --git a/src/p_spec.c b/src/p_spec.c index ef3425e04..99029d9b0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2392,7 +2392,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture; - strncpy(mapmusname, line->text, 7); + strncpy(mapmusname, sides[line->sidenum[0]].text, 7); mapmusname[6] = 0; mapmusflags = tracknum & MUSIC_TRACKMASK; From 1203b0aa73dad58cf411a4349504a3701290c680 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 7 Jan 2016 23:48:19 -0800 Subject: [PATCH 309/364] Fix crash on game clear (No, game, you can't allocate a map header for the credits, why were you doing that before and how did it not break anything??) (cherry picked from commit e1f9a012297d5220dcdd9395265467621a170e32) --- src/g_game.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 088536436..7941c33d7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2874,7 +2874,8 @@ static void G_DoCompleted(void) // We are committed to this map now. // We may as well allocate its header if it doesn't exist - if(!mapheaderinfo[nextmap]) + // (That is, if it's a real map) + if (nextmap < NUMMAPS && !mapheaderinfo[nextmap]) P_AllocMapHeader(nextmap); if (skipstats) From 04d112276e1ed1b2dd576f829d801e163ffab040 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Fri, 8 Jan 2016 03:23:05 -0800 Subject: [PATCH 310/364] Fixed some oddities with TUNES. (cherry picked from commit a4d05350f711db76676e9b48c36d88bd7dbec274) --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 9916e524f..7197def78 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3788,7 +3788,7 @@ static void Command_Tunes_f(void) tunearg = mapheaderinfo[gamemap-1]->musname; track = mapheaderinfo[gamemap-1]->mustrack; } - else if (tunearg[3] == 0 && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') + else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); if (tunenum && tunenum >= 1036) From 8fc484cea9360403644a2624656c8431937471e5 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 4 Feb 2016 17:27:55 -0800 Subject: [PATCH 311/364] Just a few more changes to TUNES, nothing special (cherry picked from commit 63a9c66317c263124567234897ed6240b5e34f9e) --- src/d_netcmd.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7197def78..5eb352834 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3766,11 +3766,12 @@ static void Command_Tunes_f(void) if (argc < 2) //tunes slot ... { - CONS_Printf("tunes :\n"); - CONS_Printf(M_GetText("Play a music slot at a set speed (\"1\" being normal speed).\n")); - CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n")); - CONS_Printf(M_GetText("The current tune is: %s\nThe current track is: %d\n"), - mapmusname, (mapmusflags & MUSIC_TRACKMASK)); + CONS_Printf("tunes [track] [speed] / <-show> / <-default> / <-none>:\n"); + CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n")); + CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n")); + CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n")); + CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n")); + CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n")); return; } @@ -3778,12 +3779,18 @@ static void Command_Tunes_f(void) tunenum = (UINT16)atoi(tunearg); track = 0; - if (!strcasecmp(tunearg, "none")) + if (!strcasecmp(tunearg, "-show")) + { + CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), + mapmusname, (mapmusflags & MUSIC_TRACKMASK)); + return; + } + if (!strcasecmp(tunearg, "-none")) { S_StopMusic(); return; } - else if (!strcasecmp(tunearg, "default")) + else if (!strcasecmp(tunearg, "-default")) { tunearg = mapheaderinfo[gamemap-1]->musname; track = mapheaderinfo[gamemap-1]->mustrack; @@ -3796,9 +3803,11 @@ static void Command_Tunes_f(void) CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n")); return; } + if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case + CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n")); - if (argc > 3) - track = (UINT16)atoi(COM_Argv(3))-1; + if (argc > 2) + track = (UINT16)atoi(COM_Argv(2))-1; if (tunenum) snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum)); @@ -3809,9 +3818,9 @@ static void Command_Tunes_f(void) S_ChangeMusic(mapmusname, mapmusflags, true); - if (argc > 2) + if (argc > 3) { - float speed = (float)atof(COM_Argv(2)); + float speed = (float)atof(COM_Argv(3)); if (speed > 0.0f) S_SpeedMusic(speed); } From b7ebb8186d3555ef8f2cbd102d755e7dfba75147 Mon Sep 17 00:00:00 2001 From: Sean Ryder Date: Tue, 9 Feb 2016 16:20:18 +0000 Subject: [PATCH 312/364] Fix MD2 interpolation for FF_ANIMATE states --- src/hardware/hw_md2.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 77795ccc0..b092ac32e 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1195,16 +1195,37 @@ void HWR_DrawMD2(gr_vissprite_t *spr) HWR_GetMappedPatch(gpatch, spr->colormap); } + if (spr->mobj->frame & FF_ANIMATE) + { + // set duration and tics to be the correct values for FF_ANIMATE states + durs = spr->mobj->state->var2; + tics = spr->mobj->anim_duration; + } + //FIXME: this is not yet correct frame = (spr->mobj->frame & FF_FRAMEMASK) % md2->model->header.numFrames; buff = md2->model->glCommandBuffer; curr = &md2->model->frames[frame]; - if (cv_grmd2.value == 1 - && spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL - && !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND])) + if (cv_grmd2.value == 1) { - const INT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; - next = &md2->model->frames[nextframe]; + // frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation + if (spr->mobj->frame & FF_ANIMATE) + { + UINT32 nextframe = (spr->mobj->frame & FF_FRAMEMASK) + 1; + if (nextframe >= (UINT32)spr->mobj->state->var1) + nextframe = (spr->mobj->state->frame & FF_FRAMEMASK); + nextframe %= md2->model->header.numFrames; + next = &md2->model->frames[nextframe]; + } + else + { + if (spr->mobj->state->nextstate != S_NULL && states[spr->mobj->state->nextstate].sprite != SPR_NULL + && !(spr->mobj->player && (spr->mobj->state->nextstate == S_PLAY_TAP1 || spr->mobj->state->nextstate == S_PLAY_TAP2) && spr->mobj->state == &states[S_PLAY_STND])) + { + const UINT32 nextframe = (states[spr->mobj->state->nextstate].frame & FF_FRAMEMASK) % md2->model->header.numFrames; + next = &md2->model->frames[nextframe]; + } + } } //Hurdler: it seems there is still a small problem with mobj angle From 31deecc51c0c920ee00dc98b5a1ba952622a9a98 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sun, 26 Jul 2015 20:14:47 +0100 Subject: [PATCH 313/364] Colour Changing MD2s I don't know how I can move my old branch over so I've just created a new one. --- src/hardware/hw_md2.c | 314 +++++++++++++++++++++++++++++++++++++++++- src/hardware/hw_md2.h | 1 + 2 files changed, 312 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 77795ccc0..e15af506f 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -41,6 +41,7 @@ #include "../r_things.h" #include "hw_main.h" +#include "../v_video.h" #ifdef HAVE_PNG #ifndef _MSC_VER @@ -881,6 +882,59 @@ static void md2_loadTexture(md2_t *model) HWR_UnlockCachedPatch(grpatch); } +// -----------------+ +// md2_loadBlendTexture : Download a pcx or png texture for blending MD2 models +// -----------------+ +static void md2_loadBlendTexture(md2_t *model) +{ + GLPatch_t *grpatch; + char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL); + strcpy(filename, model->filename); + + FIL_ForceExtension(filename, "_blend.png"); + + if (model->blendgrpatch) + { + grpatch = model->blendgrpatch; + Z_Free(grpatch->mipmap.grInfo.data); + } + else + grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO, + &(model->blendgrpatch)); + + if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data) + { + int w = 0, h = 0; +#ifdef HAVE_PNG + grpatch->mipmap.grInfo.format = PNG_Load(filename, &w, &h, grpatch); + if (grpatch->mipmap.grInfo.format == 0) +#endif + grpatch->mipmap.grInfo.format = PCX_Load(filename, &w, &h, grpatch); + if (grpatch->mipmap.grInfo.format == 0) + { + Z_Free(filename); + return; + } + + grpatch->mipmap.downloaded = 0; + grpatch->mipmap.flags = 0; + + grpatch->width = (INT16)w; + grpatch->height = (INT16)h; + grpatch->mipmap.width = (UINT16)w; + grpatch->mipmap.height = (UINT16)h; + + // not correct! + grpatch->mipmap.grInfo.smallLodLog2 = GR_LOD_LOG2_256; + grpatch->mipmap.grInfo.largeLodLog2 = GR_LOD_LOG2_256; + grpatch->mipmap.grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; + } + HWD.pfnSetTexture(&grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary + HWR_UnlockCachedPatch(grpatch); + + Z_Free(filename); +} + // Don't spam the console, or the OS with fopen requests! static boolean nomd2s = false; @@ -1050,6 +1104,248 @@ spritemd2found: fclose(f); } +static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color) +{ + UINT16 w = gpatch->width, h = gpatch->height; + UINT32 size = w*h; + RGBA_t *image, *blendimage, *cur, blendcolor; + + if (grmip->width == 0) + { + + grmip->width = gpatch->width; + grmip->height = gpatch->height; + + // no wrap around, no chroma key + grmip->flags = 0; + // setup the texture info + grmip->grInfo.format = GR_RGBA; + } + + Z_Free(grmip->grInfo.data); + grmip->grInfo.data = NULL; + + cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data); + memset(cur, 0x00, size*4); + + image = gpatch->mipmap.grInfo.data; + blendimage = blendgpatch->mipmap.grInfo.data; + + switch (color) + { + case SKINCOLOR_WHITE: + blendcolor = V_GetColor(3); + break; + case SKINCOLOR_SILVER: + blendcolor = V_GetColor(11); + break; + case SKINCOLOR_GREY: + blendcolor = V_GetColor(23); + break; + case SKINCOLOR_BLACK: + blendcolor = V_GetColor(27); + break; + case SKINCOLOR_CYAN: + blendcolor = V_GetColor(216); + break; + case SKINCOLOR_TEAL: + blendcolor = V_GetColor(220); + break; + case SKINCOLOR_STEELBLUE: + blendcolor = V_GetColor(204); + break; + case SKINCOLOR_BLUE: + blendcolor = V_GetColor(234); + break; + case SKINCOLOR_PEACH: + blendcolor = V_GetColor(73); + break; + case SKINCOLOR_TAN: + blendcolor = V_GetColor(49); + break; + case SKINCOLOR_PINK: + blendcolor = V_GetColor(146); + break; + case SKINCOLOR_LAVENDER: + blendcolor = V_GetColor(252); + break; + case SKINCOLOR_PURPLE: + blendcolor = V_GetColor(195); + break; + case SKINCOLOR_ORANGE: + blendcolor = V_GetColor(87); + break; + case SKINCOLOR_ROSEWOOD: + blendcolor = V_GetColor(94); + break; + case SKINCOLOR_BEIGE: + blendcolor = V_GetColor(40); + break; + case SKINCOLOR_BROWN: + blendcolor = V_GetColor(57); + break; + case SKINCOLOR_RED: + blendcolor = V_GetColor(130); + break; + case SKINCOLOR_DARKRED: + blendcolor = V_GetColor(139); + break; + case SKINCOLOR_NEONGREEN: + blendcolor = V_GetColor(184); + break; + case SKINCOLOR_GREEN: + blendcolor = V_GetColor(170); + break; + case SKINCOLOR_ZIM: + blendcolor = V_GetColor(180); + break; + case SKINCOLOR_OLIVE: + blendcolor = V_GetColor(108); + break; + case SKINCOLOR_YELLOW: + blendcolor = V_GetColor(104); + break; + case SKINCOLOR_GOLD: + blendcolor = V_GetColor(115); + break; + + case SKINCOLOR_SUPER1: + blendcolor = V_GetColor(101); + break; + case SKINCOLOR_SUPER2: + blendcolor = V_GetColor(113); + break; + case SKINCOLOR_SUPER3: + blendcolor = V_GetColor(114); + break; + case SKINCOLOR_SUPER4: + blendcolor = V_GetColor(116); + break; + case SKINCOLOR_SUPER5: + blendcolor = V_GetColor(119); + break; + + case SKINCOLOR_TSUPER1: + blendcolor = V_GetColor(80); + break; + case SKINCOLOR_TSUPER2: + blendcolor = V_GetColor(82); + break; + case SKINCOLOR_TSUPER3: + blendcolor = V_GetColor(84); + break; + case SKINCOLOR_TSUPER4: + blendcolor = V_GetColor(85); + break; + case SKINCOLOR_TSUPER5: + blendcolor = V_GetColor(87); + break; + + case SKINCOLOR_KSUPER1: + blendcolor = V_GetColor(122); + break; + case SKINCOLOR_KSUPER2: + blendcolor = V_GetColor(123); + break; + case SKINCOLOR_KSUPER3: + blendcolor = V_GetColor(124); + break; + case SKINCOLOR_KSUPER4: + blendcolor = V_GetColor(125); + break; + case SKINCOLOR_KSUPER5: + blendcolor = V_GetColor(126); + break; + default: + blendcolor = V_GetColor(247); + break; + } + + while (size--) + { + if (blendimage->s.alpha == 0) + { + // Don't bother with blending the pixel if the alpha of the blend pixel is 0 + cur->rgba = image->rgba; + } + else + { + INT32 tempcolor; + INT16 tempmult, tempalpha; + tempalpha = -(abs(blendimage->s.red-127)-127)*2; + if (tempalpha > 255) + tempalpha = 255; + else if (tempalpha < 0) + tempalpha = 0; + + tempmult = (blendimage->s.red-127)*2; + if (tempmult > 255) + tempmult = 255; + else if (tempmult < 0) + tempmult = 0; + + tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255; + cur->s.red = (UINT8)tempcolor; + tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255; + cur->s.green = (UINT8)tempcolor; + tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255; + cur->s.blue = (UINT8)tempcolor; + cur->s.alpha = image->s.alpha; + } + + cur++; image++; blendimage++; + } + + return; +} + +static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color) +{ + // mostly copied from HWR_GetMappedPatch, hence the similarities and comment + GLMipmap_t *grmip, *newmip; + + if (colormap == colormaps || colormap == NULL) + { + // Don't do any blending + HWD.pfnSetTexture(&gpatch->mipmap); + return; + } + + // search for the mimmap + // skip the first (no colormap translated) + for (grmip = &gpatch->mipmap; grmip->nextcolormap; ) + { + grmip = grmip->nextcolormap; + if (grmip->colormap == colormap) + { + if (grmip->downloaded && grmip->grInfo.data) + { + HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture + Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); + return; + } + } + } + + // If here, the blended texture has not been created + // So we create it + + //BP: WARNING: don't free it manually without clearing the cache of harware renderer + // (it have a liste of mipmap) + // this malloc is cleared in HWR_FreeTextureCache + // (...) unfortunately z_malloc fragment alot the memory :(so malloc is better + newmip = calloc(1, sizeof (*newmip)); + if (newmip == NULL) + I_Error("%s: Out of memory", "HWR_GetMappedPatch"); + grmip->nextcolormap = newmip; + newmip->colormap = colormap; + + HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color); + + HWD.pfnSetTexture(newmip); + Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED); +} + // -----------------+ // HWR_DrawMD2 : Draw MD2 @@ -1180,13 +1476,25 @@ void HWR_DrawMD2(gr_vissprite_t *spr) gpatch = md2->grpatch; if (!gpatch || !gpatch->mipmap.grInfo.format || !gpatch->mipmap.downloaded) md2_loadTexture(md2); - gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture... + if ((gpatch && gpatch->mipmap.grInfo.format) // don't load the blend texture if the base texture isn't available + && (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap.downloaded)) + md2_loadBlendTexture(md2); + if (gpatch && gpatch->mipmap.grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture { - // This is safe, since we know the texture has been downloaded - HWD.pfnSetTexture(&gpatch->mipmap); + if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE && + md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap.grInfo.format + && gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height) + { + HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, spr->colormap, (skincolors_t)spr->mobj->color); + } + else + { + // This is safe, since we know the texture has been downloaded + HWD.pfnSetTexture(&gpatch->mipmap); + } } else { diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 0fb486ea0..36078268b 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -120,6 +120,7 @@ typedef struct float offset; md2_model_t *model; void *grpatch; + void *blendgrpatch; boolean notfound; INT32 skin; } md2_t; From 6b8c438e583ac5d895e0b4004dec4abca1d0ab40 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Mon, 3 Aug 2015 02:01:56 +0100 Subject: [PATCH 314/364] Change a few colours. --- src/hardware/hw_md2.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e15af506f..c336e7bb3 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1137,37 +1137,37 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, blendcolor = V_GetColor(3); break; case SKINCOLOR_SILVER: - blendcolor = V_GetColor(11); + blendcolor = V_GetColor(10); break; case SKINCOLOR_GREY: - blendcolor = V_GetColor(23); + blendcolor = V_GetColor(15); break; case SKINCOLOR_BLACK: blendcolor = V_GetColor(27); break; case SKINCOLOR_CYAN: - blendcolor = V_GetColor(216); + blendcolor = V_GetColor(215); break; case SKINCOLOR_TEAL: - blendcolor = V_GetColor(220); + blendcolor = V_GetColor(221); break; case SKINCOLOR_STEELBLUE: - blendcolor = V_GetColor(204); + blendcolor = V_GetColor(203); break; case SKINCOLOR_BLUE: - blendcolor = V_GetColor(234); + blendcolor = V_GetColor(232); break; case SKINCOLOR_PEACH: - blendcolor = V_GetColor(73); + blendcolor = V_GetColor(71); break; case SKINCOLOR_TAN: - blendcolor = V_GetColor(49); + blendcolor = V_GetColor(79); break; case SKINCOLOR_PINK: - blendcolor = V_GetColor(146); + blendcolor = V_GetColor(147); break; case SKINCOLOR_LAVENDER: - blendcolor = V_GetColor(252); + blendcolor = V_GetColor(251); break; case SKINCOLOR_PURPLE: blendcolor = V_GetColor(195); @@ -1194,7 +1194,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, blendcolor = V_GetColor(184); break; case SKINCOLOR_GREEN: - blendcolor = V_GetColor(170); + blendcolor = V_GetColor(166); break; case SKINCOLOR_ZIM: blendcolor = V_GetColor(180); @@ -1210,23 +1210,23 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, break; case SKINCOLOR_SUPER1: - blendcolor = V_GetColor(101); + blendcolor = V_GetColor(97); break; case SKINCOLOR_SUPER2: - blendcolor = V_GetColor(113); + blendcolor = V_GetColor(100); break; case SKINCOLOR_SUPER3: - blendcolor = V_GetColor(114); + blendcolor = V_GetColor(103); break; case SKINCOLOR_SUPER4: - blendcolor = V_GetColor(116); + blendcolor = V_GetColor(113); break; case SKINCOLOR_SUPER5: - blendcolor = V_GetColor(119); + blendcolor = V_GetColor(116); break; case SKINCOLOR_TSUPER1: - blendcolor = V_GetColor(80); + blendcolor = V_GetColor(81); break; case SKINCOLOR_TSUPER2: blendcolor = V_GetColor(82); From ddb5652ab63c7d8720e1544af364b3252e0c1a9f Mon Sep 17 00:00:00 2001 From: Sean Ryder Date: Wed, 20 Jan 2016 15:55:32 +0000 Subject: [PATCH 315/364] Tabbing --- src/hardware/hw_md2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index c336e7bb3..6a315d881 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1107,8 +1107,8 @@ spritemd2found: static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color) { UINT16 w = gpatch->width, h = gpatch->height; - UINT32 size = w*h; - RGBA_t *image, *blendimage, *cur, blendcolor; + UINT32 size = w*h; + RGBA_t *image, *blendimage, *cur, blendcolor; if (grmip->width == 0) { From 5d1c8d29685831ac9693f9654a4f135715c1c7fe Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 9 Feb 2016 19:35:04 +0000 Subject: [PATCH 316/364] My cherry picking somehow lead to these functions being doubled ...whoops --- src/hardware/hw_md2.c | 242 ------------------------------------------ 1 file changed, 242 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index b71cfb661..6a315d881 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1346,248 +1346,6 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, con Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED); } -static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, skincolors_t color) -{ - UINT16 w = gpatch->width, h = gpatch->height; - UINT32 size = w*h; - RGBA_t *image, *blendimage, *cur, blendcolor; - - if (grmip->width == 0) - { - - grmip->width = gpatch->width; - grmip->height = gpatch->height; - - // no wrap around, no chroma key - grmip->flags = 0; - // setup the texture info - grmip->grInfo.format = GR_RGBA; - } - - Z_Free(grmip->grInfo.data); - grmip->grInfo.data = NULL; - - cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->grInfo.data); - memset(cur, 0x00, size*4); - - image = gpatch->mipmap.grInfo.data; - blendimage = blendgpatch->mipmap.grInfo.data; - - switch (color) - { - case SKINCOLOR_WHITE: - blendcolor = V_GetColor(3); - break; - case SKINCOLOR_SILVER: - blendcolor = V_GetColor(10); - break; - case SKINCOLOR_GREY: - blendcolor = V_GetColor(15); - break; - case SKINCOLOR_BLACK: - blendcolor = V_GetColor(27); - break; - case SKINCOLOR_CYAN: - blendcolor = V_GetColor(215); - break; - case SKINCOLOR_TEAL: - blendcolor = V_GetColor(221); - break; - case SKINCOLOR_STEELBLUE: - blendcolor = V_GetColor(203); - break; - case SKINCOLOR_BLUE: - blendcolor = V_GetColor(232); - break; - case SKINCOLOR_PEACH: - blendcolor = V_GetColor(71); - break; - case SKINCOLOR_TAN: - blendcolor = V_GetColor(79); - break; - case SKINCOLOR_PINK: - blendcolor = V_GetColor(147); - break; - case SKINCOLOR_LAVENDER: - blendcolor = V_GetColor(251); - break; - case SKINCOLOR_PURPLE: - blendcolor = V_GetColor(195); - break; - case SKINCOLOR_ORANGE: - blendcolor = V_GetColor(87); - break; - case SKINCOLOR_ROSEWOOD: - blendcolor = V_GetColor(94); - break; - case SKINCOLOR_BEIGE: - blendcolor = V_GetColor(40); - break; - case SKINCOLOR_BROWN: - blendcolor = V_GetColor(57); - break; - case SKINCOLOR_RED: - blendcolor = V_GetColor(130); - break; - case SKINCOLOR_DARKRED: - blendcolor = V_GetColor(139); - break; - case SKINCOLOR_NEONGREEN: - blendcolor = V_GetColor(184); - break; - case SKINCOLOR_GREEN: - blendcolor = V_GetColor(166); - break; - case SKINCOLOR_ZIM: - blendcolor = V_GetColor(180); - break; - case SKINCOLOR_OLIVE: - blendcolor = V_GetColor(108); - break; - case SKINCOLOR_YELLOW: - blendcolor = V_GetColor(104); - break; - case SKINCOLOR_GOLD: - blendcolor = V_GetColor(115); - break; - - case SKINCOLOR_SUPER1: - blendcolor = V_GetColor(97); - break; - case SKINCOLOR_SUPER2: - blendcolor = V_GetColor(100); - break; - case SKINCOLOR_SUPER3: - blendcolor = V_GetColor(103); - break; - case SKINCOLOR_SUPER4: - blendcolor = V_GetColor(113); - break; - case SKINCOLOR_SUPER5: - blendcolor = V_GetColor(116); - break; - - case SKINCOLOR_TSUPER1: - blendcolor = V_GetColor(81); - break; - case SKINCOLOR_TSUPER2: - blendcolor = V_GetColor(82); - break; - case SKINCOLOR_TSUPER3: - blendcolor = V_GetColor(84); - break; - case SKINCOLOR_TSUPER4: - blendcolor = V_GetColor(85); - break; - case SKINCOLOR_TSUPER5: - blendcolor = V_GetColor(87); - break; - - case SKINCOLOR_KSUPER1: - blendcolor = V_GetColor(122); - break; - case SKINCOLOR_KSUPER2: - blendcolor = V_GetColor(123); - break; - case SKINCOLOR_KSUPER3: - blendcolor = V_GetColor(124); - break; - case SKINCOLOR_KSUPER4: - blendcolor = V_GetColor(125); - break; - case SKINCOLOR_KSUPER5: - blendcolor = V_GetColor(126); - break; - default: - blendcolor = V_GetColor(247); - break; - } - - while (size--) - { - if (blendimage->s.alpha == 0) - { - // Don't bother with blending the pixel if the alpha of the blend pixel is 0 - cur->rgba = image->rgba; - } - else - { - INT32 tempcolor; - INT16 tempmult, tempalpha; - tempalpha = -(abs(blendimage->s.red-127)-127)*2; - if (tempalpha > 255) - tempalpha = 255; - else if (tempalpha < 0) - tempalpha = 0; - - tempmult = (blendimage->s.red-127)*2; - if (tempmult > 255) - tempmult = 255; - else if (tempmult < 0) - tempmult = 0; - - tempcolor = (image->s.red*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.red)/255)) * blendimage->s.alpha)/255; - cur->s.red = (UINT8)tempcolor; - tempcolor = (image->s.green*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.green)/255)) * blendimage->s.alpha)/255; - cur->s.green = (UINT8)tempcolor; - tempcolor = (image->s.blue*(255-blendimage->s.alpha))/255 + ((tempmult + ((tempalpha*blendcolor.s.blue)/255)) * blendimage->s.alpha)/255; - cur->s.blue = (UINT8)tempcolor; - cur->s.alpha = image->s.alpha; - } - - cur++; image++; blendimage++; - } - - return; -} - -static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, const UINT8 *colormap, skincolors_t color) -{ - // mostly copied from HWR_GetMappedPatch, hence the similarities and comment - GLMipmap_t *grmip, *newmip; - - if (colormap == colormaps || colormap == NULL) - { - // Don't do any blending - HWD.pfnSetTexture(&gpatch->mipmap); - return; - } - - // search for the mimmap - // skip the first (no colormap translated) - for (grmip = &gpatch->mipmap; grmip->nextcolormap; ) - { - grmip = grmip->nextcolormap; - if (grmip->colormap == colormap) - { - if (grmip->downloaded && grmip->grInfo.data) - { - HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture - Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED); - return; - } - } - } - - // If here, the blended texture has not been created - // So we create it - - //BP: WARNING: don't free it manually without clearing the cache of harware renderer - // (it have a liste of mipmap) - // this malloc is cleared in HWR_FreeTextureCache - // (...) unfortunately z_malloc fragment alot the memory :(so malloc is better - newmip = calloc(1, sizeof (*newmip)); - if (newmip == NULL) - I_Error("%s: Out of memory", "HWR_GetMappedPatch"); - grmip->nextcolormap = newmip; - newmip->colormap = colormap; - - HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, color); - - HWD.pfnSetTexture(newmip); - Z_ChangeTag(newmip->grInfo.data, PU_HWRCACHE_UNLOCKED); -} - // -----------------+ // HWR_DrawMD2 : Draw MD2 From 4e37964336e136ecead04d30d50579bb862eb454 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 11 Feb 2016 13:20:13 -0500 Subject: [PATCH 317/364] TRUE is not a vaild boolean under non Windows system --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 6eaf31c4a..68bc56b21 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -108,7 +108,7 @@ static UINT8 cheatf_devmode(void) G_SetGameModified(false); for (i = 0; i < MAXUNLOCKABLES; i++) unlockables[i].unlocked = true; - devparm = TRUE; + devparm = true; cv_debug |= 0x8000; // Refresh secrets menu existing. From 9470fc5567baf0ed3c73bdebac1b5fbc7751d3d1 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 11 Feb 2016 13:20:35 -0500 Subject: [PATCH 318/364] use sizeu#() on size_t printing --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index b94db488e..a5f795e0b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1105,7 +1105,7 @@ static void R_ProjectSprite(mobj_t *thing) { sprdef = &((skin_t *)thing->skin)->sprites[thing->sprite2]; if (rot >= sprdef->numframes) { - CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] frame %d\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2], rot); + CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid skins[\"%s\"].sprites[SPR2_%s] frame %s\n"), ((skin_t *)thing->skin)->name, spr2names[thing->sprite2], sizeu5(rot)); thing->sprite = states[S_UNKNOWN].sprite; thing->frame = states[S_UNKNOWN].frame; sprdef = &sprites[thing->sprite]; From f59c8d20e526b8f3f58acacbf4d6fd911aca1ab5 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Thu, 11 Feb 2016 13:46:30 -0500 Subject: [PATCH 319/364] fix md2 blendcolors for reduced palette --- src/hardware/hw_md2.c | 148 ++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 79 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index e9b387601..4eaed1259 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1145,119 +1145,109 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, case SKINCOLOR_BLACK: blendcolor = V_GetColor(27); break; - case SKINCOLOR_CYAN: - blendcolor = V_GetColor(215); - break; - case SKINCOLOR_TEAL: - blendcolor = V_GetColor(221); - break; - case SKINCOLOR_STEELBLUE: - blendcolor = V_GetColor(203); - break; - case SKINCOLOR_BLUE: - blendcolor = V_GetColor(232); + case SKINCOLOR_BEIGE: + blendcolor = V_GetColor(247); break; case SKINCOLOR_PEACH: - blendcolor = V_GetColor(71); - break; - case SKINCOLOR_TAN: - blendcolor = V_GetColor(79); - break; - case SKINCOLOR_PINK: - blendcolor = V_GetColor(147); - break; - case SKINCOLOR_LAVENDER: - blendcolor = V_GetColor(251); - break; - case SKINCOLOR_PURPLE: - blendcolor = V_GetColor(195); - break; - case SKINCOLOR_ORANGE: - blendcolor = V_GetColor(87); - break; - case SKINCOLOR_ROSEWOOD: - blendcolor = V_GetColor(94); - break; - case SKINCOLOR_BEIGE: - blendcolor = V_GetColor(40); + blendcolor = V_GetColor(218); break; case SKINCOLOR_BROWN: - blendcolor = V_GetColor(57); + blendcolor = V_GetColor(234); break; case SKINCOLOR_RED: - blendcolor = V_GetColor(130); + blendcolor = V_GetColor(38); break; - case SKINCOLOR_DARKRED: - blendcolor = V_GetColor(139); + case SKINCOLOR_CRIMSON: + blendcolor = V_GetColor(45); break; - case SKINCOLOR_NEONGREEN: - blendcolor = V_GetColor(184); + case SKINCOLOR_ORANGE: + blendcolor = V_GetColor(54); break; - case SKINCOLOR_GREEN: - blendcolor = V_GetColor(166); - break; - case SKINCOLOR_ZIM: - blendcolor = V_GetColor(180); - break; - case SKINCOLOR_OLIVE: - blendcolor = V_GetColor(108); - break; - case SKINCOLOR_YELLOW: - blendcolor = V_GetColor(104); + case SKINCOLOR_RUST: + blendcolor = V_GetColor(60); break; case SKINCOLOR_GOLD: - blendcolor = V_GetColor(115); + blendcolor = V_GetColor(67); + break; + case SKINCOLOR_YELLOW: + blendcolor = V_GetColor(73); + break; + case SKINCOLOR_TAN: + blendcolor = V_GetColor(85); + break; + case SKINCOLOR_MOSS: + blendcolor = V_GetColor(92); + break; + case SKINCOLOR_PERIDOT: + blendcolor = V_GetColor(188); + break; + case SKINCOLOR_GREEN: + blendcolor = V_GetColor(101); + break; + case SKINCOLOR_EMERALD: + blendcolor = V_GetColor(112); + break; + case SKINCOLOR_AQUA: + blendcolor = V_GetColor(122); + break; + case SKINCOLOR_TEAL: + blendcolor = V_GetColor(141); + break; + case SKINCOLOR_CYAN: + blendcolor = V_GetColor(131); + break; + case SKINCOLOR_BLUE: + blendcolor = V_GetColor(152); + break; + case SKINCOLOR_AZURE: + blendcolor = V_GetColor(171); + break; + case SKINCOLOR_PASTEL: + blendcolor = V_GetColor(161); + break; + case SKINCOLOR_PURPLE: + blendcolor = V_GetColor(165); + break; + case SKINCOLOR_LAVENDER: + blendcolor = V_GetColor(195); + break; + case SKINCOLOR_MAGENTA: + blendcolor = V_GetColor(183); + break; + case SKINCOLOR_PINK: + blendcolor = V_GetColor(211); + break; + case SKINCOLOR_ROSY: + blendcolor = V_GetColor(202); break; - case SKINCOLOR_SUPER1: - blendcolor = V_GetColor(97); + blendcolor = V_GetColor(80); break; case SKINCOLOR_SUPER2: - blendcolor = V_GetColor(100); + blendcolor = V_GetColor(83); break; case SKINCOLOR_SUPER3: - blendcolor = V_GetColor(103); + blendcolor = V_GetColor(73); break; case SKINCOLOR_SUPER4: - blendcolor = V_GetColor(113); + blendcolor = V_GetColor(64); break; case SKINCOLOR_SUPER5: - blendcolor = V_GetColor(116); + blendcolor = V_GetColor(67); break; case SKINCOLOR_TSUPER1: - blendcolor = V_GetColor(81); - break; case SKINCOLOR_TSUPER2: - blendcolor = V_GetColor(82); - break; case SKINCOLOR_TSUPER3: - blendcolor = V_GetColor(84); - break; case SKINCOLOR_TSUPER4: - blendcolor = V_GetColor(85); - break; case SKINCOLOR_TSUPER5: - blendcolor = V_GetColor(87); - break; - case SKINCOLOR_KSUPER1: - blendcolor = V_GetColor(122); - break; case SKINCOLOR_KSUPER2: - blendcolor = V_GetColor(123); - break; case SKINCOLOR_KSUPER3: - blendcolor = V_GetColor(124); - break; case SKINCOLOR_KSUPER4: - blendcolor = V_GetColor(125); - break; case SKINCOLOR_KSUPER5: - blendcolor = V_GetColor(126); - break; default: - blendcolor = V_GetColor(247); + blendcolor = V_GetColor(255); break; } From e43f21cdda4a75dd5ab089316680cdba32c27c33 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 13 Feb 2016 17:30:07 -0600 Subject: [PATCH 320/364] Fix dead MF_PAIN objects hurting the player Fixes #12 --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 7ff913a86..61d57dcd1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -503,7 +503,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // overhead if (thing->z + thing->height < tmthing->z) return true; // underneath - if (tmthing->player && tmthing->flags & MF_SHOOTABLE) + if (tmthing->player && tmthing->flags & MF_SHOOTABLE && thing->health > 0) P_DamageMobj(tmthing, thing, thing, 1); return true; } @@ -514,7 +514,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return true; // overhead if (tmthing->z + tmthing->height < thing->z) return true; // underneath - if (thing->player && thing->flags & MF_SHOOTABLE) + if (thing->player && thing->flags & MF_SHOOTABLE && tmthing->health > 0) P_DamageMobj(thing, tmthing, tmthing, 1); return true; } From db3797fd35da9dfde3dcef754b48ac47d9ea602d Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 14 Feb 2016 05:19:40 -0600 Subject: [PATCH 321/364] Add PlayerSpawn hook --- src/lua_hook.h | 2 ++ src/lua_hooklib.c | 1 + src/p_mobj.c | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/src/lua_hook.h b/src/lua_hook.h index da2dcdc38..f3af7f304 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -42,6 +42,7 @@ enum hook { hook_LinedefExecute, hook_PlayerMsg, hook_HurtMsg, + hook_PlayerSpawn, hook_MAX // last hook }; @@ -75,5 +76,6 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_B boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages +#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for P_SpawnPlayer #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 0415d23e6..dfd6d703c 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -53,6 +53,7 @@ const char *const hookNames[hook_MAX+1] = { "LinedefExecute", "PlayerMsg", "HurtMsg", + "PlayerSpawn", NULL }; diff --git a/src/p_mobj.c b/src/p_mobj.c index 25ae8815a..4916dbfdf 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8294,6 +8294,12 @@ void P_SpawnPlayer(INT32 playernum) // Spawn with a pity shield if necessary. P_DoPityCheck(p); + +#ifdef HAVE_BLUA + if (LUAh_PlayerSpawn(p)) // Lua hook for player spawning :) + ; +#endif + } void P_AfterPlayerSpawn(INT32 playernum) From 7c5adacc6f25b19474e56764553f3e6b4523e27d Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 14 Feb 2016 12:28:03 -0800 Subject: [PATCH 322/364] Fixed chain launching In the process, the stasis flags work like you'd expect them to. You can now set them in Lua or code and they'll actually do something. --- src/p_inter.c | 3 +++ src/p_user.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 709e0e2be..55d36a1de 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1339,6 +1339,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } else player->pflags |= PF_ITEMHANG; + + // Can't jump first frame + player->pflags |= PF_JUMPSTASIS; return; case MT_BIGMINE: case MT_BIGAIRMINE: diff --git a/src/p_user.c b/src/p_user.c index 96841d7e0..da65b7cb4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6340,8 +6340,7 @@ static void P_MovePlayer(player_t *player) if (!(player->powers[pw_nocontrol] & (1<<15))) player->pflags |= PF_JUMPSTASIS; } - else - player->pflags &= ~PF_FULLSTASIS; + // note: don't unset stasis here if (!player->spectator && G_TagGametype()) { @@ -8928,6 +8927,11 @@ void P_PlayerThink(player_t *player) if (!player->mo) return; // P_MovePlayer removed player->mo. + // Unset statis flags after moving. + // In other words, if you manually set stasis via code, + // it lasts for one tic. + player->pflags &= ~PF_FULLSTASIS; + #ifdef POLYOBJECTS if (player->onconveyor == 1) player->cmomy = player->cmomx = 0; From 000ec9ac67c47c1c16489f35987fe2c87caaab81 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 14 Feb 2016 15:22:13 -0600 Subject: [PATCH 323/364] Call LUAh_PlayerSpawn instead of checking for it --- src/p_mobj.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4916dbfdf..367a3a7d0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8296,8 +8296,7 @@ void P_SpawnPlayer(INT32 playernum) P_DoPityCheck(p); #ifdef HAVE_BLUA - if (LUAh_PlayerSpawn(p)) // Lua hook for player spawning :) - ; + LUAh_PlayerSpawn(p); // Lua hook for player spawning :) #endif } From b258b9b5035252dfbef8f2b7b79ddfdbdf9885cd Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Mon, 22 Feb 2016 01:33:10 -0800 Subject: [PATCH 324/364] remove cpuaffinity code from SDL still exists in DD (while it exists) but no longer saves. No reason whatsoever for affinity to be settable by the game itself. --- src/sdl/i_system.c | 53 ++------------------------------------------- src/win32/win_sys.c | 2 +- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index da4111538..f239dd036 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -45,9 +45,6 @@ typedef DWORD (WINAPI *p_timeGetTime) (void); typedef UINT (WINAPI *p_timeEndPeriod) (UINT); typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR); typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); -typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID); -typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR); -typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR); #endif #endif #include @@ -3070,52 +3067,6 @@ const CPUInfoFlags *I_CPUInfo(void) #endif } -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) -static void CPUAffinity_OnChange(void); -static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL}; - -static p_GetCurrentProcess pfnGetCurrentProcess = NULL; -static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL; -static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL; - -static inline VOID GetAffinityFuncs(VOID) -{ - HMODULE h = GetModuleHandleA("kernel32.dll"); - pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess"); - pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask"); - pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask"); -} - -static void CPUAffinity_OnChange(void) -{ - DWORD_PTR dwProcMask, dwSysMask; - HANDLE selfpid; - - if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask) - return; - else - selfpid = pfnGetCurrentProcess(); - - pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask); - - /* If resulting mask is zero, don't change anything and fall back to - * actual mask. - */ - if(dwSysMask & cv_cpuaffinity.value) - { - pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value); - CV_StealthSetValue(&cv_cpuaffinity, (INT32)(dwSysMask & cv_cpuaffinity.value)); - } - else - CV_StealthSetValue(&cv_cpuaffinity, (INT32)dwProcMask); -} -#endif - -void I_RegisterSysCommands(void) -{ -#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) - GetAffinityFuncs(); - CV_RegisterVar(&cv_cpuaffinity); -#endif -} +// note CPUAFFINITY code used to reside here +void I_RegisterSysCommands(void) {} #endif diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c index efb0be463..2babb57b9 100644 --- a/src/win32/win_sys.c +++ b/src/win32/win_sys.c @@ -3656,7 +3656,7 @@ const CPUInfoFlags *I_CPUInfo(void) } static void CPUAffinity_OnChange(void); -static consvar_t cv_cpuaffinity = {"cpuaffinity", "1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL}; +static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL}; typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID); static p_GetCurrentProcess pfnGetCurrentProcess = NULL; From 6dda71bef7d99c9a5fe6184b739c9f79788733a4 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Mon, 22 Feb 2016 23:05:36 -0800 Subject: [PATCH 325/364] I guess this is becoming the "try to make SDL_mixer work" branch Move InitSubSystem calls into proper places, don't use AUDIO_S16LSB (bad according to SDL_mixer docs) Add error checking --- src/sdl/i_video.c | 16 +++------------- src/sdl/mixer_sound.c | 27 ++++++++++++++++++++++++--- src/sdl/sdl_sound.c | 10 ++++++++++ 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index dbb97f093..963310a26 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1701,21 +1701,11 @@ void I_StartupGraphics(void) keyboard_started = true; #if !defined(HAVE_TTF) -#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio - if (SDL_InitSubSystem(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0) -#else //SDL_OpenAudio will do SDL_InitSubSystem(SDL_INIT_AUDIO) + // Previously audio was init here for questionable reasons? if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) -#endif { -#ifdef _WIN32 - if (SDL_WasInit(SDL_INIT_AUDIO)==0) - CONS_Printf(M_GetText("Couldn't initialize SDL's Audio System with Video System: %s\n"), SDL_GetError()); - if (SDL_WasInit(SDL_INIT_VIDEO)==0) -#endif - { - CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError()); - return; - } + CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError()); + return; } #endif { diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 71969209c..50e501394 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -77,7 +77,16 @@ static INT32 current_track; void I_StartupSound(void) { I_Assert(!sound_started); - sound_started = true; + + // EE inits audio first so we're following along. + if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO) + CONS_Printf("SDL Audio already started\n"); + else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) + { + CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError()); + // call to start audio failed -- we do not have it + return; + } midimode = false; music = NULL; @@ -86,19 +95,31 @@ void I_StartupSound(void) #if SDL_MIXER_VERSION_ATLEAST(1,2,11) Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG); #endif - Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048); + + if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0) + { + CONS_Alert(CONS_ERROR, "Error starting SDL_Mixer: %s\n", Mix_GetError()); + // call to start audio failed -- we do not have it + return; + } + + sound_started = true; Mix_AllocateChannels(256); } void I_ShutdownSound(void) { - I_Assert(sound_started); + if (!sound_started) + return; // not an error condition sound_started = false; Mix_CloseAudio(); #if SDL_MIXER_VERSION_ATLEAST(1,2,11) Mix_Quit(); #endif + + SDL_QuitSubSystem(SDL_INIT_AUDIO); + #ifdef HAVE_LIBGME if (gme) gme_delete(gme); diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 5d6c007b5..0face92e2 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1213,6 +1213,16 @@ void I_StartupSound(void) // Configure sound device CONS_Printf("I_StartupSound:\n"); + // EE inits audio first so we're following along. + if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO) + CONS_Printf("SDL Audio already started\n"); + else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) + { + CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError()); + // call to start audio failed -- we do not have it + return; + } + // Open the audio device if (M_CheckParm ("-freq") && M_IsNextParm()) { From f10279d61bf2a79bcd031ab1f625368cd5bf6ebc Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 25 Feb 2016 14:35:05 -0800 Subject: [PATCH 326/364] Very minor performance improvement. --- src/p_mobj.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 323e5ce95..d2454f267 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -92,9 +92,7 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj) // compare the current sprite frame to the one we started from // if more than var1 away from it, swap back to the original // else just advance by one - if ((mobj->frame & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) < (UINT32)mobj->state->var1) - ++mobj->frame; - else + if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1) mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK); } From 8a369d969bc90e4d81adfeb27742f757050f786a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 25 Feb 2016 18:28:48 -0500 Subject: [PATCH 327/364] whitespace clean --- CMakeLists.txt | 14 +++++++------- cmake/Modules/FindSDL2.cmake | 2 +- cmake/Modules/FindSDL2_main.cmake | 2 +- cmake/Modules/FindSDL2_mixer.cmake | 2 +- cmake/Modules/LibFindMacros.cmake | 8 ++++---- src/sdl/CMakeLists.txt | 2 +- src/sdl/i_system.c | 7 +++---- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59557ef42..a735be000 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,13 +23,13 @@ endfunction() # Macro to add OSX framework macro(add_framework fwname appname) find_library(FRAMEWORK_${fwname} - NAMES ${fwname} - PATHS ${CMAKE_OSX_SYSROOT}/System/Library - ${CMAKE_OSX_SYSROOT}/Library - /System/Library - /Library - PATH_SUFFIXES Frameworks - NO_DEFAULT_PATH) + NAMES ${fwname} + PATHS ${CMAKE_OSX_SYSROOT}/System/Library + ${CMAKE_OSX_SYSROOT}/Library + /System/Library + /Library + ATH_SUFFIXES Frameworks + NO_DEFAULT_PATH) if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND) MESSAGE(ERROR ": Framework ${fwname} not found") else() diff --git a/cmake/Modules/FindSDL2.cmake b/cmake/Modules/FindSDL2.cmake index faa556a88..ec9f38359 100644 --- a/cmake/Modules/FindSDL2.cmake +++ b/cmake/Modules/FindSDL2.cmake @@ -1,6 +1,6 @@ # Find SDL2 # Once done, this will define -# +# # SDL2_FOUND - system has SDL2 # SDL2_INCLUDE_DIRS - SDL2 include directories # SDL2_LIBRARIES - link libraries diff --git a/cmake/Modules/FindSDL2_main.cmake b/cmake/Modules/FindSDL2_main.cmake index 280e51e2e..d4cbdeb11 100644 --- a/cmake/Modules/FindSDL2_main.cmake +++ b/cmake/Modules/FindSDL2_main.cmake @@ -1,6 +1,6 @@ # Find SDL2 # Once done, this will define -# +# # SDL2_MAIN_FOUND - system has SDL2 # SDL2_MAIN_INCLUDE_DIRS - SDL2 include directories # SDL2_MAIN_LIBRARIES - link libraries diff --git a/cmake/Modules/FindSDL2_mixer.cmake b/cmake/Modules/FindSDL2_mixer.cmake index 59b4823ed..9af3e26dd 100644 --- a/cmake/Modules/FindSDL2_mixer.cmake +++ b/cmake/Modules/FindSDL2_mixer.cmake @@ -1,6 +1,6 @@ # Find SDL2 # Once done, this will define -# +# # SDL2_MIXER_FOUND - system has SDL2 # SDL2_MIXER_INCLUDE_DIRS - SDL2 include directories # SDL2_MIXER_LIBRARIES - link libraries diff --git a/cmake/Modules/LibFindMacros.cmake b/cmake/Modules/LibFindMacros.cmake index f6800aa7b..81fef7d8e 100644 --- a/cmake/Modules/LibFindMacros.cmake +++ b/cmake/Modules/LibFindMacros.cmake @@ -123,7 +123,7 @@ function (libfind_process PREFIX) set(includeopts ${${PREFIX}_PROCESS_INCLUDES}) set(libraryopts ${${PREFIX}_PROCESS_LIBS}) - # Process deps to add to + # Process deps to add to foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) # The package seems to export option lists that we can use, woohoo! @@ -146,11 +146,11 @@ function (libfind_process PREFIX) endif() endif() endforeach() - + if (includeopts) list(REMOVE_DUPLICATES includeopts) endif() - + if (libraryopts) list(REMOVE_DUPLICATES libraryopts) endif() @@ -215,7 +215,7 @@ function (libfind_process PREFIX) set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE) set (${PREFIX}_FOUND TRUE PARENT_SCOPE) endif() - return() + return() endif() # Format messages for debug info and the type of error diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index eb832797e..b3d734521 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -57,7 +57,7 @@ if(${SDL2_FOUND}) ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS} ) - + source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}) source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES}) source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES}) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f239dd036..2e9ebbede 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2756,8 +2756,8 @@ static const char *locateWad(void) if (isWadPathOk(returnWadPath)) return NULL; #endif - - + + #ifdef CMAKECONFIG #ifndef NDEBUG I_OutputMsg(","CMAKE_ASSETS_DIR); @@ -2768,7 +2768,7 @@ static const char *locateWad(void) } #endif #endif - + #ifdef __APPLE__ OSX_GetResourcesPath(returnWadPath); I_OutputMsg(",%s", returnWadPath); @@ -2776,7 +2776,6 @@ static const char *locateWad(void) { return returnWadPath; } - #endif // examine default dirs From 5c9aaf2fe4ae3d93dfe50028634e0b70d4ac598f Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 25 Feb 2016 22:28:19 -0600 Subject: [PATCH 328/364] Move hook into G_SpawnPlayer --- src/g_game.c | 6 ++++++ src/lua_hook.h | 2 +- src/p_mobj.c | 5 ----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 72cfe4a57..3329e8eff 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2328,6 +2328,12 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) } } P_MovePlayerToSpawn(playernum, spawnpoint); + +#ifdef HAVE_BLUA + player_t *p = &players[playernum]; + LUAh_PlayerSpawn(p); // Lua hook for player spawning :) +#endif + } mapthing_t *G_FindCTFStart(INT32 playernum) diff --git a/src/lua_hook.h b/src/lua_hook.h index f3af7f304..4eb083780 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -76,6 +76,6 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_B boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages -#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for P_SpawnPlayer +#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer #endif diff --git a/src/p_mobj.c b/src/p_mobj.c index 367a3a7d0..25ae8815a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8294,11 +8294,6 @@ void P_SpawnPlayer(INT32 playernum) // Spawn with a pity shield if necessary. P_DoPityCheck(p); - -#ifdef HAVE_BLUA - LUAh_PlayerSpawn(p); // Lua hook for player spawning :) -#endif - } void P_AfterPlayerSpawn(INT32 playernum) From 8f0abb267edd493b58e875a08083af9c36ea3870 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 25 Feb 2016 22:47:52 -0600 Subject: [PATCH 329/364] Don't mix declarations and code --- src/g_game.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 3329e8eff..219b276ec 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2330,8 +2330,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost) P_MovePlayerToSpawn(playernum, spawnpoint); #ifdef HAVE_BLUA - player_t *p = &players[playernum]; - LUAh_PlayerSpawn(p); // Lua hook for player spawning :) + LUAh_PlayerSpawn(&players[playernum]); // Lua hook for player spawning :) #endif } From 9b55244dc32400a38d2fbbf33aaf7f8ac9446436 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 26 Feb 2016 01:39:08 -0500 Subject: [PATCH 330/364] travis: use SRB2-v2114-assets.7z --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c6a3ce799..de3085828 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,8 @@ addons: before_script: - mkdir $HOME/srb2_cache - - wget http://rosenthalcastle.org/srb2/SRB2-v2114-Installer.exe -c -O $HOME/srb2_cache/SRB2-v2114-Installer.exe - - 7z x $HOME/srb2_cache/SRB2-v2114-Installer.exe -oassets + - wget http://rosenthalcastle.org/srb2/SRB2-v2114-assets.7z -c -O $HOME/srb2_cache/SRB2-v2114-assets.7z + - 7z x $HOME/srb2_cache/SRB2-v2114-assets.7z -oassets - mkdir build - cd build - cmake .. From 41f8b25c36037270229343316d1ed26edd19c3c6 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 26 Feb 2016 01:48:11 -0500 Subject: [PATCH 331/364] travis: add verbose and server-response to wget --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index de3085828..db44edb5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ compiler: cache: directories: - - $HOME/srb2_cache + - $HOME/srb2_cache addons: apt: @@ -24,7 +24,7 @@ addons: before_script: - mkdir $HOME/srb2_cache - - wget http://rosenthalcastle.org/srb2/SRB2-v2114-assets.7z -c -O $HOME/srb2_cache/SRB2-v2114-assets.7z + - wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2114-assets.7z -O $HOME/srb2_cache/SRB2-v2114-assets.7z - 7z x $HOME/srb2_cache/SRB2-v2114-assets.7z -oassets - mkdir build - cd build From f5ba192f0b7c3501950e81d3d29958610ad28cf2 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 25 Feb 2016 23:31:48 -0800 Subject: [PATCH 332/364] remove extraneous va() calls --- src/dehacked.c | 2 +- src/p_setup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6f07ce8e0..b022d51e7 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1185,7 +1185,7 @@ static void readlevelheader(MYFILE *f, INT32 num) deh_warning("Level header %d: musicslot out of range (0 - 1035)\n", num); else // it's just a number { - snprintf(mapheaderinfo[num-1]->musname, 7, va("%sM", G_BuildMapName(i))); + snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num-1]->musname[6] = 0; } } diff --git a/src/p_setup.c b/src/p_setup.c index 000a3a65c..00bb4a634 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -181,7 +181,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) DEH_WriteUndoline("NEXTLEVEL", va("%d", mapheaderinfo[num]->nextlevel), UNDO_NONE); mapheaderinfo[num]->nextlevel = (INT16)(i + 1); DEH_WriteUndoline("MUSIC", mapheaderinfo[num]->musname, UNDO_NONE); - snprintf(mapheaderinfo[num]->musname, 7, va("%sM", G_BuildMapName(i))); + snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i)); mapheaderinfo[num]->musname[6] = 0; DEH_WriteUndoline("MUSICTRACK", va("%d", mapheaderinfo[num]->mustrack), UNDO_NONE); mapheaderinfo[num]->mustrack = 0; From c7ba1d15321531fe2d5ba01e6854760305e98f63 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 26 Feb 2016 18:11:12 +0000 Subject: [PATCH 333/364] Make sure target sector's lightlist is reset whenever FOF flags are changed. This fixes how removing certain flags (such as FF_EXISTS) from FOFs can cause HOMs on walls bordering their target sectors. Also fixes how the force-FOF-to-vanish linedef special can leave behind the FOF's shadow --- src/lua_maplib.c | 6 +++++- src/p_spec.c | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 38920c223..16d05dacd 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1111,9 +1111,13 @@ static int ffloor_set(lua_State *L) case ffloor_bottompic: *ffloor->bottompic = P_AddLevelFlatRuntime(luaL_checkstring(L, 3)); break; - case ffloor_flags: + case ffloor_flags: { + ffloortype_e oldflags = ffloor->flags; // store FOF's old flags ffloor->flags = luaL_checkinteger(L, 3); + if (ffloor->flags != oldflags) + ffloor->target->moved = true; // reset target sector's lightlist break; + } case ffloor_alpha: ffloor->alpha = (INT32)luaL_checkinteger(L, 3); break; diff --git a/src/p_spec.c b/src/p_spec.c index 81994d46c..2c471fa9e 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3039,6 +3039,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); sector_t *sec; // Sector that the FOF is visible (or not visible) in ffloor_t *rover; // FOF to vanish/un-vanish + ffloortype_e oldflags; // store FOF's old flags for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) { @@ -3062,11 +3063,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) return; } + oldflags = rover->flags; + // Abracadabra! if (line->flags & ML_NOCLIMB) rover->flags |= FF_EXISTS; else rover->flags &= ~FF_EXISTS; + + // if flags changed, reset sector's light list + if (rover->flags != oldflags) + sec->moved = true; } } break; From 753ee4e42a9e3ca4383d190dd36c89c37a4c1e6e Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 27 Feb 2016 14:13:49 -0600 Subject: [PATCH 334/364] Update names in credits Add me and toaster's names, change Shane's by request, and fix Randi Heit's name --- src/f_finale.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 507616f3c..c89c39cf3 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -977,6 +977,7 @@ static const char *credits[] = { "\"Monster\" Iestyn Jealous", "Ronald \"Furyhunter\" Kinard", // The SDL2 port "John \"JTE\" Muniz", + "Ehab \"Wolfy\" Saeed", "\"SSNTails\"", "Matthew \"Inuyasha\" Walsh", "", @@ -985,6 +986,7 @@ static const char *credits[] = { "\"chi.miru\"", // Red's secret weapon, the REAL reason slopes exist (also helped port drawing code from ZDoom) "Andrew \"orospakr\" Clunis", "Gregor \"Oogaland\" Dick", + "Vivian \"toaster\" Grannell", "Julio \"Chaos Zero 64\" Guir", "\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog "Matthew \"Shuffle\" Marsalko", @@ -1001,6 +1003,7 @@ static const char *credits[] = { "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", "Andrew \"Senku Niola\" Moran", + "Vivian \"toaster\" Grannell", "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", "", @@ -1020,7 +1023,7 @@ static const char *credits[] = { "\"Monster\" Iestyn Jealous", "Jarel \"Arrow\" Jones", "Stefan \"Stuf\" Rimalia", - "Shane Strife", + "Shane Mychal Sexton", "\"Spazzo\"", "David \"Big Wave Dave\" Spencer Sr.", "David \"Instant Sonic\" Spencer Jr.", @@ -1033,6 +1036,7 @@ static const char *credits[] = { "Sherman \"CoatRack\" DesJardins", "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", + "Vivian \"toaster\" Grannell", "Dan \"Blitzzo\" Hagerstrand", "Kepa \"Nev3r\" Iceta", "Thomas \"Shadow Hog\" Igoe", @@ -1069,7 +1073,7 @@ static const char *credits[] = { "iD Software", "Alex \"MistaED\" Fuller", "FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak - "Randy Heit ()", // For his MSPaint sprite that we nicked + "Randi Heit ()", // For their MSPaint sprite that we nicked "", "\1Produced By", "Sonic Team Junior", From c3166e40b0010fa9c6748875c8e1bfc9551cbc2f Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 27 Feb 2016 14:27:14 -0600 Subject: [PATCH 335/364] Update names in credits Same as the commit in internal, minus toaster's name (by request, of course.) --- src/f_finale.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 507616f3c..2a1e5cce2 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -977,6 +977,7 @@ static const char *credits[] = { "\"Monster\" Iestyn Jealous", "Ronald \"Furyhunter\" Kinard", // The SDL2 port "John \"JTE\" Muniz", + "Ehab \"Wolfy\" Saeed", "\"SSNTails\"", "Matthew \"Inuyasha\" Walsh", "", @@ -1020,7 +1021,7 @@ static const char *credits[] = { "\"Monster\" Iestyn Jealous", "Jarel \"Arrow\" Jones", "Stefan \"Stuf\" Rimalia", - "Shane Strife", + "Shane Mychal Sexton", "\"Spazzo\"", "David \"Big Wave Dave\" Spencer Sr.", "David \"Instant Sonic\" Spencer Jr.", @@ -1069,7 +1070,7 @@ static const char *credits[] = { "iD Software", "Alex \"MistaED\" Fuller", "FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak - "Randy Heit ()", // For his MSPaint sprite that we nicked + "Randi Heit ()", // For their MSPaint sprite that we nicked "", "\1Produced By", "Sonic Team Junior", From fdb4ac5c2e7b7b0aed0cc8abf9fb5713a9d24595 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 28 Feb 2016 18:19:46 -0800 Subject: [PATCH 336/364] Super color code cleaning, speed 50%, nothing special --- src/g_game.c | 6 ++---- src/p_user.c | 23 +++++------------------ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e2ed1e792..f27da994b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4336,10 +4336,8 @@ void G_GhostTicker(void) switch(g->color) { case GHC_SUPER: // Super Sonic (P_DoSuperStuff) - if (leveltime % 9 < 5) - g->mo->color = SKINCOLOR_SUPER1 + leveltime % 9; - else - g->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9; + g->mo->color = SKINCOLOR_SUPER1; + g->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4); break; case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); diff --git a/src/p_user.c b/src/p_user.c index 530a6068e..96907fe51 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3437,27 +3437,14 @@ static void P_DoSuperStuff(player_t *player) player->mo->health--; } + // future todo: a skin option for this, and possibly more colors switch (player->skin) { - case 1: // Golden orange supertails. - if (leveltime % 9 < 5) - player->mo->color = SKINCOLOR_TSUPER1 + leveltime % 9; - else - player->mo->color = SKINCOLOR_TSUPER1 + 9 - leveltime % 9; - break; - case 2: // Pink superknux. - if (leveltime % 9 < 5) - player->mo->color = SKINCOLOR_KSUPER1 + leveltime % 9; - else - player->mo->color = SKINCOLOR_KSUPER1 + 9 - leveltime % 9; - break; - default: // Yousa yellow now! - if (leveltime % 9 < 5) - player->mo->color = SKINCOLOR_SUPER1 + leveltime % 9; - else - player->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9; - break; + case 1: /* Tails */ player->mo->color = SKINCOLOR_TSUPER1; break; + case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break; + default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break; } + player->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4); if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) From e2b3adc04f73663659afad9a8b42b87a9778055d Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 28 Feb 2016 18:21:37 -0800 Subject: [PATCH 337/364] Randy Heit -> Randi Heit --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 466e208a5..9c3da5a68 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1068,7 +1068,7 @@ static const char *credits[] = { "iD Software", "Alex \"MistaED\" Fuller", "FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak - "Randy Heit ()", // For his MSPaint sprite that we nicked + "Randi Heit ()", // For their MSPaint sprite that we nicked "", "\1Produced By", "Sonic Team Junior", From 3a045c4cc94460a059048c5d6acf3d98d844bb9e Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 28 Feb 2016 23:30:52 -0800 Subject: [PATCH 338/364] Fix the green text after reduced pal changes --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index a6919c0f0..a07aeea39 100644 --- a/src/console.c +++ b/src/console.c @@ -310,7 +310,7 @@ static void CON_SetupBackColormap(void) yellowmap[9] = (UINT8)66; purplemap[3] = (UINT8)184; purplemap[9] = (UINT8)186; - lgreenmap[3] = (UINT8)102; + lgreenmap[3] = (UINT8)98; lgreenmap[9] = (UINT8)106; bluemap[3] = (UINT8)147; bluemap[9] = (UINT8)158; From ffa9a4e056a7ad2117eca8155285931f92f13cd4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 2 Oct 2015 13:45:51 +0100 Subject: [PATCH 339/364] Removed the removal of SF_SUPER from skins other than Sonic # Conflicts: # src/r_things.c --- src/r_things.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 2a3f8e771..bdc6c4760 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2698,9 +2698,6 @@ next_token: } free(buf2); - // Not in vanilla, you don't. - skin->flags &= ~SF_SUPER; - lump++; // if no sprite defined use spirte just after this one if (skin->sprite[0] == '\0') { From fc35c8557e97e64c17718f5ceee7d8f0190b9246 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sun, 28 Feb 2016 18:19:46 -0800 Subject: [PATCH 340/364] Super color code cleaning, speed 50%, nothing special --- src/g_game.c | 6 ++---- src/p_user.c | 23 +++++------------------ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 72cfe4a57..dda8793bb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4326,10 +4326,8 @@ void G_GhostTicker(void) switch(g->color) { case GHC_SUPER: // Super Sonic (P_DoSuperStuff) - if (leveltime % 9 < 5) - g->mo->color = SKINCOLOR_SUPER1 + leveltime % 9; - else - g->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9; + g->mo->color = SKINCOLOR_SUPER1; + g->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4); break; case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer) g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS); diff --git a/src/p_user.c b/src/p_user.c index da65b7cb4..89b530c35 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3442,27 +3442,14 @@ static void P_DoSuperStuff(player_t *player) player->mo->health--; } + // future todo: a skin option for this, and possibly more colors switch (player->skin) { - case 1: // Golden orange supertails. - if (leveltime % 9 < 5) - player->mo->color = SKINCOLOR_TSUPER1 + leveltime % 9; - else - player->mo->color = SKINCOLOR_TSUPER1 + 9 - leveltime % 9; - break; - case 2: // Pink superknux. - if (leveltime % 9 < 5) - player->mo->color = SKINCOLOR_KSUPER1 + leveltime % 9; - else - player->mo->color = SKINCOLOR_KSUPER1 + 9 - leveltime % 9; - break; - default: // Yousa yellow now! - if (leveltime % 9 < 5) - player->mo->color = SKINCOLOR_SUPER1 + leveltime % 9; - else - player->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9; - break; + case 1: /* Tails */ player->mo->color = SKINCOLOR_TSUPER1; break; + case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break; + default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break; } + player->mo->color += abs( ( ( leveltime >> 1 ) % 9) - 4); if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN)) && !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy)) From ab288a7d1a76f2d79ea7136024902891b7b8c328 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Tue, 1 Mar 2016 17:48:10 -0600 Subject: [PATCH 341/364] Allow Lua to read VERSION, SUBVERSION, and VERSIONSTRING constants --- src/dehacked.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index d6a1881e6..955937983 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6941,6 +6941,8 @@ struct { {"PUSHACCEL",PUSHACCEL}, {"MODID",MODID}, // I don't know, I just thought it would be cool for a wad to potentially know what mod it was loaded into. {"CODEBASE",CODEBASE}, // or what release of SRB2 this is. + {"VERSION",VERSION}, // Grab the game's version! + {"SUBVERSION",SUBVERSION}, // more precise version number // Special linedef executor tag numbers! {"LE_PINCHPHASE",LE_PINCHPHASE}, // A boss entered pinch phase (and, in most cases, is preparing their pinch phase attack!) @@ -8213,6 +8215,9 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"gravity")) { lua_pushinteger(L, gravity); return 1; + } else if (fastcmp(word,"VERSIONSTRING")) { + lua_pushstring(L, VERSIONSTRING); + return 1; } return 0; From 7349cbdbc0c16fe1e6d572de70244bb458633654 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 3 Mar 2016 02:54:07 -0800 Subject: [PATCH 342/364] Backwards compatibility. A test WAD for all possible use cases I can think of can be found here: https://dl.dropboxusercontent.com/u/3518218/21/secret/bc_test.wad --- src/dehacked.c | 110 ++++++++++++++++++++++++++++++++++++++++------ src/doomdef.h | 4 ++ src/lua_baselib.c | 42 ++++++++++++++++++ src/s_sound.c | 22 ++++++++++ src/s_sound.h | 6 +++ 5 files changed, 171 insertions(+), 13 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index b022d51e7..3ab377065 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -65,6 +65,9 @@ static mobjtype_t get_mobjtype(const char *word); static statenum_t get_state(const char *word); static spritenum_t get_sprite(const char *word); static sfxenum_t get_sfx(const char *word); +#ifdef MUSICSLOT_COMPATIBILITY +static UINT16 get_mus(const char *word, UINT8 dehacked_mode); +#endif static hudnum_t get_huditem(const char *word); #ifndef HAVE_BLUA static powertype_t get_power(const char *word); @@ -1173,22 +1176,19 @@ static void readlevelheader(MYFILE *f, INT32 num) sizeof(mapheaderinfo[num-1]->musname), va("Level header %d: music", num)); } } +#ifdef MUSICSLOT_COMPATIBILITY else if (fastcmp(word, "MUSICSLOT")) - { // Backwards compatibility? - // Convert to map number - if (word2[0] >= 'A' && word2[0] <= 'Z' && word2[2] == '\0') - i = M_MapNumber(word2[0], word2[1]); - - if (!i) - mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string - else if (i > 1035) - deh_warning("Level header %d: musicslot out of range (0 - 1035)\n", num); - else // it's just a number - { + { + i = get_mus(word2, true); + if (i && i <= 1035) snprintf(mapheaderinfo[num-1]->musname, 7, "%sM", G_BuildMapName(i)); - mapheaderinfo[num-1]->musname[6] = 0; - } + else if (i && i <= 1050) + strncpy(mapheaderinfo[num-1]->musname, compat_special_music_slots[i - 1036], 7); + else + mapheaderinfo[num-1]->musname[0] = 0; // becomes empty string + mapheaderinfo[num-1]->musname[6] = 0; } +#endif else if (fastcmp(word, "MUSICTRACK")) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); else if (fastcmp(word, "FORCECHARACTER")) @@ -1463,6 +1463,20 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7); cutscenes[num]->scene[scenenum].musswitch[6] = 0; } +#ifdef MUSICSLOT_COMPATIBILITY + else if (fastcmp(word, "MUSICSLOT")) + { + DEH_WriteUndoline(word, cutscenes[num]->scene[scenenum].musswitch, UNDO_NONE); + i = get_mus(word2, true); + if (i && i <= 1035) + snprintf(cutscenes[num]->scene[scenenum].musswitch, 7, "%sM", G_BuildMapName(i)); + else if (i && i <= 1050) + strncpy(cutscenes[num]->scene[scenenum].musswitch, compat_special_music_slots[i - 1036], 7); + else + cutscenes[num]->scene[scenenum].musswitch[0] = 0; // becomes empty string + cutscenes[num]->scene[scenenum].musswitch[6] = 0; + } +#endif else if (fastcmp(word, "MUSICTRACK")) { DEH_WriteUndoline(word, va("%u", cutscenes[num]->scene[scenenum].musswitchflags), UNDO_NONE); @@ -7978,6 +7992,46 @@ static sfxenum_t get_sfx(const char *word) return sfx_None; } +#ifdef MUSICSLOT_COMPATIBILITY +static UINT16 get_mus(const char *word, UINT8 dehacked_mode) +{ // Returns the value of MUS_ enumerations + UINT16 i; + char lumptmp[4]; + + if (*word >= '0' && *word <= '9') + return atoi(word); + if (!word[2] && toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z') + return (UINT16)M_MapNumber(word[0], word[1]); + + if (fastncmp("MUS_",word,4)) + word += 4; // take off the MUS_ + else if (fastncmp("O_",word,2) || fastncmp("D_",word,2)) + word += 2; // take off the O_ or D_ + + strncpy(lumptmp, word, 4); + lumptmp[3] = 0; + if (fasticmp("MAP",lumptmp)) + { + word += 3; + if (toupper(word[0]) >= 'A' && toupper(word[0]) <= 'Z') + return (UINT16)M_MapNumber(word[0], word[1]); + else if ((i = atoi(word))) + return i; + + word -= 3; + if (dehacked_mode) + deh_warning("Couldn't find music named 'MUS_%s'",word); + return 0; + } + for (i = 0; compat_special_music_slots[i][0]; ++i) + if (fasticmp(word, compat_special_music_slots[i])) + return i + 1036; + if (dehacked_mode) + deh_warning("Couldn't find music named 'MUS_%s'",word); + return 0; +} +#endif + static hudnum_t get_huditem(const char *word) { // Returns the value of HUD_ enumerations hudnum_t i; @@ -8176,6 +8230,13 @@ static fixed_t find_const(const char **rword) free(word); return r; } +#ifdef MUSICSLOT_COMPATIBILITY + else if (fastncmp("MUS_",word,4) || fastncmp("O_",word,2)) { + r = get_mus(word, true); + free(word); + return r; + } +#endif else if (fastncmp("PW_",word,3)) { r = get_power(word); free(word); @@ -8545,6 +8606,29 @@ static inline int lib_getenum(lua_State *L) if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word); return 0; } +#ifdef MUSICSLOT_COMPATIBILITY + else if (!mathlib && fastncmp("mus_",word,4)) { + p = word+4; + if ((i = get_mus(p, false)) == 0) + return 0; + lua_pushinteger(L, i); + return 1; + } + else if (mathlib && fastncmp("MUS_",word,4)) { // SOCs are ALL CAPS! + p = word+4; + if ((i = get_mus(p, false)) == 0) + return luaL_error(L, "music '%s' could not be found.\n", word); + lua_pushinteger(L, i); + return 1; + } + else if (mathlib && (fastncmp("O_",word,2) || fastncmp("D_",word,2))) { + p = word+2; + if ((i = get_mus(p, false)) == 0) + return luaL_error(L, "music '%s' could not be found.\n", word); + lua_pushinteger(L, i); + return 1; + } +#endif else if (!mathlib && fastncmp("pw_",word,3)) { p = word+3; for (i = 0; i < NUMPOWERS; i++) diff --git a/src/doomdef.h b/src/doomdef.h index 8935eb117..0fc4a1fea 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -490,4 +490,8 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.) //#define REDSANALOG +/// Backwards compatibility with musicslots. +/// \note You should leave this enabled unless you're working with a future SRB2 version. +#define MUSICSLOT_COMPATIBILITY + #endif // __DOOMDEF__ diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 386270959..c415eecb8 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1636,17 +1636,59 @@ static int lib_sStopSound(lua_State *L) static int lib_sChangeMusic(lua_State *L) { +#ifdef MUSICSLOT_COMPATIBILITY + const char *music_name; + UINT32 music_num; + char music_compat_name[7]; + + boolean looping; + player_t *player = NULL; + UINT16 music_flags = 0; + NOHUD + + if (lua_isnumber(L, 1)) + { + music_num = (UINT32)luaL_checkinteger(L, 1); + music_flags = (UINT16)(music_num & 0x0000FFFF); + if (music_flags && music_flags <= 1035) + snprintf(music_compat_name, 7, "%sM", G_BuildMapName((INT32)music_flags)); + else if (music_flags && music_flags <= 1050) + strncpy(music_compat_name, compat_special_music_slots[music_flags - 1036], 7); + else + music_compat_name[0] = 0; // becomes empty string + music_compat_name[6] = 0; + music_name = (const char *)&music_compat_name; + music_flags = 0; + } + else + { + music_num = 0; + music_name = luaL_checkstring(L, 1); + } + + + looping = (boolean)lua_opttrueboolean(L, 2); + +#else const char *music_name = luaL_checkstring(L, 1); boolean looping = (boolean)lua_opttrueboolean(L, 2); player_t *player = NULL; UINT16 music_flags = 0; NOHUD + +#endif if (!lua_isnone(L, 3) && lua_isuserdata(L, 3)) { player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER)); if (!player) return LUA_ErrInvalid(L, "player_t"); } + +#ifdef MUSICSLOT_COMPATIBILITY + if (music_num) + music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16); + else +#endif music_flags = (UINT16)luaL_optinteger(L, 4, 0); if (!player || P_IsLocalPlayer(player)) diff --git a/src/s_sound.c b/src/s_sound.c index 1e5f79aa0..49373d94c 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1155,6 +1155,28 @@ void S_StartSoundName(void *mo, const char *soundname) /// Music /// ------------------------ +#ifdef MUSICSLOT_COMPATIBILITY +const char *compat_special_music_slots[16] = +{ + "titles", // 1036 title screen + "read_m", // 1037 intro + "lclear", // 1038 level clear + "invinc", // 1039 invincibility + "shoes", // 1040 super sneakers + "minvnc", // 1041 Mario invincibility + "drown", // 1042 drowning + "gmover", // 1043 game over + "xtlife", // 1044 extra life + "contsc", // 1045 continue screen + "supers", // 1046 Super Sonic + "chrsel", // 1047 character select + "credit", // 1048 credits + "racent", // 1049 Race Results + "stjr", // 1050 Sonic Team Jr. Presents + "" +}; +#endif + #define music_playing (music_name[0]) // String is empty if no music is playing static char music_name[7]; // up to 6-character name diff --git a/src/s_sound.h b/src/s_sound.h index 12787536b..d5cf3570d 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -139,4 +139,10 @@ void S_StopSoundByNum(sfxenum_t sfxnum); #define S_StartScreamSound S_StartSound #endif +#ifdef MUSICSLOT_COMPATIBILITY +// For compatibility with code/scripts relying on older versions +// This is a list of all the "special" slot names and their associated numbers +const char *compat_special_music_slots[16]; +#endif + #endif From 61a0d1bcd162062e43d35a87b8ba539c27187e3c Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 3 Mar 2016 03:09:35 -0800 Subject: [PATCH 343/364] don't use lstring you have space for a null terminator there... --- src/lua_maplib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 5f77b2b5c..e7801d773 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1169,7 +1169,7 @@ static int mapheaderinfo_get(lua_State *L) else if (fastcmp(field,"nextlevel")) lua_pushinteger(L, header->nextlevel); else if (fastcmp(field,"musname")) - lua_pushlstring(L, header->musname, 6); + lua_pushstring(L, header->musname); else if (fastcmp(field,"mustrack")) lua_pushinteger(L, header->mustrack); else if (fastcmp(field,"forcecharacter")) From 4f9bb15e4db743221622b421a5ee7828229e9917 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 3 Mar 2016 18:31:17 +0000 Subject: [PATCH 344/364] "Loading SOC from" console message now also displays the name of the SOC_ lump --- src/w_wad.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index dc994e848..132df8fcb 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -32,6 +32,7 @@ #include "w_wad.h" #include "z_zone.h" +#include "fastcmp.h" #include "i_video.h" // rendermode #include "d_netfil.h" @@ -151,8 +152,16 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum) lumpinfo_t *lump_p = wadfiles[wadnum]->lumpinfo; for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++) if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump - { - CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfiles[wadnum]->filename); + { // shameless copy+paste of code from LUA_LoadLump + char *name = malloc(strlen(wadfiles[wadnum]->filename)+10); + strcpy(name, wadfiles[wadnum]->filename); + if (!fasticmp(&name[strlen(name) - 4], ".soc")) { + // If it's not a .soc file, copy the lump name in too. + name[strlen(wadfiles[wadnum]->filename)] = '|'; + M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8); + name[strlen(wadfiles[wadnum]->filename)+9] = '\0'; + } + CONS_Printf(M_GetText("Loading SOC from %s\n"), name); DEH_LoadDehackedLumpPwad(wadnum, lump); } else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG From 0b704ba6188ee47763ab682c64b0d43138152846 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Thu, 3 Mar 2016 17:07:05 -0500 Subject: [PATCH 345/364] Updated NetArchiveHook to lua_hooklib.c Fixes I_Assert failure crash due to hooks working differently now. --- src/lua_hooklib.c | 24 ++++++++++++++++++++++++ src/lua_script.c | 28 +++------------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 0415d23e6..4a3325cf1 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -768,4 +768,28 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) return hooked; } +void LUAh_NetArchiveHook(lua_CFunction archFunc) +{ + hook_p hookp; + + if (!gL || !(hooksAvailable[hook_NetVars/8] & (1<<(hook_NetVars%8)))) + return; + + // stack: tables + I_Assert(lua_gettop(gL) > 0); + I_Assert(lua_istable(gL, -1)); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_NetVars) + { + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -2); // tables + LUA_Call(gL, 1); + } + + // pop tables + lua_pop(gL, 1); +} + #endif diff --git a/src/lua_script.c b/src/lua_script.c index a7315ad62..2e076b024 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -915,29 +915,7 @@ static void UnArchiveTables(void) } } -static void NetArchiveHook(lua_CFunction archFunc) -{ - int TABLESINDEX; - - if (!gL) - return; - - TABLESINDEX = lua_gettop(gL); - lua_getfield(gL, LUA_REGISTRYINDEX, "hook"); - I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, hook_NetVars); - lua_remove(gL, -2); - I_Assert(lua_istable(gL, -1)); - - lua_pushvalue(gL, TABLESINDEX); - lua_pushcclosure(gL, archFunc, 1); - lua_pushnil(gL); - while (lua_next(gL, -3) != 0) { - lua_pushvalue(gL, -3); // function - LUA_Call(gL, 1); - } - lua_pop(gL, 2); -} +void LUAh_NetArchiveHook(lua_CFunction archFunc); void LUA_Step(void) { @@ -972,7 +950,7 @@ void LUA_Archive(void) } WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum. - NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode + LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode ArchiveTables(); if (gL) @@ -1003,7 +981,7 @@ void LUA_UnArchive(void) UnArchiveExtVars(th); // apply variables } while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker. - NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode + LUAh_NetArchiveHook(NetUnArchive); // call the NetArchive hook in unarchive mode UnArchiveTables(); if (gL) From 7ae871c7f860d2d76294a3c78379a1124d8af0e2 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Thu, 3 Mar 2016 17:19:21 -0500 Subject: [PATCH 346/364] Fix errenous stack pop. This function is intended to leave the stack in the same state it recieved it. --- src/lua_hooklib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 4a3325cf1..01d4314c8 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -788,8 +788,7 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc) LUA_Call(gL, 1); } - // pop tables - lua_pop(gL, 1); + // stack: tables } #endif From 0bdc976d50038db25386290339eb1c959d43dd04 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Thu, 3 Mar 2016 17:19:35 -0500 Subject: [PATCH 347/364] Shut up compiler warning. --- src/lua_hooklib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 01d4314c8..48c6df6d2 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -24,6 +24,8 @@ #include "lua_hook.h" #include "lua_hud.h" // hud_running errors +void LUAh_NetArchiveHook(lua_CFunction archFunc); + static UINT8 hooksAvailable[(hook_MAX/8)+1]; const char *const hookNames[hook_MAX+1] = { From 9d6e75ae4f625cb5330b627b1777ef279e0344d9 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Thu, 3 Mar 2016 17:30:10 -0500 Subject: [PATCH 348/364] Cleanup LUAh_NetArchiveHook prototype mess. --- src/lua_hooklib.c | 2 -- src/lua_script.c | 2 -- src/lua_script.h | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 48c6df6d2..01d4314c8 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -24,8 +24,6 @@ #include "lua_hook.h" #include "lua_hud.h" // hud_running errors -void LUAh_NetArchiveHook(lua_CFunction archFunc); - static UINT8 hooksAvailable[(hook_MAX/8)+1]; const char *const hookNames[hook_MAX+1] = { diff --git a/src/lua_script.c b/src/lua_script.c index 2e076b024..9925bac02 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -915,8 +915,6 @@ static void UnArchiveTables(void) } } -void LUAh_NetArchiveHook(lua_CFunction archFunc); - void LUA_Step(void) { if (!gL) diff --git a/src/lua_script.h b/src/lua_script.h index 292160a0b..ec67703c3 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -55,6 +55,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c void LUA_CVarChanged(const char *name); // lua_consolelib.c int Lua_optoption(lua_State *L, int narg, const char *def, const char *const lst[]); +void LUAh_NetArchiveHook(lua_CFunction archFunc); // Console wrapper void COM_Lua_f(void); From b368936b03b3e65e7cb8c5fdf417660806fc05cc Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Thu, 3 Mar 2016 17:30:46 -0500 Subject: [PATCH 349/364] Fix bad logic in LUAh_NetArchiveHook rewrite... Argh, I knew I was forgetting something! archFunc is the argument to be passed to the hooks, not tables! --- src/lua_hooklib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 01d4314c8..5230886a8 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -779,15 +779,21 @@ void LUAh_NetArchiveHook(lua_CFunction archFunc) I_Assert(lua_gettop(gL) > 0); I_Assert(lua_istable(gL, -1)); + // tables becomes an upvalue of archFunc + lua_pushvalue(gL, -1); + lua_pushcclosure(gL, archFunc, 1); + // stack: tables, archFunc + for (hookp = roothook; hookp; hookp = hookp->next) if (hookp->type == hook_NetVars) { lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_gettable(gL, LUA_REGISTRYINDEX); - lua_pushvalue(gL, -2); // tables + lua_pushvalue(gL, -2); // archFunc LUA_Call(gL, 1); } + lua_pop(gL, 1); // pop archFunc // stack: tables } From b96de7705018251e7c213ab50bfd100cab1641d1 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 3 Mar 2016 20:54:19 -0600 Subject: [PATCH 350/364] Fix sorting on toaster's name --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index c89c39cf3..d47b8e988 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1002,8 +1002,8 @@ static const char *credits[] = { "Jim \"MotorRoach\" DeMello", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", - "Andrew \"Senku Niola\" Moran", "Vivian \"toaster\" Grannell", + "Andrew \"Senku Niola\" Moran", "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", "", From c7b18207f5d338a6d3155844092dcb77de52a6e0 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Mon, 7 Mar 2016 16:06:04 -0500 Subject: [PATCH 351/364] travis: do not error on making cache folder, if it already restored from cache --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index db44edb5d..c652584f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ addons: - p7zip-full before_script: - - mkdir $HOME/srb2_cache + - mkdir -p $HOME/srb2_cache - wget --verbose --server-response -c http://rosenthalcastle.org/srb2/SRB2-v2114-assets.7z -O $HOME/srb2_cache/SRB2-v2114-assets.7z - 7z x $HOME/srb2_cache/SRB2-v2114-assets.7z -oassets - mkdir build From 694220155e26e63af242fa9ff457d34261425ca3 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 8 Mar 2016 21:30:12 -0800 Subject: [PATCH 352/364] Revert "MF2_PUSHED is now MFE_PUSHED, for the simple reason that it makes more sense as an eflags object flag than a flags2 object flag!" This reverts commit c8c7878005f79e87f7c0cfa5e0a2f42a53d68758. # Conflicts: # src/dehacked.c # src/p_mobj.c # src/p_mobj.h --- src/dehacked.c | 2 +- src/p_mobj.c | 3 ++- src/p_mobj.h | 38 +++++++++++++++++++------------------- src/p_spec.c | 18 +++++++++--------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index c21e8fb99..60f3b0592 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6684,6 +6684,7 @@ static const char *const MOBJFLAG2_LIST[] = { "EXPLOSION", // Thrown ring has explosive properties "SCATTER", // Thrown ring has scatter properties "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. + "PUSHED", // Mobj was already pushed this tic "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. "CLASSICPUSH", // Drops straight down when object has negative Z. "STANDONME", // While not pushable, stand on me anyway. @@ -6712,7 +6713,6 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water - "PUSHED", // Mobj was already pushed this tic "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_mobj.c b/src/p_mobj.c index d2454f267..cb9bc775a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6083,7 +6083,8 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->tracer && P_MobjWasRemoved(mobj->tracer)) P_SetTarget(&mobj->tracer, NULL); - mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG); + mobj->flags2 &= ~MF2_PUSHED; + mobj->eflags &= ~MFE_SPRUNG; tmfloorthing = tmhitthing = NULL; diff --git a/src/p_mobj.h b/src/p_mobj.h index 6198f5bec..e24b09652 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -175,23 +175,24 @@ typedef enum MF2_EXPLOSION = 1<<7, // Thrown ring has explosive properties MF2_SCATTER = 1<<8, // Thrown ring has scatter properties MF2_BEYONDTHEGRAVE = 1<<9, // Source of this missile has died and has since respawned. - MF2_SLIDEPUSH = 1<<10, // MF_PUSHABLE that pushes continuously. - MF2_CLASSICPUSH = 1<<11, // Drops straight down when object has negative Z. - MF2_STANDONME = 1<<12, // While not pushable, stand on me anyway. - MF2_INFLOAT = 1<<13, // Floating to a height for a move, don't auto float to target's height. - MF2_DEBRIS = 1<<14, // Splash ring from explosion ring - MF2_NIGHTSPULL = 1<<15, // Attracted from a paraloop - MF2_JUSTATTACKED = 1<<16, // can be pushed by other moving mobjs - MF2_FIRING = 1<<17, // turret fire - MF2_SUPERFIRE = 1<<18, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. - MF2_SHADOW = 1<<19, // Fuzzy draw, makes targeting harder. - MF2_STRONGBOX = 1<<20, // Flag used for "strong" random monitors. - MF2_OBJECTFLIP = 1<<21, // Flag for objects that always have flipped gravity. - MF2_SKULLFLY = 1<<22, // Special handling: skull in flight. - MF2_FRET = 1<<23, // Flashing from a previous hit - MF2_BOSSNOTRAP = 1<<24, // No Egg Trap after boss - MF2_BOSSFLEE = 1<<25, // Boss is fleeing! - MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + MF2_PUSHED = 1<<10, // Mobj was already pushed this tic + MF2_SLIDEPUSH = 1<<11, // MF_PUSHABLE that pushes continuously. + MF2_CLASSICPUSH = 1<<12, // Drops straight down when object has negative Z. + MF2_STANDONME = 1<<13, // While not pushable, stand on me anyway. + MF2_INFLOAT = 1<<14, // Floating to a height for a move, don't auto float to target's height. + MF2_DEBRIS = 1<<15, // Splash ring from explosion ring + MF2_NIGHTSPULL = 1<<16, // Attracted from a paraloop + MF2_JUSTATTACKED = 1<<17, // can be pushed by other moving mobjs + MF2_FIRING = 1<<18, // turret fire + MF2_SUPERFIRE = 1<<19, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. + MF2_SHADOW = 1<<20, // Fuzzy draw, makes targeting harder. + MF2_STRONGBOX = 1<<21, // Flag used for "strong" random monitors. + MF2_OBJECTFLIP = 1<<22, // Flag for objects that always have flipped gravity. + MF2_SKULLFLY = 1<<23, // Special handling: skull in flight. + MF2_FRET = 1<<24, // Flashing from a previous hit + MF2_BOSSNOTRAP = 1<<25, // No Egg Trap after boss + MF2_BOSSFLEE = 1<<26, // Boss is fleeing! + MF2_BOSSDEAD = 1<<27, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) // free: to and including 1<<31 } mobjflag2_t; @@ -231,8 +232,7 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // Mobj was already pushed this tic - MFE_PUSHED = 1<<7, + // free: to and including 1<<7 // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement diff --git a/src/p_spec.c b/src/p_spec.c index f9fa5f1f1..34b779068 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6468,7 +6468,7 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv thing->momy += dy; if (exclusive) - thing->eflags |= MFE_PUSHED; + thing->flags2 |= MF2_PUSHED; } /** Processes an active scroller. @@ -6572,7 +6572,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->eflags & MFE_PUSHED) // Already pushed this tic by an exclusive pusher. + if (thing->flags2 & MF2_PUSHED) // Already pushed this tic by an exclusive pusher. continue; height = P_GetSpecialBottomZ(thing, sec, psec); @@ -6594,7 +6594,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->eflags & MFE_PUSHED) + if (thing->flags2 & MF2_PUSHED) continue; height = P_GetSpecialBottomZ(thing, sec, sec); @@ -6635,7 +6635,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->eflags & MFE_PUSHED) + if (thing->flags2 & MF2_PUSHED) continue; height = P_GetSpecialTopZ(thing, sec, psec); @@ -6657,7 +6657,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->eflags & MFE_PUSHED) + if (thing->flags2 & MF2_PUSHED) continue; height = P_GetSpecialTopZ(thing, sec, sec); @@ -7140,7 +7140,7 @@ static pusher_t *tmpusher; // pusher structure for blockmap searches */ static inline boolean PIT_PushThing(mobj_t *thing) { - if (thing->eflags & MFE_PUSHED) + if (thing->flags2 & MF2_PUSHED) return false; if (thing->player && thing->player->pflags & PF_ROPEHANG) @@ -7270,7 +7270,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) } if (tmpusher->exclusive) - thing->eflags |= MFE_PUSHED; + thing->flags2 |= MF2_PUSHED; return true; } @@ -7373,7 +7373,7 @@ void T_Pusher(pusher_t *p) || thing->type == MT_BIGTUMBLEWEED)) continue; - if (thing->eflags & MFE_PUSHED) + if (thing->flags2 & MF2_PUSHED) continue; if (thing->player && thing->player->pflags & PF_ROPEHANG) @@ -7540,7 +7540,7 @@ void T_Pusher(pusher_t *p) } if (p->exclusive) - thing->eflags |= MFE_PUSHED; + thing->flags2 |= MF2_PUSHED; } } } From cfcd7ce0d3959bcce0e8e00cc504b1354451cb50 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 8 Mar 2016 22:15:26 -0800 Subject: [PATCH 353/364] Readded EvalMath to Lua. There is a caveat to this: The first time EvalMath is used, a deprecated function warning will be shown to the user that tells them to use _G[] instead. This reverts commit 9d36cf37bd6fc1e5e0e9770031925db3a92a9929. --- src/lua_baselib.c | 9 +++++++++ src/lua_script.h | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index c415eecb8..2cc79db47 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -85,6 +85,14 @@ static int lib_print(lua_State *L) return 0; } +static int lib_evalMath(lua_State *L) +{ + const char *word = luaL_checkstring(L, 1); + LUA_Deprecated(L, "EvalMath(string)", "_G[string]"); + lua_pushinteger(L, LUA_EvalMath(word)); + return 1; +} + // M_RANDOM ////////////// @@ -1899,6 +1907,7 @@ static int lib_gTicsToMilliseconds(lua_State *L) static luaL_Reg lib[] = { {"print", lib_print}, + {"EvalMath", lib_evalMath}, // m_random {"P_Random",lib_pRandom}, diff --git a/src/lua_script.h b/src/lua_script.h index ec67703c3..96f832e2c 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -70,4 +70,15 @@ void COM_Lua_f(void); #define LUA_ErrInvalid(L, type) luaL_error(L, "accessed " type " doesn't exist anymore, please check 'valid' before using " type "."); +// Deprecation warnings +// Shows once upon use. Then doesn't show again. +#define LUA_Deprecated(L,this_func,use_instead)\ +{\ + static UINT8 seen = 0;\ + if (!seen) {\ + seen = 1;\ + CONS_Alert(CONS_WARNING,"\"%s\" is deprecated and will be removed.\nUse \"%s\" instead.\n", this_func, use_instead);\ + }\ +} + #endif From 7ae87cc2c66de2e3a23490bb090caa9febec43f8 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 8 Mar 2016 22:22:30 -0800 Subject: [PATCH 354/364] Revert "No more stupidity for No More Enemies special plz" This reverts commit 474ad01b46ddfc1983203ed006532eed403b6fa2. --- src/p_floor.c | 66 ++++++++++++++++++--------------------------------- src/p_spec.c | 1 - 2 files changed, 23 insertions(+), 44 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index b8d3f7b5e..cacaadf81 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1973,71 +1973,51 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies) { size_t i; fixed_t upperbound, lowerbound; - sector_t *sec = NULL; - sector_t *targetsec = NULL; - INT32 secnum = -1; + INT32 s; + sector_t *checksector; msecnode_t *node; mobj_t *thing; - boolean FOFsector = false; + boolean exists = false; - while ((secnum = P_FindSectorFromLineTag(nobaddies->sourceline, secnum)) >= 0) + for (i = 0; i < nobaddies->sector->linecount; i++) { - sec = §ors[secnum]; - - FOFsector = false; - - // Check the lines of this sector, to see if it is a FOF control sector. - for (i = 0; i < sec->linecount; i++) + if (nobaddies->sector->lines[i]->special == 223) { - INT32 targetsecnum = -1; - if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) - continue; + upperbound = nobaddies->sector->ceilingheight; + lowerbound = nobaddies->sector->floorheight; - FOFsector = true; - - while ((targetsecnum = P_FindSectorFromLineTag(sec->lines[i], targetsecnum)) >= 0) + for (s = -1; (s = P_FindSectorFromLineTag(nobaddies->sector->lines[i], s)) >= 0 ;) { - targetsec = §ors[targetsecnum]; + checksector = §ors[s]; - upperbound = targetsec->ceilingheight; - lowerbound = targetsec->floorheight; - node = targetsec->touching_thinglist; // things touching this sector + node = checksector->touching_thinglist; // things touching this sector while (node) { thing = node->m_thing; if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 - && thing->z < upperbound && thing->z+thing->height > lowerbound) - return; + && thing->z < upperbound && thing->z+thing->height > lowerbound) + { + exists = true; + goto foundenemy; + } node = node->m_snext; } } } - - if (!FOFsector) - { - upperbound = sec->ceilingheight; - lowerbound = sec->floorheight; - node = sec->touching_thinglist; // things touching this sector - while (node) - { - thing = node->m_thing; - - if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 - && thing->z < upperbound && thing->z+thing->height > lowerbound) - return; - - node = node->m_snext; - } - } } +foundenemy: + if (exists) + return; - CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", nobaddies->sourceline->tag); + s = P_AproxDistance(nobaddies->sourceline->dx, nobaddies->sourceline->dy)>>FRACBITS; - // No enemies found, run the linedef exec and terminate this thinker - P_RunTriggerLinedef(nobaddies->sourceline, NULL, NULL); + CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", s); + + // Otherwise, run the linedef exec and terminate this thinker + P_LinedefExecute((INT16)s, NULL, NULL); P_RemoveThinker(&nobaddies->thinker); } diff --git a/src/p_spec.c b/src/p_spec.c index 34b779068..285da0e7f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1891,7 +1891,6 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || specialtype == 304 // Ring count - Once || specialtype == 307 // Character ability - Once || specialtype == 308 // Race only - Once - || specialtype == 313 // No More Enemies - Once || specialtype == 315 // No of pushables - Once || specialtype == 318 // Unlockable trigger - Once || specialtype == 320 // Unlockable - Once From 6aa708b5afdfd84da47d78c1f548b8ee4175dbd5 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 00:49:35 -0800 Subject: [PATCH 355/364] I don't think we need the BLUE_SPHERES define anymore... --- src/dehacked.c | 2 -- src/doomdef.h | 4 ---- src/info.c | 2 -- src/info.h | 2 -- src/p_inter.c | 7 +------ src/p_mobj.c | 18 ------------------ src/p_user.c | 5 +---- 7 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 60f3b0592..926c3a488 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6229,9 +6229,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Collectible Items "MT_RING", "MT_FLINGRING", // Lost ring -#ifdef BLUE_SPHERES "MT_BLUEBALL", // Blue sphere replacement for special stages -#endif "MT_REDTEAMRING", //Rings collectable by red team. "MT_BLUETEAMRING", //Rings collectable by blue team. "MT_EMMY", // emerald token for special stage diff --git a/src/doomdef.h b/src/doomdef.h index 0fc4a1fea..4fd50e927 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -449,10 +449,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Polyobject fake flat code #define POLYOBJECTS_PLANES -/// Blue spheres for future use. -/// \todo Remove this define. -#define BLUE_SPHERES // Blue spheres for future use. - /// Improved way of dealing with ping values and a ping limit. #define NEWPING diff --git a/src/info.c b/src/info.c index fb19fa2b4..0eda41770 100644 --- a/src/info.c +++ b/src/info.c @@ -4569,7 +4569,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, -#ifdef BLUE_SPHERES { // MT_BLUEBALL -1, // doomednum S_BLUEBALL, // spawnstate @@ -4596,7 +4595,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, -#endif { // MT_REDTEAMRING 308, // doomednum diff --git a/src/info.h b/src/info.h index 9596f0384..6e14448f4 100644 --- a/src/info.h +++ b/src/info.h @@ -3049,9 +3049,7 @@ typedef enum mobj_type // Collectible Items MT_RING, MT_FLINGRING, // Lost ring -#ifdef BLUE_SPHERES MT_BLUEBALL, // Blue sphere replacement for special stages -#endif MT_REDTEAMRING, //Rings collectable by red team. MT_BLUETEAMRING, //Rings collectable by blue team. MT_EMMY, // emerald token for special stage diff --git a/src/p_inter.c b/src/p_inter.c index 6ab6aaf40..b8101f12b 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -405,7 +405,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN) P_DoNightsScore(player); break; -#ifdef BLUE_SPHERES case MT_BLUEBALL: if (!(P_CanPickupItem(player, false))) return; @@ -422,7 +421,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (maptol & TOL_NIGHTS) P_DoNightsScore(player); break; -#endif case MT_AUTOPICKUP: case MT_BOUNCEPICKUP: case MT_SCATTERPICKUP: @@ -766,10 +764,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN -#ifdef BLUE_SPHERES - || mo2->type == MT_BLUEBALL -#endif - )) + || mo2->type == MT_BLUEBALL)) continue; // Yay! The thing's in reach! Pull it in! diff --git a/src/p_mobj.c b/src/p_mobj.c index cb9bc775a..4e60ad612 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2188,9 +2188,7 @@ static boolean P_ZMovement(mobj_t *mo) case MT_RING: // Ignore still rings case MT_COIN: -#ifdef BLUE_SPHERES case MT_BLUEBALL: -#endif case MT_REDTEAMRING: case MT_BLUETEAMRING: case MT_FLINGRING: @@ -6479,14 +6477,12 @@ void P_MobjThinker(mobj_t *mobj) else if (mobj->health <= 0) // Dead things think differently than the living. switch (mobj->type) { -#ifdef BLUE_SPHERES case MT_BLUEBALL: if ((mobj->tics>>2)+1 > 0 && (mobj->tics>>2)+1 <= tr_trans60) // tr_trans50 through tr_trans90, shifting once every second frame mobj->frame = (NUMTRANSMAPS-((mobj->tics>>2)+1))<frame = tr_trans60<z <= mobj->floorz) { @@ -6944,9 +6940,7 @@ void P_MobjThinker(mobj_t *mobj) break; case MT_RING: case MT_COIN: -#ifdef BLUE_SPHERES case MT_BLUEBALL: -#endif case MT_REDTEAMRING: case MT_BLUETEAMRING: // No need to check water. Who cares? @@ -7712,9 +7706,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) break; case MT_RING: case MT_COIN: -#ifdef BLUE_SPHERES case MT_BLUEBALL: -#endif nummaprings++; default: break; @@ -7840,9 +7832,7 @@ void P_RemoveMobj(mobj_t *mobj) if (mobj->spawnpoint && (mobj->type == MT_RING || mobj->type == MT_COIN -#ifdef BLUE_SPHERES || mobj->type == MT_BLUEBALL -#endif || mobj->type == MT_REDTEAMRING || mobj->type == MT_BLUETEAMRING || P_WeaponOrPanel(mobj->type)) @@ -9628,11 +9618,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) ringthing = (gametype == GT_CTF) ? MT_BLUETEAMRING : MT_RING; break; default: -#ifdef BLUE_SPHERES // Spawn rings as blue spheres in special stages, ala S3+K. if (G_IsSpecialStage(gamemap) && useNightsSS) ringthing = MT_BLUEBALL; -#endif break; } @@ -9697,11 +9685,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) return; -#ifdef BLUE_SPHERES // Spawn rings as blue spheres in special stages, ala S3+K. if (G_IsSpecialStage(gamemap) && useNightsSS) ringthing = MT_BLUEBALL; -#endif for (r = 1; r <= 5; r++) { @@ -9752,11 +9738,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS)) return; -#ifdef BLUE_SPHERES // Spawn rings as blue spheres in special stages, ala S3+K. if (G_IsSpecialStage(gamemap) && useNightsSS) ringthing = MT_BLUEBALL; -#endif angle >>= ANGLETOFINESHIFT; @@ -9849,11 +9833,9 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS))) continue; -#ifdef BLUE_SPHERES // Spawn rings as blue spheres in special stages, ala S3+K. if (G_IsSpecialStage(gamemap) && useNightsSS) itemToSpawn = MT_BLUEBALL; -#endif } fa = i*FINEANGLES/numitems; diff --git a/src/p_user.c b/src/p_user.c index 463937290..03b2c1dd8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8857,10 +8857,7 @@ void P_PlayerThink(player_t *player) mo2 = (mobj_t *)th; if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN -#ifdef BLUE_SPHERES - || mo2->type == MT_BLUEBALL -#endif - )) + || mo2->type == MT_BLUEBALL)) continue; if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) From 5a38088623fceb0d31c43d79ab8cb42b85a635ff Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 01:09:21 -0800 Subject: [PATCH 356/364] Well, we don't need "experimental" slopes anymore either Not when we have properly working ones! --- src/doomdef.h | 3 --- src/hardware/hw_glob.h | 2 -- src/hardware/hw_main.c | 21 ++------------------- src/p_spec.c | 25 ------------------------- src/r_defs.h | 8 -------- 5 files changed, 2 insertions(+), 57 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 4fd50e927..a44fe4779 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -427,9 +427,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// \note obsoleted by cv_maxportals //#define PORTAL_LIMIT 8 -/// Fun experimental slope stuff! -//#define SLOPENESS - /// Kalaron/Eternity Engine slope code (SRB2CB ported) #define ESLOPE diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 83dff02f8..94eef1d3e 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -36,9 +36,7 @@ typedef struct { float x; float y; -//#ifdef SLOPENESS float z; -//#endif } polyvertex_t; #ifdef _MSC_VER diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 409900b98..58e4e87f2 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -539,6 +539,8 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi static FOutVector *planeVerts = NULL; static UINT16 numAllocedPlaneVerts = 0; + (void)sector; + // no convex poly were generated for this subsector if (!xsub->planepoly) return; @@ -678,25 +680,6 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, fixed_t fi v3d->x = pv->x; v3d->y = height; v3d->z = pv->y; -#ifdef SLOPENESS - if (sector && sector->special == 65535) - { - size_t q; - for (q = 0; q < sector->linecount; q++) - { - if (v3d->x == sector->lines[q]->v1->x>>FRACBITS) - { - if (v3d->z == sector->lines[q]->v1->y>>FRACBITS) - { - v3d->y += sector->lines[q]->v1->z>>FRACBITS; - break; - } - } - } - } -#else - (void)sector; -#endif } // only useful for flat coloured triangles diff --git a/src/p_spec.c b/src/p_spec.c index 285da0e7f..277fe19eb 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6028,31 +6028,6 @@ void P_SpawnSpecials(INT32 fromnetsave) P_AddRaiseThinker(lines[i].frontsector, &lines[i]); break; -#ifdef SLOPENESS - case 999: - sec = sides[*lines[i].sidenum].sector-sectors; - for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) - { - size_t counting; - - sectors[s].floorangle = ANGLE_45; - for (counting = 0; counting < sectors[s].linecount/2; counting++) - { - sectors[s].lines[counting]->v1->z = sectors[sec].floorheight; - CONS_Debug(DBG_GAMELOGIC, "Set it to %d\n", sectors[s].lines[counting]->v1->z>>FRACBITS); - } - - for (counting = sectors[s].linecount/2; counting < sectors[s].linecount; counting++) - { - sectors[s].lines[counting]->v1->z = sectors[sec].ceilingheight; - CONS_Debug(DBG_GAMELOGIC, "Set it to %d\n", sectors[s].lines[counting]->v1->z>>FRACBITS); - } - sectors[s].special = 65535; - CONS_Debug(DBG_GAMELOGIC, "Found & Set slope!\n"); - } - break; -#endif - case 200: // Double light effect P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES|FF_DOUBLESHADOW, secthinkers); break; diff --git a/src/r_defs.h b/src/r_defs.h index f18410fe8..2915b9259 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -369,14 +369,6 @@ typedef struct sector_s double lineoutLength; #endif // ----- end special tricks ----- - // ZDoom C++ to Legacy C conversion (for slopes) - // store floor and ceiling planes instead of heights - //secplane_t floorplane, ceilingplane; -#ifdef SLOPENESS - //fixed_t floortexz, ceilingtexz; // [RH] used for wall texture mapping - angle_t floorangle; -#endif - // This points to the master's floorheight, so it can be changed in realtime! fixed_t *gravity; // per-sector gravity boolean verticalflip; // If gravity < 0, then allow flipped physics From b229cac57a997ed4617d4bae8d12989f79e2dbd1 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 01:24:13 -0800 Subject: [PATCH 357/364] Revert "Revert "No more stupidity for No More Enemies special plz"" This reverts commit 7ae87cc2c66de2e3a23490bb090caa9febec43f8. --- src/p_floor.c | 66 +++++++++++++++++++++++++++++++++------------------ src/p_spec.c | 1 + 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index 73c5281fa..ec52abeb9 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1971,51 +1971,71 @@ void T_NoEnemiesSector(levelspecthink_t *nobaddies) { size_t i; fixed_t upperbound, lowerbound; - INT32 s; - sector_t *checksector; + sector_t *sec = NULL; + sector_t *targetsec = NULL; + INT32 secnum = -1; msecnode_t *node; mobj_t *thing; - boolean exists = false; + boolean FOFsector = false; - for (i = 0; i < nobaddies->sector->linecount; i++) + while ((secnum = P_FindSectorFromLineTag(nobaddies->sourceline, secnum)) >= 0) { - if (nobaddies->sector->lines[i]->special == 223) + sec = §ors[secnum]; + + FOFsector = false; + + // Check the lines of this sector, to see if it is a FOF control sector. + for (i = 0; i < sec->linecount; i++) { + INT32 targetsecnum = -1; - upperbound = nobaddies->sector->ceilingheight; - lowerbound = nobaddies->sector->floorheight; + if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) + continue; - for (s = -1; (s = P_FindSectorFromLineTag(nobaddies->sector->lines[i], s)) >= 0 ;) + FOFsector = true; + + while ((targetsecnum = P_FindSectorFromLineTag(sec->lines[i], targetsecnum)) >= 0) { - checksector = §ors[s]; + targetsec = §ors[targetsecnum]; - node = checksector->touching_thinglist; // things touching this sector + upperbound = targetsec->ceilingheight; + lowerbound = targetsec->floorheight; + node = targetsec->touching_thinglist; // things touching this sector while (node) { thing = node->m_thing; if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 - && thing->z < upperbound && thing->z+thing->height > lowerbound) - { - exists = true; - goto foundenemy; - } + && thing->z < upperbound && thing->z+thing->height > lowerbound) + return; node = node->m_snext; } } } + + if (!FOFsector) + { + upperbound = sec->ceilingheight; + lowerbound = sec->floorheight; + node = sec->touching_thinglist; // things touching this sector + while (node) + { + thing = node->m_thing; + + if ((thing->flags & (MF_ENEMY|MF_BOSS)) && thing->health > 0 + && thing->z < upperbound && thing->z+thing->height > lowerbound) + return; + + node = node->m_snext; + } + } } -foundenemy: - if (exists) - return; - s = P_AproxDistance(nobaddies->sourceline->dx, nobaddies->sourceline->dy)>>FRACBITS; + CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", nobaddies->sourceline->tag); - CONS_Debug(DBG_GAMELOGIC, "Running no-more-enemies exec with tag of %d\n", s); - - // Otherwise, run the linedef exec and terminate this thinker - P_LinedefExecute((INT16)s, NULL, NULL); + // No enemies found, run the linedef exec and terminate this thinker + P_RunTriggerLinedef(nobaddies->sourceline, NULL, NULL); P_RemoveThinker(&nobaddies->thinker); } diff --git a/src/p_spec.c b/src/p_spec.c index fdbbbfdcb..7860ec59d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1891,6 +1891,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || specialtype == 304 // Ring count - Once || specialtype == 307 // Character ability - Once || specialtype == 308 // Race only - Once + || specialtype == 313 // No More Enemies - Once || specialtype == 315 // No of pushables - Once || specialtype == 318 // Unlockable trigger - Once || specialtype == 320 // Unlockable - Once From 62b2e5c17e3e0d7ac42c2f160d96e04a42e75247 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 01:29:58 -0800 Subject: [PATCH 358/364] Revert "Readded EvalMath to Lua." This partially reverts commit cfcd7ce0d3959bcce0e8e00cc504b1354451cb50. --- src/lua_baselib.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 640e9ac3b..807403389 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -85,14 +85,6 @@ static int lib_print(lua_State *L) return 0; } -static int lib_evalMath(lua_State *L) -{ - const char *word = luaL_checkstring(L, 1); - LUA_Deprecated(L, "EvalMath(string)", "_G[string]"); - lua_pushinteger(L, LUA_EvalMath(word)); - return 1; -} - // M_RANDOM ////////////// @@ -1911,7 +1903,6 @@ static int lib_gTicsToMilliseconds(lua_State *L) static luaL_Reg lib[] = { {"print", lib_print}, - {"EvalMath", lib_evalMath}, // m_random {"P_Random",lib_pRandom}, From b61959051ea2f1b96c525163e6c51704a8874fac Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 01:30:52 -0800 Subject: [PATCH 359/364] Revert "Revert "MF2_PUSHED is now MFE_PUSHED..."" This reverts commit 694220155e26e63af242fa9ff457d34261425ca3. --- src/dehacked.c | 2 +- src/p_mobj.c | 3 +-- src/p_mobj.h | 38 +++++++++++++++++++------------------- src/p_spec.c | 18 +++++++++--------- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8f654bc4c..6747f2c59 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6680,7 +6680,6 @@ static const char *const MOBJFLAG2_LIST[] = { "EXPLOSION", // Thrown ring has explosive properties "SCATTER", // Thrown ring has scatter properties "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. - "PUSHED", // Mobj was already pushed this tic "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. "CLASSICPUSH", // Drops straight down when object has negative Z. "STANDONME", // While not pushable, stand on me anyway. @@ -6709,6 +6708,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water + "PUSHED", // Mobj was already pushed this tic "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_mobj.c b/src/p_mobj.c index 414c91970..6ee6e5ae1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6256,8 +6256,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->tracer && P_MobjWasRemoved(mobj->tracer)) P_SetTarget(&mobj->tracer, NULL); - mobj->flags2 &= ~MF2_PUSHED; - mobj->eflags &= ~MFE_SPRUNG; + mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG); tmfloorthing = tmhitthing = NULL; diff --git a/src/p_mobj.h b/src/p_mobj.h index 5cf64feb5..1dba10e4b 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -175,24 +175,23 @@ typedef enum MF2_EXPLOSION = 1<<7, // Thrown ring has explosive properties MF2_SCATTER = 1<<8, // Thrown ring has scatter properties MF2_BEYONDTHEGRAVE = 1<<9, // Source of this missile has died and has since respawned. - MF2_PUSHED = 1<<10, // Mobj was already pushed this tic - MF2_SLIDEPUSH = 1<<11, // MF_PUSHABLE that pushes continuously. - MF2_CLASSICPUSH = 1<<12, // Drops straight down when object has negative Z. - MF2_STANDONME = 1<<13, // While not pushable, stand on me anyway. - MF2_INFLOAT = 1<<14, // Floating to a height for a move, don't auto float to target's height. - MF2_DEBRIS = 1<<15, // Splash ring from explosion ring - MF2_NIGHTSPULL = 1<<16, // Attracted from a paraloop - MF2_JUSTATTACKED = 1<<17, // can be pushed by other moving mobjs - MF2_FIRING = 1<<18, // turret fire - MF2_SUPERFIRE = 1<<19, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. - MF2_SHADOW = 1<<20, // Fuzzy draw, makes targeting harder. - MF2_STRONGBOX = 1<<21, // Flag used for "strong" random monitors. - MF2_OBJECTFLIP = 1<<22, // Flag for objects that always have flipped gravity. - MF2_SKULLFLY = 1<<23, // Special handling: skull in flight. - MF2_FRET = 1<<24, // Flashing from a previous hit - MF2_BOSSNOTRAP = 1<<25, // No Egg Trap after boss - MF2_BOSSFLEE = 1<<26, // Boss is fleeing! - MF2_BOSSDEAD = 1<<27, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + MF2_SLIDEPUSH = 1<<10, // MF_PUSHABLE that pushes continuously. + MF2_CLASSICPUSH = 1<<11, // Drops straight down when object has negative Z. + MF2_STANDONME = 1<<12, // While not pushable, stand on me anyway. + MF2_INFLOAT = 1<<13, // Floating to a height for a move, don't auto float to target's height. + MF2_DEBRIS = 1<<14, // Splash ring from explosion ring + MF2_NIGHTSPULL = 1<<15, // Attracted from a paraloop + MF2_JUSTATTACKED = 1<<16, // can be pushed by other moving mobjs + MF2_FIRING = 1<<17, // turret fire + MF2_SUPERFIRE = 1<<18, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. + MF2_SHADOW = 1<<19, // Fuzzy draw, makes targeting harder. + MF2_STRONGBOX = 1<<20, // Flag used for "strong" random monitors. + MF2_OBJECTFLIP = 1<<21, // Flag for objects that always have flipped gravity. + MF2_SKULLFLY = 1<<22, // Special handling: skull in flight. + MF2_FRET = 1<<23, // Flashing from a previous hit + MF2_BOSSNOTRAP = 1<<24, // No Egg Trap after boss + MF2_BOSSFLEE = 1<<25, // Boss is fleeing! + MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) // free: to and including 1<<31 } mobjflag2_t; @@ -232,7 +231,8 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 + // Mobj was already pushed this tic + MFE_PUSHED = 1<<7, // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement diff --git a/src/p_spec.c b/src/p_spec.c index 7860ec59d..c039a8672 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6443,7 +6443,7 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv thing->momy += dy; if (exclusive) - thing->flags2 |= MF2_PUSHED; + thing->eflags |= MFE_PUSHED; } /** Processes an active scroller. @@ -6547,7 +6547,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->flags2 & MF2_PUSHED) // Already pushed this tic by an exclusive pusher. + if (thing->eflags & MFE_PUSHED) // Already pushed this tic by an exclusive pusher. continue; height = P_GetSpecialBottomZ(thing, sec, psec); @@ -6569,7 +6569,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->flags2 & MF2_PUSHED) + if (thing->eflags & MFE_PUSHED) continue; height = P_GetSpecialBottomZ(thing, sec, sec); @@ -6610,7 +6610,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->flags2 & MF2_PUSHED) + if (thing->eflags & MFE_PUSHED) continue; height = P_GetSpecialTopZ(thing, sec, psec); @@ -6632,7 +6632,7 @@ void T_Scroll(scroll_t *s) { thing = node->m_thing; - if (thing->flags2 & MF2_PUSHED) + if (thing->eflags & MFE_PUSHED) continue; height = P_GetSpecialTopZ(thing, sec, sec); @@ -7115,7 +7115,7 @@ static pusher_t *tmpusher; // pusher structure for blockmap searches */ static inline boolean PIT_PushThing(mobj_t *thing) { - if (thing->flags2 & MF2_PUSHED) + if (thing->eflags & MFE_PUSHED) return false; if (thing->player && thing->player->pflags & PF_ROPEHANG) @@ -7245,7 +7245,7 @@ static inline boolean PIT_PushThing(mobj_t *thing) } if (tmpusher->exclusive) - thing->flags2 |= MF2_PUSHED; + thing->eflags |= MFE_PUSHED; return true; } @@ -7348,7 +7348,7 @@ void T_Pusher(pusher_t *p) || thing->type == MT_BIGTUMBLEWEED)) continue; - if (thing->flags2 & MF2_PUSHED) + if (thing->eflags & MFE_PUSHED) continue; if (thing->player && thing->player->pflags & PF_ROPEHANG) @@ -7515,7 +7515,7 @@ void T_Pusher(pusher_t *p) } if (p->exclusive) - thing->flags2 |= MF2_PUSHED; + thing->eflags |= MFE_PUSHED; } } } From 280e932f02c64a8ac3d01bd89e5e578938d32363 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 9 Mar 2016 13:38:30 +0000 Subject: [PATCH 360/364] Shifted down the last few mobj eflags to close gap left by MF2_PUSHED -> MFE_PUSHED undo --- src/p_mobj.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index e24b09652..44b3ceeec 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,11 +232,10 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 // Mobj was already sprung this tic - MFE_SPRUNG = 1<<8, + MFE_SPRUNG = 1<<7, // Platform movement - MFE_APPLYPMOMZ = 1<<9, + MFE_APPLYPMOMZ = 1<<8, // free: to and including 1<<15 } mobjeflag_t; From bf415b8618c51f7826cb76ab91fe4a0003c3d238 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 9 Mar 2016 13:59:10 +0000 Subject: [PATCH 361/364] Revert "Shifted down the last few mobj eflags to close gap left by MF2_PUSHED -> MFE_PUSHED undo" This reverts commit 280e932f02c64a8ac3d01bd89e5e578938d32363. --- src/p_mobj.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index 44b3ceeec..e24b09652 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,10 +232,11 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, + // free: to and including 1<<7 // Mobj was already sprung this tic - MFE_SPRUNG = 1<<7, + MFE_SPRUNG = 1<<8, // Platform movement - MFE_APPLYPMOMZ = 1<<8, + MFE_APPLYPMOMZ = 1<<9, // free: to and including 1<<15 } mobjeflag_t; From 4625118ee863b43a3c8828c79879f92ff649b850 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 9 Mar 2016 14:03:20 +0000 Subject: [PATCH 362/364] MFE_DUMMY now exists to fill the slot where MFE_PUSHED was, bleh --- src/dehacked.c | 1 + src/p_mobj.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 926c3a488..31cf37636 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6711,6 +6711,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water + "DUMMY", // free: 1<<7 "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_mobj.h b/src/p_mobj.h index e24b09652..3979b1304 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,7 +232,8 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: to and including 1<<7 + // free: 1<<7 + MFE_DUMMY = 1<<7, // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement From f40cfb0271a5945a736c6edafd012174b09f71e8 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 06:22:40 -0800 Subject: [PATCH 363/364] Revert "MFE_DUMMY now exists to fill the slot where MFE_PUSHED was, bleh" This reverts commit 4625118ee863b43a3c8828c79879f92ff649b850. --- src/dehacked.c | 1 - src/p_mobj.h | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 31cf37636..926c3a488 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6711,7 +6711,6 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water - "DUMMY", // free: 1<<7 "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL diff --git a/src/p_mobj.h b/src/p_mobj.h index 3979b1304..e24b09652 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -232,8 +232,7 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, - // free: 1<<7 - MFE_DUMMY = 1<<7, + // free: to and including 1<<7 // Mobj was already sprung this tic MFE_SPRUNG = 1<<8, // Platform movement From a7cb049b65ddd126c1532d4a5f13dbba35942947 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 9 Mar 2016 06:23:57 -0800 Subject: [PATCH 364/364] leave a dummy string in dehacked, nothing more. a courtesy fuck you to gitlab for making me have to keep the previous screwed up bullshit in this branch. --- src/dehacked.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dehacked.c b/src/dehacked.c index 926c3a488..61bccb4f6 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6711,6 +6711,7 @@ static const char *const MOBJEFLAG_LIST[] = { "JUSTSTEPPEDDOWN", // used for ramp sectors "VERTICALFLIP", // Vertically flip sprite/allow upside-down physics "GOOWATER", // Goo water + "\x01", // free: 1<<7 (name un-matchable) "SPRUNG", // Mobj was already sprung this tic "APPLYPMOMZ", // Platform movement NULL