From b449bd826a014bdc07f43c544f522a628ed128c0 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 13 Aug 2015 19:42:00 +0100 Subject: [PATCH 01/43] 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 0f038f9a3bb2dfa880061d60a2a04e6b9e89c7d1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 1 Sep 2015 12:45:26 +0100 Subject: [PATCH 02/43] 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 03/43] 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 b9b1e2b2984966445bcd7155394c34ef65b61dbb Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Sat, 2 Jan 2016 21:53:43 -0600 Subject: [PATCH 04/43] 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 05/43] 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 06/43] 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 07/43] 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 997ae7dcc9ab634531b265589905b8bced11a0d5 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 10 Jan 2016 18:24:58 +0000 Subject: [PATCH 08/43] 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 09/43] 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 10/43] 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 11/43] 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 12/43] 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 13/43] 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 14/43] 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 06dea3ab781ca953493c5044e67f71e150f58203 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 14 Jan 2016 04:31:48 -0800 Subject: [PATCH 15/43] 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 16/43] 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 17/43] 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 18/43] 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 19/43] 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 20/43] 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 21/43] 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 22/43] 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 23/43] 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 24/43] 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 25/43] 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 26/43] 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 27/43] 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 28/43] 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 29/43] 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 6fd3036112cfc0edf02eaa51016dc7ed552855fa Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Sat, 16 Jan 2016 11:35:34 -0800 Subject: [PATCH 30/43] 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 c6a2bde7d97aef3ebfbc82678e5c37a22379a323 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 18 Jan 2016 19:46:00 +0000 Subject: [PATCH 31/43] 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 55f0e5cab5fe13bef38d7ad67c2f80226128769d Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 20 Jan 2016 01:13:21 -0800 Subject: [PATCH 32/43] 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 7d6dc3a5bb64e1ad8fe1ac091fbcff8c11ef7bcf Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 20 Jan 2016 09:25:28 -0800 Subject: [PATCH 33/43] 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 34/43] 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 35/43] 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 ccb0abb853233e414a1734bf2556f556d4580320 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 21 Jan 2016 20:19:43 +0000 Subject: [PATCH 36/43] 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 37/43] 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 80fb282334435ff7ee566e4ff08e46d4833b2b2a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 23 Jan 2016 18:59:17 +0000 Subject: [PATCH 38/43] 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 d76e21b54660c2efec99384538ed90b28eb513e3 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 28 Jan 2016 08:15:34 -0800 Subject: [PATCH 39/43] 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 2e58f6c4d9728569b8e66ac04444fc225fe4ec3a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 23 Jan 2016 19:58:57 +0000 Subject: [PATCH 40/43] 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 31deecc51c0c920ee00dc98b5a1ba952622a9a98 Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sun, 26 Jul 2015 20:14:47 +0100 Subject: [PATCH 41/43] 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 42/43] 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 43/43] 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) {