From dabed04d2a376e07043bea59cb7a2cd51d153825 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Mar 2016 12:36:15 +0100 Subject: [PATCH] - floatification of p_3dfloors, p_3dmidtex and p_acs.cpp plus some leftovers. - removed all references to Doom specific headers from xs_Float.h and cmath.h. --- src/basictypes.h | 6 +- src/fragglescript/t_oper.cpp | 5 +- src/math/cmath.h | 28 +++-- src/math/fastsin.cpp | 6 +- src/p_3dfloors.cpp | 69 +++++------ src/p_3dfloors.h | 19 +-- src/p_3dmidtex.cpp | 34 ++---- src/p_3dmidtex.h | 2 +- src/p_acs.cpp | 96 +++++++-------- src/p_acs.h | 4 +- src/p_effect.cpp | 27 ++--- src/p_effect.h | 7 +- src/p_enemy.cpp | 8 +- src/p_lnspec.cpp | 221 ++++++++++++++++++----------------- src/p_local.h | 3 +- src/p_maputl.cpp | 4 +- src/p_mobj.cpp | 2 +- src/p_switch.cpp | 6 +- src/p_things.cpp | 4 +- src/p_writemap.cpp | 4 +- src/r_defs.h | 17 +++ src/tables.h | 2 +- src/textures/textures.h | 1 - src/vectors.h | 6 +- src/win32/fb_d3d9.cpp | 4 +- src/xs_Float.h | 69 ++++++----- 26 files changed, 319 insertions(+), 335 deletions(-) diff --git a/src/basictypes.h b/src/basictypes.h index 13be07b9f..e06e49494 100644 --- a/src/basictypes.h +++ b/src/basictypes.h @@ -12,10 +12,6 @@ typedef uint32_t uint32; typedef int64_t SQWORD; typedef uint64_t QWORD; -typedef SDWORD int32; -typedef float real32; -typedef double real64; - // windef.h, included by windows.h, has its own incompatible definition // of DWORD as a long. In files that mix Doom and Windows code, you // must define USE_WINDOWS_DWORD before including doomtype.h so that @@ -62,7 +58,7 @@ union QWORD_UNION }; // -// Fixed point, 32bit as 16.16. +// fixed point, 32bit as 16.16. // #define FRACBITS 16 #define FRACUNIT (1< #include "cmath.h" -#include "m_fixed.h" + + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif FFastTrig fasttrig; diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index ea5573b0d..c87d61817 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -422,10 +422,10 @@ void P_Recalculate3DFloors(sector_t * sector) unsigned pickindex; F3DFloor * clipped=NULL; F3DFloor * solid=NULL; - fixed_t solid_bottom=0; - fixed_t clipped_top; - fixed_t clipped_bottom=0; - fixed_t maxheight, minheight; + double solid_bottom=0; + double clipped_top; + double clipped_bottom=0; + double maxheight, minheight; unsigned i, j; lightlist_t newlight; lightlist_t resetlight; // what it goes back to after FF_DOUBLESHADOW @@ -464,13 +464,13 @@ void P_Recalculate3DFloors(sector_t * sector) while (oldlist.Size()) { pick=oldlist[0]; - fixed_t height=pick->top.plane->ZatPoint(sector->_f_centerspot()); + double height=pick->top.plane->ZatPoint(sector->centerspot); // find highest starting ffloor - intersections are not supported! pickindex=0; for (j=1;jtop.plane->ZatPoint(sector->_f_centerspot()); + double h2=oldlist[j]->top.plane->ZatPoint(sector->centerspot); if (h2>height) { @@ -481,7 +481,7 @@ void P_Recalculate3DFloors(sector_t * sector) } oldlist.Delete(pickindex); - fixed_t pick_bottom=pick->bottom.plane->ZatPoint(sector->_f_centerspot()); + double pick_bottom=pick->bottom.plane->ZatPoint(sector->centerspot); if (pick->flags & FF_THISINSIDE) { @@ -586,8 +586,8 @@ void P_Recalculate3DFloors(sector_t * sector) resetlight = lightlist[0]; - maxheight = sector->CenterCeiling(); - minheight = sector->CenterFloor(); + maxheight = sector->ceilingplane.ZatPoint(sector->centerspot); + minheight = sector->floorplane.ZatPoint(sector->centerspot); for(i = 0; i < ffloors.Size(); i++) { rover=ffloors[i]; @@ -595,7 +595,7 @@ void P_Recalculate3DFloors(sector_t * sector) if ( !(rover->flags & FF_EXISTS) || rover->flags & FF_NOSHADE ) continue; - fixed_t ff_top=rover->top.plane->ZatPoint(sector->_f_centerspot()); + double ff_top=rover->top.plane->ZatPoint(sector->centerspot); if (ff_top < minheight) break; // reached the floor if (ff_top < maxheight) { @@ -610,7 +610,7 @@ void P_Recalculate3DFloors(sector_t * sector) } else { - fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->_f_centerspot()); + double ff_bottom=rover->bottom.plane->ZatPoint(sector->centerspot); if (ff_bottomflags&FF_DOUBLESHADOW) { - fixed_t ff_bottom=rover->bottom.plane->ZatPoint(sector->_f_centerspot()); + double ff_bottom=rover->bottom.plane->ZatPoint(sector->centerspot); if(ff_bottom < maxheight && ff_bottom>minheight) { newlight.caster = rover; @@ -724,11 +724,11 @@ lightlist_t * P_GetPlaneLight(sector_t * sector, secplane_t * plane, bool unders unsigned i; TArray &lightlist = sector->e->XFloor.lightlist; - fixed_t planeheight=plane->ZatPoint(sector->_f_centerspot()); + double planeheight=plane->ZatPoint(sector->centerspot); if(underside) planeheight--; for(i = 1; i < lightlist.Size(); i++) - if (lightlist[i].plane.ZatPoint(sector->_f_centerspot()) <= planeheight) + if (lightlist[i].plane.ZatPoint(sector->centerspot) <= planeheight) return &lightlist[i - 1]; return &lightlist[lightlist.Size() - 1]; @@ -851,12 +851,6 @@ void P_Spawn3DFloors (void) switch(line->special) { case ExtraFloor_LightOnly: - // Note: I am spawning both this and ZDoom's ExtraLight data - // I don't want to mess with both at the same time during rendering - // so inserting this into the 3D-floor table as well seemed to be - // the best option. - // - // This does not yet handle case 0 properly! if (line->args[1] < 0 || line->args[1] > 2) line->args[1] = 0; P_Set3DFloor(line, 3, flagvals[line->args[1]], 0); break; @@ -900,17 +894,16 @@ void P_Spawn3DFloors (void) // //========================================================================== -secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z) +secplane_t P_FindFloorPlane(sector_t * sector, const DVector3 &pos) { secplane_t retplane = sector->floorplane; if (sector->e) // apparently this can be called when the data is already gone { - for(unsigned int i=0;ie->XFloor.ffloors.Size();i++) + for(auto rover : sector->e->XFloor.ffloors) { - F3DFloor * rover= sector->e->XFloor.ffloors[i]; if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; - if (rover->top.plane->ZatPoint(x, y) == z) + if (rover->top.plane->ZatPoint(pos) == pos.Z) { retplane = *rover->top.plane; if (retplane.c<0) retplane.FlipVert(); @@ -928,20 +921,20 @@ secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z) // //========================================================================== -int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz) +int P_Find3DFloor(sector_t * sec, const DVector3 &pos, bool above, bool floor, double &cmpz) { // If no sector given, find the one appropriate if (sec == NULL) - sec = R_PointInSubsector(x, y)->sector; + sec = P_PointInSector(pos); // Above normal ceiling - cmpz = sec->ceilingplane.ZatPoint(x, y); - if (z >= cmpz) + cmpz = sec->ceilingplane.ZatPoint(pos); + if (pos.Z >= cmpz) return -1; // Below normal floor - cmpz = sec->floorplane.ZatPoint(x, y); - if (z <= cmpz) + cmpz = sec->floorplane.ZatPoint(pos); + if (pos.Z <= cmpz) return -1; // Looking through planes from top to bottom @@ -955,19 +948,19 @@ int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, b if (above) { // z is above that floor - if (floor && (z >= (cmpz = rover->top.plane->ZatPoint(x, y)))) + if (floor && (pos.Z >= (cmpz = rover->top.plane->ZatPoint(pos)))) return i - 1; // z is above that ceiling - if (z >= (cmpz = rover->bottom.plane->ZatPoint(x, y))) + if (pos.Z >= (cmpz = rover->bottom.plane->ZatPoint(pos))) return i - 1; } else // below { // z is below that ceiling - if (!floor && (z <= (cmpz = rover->bottom.plane->ZatPoint(x, y)))) + if (!floor && (pos.Z <= (cmpz = rover->bottom.plane->ZatPoint(pos)))) return i; // z is below that floor - if (z <= (cmpz = rover->top.plane->ZatPoint(x, y))) + if (pos.Z <= (cmpz = rover->top.plane->ZatPoint(pos))) return i; } } @@ -989,13 +982,13 @@ CCMD (dump3df) for (unsigned int i = 0; i < ffloors.Size(); i++) { - fixed_t height=ffloors[i]->top.plane->ZatPoint(sector->_f_centerspot()); - fixed_t bheight=ffloors[i]->bottom.plane->ZatPoint(sector->_f_centerspot()); + double height=ffloors[i]->top.plane->ZatPoint(sector->centerspot); + double bheight=ffloors[i]->bottom.plane->ZatPoint(sector->centerspot); IGNORE_FORMAT_PRE Printf("FFloor %d @ top = %f (model = %d), bottom = %f (model = %d), flags = %B, alpha = %d %s %s\n", - i, height / 65536., ffloors[i]->top.model->sectornum, - bheight / 65536., ffloors[i]->bottom.model->sectornum, + i, height, ffloors[i]->top.model->sectornum, + bheight, ffloors[i]->bottom.model->sectornum, ffloors[i]->flags, ffloors[i]->alpha, (ffloors[i]->flags&FF_EXISTS)? "Exists":"", (ffloors[i]->flags&FF_DYNAMIC)? "Dynamic":""); IGNORE_FORMAT_POST } diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 3ec2ab202..02e25f882 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -86,8 +86,6 @@ struct F3DFloor short *toplightlevel; - fixed_t delta; - unsigned int flags; line_t* master; @@ -125,7 +123,6 @@ struct lightlist_t class player_s; void P_PlayerOnSpecial3DFloor(player_t* player); -void P_Get3DFloorAndCeiling(AActor * thing, sector_t * sector, fixed_t * floorz, fixed_t * ceilingz, int * floorpic); bool P_CheckFor3DFloorHit(AActor * mo); bool P_CheckFor3DCeilingHit(AActor * mo); void P_Recalculate3DFloors(sector_t *); @@ -141,19 +138,7 @@ struct FLineOpening; void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef, double x, double y, bool restrict); -secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z); -int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz); -inline int P_Find3DFloor(sector_t * sec, const fixedvec3 &pos, bool above, bool floor, fixed_t &cmpz) -{ - return P_Find3DFloor(sec, pos.x, pos.y, pos.z, above, floor, cmpz); -} -inline int P_Find3DFloor(sector_t * sec, const DVector3 &pos, bool above, bool floor, double &cmpz) -{ - fixed_t fr = FLOAT2FIXED(cmpz); - int ret = P_Find3DFloor(sec, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), above, floor, fr); - cmpz = FIXED2DBL(fr); - return ret; -} - +secplane_t P_FindFloorPlane(sector_t * sector, const DVector3 &pos); +int P_Find3DFloor(sector_t * sec, const DVector3 &pos, bool above, bool floor, double &cmpz); #endif \ No newline at end of file diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 8b1e5aabb..fda17dc84 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -221,7 +221,7 @@ void P_Attach3dMidtexLinesToSector(sector_t *sector, int lineid, int tag, bool c // Retrieves top and bottom of the current line's mid texture. // //============================================================================ -bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot) +bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot) { if (line->sidedef[0]==NULL || line->sidedef[1]==NULL) return false; @@ -231,45 +231,31 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f FTexture * tex= TexMan(texnum); if (!tex) return false; - double totalscale = fabs(FIXED2DBL(side->GetTextureYScale(side_t::mid)) * tex->GetScaleY()); - fixed_t y_offset = side->GetTextureYOffset(side_t::mid); - fixed_t textureheight = tex->GetScaledHeight(totalscale) << FRACBITS; + double totalscale = fabs(side->GetTextureYScaleF(side_t::mid)) * tex->GetScaleY(); + double y_offset = side->GetTextureYOffsetF(side_t::mid); + double textureheight = tex->GetHeight() / totalscale; if (totalscale != 1. && !tex->bWorldPanning) { - y_offset = fixed_t(y_offset * totalscale); + y_offset *= totalscale; } if(line->flags & ML_DONTPEGBOTTOM) { *ptexbot = y_offset + - MAX(line->frontsector->GetPlaneTexZ(sector_t::floor), line->backsector->GetPlaneTexZ(sector_t::floor)); + MAX(line->frontsector->GetPlaneTexZF(sector_t::floor), line->backsector->GetPlaneTexZF(sector_t::floor)); *ptextop = *ptexbot + textureheight; } else { *ptextop = y_offset + - MIN(line->frontsector->GetPlaneTexZ(sector_t::ceiling), line->backsector->GetPlaneTexZ(sector_t::ceiling)); + MIN(line->frontsector->GetPlaneTexZF(sector_t::ceiling), line->backsector->GetPlaneTexZF(sector_t::ceiling)); *ptexbot = *ptextop - textureheight; } return true; } - -bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot) -{ - fixed_t t, b; - if (P_GetMidTexturePosition(line, sideno, &t, &b)) - { - *ptextop = FIXED2DBL(t); - *ptexbot = FIXED2DBL(b); - return true; - } - return false; -} - - //============================================================================ // // P_LineOpening_3dMidtex @@ -308,8 +294,8 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening & open.abovemidtex = true; open.floorpic = linedef->sidedef[0]->GetTexture(side_t::mid); open.floorterrain = TerrainTypes[open.floorpic]; - open.frontfloorplane.SetAtHeight(FLOAT2FIXED(tt), sector_t::floor); - open.backfloorplane.SetAtHeight(FLOAT2FIXED(tt), sector_t::floor); + open.frontfloorplane.SetAtHeight(tt, sector_t::floor); + open.backfloorplane.SetAtHeight(tt, sector_t::floor); } // returns true if it touches the midtexture @@ -321,7 +307,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening & /* still have to figure out what this code from Eternity means... if((linedef->flags & ML_BLOCKMONSTERS) && !(mo->flags & (MF_FLOAT | MF_DROPOFF)) && - D_abs(mo->z - textop) <= 24*FRACUNIT) + fabs(mo->Z() - tt) <= 24) { opentop = openbottom; openrange = 0; diff --git a/src/p_3dmidtex.h b/src/p_3dmidtex.h index d308f4f3c..641e057ee 100644 --- a/src/p_3dmidtex.h +++ b/src/p_3dmidtex.h @@ -12,7 +12,7 @@ class AActor; bool P_Scroll3dMidtex(sector_t *sector, int crush, fixed_t move, bool ceiling); void P_Start3dMidtexInterpolations(TArray &list, sector_t *sec, bool ceiling); void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling); -bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot); +bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot); bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open, bool restrict=false); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 3ea923542..d9ae0c358 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -175,7 +175,7 @@ inline DAngle ACSToAngle(int acsval) inline int AngleToACS(DAngle ang) { - xs_CRoundToInt(ang.Degrees * (65536. / 360.)); + return ang.BAMs() >> 16; } struct CallReturn @@ -722,7 +722,7 @@ void ACSStringPool::ReadStrings(PNGHandle *png, DWORD id) if (len != 0) { FPNGChunkArchive arc(png->File->GetFile(), id, len); - int32 i, j, poolsize; + int32_t i, j, poolsize; unsigned int h, bucketnum; char *str = NULL; @@ -768,7 +768,7 @@ void ACSStringPool::ReadStrings(PNGHandle *png, DWORD id) void ACSStringPool::WriteStrings(FILE *file, DWORD id) const { - int32 i, poolsize = (int32)Pool.Size(); + int32_t i, poolsize = (int32_t)Pool.Size(); if (poolsize == 0) { // No need to write if we don't have anything. @@ -3554,13 +3554,13 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force) return spawned; } -void DLevelScript::DoFadeTo (int r, int g, int b, int a, fixed_t time) +void DLevelScript::DoFadeTo (int r, int g, int b, int a, int time) { - DoFadeRange (0, 0, 0, -1, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255), clamp(a, 0, FRACUNIT), time); + DoFadeRange (0, 0, 0, -1, clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255), clamp(a, 0, 65536), time); } void DLevelScript::DoFadeRange (int r1, int g1, int b1, int a1, - int r2, int g2, int b2, int a2, fixed_t time) + int r2, int g2, int b2, int a2, int time) { player_t *viewer; float ftime = (float)time / 65536.f; @@ -4220,12 +4220,12 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b if (floor) { - actor->Sector->NextLowestFloorAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), 0, actor->_f_MaxStepHeight(), &resultsec, &resffloor); + actor->Sector->NextLowestFloorAt(actor->X(), actor->Y(), actor->Z(), 0, actor->MaxStepHeight, &resultsec, &resffloor); secpic = resffloor ? *resffloor->top.texture : resultsec->planes[sector_t::floor].Texture; } else { - actor->Sector->NextHighestCeilingAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), actor->_f_Top(), 0, &resultsec, &resffloor); + actor->Sector->NextHighestCeilingAt(actor->X(), actor->Y(), actor->Z(), actor->Top(), 0, &resultsec, &resffloor); secpic = resffloor ? *resffloor->bottom.texture : resultsec->planes[sector_t::ceiling].Texture; } return tex == TexMan[secpic]; @@ -5957,22 +5957,22 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) case ACSF_GetActorRoll: actor = SingleActorFromTID(args[0], activator); - return actor != NULL? actor->Angles.Roll.FixedAngle() : 0; + return actor != NULL? AngleToACS(actor->Angles.Roll) : 0; // [ZK] A_Warp in ACS case ACSF_Warp: { int tid_dest = args[0]; - fixed_t xofs = args[1]; - fixed_t yofs = args[2]; - fixed_t zofs = args[3]; - angle_t angle = args[4]; + int xofs = args[1]; + int yofs = args[2]; + int zofs = args[3]; + int angle = args[4]; int flags = args[5]; const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : ""; bool exact = argCount > 7 ? !!args[7] : false; - fixed_t heightoffset = argCount > 8 ? args[8] : 0; - fixed_t radiusoffset = argCount > 9 ? args[9] : 0; - fixed_t pitch = argCount > 10 ? args[10] : 0; + int heightoffset = argCount > 8 ? args[8] : 0; + int radiusoffset = argCount > 9 ? args[9] : 0; + int pitch = argCount > 10 ? args[10] : 0; FState *state = argCount > 6 ? activator->GetClass()->FindStateByString(statename, exact) : 0; @@ -6047,15 +6047,15 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) bool fullbright = argCount > 1 ? !!args[1] : false; int lifetime = argCount > 2 ? args[2] : 35; int size = argCount > 3 ? args[3] : 1; - fixed_t x = argCount > 4 ? args[4] : 0; - fixed_t y = argCount > 5 ? args[5] : 0; - fixed_t z = argCount > 6 ? args[6] : 0; - fixed_t xvel = argCount > 7 ? args[7] : 0; - fixed_t yvel = argCount > 8 ? args[8] : 0; - fixed_t zvel = argCount > 9 ? args[9] : 0; - fixed_t accelx = argCount > 10 ? args[10] : 0; - fixed_t accely = argCount > 11 ? args[11] : 0; - fixed_t accelz = argCount > 12 ? args[12] : 0; + int x = argCount > 4 ? args[4] : 0; + int y = argCount > 5 ? args[5] : 0; + int z = argCount > 6 ? args[6] : 0; + int xvel = argCount > 7 ? args[7] : 0; + int yvel = argCount > 8 ? args[8] : 0; + int zvel = argCount > 9 ? args[9] : 0; + int accelx = argCount > 10 ? args[10] : 0; + int accely = argCount > 11 ? args[11] : 0; + int accelz = argCount > 12 ? args[12] : 0; int startalpha = argCount > 13 ? args[13] : 0xFF; // Byte trans int fadestep = argCount > 14 ? args[14] : -1; @@ -6065,7 +6065,10 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) size = clamp(size, 0, 65535); // Clamp to word if (lifetime != 0) - P_SpawnParticle(x, y, z, xvel, yvel, zvel, color, fullbright, startalpha, lifetime, size, fadestep, accelx, accely, accelz); + P_SpawnParticle(DVector3(ACSToDouble(x), ACSToDouble(y), ACSToDouble(z)), + DVector3(ACSToDouble(xvel), ACSToDouble(yvel), ACSToDouble(zvel)), + DVector3(ACSToDouble(accelx), ACSToDouble(accely), ACSToDouble(accelz)), + color, fullbright, startalpha/255., lifetime, size, fadestep/255.); } break; @@ -8730,21 +8733,21 @@ scriptwait: case PCD_GETACTORANGLE: { AActor *actor = SingleActorFromTID(STACK(1), activator); - STACK(1) = actor == NULL ? 0 : actor->Angles.Yaw.FixedAngle(); + STACK(1) = actor == NULL ? 0 : AngleToACS(actor->Angles.Yaw); } break; case PCD_GETACTORPITCH: { AActor *actor = SingleActorFromTID(STACK(1), activator); - STACK(1) = actor == NULL ? 0 : actor->Angles.Pitch.FixedAngle(); + STACK(1) = actor == NULL ? 0 : AngleToACS(actor->Angles.Pitch); } break; case PCD_GETLINEROWOFFSET: if (activationline != NULL) { - PushToStack (activationline->sidedef[0]->GetTextureYOffset(side_t::mid) >> FRACBITS); + PushToStack (int(activationline->sidedef[0]->GetTextureYOffsetF(side_t::mid))); } else { @@ -8761,28 +8764,27 @@ scriptwait: { int tag = STACK(3); int secnum; - fixed_t x = STACK(2) << FRACBITS; - fixed_t y = STACK(1) << FRACBITS; - fixed_t z = 0; + DVector2 pos(ACSToDouble(STACK(2)), ACSToDouble(STACK(1))); + double z = 0; if (tag != 0) secnum = P_FindFirstSectorFromTag (tag); else - secnum = int(P_PointInSector (x, y) - sectors); + secnum = int(P_PointInSector (pos) - sectors); if (secnum >= 0) { if (pcd == PCD_GETSECTORFLOORZ) { - z = sectors[secnum].floorplane.ZatPoint (x, y); + z = sectors[secnum].floorplane.ZatPoint (pos); } else { - z = sectors[secnum].ceilingplane.ZatPoint (x, y); + z = sectors[secnum].ceilingplane.ZatPoint (pos); } } sp -= 2; - STACK(1) = z; + STACK(1) = DoubleToACS(z); } break; @@ -8863,12 +8865,12 @@ scriptwait: { // translation using desaturation int start = STACK(8); int end = STACK(7); - fixed_t r1 = STACK(6); - fixed_t g1 = STACK(5); - fixed_t b1 = STACK(4); - fixed_t r2 = STACK(3); - fixed_t g2 = STACK(2); - fixed_t b2 = STACK(1); + int r1 = STACK(6); + int g1 = STACK(5); + int b1 = STACK(4); + int r2 = STACK(3); + int g2 = STACK(2); + int b2 = STACK(1); sp -= 8; if (translation != NULL) @@ -8886,15 +8888,15 @@ scriptwait: break; case PCD_SIN: - STACK(1) = finesine[angle_t(STACK(1)<<16)>>ANGLETOFINESHIFT]; + STACK(1) = DoubleToACS(ACSToAngle(STACK(1)).Sin()); break; case PCD_COS: - STACK(1) = finecosine[angle_t(STACK(1)<<16)>>ANGLETOFINESHIFT]; + STACK(1) = DoubleToACS(ACSToAngle(STACK(1)).Cos()); break; case PCD_VECTORANGLE: - STACK(2) = R_PointToAngle2 (0, 0, STACK(2), STACK(1)) >> 16; + STACK(2) = AngleToACS(VecToAngle(STACK(2), STACK(1)).Degrees); sp--; break; @@ -9075,14 +9077,14 @@ scriptwait: // projectile a TID. // Thing_Projectile2 (tid, type, angle, speed, vspeed, gravity, newtid); P_Thing_Projectile(STACK(7), activator, STACK(6), NULL, STACK(5) * (360. / 256.), - STACK(4) << (FRACBITS - 3), STACK(3) << (FRACBITS - 3), 0, NULL, STACK(2), STACK(1), false); + ACSToDouble(STACK(4)) / 8., ACSToDouble(STACK(3)) / 8., 0, NULL, STACK(2), STACK(1), false); sp -= 7; break; case PCD_SPAWNPROJECTILE: // Same, but takes an actor name instead of a spawn ID. P_Thing_Projectile(STACK(7), activator, 0, FBehavior::StaticLookupString(STACK(6)), STACK(5) * (360. / 256.), - STACK(4) << (FRACBITS - 3), STACK(3) << (FRACBITS - 3), 0, NULL, STACK(2), STACK(1), false); + ACSToDouble(STACK(4)) / 8., ACSToDouble(STACK(3)) / 8., 0, NULL, STACK(2), STACK(1), false); sp -= 7; break; diff --git a/src/p_acs.h b/src/p_acs.h index c6dede0b8..6a7a8d3a1 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -915,9 +915,9 @@ protected: int DoClassifyActor (int tid); int CallFunction(int argCount, int funcIndex, SDWORD *args); - void DoFadeTo (int r, int g, int b, int a, fixed_t time); + void DoFadeTo (int r, int g, int b, int a, int time); void DoFadeRange (int r1, int g1, int b1, int a1, - int r2, int g2, int b2, int a2, fixed_t time); + int r2, int g2, int b2, int a2, int time); void DoSetFont (int fontnum); void SetActorProperty (int tid, int property, int value); void DoSetActorProperty (AActor *actor, int property, int value); diff --git a/src/p_effect.cpp b/src/p_effect.cpp index ba994d4e2..5e5ed316e 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -313,26 +313,27 @@ void P_ThinkParticles () } } -void P_SpawnParticle(fixed_t x, fixed_t y, fixed_t z, fixed_t vx, fixed_t vy, fixed_t vz, PalEntry color, bool fullbright, BYTE startalpha, BYTE lifetime, int size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz) + +void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, bool fullbright, double startalpha, int lifetime, WORD size, double fadestep) { particle_t *particle = NewParticle(); if (particle) { - particle->x = x; - particle->y = y; - particle->z = z; - particle->vel.x = vx; - particle->vel.y = vy; - particle->vel.z = vz; + particle->x = FLOAT2FIXED(pos.X); + particle->y = FLOAT2FIXED(pos.Y); + particle->z = FLOAT2FIXED(pos.Z); + particle->vel.x = FLOAT2FIXED(vel.X); + particle->vel.y = FLOAT2FIXED(vel.Y); + particle->vel.z = FLOAT2FIXED(vel.Z); particle->color = ParticleColor(color); - particle->trans = startalpha; - if (fadestep < 0) fadestep = FADEFROMTTL(lifetime); - particle->fade = fadestep; + particle->trans = BYTE(startalpha*255); + if (fadestep < 0) particle->fade = FADEFROMTTL(lifetime); + else particle->fade = int(fadestep * 255); particle->ttl = lifetime; - particle->accx = accelx; - particle->accy = accely; - particle->accz = accelz; + particle->accx = FLOAT2FIXED(accel.X); + particle->accy = FLOAT2FIXED(accel.Y); + particle->accz = FLOAT2FIXED(accel.Z); particle->bright = fullbright; particle->size = (WORD)size; } diff --git a/src/p_effect.h b/src/p_effect.h index 856f0d824..d62fc7d65 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -83,12 +83,7 @@ particle_t *JitterParticle (int ttl); particle_t *JitterParticle (int ttl, double drift); void P_ThinkParticles (void); -void P_SpawnParticle(fixed_t x, fixed_t y, fixed_t z, fixed_t vx, fixed_t vy, fixed_t vz, PalEntry color, bool fullbright, BYTE startalpha, BYTE lifetime, int size, int fadestep, fixed_t accelx, fixed_t accely, fixed_t accelz); -inline void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, bool fullbright, double startalpha, int lifetime, WORD size, double fadestep) -{ - P_SpawnParticle(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), FLOAT2FIXED(vel.X), FLOAT2FIXED(vel.Y), FLOAT2FIXED(vel.Z), - color, fullbright, BYTE(startalpha * 255), BYTE(lifetime), WORD(size), fadestep < 0 ? -1 : int(fadestep * 255), FLOAT2FIXED(accel.X), FLOAT2FIXED(accel.Y), FLOAT2FIXED(accel.Z)); -} +void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, bool fullbright, double startalpha, int lifetime, WORD size, double fadestep); void P_InitEffects (void); void P_RunEffects (void); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 76aecea8c..9f88d7ad8 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2636,12 +2636,12 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) (vilesec != corpsec && corpsec->e->XFloor.ffloors.Size()) ? corpsec : NULL; if (testsec) { - fixed_t zdist1, zdist2; - if (P_Find3DFloor(testsec, corpsehit->_f_Pos(), false, true, zdist1) - != P_Find3DFloor(testsec, self->_f_Pos(), false, true, zdist2)) + double zdist1, zdist2; + if (P_Find3DFloor(testsec, corpsehit->Pos(), false, true, zdist1) + != P_Find3DFloor(testsec, self->Pos(), false, true, zdist2)) { // Not on same floor - if (vilesec == corpsec || abs(zdist1 - self->_f_Z()) > self->_f_height()) + if (vilesec == corpsec || fabs(zdist1 - self->Z()) > self->Height) continue; } } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 833f41bad..28764d4d3 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -79,7 +79,8 @@ static const BYTE ChangeMap[8] = { 0, 1, 5, 3, 7, 2, 6, 0 }; #define FUNC(a) static int a (line_t *ln, AActor *it, bool backSide, \ int arg0, int arg1, int arg2, int arg3, int arg4) -#define SPEED(a) ((a)*(FRACUNIT/8)) +#define SPEED(a) ((a) / 8.) +#define _f_SPEED(a) ((a)*(FRACUNIT/8)) #define TICS(a) (((a)*TICRATE)/35) #define OCTICS(a) (((a)*TICRATE)/8) #define _f_BYTEANGLE(a) ((angle_t)((a)<<24)) @@ -147,19 +148,19 @@ FUNC(LS_Polyobj_RotateRight) FUNC(LS_Polyobj_Move) // Polyobj_Move (po, speed, angle, distance) { - return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT, false); + return EV_MovePoly (ln, arg0, _f_SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT, false); } FUNC(LS_Polyobj_MoveTimes8) // Polyobj_MoveTimes8 (po, speed, angle, distance) { - return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT * 8, false); + return EV_MovePoly (ln, arg0, _f_SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT * 8, false); } FUNC(LS_Polyobj_MoveTo) // Polyobj_MoveTo (po, speed, x, y) { - return EV_MovePolyTo (ln, arg0, SPEED(arg1), arg2 << FRACBITS, arg3 << FRACBITS, false); + return EV_MovePolyTo (ln, arg0, _f_SPEED(arg1), arg2 << FRACBITS, arg3 << FRACBITS, false); } FUNC(LS_Polyobj_MoveToSpot) @@ -168,7 +169,7 @@ FUNC(LS_Polyobj_MoveToSpot) FActorIterator iterator (arg2); AActor *spot = iterator.Next(); if (spot == NULL) return false; - return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->_f_X(), spot->_f_Y(), false); + return EV_MovePolyTo (ln, arg0, _f_SPEED(arg1), spot->_f_X(), spot->_f_Y(), false); } FUNC(LS_Polyobj_DoorSwing) @@ -180,7 +181,7 @@ FUNC(LS_Polyobj_DoorSwing) FUNC(LS_Polyobj_DoorSlide) // Polyobj_DoorSlide (po, speed, angle, distance, delay) { - return EV_OpenPolyDoor (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg4, arg3*FRACUNIT, PODOOR_SLIDE); + return EV_OpenPolyDoor (ln, arg0, _f_SPEED(arg1), _f_BYTEANGLE(arg2), arg4, arg3*FRACUNIT, PODOOR_SLIDE); } FUNC(LS_Polyobj_OR_RotateLeft) @@ -198,19 +199,19 @@ FUNC(LS_Polyobj_OR_RotateRight) FUNC(LS_Polyobj_OR_Move) // Polyobj_OR_Move (po, speed, angle, distance) { - return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT, true); + return EV_MovePoly (ln, arg0, _f_SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT, true); } FUNC(LS_Polyobj_OR_MoveTimes8) // Polyobj_OR_MoveTimes8 (po, speed, angle, distance) { - return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT * 8, true); + return EV_MovePoly (ln, arg0, _f_SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT * 8, true); } FUNC(LS_Polyobj_OR_MoveTo) // Polyobj_OR_MoveTo (po, speed, x, y) { - return EV_MovePolyTo (ln, arg0, SPEED(arg1), arg2 << FRACBITS, arg3 << FRACBITS, true); + return EV_MovePolyTo (ln, arg0, _f_SPEED(arg1), arg2 << FRACBITS, arg3 << FRACBITS, true); } FUNC(LS_Polyobj_OR_MoveToSpot) @@ -219,7 +220,7 @@ FUNC(LS_Polyobj_OR_MoveToSpot) FActorIterator iterator (arg2); AActor *spot = iterator.Next(); if (spot == NULL) return false; - return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->_f_X(), spot->_f_Y(), true); + return EV_MovePolyTo (ln, arg0, _f_SPEED(arg1), spot->_f_X(), spot->_f_Y(), true); } FUNC(LS_Polyobj_Stop) @@ -231,44 +232,44 @@ FUNC(LS_Polyobj_Stop) FUNC(LS_Door_Close) // Door_Close (tag, speed, lighttag) { - return EV_DoDoor (DDoor::doorClose, ln, it, arg0, SPEED(arg1), 0, 0, arg2); + return EV_DoDoor (DDoor::doorClose, ln, it, arg0, _f_SPEED(arg1), 0, 0, arg2); } FUNC(LS_Door_Open) // Door_Open (tag, speed, lighttag) { - return EV_DoDoor (DDoor::doorOpen, ln, it, arg0, SPEED(arg1), 0, 0, arg2); + return EV_DoDoor (DDoor::doorOpen, ln, it, arg0, _f_SPEED(arg1), 0, 0, arg2); } FUNC(LS_Door_Raise) // Door_Raise (tag, speed, delay, lighttag) { - return EV_DoDoor (DDoor::doorRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg3); + return EV_DoDoor (DDoor::doorRaise, ln, it, arg0, _f_SPEED(arg1), TICS(arg2), 0, arg3); } FUNC(LS_Door_LockedRaise) // Door_LockedRaise (tag, speed, delay, lock, lighttag) { return EV_DoDoor (arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it, - arg0, SPEED(arg1), TICS(arg2), arg3, arg4); + arg0, _f_SPEED(arg1), TICS(arg2), arg3, arg4); } FUNC(LS_Door_CloseWaitOpen) // Door_CloseWaitOpen (tag, speed, delay, lighttag) { - return EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, SPEED(arg1), OCTICS(arg2), 0, arg3); + return EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, _f_SPEED(arg1), OCTICS(arg2), 0, arg3); } FUNC(LS_Door_WaitRaise) // Door_WaitRaise(tag, speed, delay, wait, lighttag) { - return EV_DoDoor(DDoor::doorWaitRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3)); + return EV_DoDoor(DDoor::doorWaitRaise, ln, it, arg0, _f_SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3)); } FUNC(LS_Door_WaitClose) // Door_WaitRaise(tag, speed, wait, lighttag) { - return EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, SPEED(arg1), 0, 0, arg3, false, TICS(arg2)); + return EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, _f_SPEED(arg1), 0, 0, arg3, false, TICS(arg2)); } FUNC(LS_Door_Animated) @@ -308,55 +309,55 @@ FUNC(LS_Generic_Door) tag = arg0; lightTag = 0; } - return EV_DoDoor (type, ln, it, tag, SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen); + return EV_DoDoor (type, ln, it, tag, _f_SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen); } FUNC(LS_Floor_LowerByValue) // Floor_LowerByValue (tag, speed, height, change) { - return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), FRACUNIT*arg2, -1, CHANGE(arg3), false); + return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2, -1, CHANGE(arg3), false); } FUNC(LS_Floor_LowerToLowest) // Floor_LowerToLowest (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); + return EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), false); } FUNC(LS_Floor_LowerToHighest) // Floor_LowerToHighest (tag, speed, adjust, hereticlower) { - return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), (arg2-128)*FRACUNIT, -1, 0, false, arg3==1); + return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, _f_SPEED(arg1), (arg2-128)*FRACUNIT, -1, 0, false, arg3==1); } FUNC(LS_Floor_LowerToHighestEE) // Floor_LowerToHighest (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); + return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), false); } FUNC(LS_Floor_LowerToNearest) // Floor_LowerToNearest (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); + return EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), false); } FUNC(LS_Floor_RaiseByValue) // Floor_RaiseByValue (tag, speed, height, change, crush) { - return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), FRACUNIT*arg2, CRUSH(arg4), CHANGE(arg3), true); + return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2, CRUSH(arg4), CHANGE(arg3), true); } FUNC(LS_Floor_RaiseToHighest) // Floor_RaiseToHighest (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseToNearest) // Floor_RaiseToNearest (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseToLowest) @@ -369,25 +370,25 @@ FUNC(LS_Floor_RaiseToLowest) FUNC(LS_Floor_RaiseAndCrush) // Floor_RaiseAndCrush (tag, speed, crush, crushmode) { - return EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); + return EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, _f_SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); } FUNC(LS_Floor_RaiseAndCrushDoom) // Floor_RaiseAndCrushDoom (tag, speed, crush, crushmode) { - return EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); + return EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, _f_SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); } FUNC(LS_Floor_RaiseByValueTimes8) // FLoor_RaiseByValueTimes8 (tag, speed, height, change, crush) { - return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), FRACUNIT*arg2*8, CRUSH(arg4), CHANGE(arg3), true); + return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2*8, CRUSH(arg4), CHANGE(arg3), true); } FUNC(LS_Floor_LowerByValueTimes8) // Floor_LowerByValueTimes8 (tag, speed, height, change) { - return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), FRACUNIT*arg2*8, -1, CHANGE(arg3), false); + return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, _f_SPEED(arg1), FRACUNIT*arg2*8, -1, CHANGE(arg3), false); } FUNC(LS_Floor_CrushStop) @@ -417,57 +418,57 @@ FUNC(LS_Floor_ToCeilingInstant) FUNC(LS_Floor_MoveToValueTimes8) // Floor_MoveToValueTimes8 (tag, speed, height, negative, change) { - return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), + return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT*8*(arg3?-1:1), -1, CHANGE(arg4), false); } FUNC(LS_Floor_MoveToValue) // Floor_MoveToValue (tag, speed, height, negative, change) { - return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), + return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT*(arg3?-1:1), -1, CHANGE(arg4), false); } FUNC(LS_Floor_RaiseToLowestCeiling) // Floor_RaiseToLowestCeiling (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_LowerToLowestCeiling) // Floor_LowerToLowestCeiling (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), true); } FUNC(LS_Floor_RaiseByTexture) // Floor_RaiseByTexture (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_LowerByTexture) // Floor_LowerByTexture (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, _f_SPEED(arg1), 0, -1, CHANGE(arg2), true); } FUNC(LS_Floor_RaiseToCeiling) // Floor_RaiseToCeiling (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, _f_SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseByValueTxTy) // Floor_RaiseByValueTxTy (tag, speed, height) { - return EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, SPEED(arg1), arg2*FRACUNIT, -1, 0, false); + return EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, -1, 0, false); } FUNC(LS_Floor_LowerToLowestTxTy) // Floor_LowerToLowestTxTy (tag, speed) { - return EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, SPEED(arg1), arg2*FRACUNIT, -1, 0, false); + return EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, -1, 0, false); } FUNC(LS_Floor_Waggle) @@ -497,7 +498,7 @@ FUNC(LS_Floor_TransferNumeric) FUNC(LS_Floor_Donut) // Floor_Donut (pillartag, pillarspeed, slimespeed) { - return EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2)); + return EV_DoDonut (arg0, ln, _f_SPEED(arg1), _f_SPEED(arg2)); } FUNC(LS_Generic_Floor) @@ -532,7 +533,7 @@ FUNC(LS_Generic_Floor) } } - return EV_DoFloor (type, ln, arg0, SPEED(arg1), arg2*FRACUNIT, + return EV_DoFloor (type, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, (arg4 & 16) ? 20 : -1, arg4 & 7, false); } @@ -541,56 +542,56 @@ FUNC(LS_Stairs_BuildDown) // Stair_BuildDown (tag, speed, height, delay, reset) { return EV_BuildStairs (arg0, DFloor::buildDown, ln, - arg2 * FRACUNIT, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); + arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); } FUNC(LS_Stairs_BuildUp) // Stairs_BuildUp (tag, speed, height, delay, reset) { return EV_BuildStairs (arg0, DFloor::buildUp, ln, - arg2 * FRACUNIT, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); + arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); } FUNC(LS_Stairs_BuildDownSync) // Stairs_BuildDownSync (tag, speed, height, reset) { return EV_BuildStairs (arg0, DFloor::buildDown, ln, - arg2 * FRACUNIT, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); + arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); } FUNC(LS_Stairs_BuildUpSync) // Stairs_BuildUpSync (tag, speed, height, reset) { return EV_BuildStairs (arg0, DFloor::buildUp, ln, - arg2 * FRACUNIT, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); + arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); } FUNC(LS_Stairs_BuildUpDoom) // Stairs_BuildUpDoom (tag, speed, height, delay, reset) { return EV_BuildStairs (arg0, DFloor::buildUp, ln, - arg2 * FRACUNIT, SPEED(arg1), TICS(arg3), arg4, 0, 0); + arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, 0); } FUNC(LS_Stairs_BuildDownDoom) // Stair_BuildDownDoom (tag, speed, height, delay, reset) { return EV_BuildStairs (arg0, DFloor::buildDown, ln, - arg2 * FRACUNIT, SPEED(arg1), TICS(arg3), arg4, 0, 0); + arg2 * FRACUNIT, _f_SPEED(arg1), TICS(arg3), arg4, 0, 0); } FUNC(LS_Stairs_BuildDownDoomSync) // Stairs_BuildDownDoomSync (tag, speed, height, reset) { return EV_BuildStairs (arg0, DFloor::buildDown, ln, - arg2 * FRACUNIT, SPEED(arg1), 0, arg3, 0, DFloor::stairSync); + arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairSync); } FUNC(LS_Stairs_BuildUpDoomSync) // Stairs_BuildUpDoomSync (tag, speed, height, reset) { return EV_BuildStairs (arg0, DFloor::buildUp, ln, - arg2 * FRACUNIT, SPEED(arg1), 0, arg3, 0, DFloor::stairSync); + arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg3, 0, DFloor::stairSync); } @@ -599,7 +600,7 @@ FUNC(LS_Generic_Stairs) { DFloor::EStair type = (arg3 & 1) ? DFloor::buildUp : DFloor::buildDown; bool res = EV_BuildStairs (arg0, type, ln, - arg2 * FRACUNIT, SPEED(arg1), 0, arg4, arg3 & 2, 0); + arg2 * FRACUNIT, _f_SPEED(arg1), 0, arg4, arg3 & 2, 0); if (res && ln && (ln->flags & ML_REPEAT_SPECIAL) && ln->special == Generic_Stairs) // Toggle direction of next activation of repeatable stairs @@ -611,61 +612,61 @@ FUNC(LS_Generic_Stairs) FUNC(LS_Pillar_Build) // Pillar_Build (tag, speed, height) { - return EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2*FRACUNIT, 0, -1, false); + return EV_DoPillar (DPillar::pillarBuild, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, 0, -1, false); } FUNC(LS_Pillar_BuildAndCrush) // Pillar_BuildAndCrush (tag, speed, height, crush, crushtype) { - return EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2*FRACUNIT, 0, arg3, CRUSHTYPE(arg4)); + return EV_DoPillar (DPillar::pillarBuild, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, 0, arg3, CRUSHTYPE(arg4)); } FUNC(LS_Pillar_Open) // Pillar_Open (tag, speed, f_height, c_height) { - return EV_DoPillar (DPillar::pillarOpen, ln, arg0, SPEED(arg1), arg2*FRACUNIT, arg3*FRACUNIT, -1, false); + return EV_DoPillar (DPillar::pillarOpen, ln, arg0, _f_SPEED(arg1), arg2*FRACUNIT, arg3*FRACUNIT, -1, false); } FUNC(LS_Ceiling_LowerByValue) // Ceiling_LowerByValue (tag, speed, height, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT, CRUSH(arg4), 0, CHANGE(arg3), false); + return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, _f_SPEED(arg1), 0, arg2*FRACUNIT, CRUSH(arg4), 0, CHANGE(arg3), false); } FUNC(LS_Ceiling_RaiseByValue) // Ceiling_RaiseByValue (tag, speed, height, change) { - return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT, CRUSH(arg4), 0, CHANGE(arg3), false); + return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, _f_SPEED(arg1), 0, arg2*FRACUNIT, CRUSH(arg4), 0, CHANGE(arg3), false); } FUNC(LS_Ceiling_LowerByValueTimes8) // Ceiling_LowerByValueTimes8 (tag, speed, height, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3), false); + return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, _f_SPEED(arg1), 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3), false); } FUNC(LS_Ceiling_RaiseByValueTimes8) // Ceiling_RaiseByValueTimes8 (tag, speed, height, change) { - return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3), false); + return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, _f_SPEED(arg1), 0, arg2*FRACUNIT*8, -1, 0, CHANGE(arg3), false); } FUNC(LS_Ceiling_CrushAndRaise) // Ceiling_CrushAndRaise (tag, speed, crush, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3)); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg1)/2, 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3)); } FUNC(LS_Ceiling_LowerAndCrush) // Ceiling_LowerAndCrush (tag, speed, crush, crushtype) { - return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3)); + return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg1), 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3)); } FUNC(LS_Ceiling_LowerAndCrushDist) // Ceiling_LowerAndCrush (tag, speed, crush, dist, crushtype) { - return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), arg3*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg1), arg3*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_CrushStop) @@ -677,27 +678,27 @@ FUNC(LS_Ceiling_CrushStop) FUNC(LS_Ceiling_CrushRaiseAndStay) // Ceiling_CrushRaiseAndStay (tag, speed, crush, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3)); + return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg1)/2, 8*FRACUNIT, arg2, 0, 0, CRUSHTYPE(arg3)); } FUNC(LS_Ceiling_MoveToValueTimes8) // Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change) { - return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, + return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, _f_SPEED(arg1), 0, arg2*FRACUNIT*8*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4), false); } FUNC(LS_Ceiling_MoveToValue) // Ceiling_MoveToValue (tag, speed, height, negative, change) { - return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, + return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, _f_SPEED(arg1), 0, arg2*FRACUNIT*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4), false); } FUNC(LS_Ceiling_LowerToHighestFloor) // Ceiling_LowerToHighestFloor (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToHighestFloor, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2), false); + return EV_DoCeiling (DCeiling::ceilLowerToHighestFloor, ln, arg0, _f_SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2), false); } FUNC(LS_Ceiling_LowerInstant) @@ -715,79 +716,79 @@ FUNC(LS_Ceiling_RaiseInstant) FUNC(LS_Ceiling_CrushRaiseAndStayA) // Ceiling_CrushRaiseAndStayA (tag, dnspeed, upspeed, damage, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_CrushRaiseAndStaySilA) // Ceiling_CrushRaiseAndStaySilA (tag, dnspeed, upspeed, damage, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_CrushAndRaiseA) // Ceiling_CrushAndRaiseA (tag, dnspeed, upspeed, damage, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_CrushAndRaiseDist) // Ceiling_CrushAndRaiseDist (tag, dist, speed, damage, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1*FRACUNIT, arg3, 0, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg2), _f_SPEED(arg2), arg1*FRACUNIT, arg3, 0, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_CrushAndRaiseSilentA) // Ceiling_CrushAndRaiseSilentA (tag, dnspeed, upspeed, damage, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_CrushAndRaiseSilentDist) // Ceiling_CrushAndRaiseSilentDist (tag, dist, upspeed, damage, crushtype) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1*FRACUNIT, arg3, 1, 0, CRUSHTYPE(arg4)); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg2), _f_SPEED(arg2), arg1*FRACUNIT, arg3, 1, 0, CRUSHTYPE(arg4)); } FUNC(LS_Ceiling_RaiseToNearest) // Ceiling_RaiseToNearest (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToNearest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); + return EV_DoCeiling (DCeiling::ceilRaiseToNearest, ln, arg0, _f_SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); } FUNC(LS_Ceiling_RaiseToHighest) // Ceiling_RaiseToHighest (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); + return EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, _f_SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); } FUNC(LS_Ceiling_RaiseToLowest) // Ceiling_RaiseToLowest (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToLowest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); + return EV_DoCeiling (DCeiling::ceilRaiseToLowest, ln, arg0, _f_SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); } FUNC(LS_Ceiling_RaiseToHighestFloor) // Ceiling_RaiseToHighestFloor (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToHighestFloor, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); + return EV_DoCeiling (DCeiling::ceilRaiseToHighestFloor, ln, arg0, _f_SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); } FUNC(LS_Ceiling_RaiseByTexture) // Ceiling_RaiseByTexture (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseByTexture, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); + return EV_DoCeiling (DCeiling::ceilRaiseByTexture, ln, arg0, _f_SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0, false); } FUNC(LS_Ceiling_LowerToLowest) // Ceiling_LowerToLowest (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToLowest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2), false); + return EV_DoCeiling (DCeiling::ceilLowerToLowest, ln, arg0, _f_SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2), false); } FUNC(LS_Ceiling_LowerToNearest) // Ceiling_LowerToNearest (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToNearest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2), false); + return EV_DoCeiling (DCeiling::ceilLowerToNearest, ln, arg0, _f_SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2), false); } FUNC(LS_Ceiling_ToHighestInstant) @@ -805,13 +806,13 @@ FUNC(LS_Ceiling_ToFloorInstant) FUNC(LS_Ceiling_LowerToFloor) // Ceiling_LowerToFloor (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToFloor, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg4), false); + return EV_DoCeiling (DCeiling::ceilLowerToFloor, ln, arg0, _f_SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg4), false); } FUNC(LS_Ceiling_LowerByTexture) // Ceiling_LowerByTexture (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerByTexture, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg4), false); + return EV_DoCeiling (DCeiling::ceilLowerByTexture, ln, arg0, _f_SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg4), false); } FUNC(LS_Generic_Ceiling) @@ -841,35 +842,35 @@ FUNC(LS_Generic_Ceiling) } } - return EV_DoCeiling (type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2*FRACUNIT, + return EV_DoCeiling (type, ln, arg0, _f_SPEED(arg1), _f_SPEED(arg1), arg2*FRACUNIT, (arg4 & 16) ? 20 : -1, 0, arg4 & 7, false); } FUNC(LS_Generic_Crusher) // Generic_Crusher (tag, dnspeed, upspeed, silent, damage) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), - SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, false); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg1), + _f_SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, false); } FUNC(LS_Generic_Crusher2) // Generic_Crusher2 (tag, dnspeed, upspeed, silent, damage) { // same as above but uses Hexen's crushing method. - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), - SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, true); + return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, _f_SPEED(arg1), + _f_SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, true); } FUNC(LS_Plat_PerpetualRaise) // Plat_PerpetualRaise (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), 8, 0); + return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, _f_SPEED(arg1), TICS(arg2), 8, 0); } FUNC(LS_Plat_PerpetualRaiseLip) // Plat_PerpetualRaiseLip (tag, speed, delay, lip) { - return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), arg3, 0); + return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, _f_SPEED(arg1), TICS(arg2), arg3, 0); } FUNC(LS_Plat_Stop) @@ -882,7 +883,7 @@ FUNC(LS_Plat_Stop) FUNC(LS_Plat_DownWaitUpStay) // Plat_DownWaitUpStay (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platDownWaitUpStay, 0, SPEED(arg1), TICS(arg2), 8, 0); + return EV_DoPlat (arg0, ln, DPlat::platDownWaitUpStay, 0, _f_SPEED(arg1), TICS(arg2), 8, 0); } FUNC(LS_Plat_DownWaitUpStayLip) @@ -890,31 +891,31 @@ FUNC(LS_Plat_DownWaitUpStayLip) { return EV_DoPlat (arg0, ln, arg4 ? DPlat::platDownWaitUpStayStone : DPlat::platDownWaitUpStay, - 0, SPEED(arg1), TICS(arg2), arg3, 0); + 0, _f_SPEED(arg1), TICS(arg2), arg3, 0); } FUNC(LS_Plat_DownByValue) // Plat_DownByValue (tag, speed, delay, height) { - return EV_DoPlat (arg0, ln, DPlat::platDownByValue, FRACUNIT*arg3*8, SPEED(arg1), TICS(arg2), 0, 0); + return EV_DoPlat (arg0, ln, DPlat::platDownByValue, FRACUNIT*arg3*8, _f_SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_UpByValue) // Plat_UpByValue (tag, speed, delay, height) { - return EV_DoPlat (arg0, ln, DPlat::platUpByValue, FRACUNIT*arg3*8, SPEED(arg1), TICS(arg2), 0, 0); + return EV_DoPlat (arg0, ln, DPlat::platUpByValue, FRACUNIT*arg3*8, _f_SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_UpWaitDownStay) // Plat_UpWaitDownStay (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platUpWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0); + return EV_DoPlat (arg0, ln, DPlat::platUpWaitDownStay, 0, _f_SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_UpNearestWaitDownStay) // Plat_UpNearestWaitDownStay (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platUpNearestWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0); + return EV_DoPlat (arg0, ln, DPlat::platUpNearestWaitDownStay, 0, _f_SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_RaiseAndStayTx0) @@ -936,13 +937,13 @@ FUNC(LS_Plat_RaiseAndStayTx0) } - return EV_DoPlat (arg0, ln, type, 0, SPEED(arg1), 0, 0, 1); + return EV_DoPlat (arg0, ln, type, 0, _f_SPEED(arg1), 0, 0, 1); } FUNC(LS_Plat_UpByValueStayTx) // Plat_UpByValueStayTx (tag, speed, height) { - return EV_DoPlat (arg0, ln, DPlat::platUpByValueStay, FRACUNIT*arg2*8, SPEED(arg1), 0, 0, 2); + return EV_DoPlat (arg0, ln, DPlat::platUpByValueStay, FRACUNIT*arg2*8, _f_SPEED(arg1), 0, 0, 2); } FUNC(LS_Plat_ToggleCeiling) @@ -975,7 +976,7 @@ FUNC(LS_Generic_Lift) break; } - return EV_DoPlat (arg0, ln, type, arg4*8*FRACUNIT, SPEED(arg1), OCTICS(arg2), 0, 0); + return EV_DoPlat (arg0, ln, type, arg4*8*FRACUNIT, _f_SPEED(arg1), OCTICS(arg2), 0, 0); } FUNC(LS_Exit_Normal) @@ -1457,15 +1458,15 @@ FUNC(LS_Thing_Damage) FUNC(LS_Thing_Projectile) // Thing_Projectile (tid, type, angle, speed, vspeed) { - return P_Thing_Projectile (arg0, it, arg1, NULL, BYTEANGLE(arg2), arg3<<(FRACBITS-3), - arg4<<(FRACBITS-3), 0, NULL, 0, 0, false); + return P_Thing_Projectile (arg0, it, arg1, NULL, BYTEANGLE(arg2), SPEED(arg3), + SPEED(arg4), 0, NULL, 0, 0, false); } FUNC(LS_Thing_ProjectileGravity) // Thing_ProjectileGravity (tid, type, angle, speed, vspeed) { - return P_Thing_Projectile (arg0, it, arg1, NULL, BYTEANGLE(arg2), arg3<<(FRACBITS-3), - arg4<<(FRACBITS-3), 0, NULL, 1, 0, false); + return P_Thing_Projectile (arg0, it, arg1, NULL, BYTEANGLE(arg2), SPEED(arg3), + SPEED(arg4), 0, NULL, 1, 0, false); } FUNC(LS_Thing_Hate) @@ -1634,13 +1635,13 @@ FUNC(LS_Thing_Hate) FUNC(LS_Thing_ProjectileAimed) // Thing_ProjectileAimed (tid, type, speed, target, newtid) { - return P_Thing_Projectile (arg0, it, arg1, NULL, 0., arg2<<(FRACBITS-3), 0, arg3, it, 0, arg4, false); + return P_Thing_Projectile (arg0, it, arg1, NULL, 0., SPEED(arg2), 0, arg3, it, 0, arg4, false); } FUNC(LS_Thing_ProjectileIntercept) // Thing_ProjectileIntercept (tid, type, speed, target, newtid) { - return P_Thing_Projectile (arg0, it, arg1, NULL, 0., arg2<<(FRACBITS-3), 0, arg3, it, 0, arg4, true); + return P_Thing_Projectile (arg0, it, arg1, NULL, 0., SPEED(arg2), 0, arg3, it, 0, arg4, true); } // [BC] added newtid for next two @@ -1930,26 +1931,26 @@ FUNC(LS_FS_Execute) FUNC(LS_FloorAndCeiling_LowerByValue) // FloorAndCeiling_LowerByValue (tag, speed, height) { - return EV_DoElevator (ln, DElevator::elevateLower, SPEED(arg1), arg2*FRACUNIT, arg0); + return EV_DoElevator (ln, DElevator::elevateLower, _f_SPEED(arg1), arg2*FRACUNIT, arg0); } FUNC(LS_FloorAndCeiling_RaiseByValue) // FloorAndCeiling_RaiseByValue (tag, speed, height) { - return EV_DoElevator (ln, DElevator::elevateRaise, SPEED(arg1), arg2*FRACUNIT, arg0); + return EV_DoElevator (ln, DElevator::elevateRaise, _f_SPEED(arg1), arg2*FRACUNIT, arg0); } FUNC(LS_FloorAndCeiling_LowerRaise) // FloorAndCeiling_LowerRaise (tag, fspeed, cspeed, boomemu) { - bool res = EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg2), 0, 0, 0, 0, 0, false); + bool res = EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, _f_SPEED(arg2), 0, 0, 0, 0, 0, false); // The switch based Boom equivalents of FloorandCeiling_LowerRaise do incorrect checks // which cause the floor only to move when the ceiling fails to do so. // To avoid problems with maps that have incorrect args this only uses a // more or less unintuitive value for the fourth arg to trigger Boom's broken behavior if (arg3 != 1998 || !res) // (1998 for the year in which Boom was released... :P) { - res |= EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, 0, false); + res |= EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, _f_SPEED(arg1), 0, -1, 0, false); } return res; } @@ -1957,19 +1958,19 @@ FUNC(LS_FloorAndCeiling_LowerRaise) FUNC(LS_Elevator_MoveToFloor) // Elevator_MoveToFloor (tag, speed) { - return EV_DoElevator (ln, DElevator::elevateCurrent, SPEED(arg1), 0, arg0); + return EV_DoElevator (ln, DElevator::elevateCurrent, _f_SPEED(arg1), 0, arg0); } FUNC(LS_Elevator_RaiseToNearest) // Elevator_RaiseToNearest (tag, speed) { - return EV_DoElevator (ln, DElevator::elevateUp, SPEED(arg1), 0, arg0); + return EV_DoElevator (ln, DElevator::elevateUp, _f_SPEED(arg1), 0, arg0); } FUNC(LS_Elevator_LowerToNearest) // Elevator_LowerToNearest (tag, speed) { - return EV_DoElevator (ln, DElevator::elevateDown, SPEED(arg1), 0, arg0); + return EV_DoElevator (ln, DElevator::elevateDown, _f_SPEED(arg1), 0, arg0); } FUNC(LS_Light_ForceLightning) @@ -2893,7 +2894,7 @@ enum PROP_FLIGHT, PROP_UNUSED1, PROP_UNUSED2, - PROP_SPEED, + PROP__f_SPEED, PROP_BUDDHA, }; @@ -2908,7 +2909,7 @@ FUNC(LS_SetPlayerProperty) return false; // Add or remove a power - if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP_SPEED) + if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP__f_SPEED) { static PClass * const *powers[11] = { diff --git a/src/p_local.h b/src/p_local.h index 47be75835..e9a9b9992 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -210,8 +210,9 @@ extern FClassMap StrifeTypes; bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, int newtid); bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_name, DAngle angle, - fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid, + double speed, double vspeed, int dest, AActor *forcedest, int gravity, int newtid, bool leadTarget); + bool P_MoveThing(AActor *source, const DVector3 &pos, bool fog); bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog); int P_Thing_Damage (int tid, AActor *whofor0, int amount, FName type); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index b4d6dc8fe..adacb4d43 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -243,8 +243,8 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co open.floorterrain = -1; open.bottom = LINEOPEN_MIN; open.lowfloor = LINEOPEN_MAX; - open.frontfloorplane.SetAtHeight(FIXED_MIN, sector_t::floor); - open.backfloorplane.SetAtHeight(FIXED_MIN, sector_t::floor); + open.frontfloorplane.SetAtHeight(LINEOPEN_MIN, sector_t::floor); + open.backfloorplane.SetAtHeight(LINEOPEN_MIN, sector_t::floor); } // Check 3D floors diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b64b4777d..28f264002 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3683,7 +3683,7 @@ void AActor::Tick () secplane_t floorplane; // Check 3D floors as well - floorplane = P_FindFloorPlane(floorsector, _f_X(), _f_Y(), _f_floorz()); + floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz)); if (floorplane.c < STEEPSLOPE && floorplane.ZatPoint (_f_PosRelative(floorsector)) <= _f_floorz()) diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 91f579250..962330be1 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -119,8 +119,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo if (side == NULL) return true; - fixed_t checktop; - fixed_t checkbot; + double checktop; + double checkbot; sector_t *front = side->sector; FLineOpening open; int flags = line->flags; @@ -229,7 +229,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo // to keep compatibility with Eternity's implementation. if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot)) return false; - return user->_f_Z() < checktop && user->_f_Top() > checkbot; + return user->Z() < checktop && user->Top() > checkbot; } else { diff --git a/src/p_things.cpp b/src/p_things.cpp index 929f07482..1560736a0 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -169,15 +169,13 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog) } bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_name, DAngle angle, - fixed_t _speed, fixed_t _vspeed, int dest, AActor *forcedest, int gravity, int newtid, + double speed, double vspeed, int dest, AActor *forcedest, int gravity, int newtid, bool leadTarget) { int rtn = 0; PClassActor *kind; AActor *spot, *mobj, *targ = forcedest; FActorIterator iterator (tid); - double speed = FIXED2DBL(_speed); - double vspeed = FIXED2DBL(_vspeed); int defflags3; if (type_name == NULL) diff --git a/src/p_writemap.cpp b/src/p_writemap.cpp index ab3290619..cd8082cfe 100644 --- a/src/p_writemap.cpp +++ b/src/p_writemap.cpp @@ -150,8 +150,8 @@ static int WriteSIDEDEFS (FILE *file) for (int i = 0; i < numsides; ++i) { - msd.textureoffset = LittleShort(short(sides[i].GetTextureXOffset(side_t::mid) >> FRACBITS)); - msd.rowoffset = LittleShort(short(sides[i].GetTextureYOffset(side_t::mid) >> FRACBITS)); + msd.textureoffset = LittleShort(short(sides[i].GetTextureXOffsetF(side_t::mid))); + msd.rowoffset = LittleShort(short(sides[i].GetTextureYOffsetF(side_t::mid))); msd.sector = LittleShort(short(sides[i].sector - sectors)); uppercopy (msd.toptexture, GetTextureName (sides[i].GetTexture(side_t::top))); uppercopy (msd.bottomtexture, GetTextureName (sides[i].GetTexture(side_t::bottom))); diff --git a/src/r_defs.h b/src/r_defs.h index 6985d174b..4be105906 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -405,6 +405,11 @@ struct secplane_t } } + inline void SetAtHeight(double height, int ceiling) + { + SetAtHeight(FLOAT2FIXED(clamp(height, -32767., 32767.)), ceiling); + } + bool CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) const; }; @@ -1113,6 +1118,10 @@ struct side_t { return textures[which].xoffset; } + double GetTextureXOffsetF(int which) const + { + return FIXED2DBL(textures[which].xoffset); + } void AddTextureXOffset(int which, fixed_t delta) { textures[which].xoffset += delta; @@ -1132,6 +1141,10 @@ struct side_t { return textures[which].yoffset; } + double GetTextureYOffsetF(int which) const + { + return FIXED2DBL(textures[which].yoffset); + } void AddTextureYOffset(int which, fixed_t delta) { textures[which].yoffset += delta; @@ -1167,6 +1180,10 @@ struct side_t { return textures[which].yscale; } + double GetTextureYScaleF(int which) const + { + return FIXED2DBL(textures[which].yscale); + } void MultiplyTextureYScale(int which, fixed_t delta) { textures[which].yscale = FixedMul(textures[which].yscale, delta); diff --git a/src/tables.h b/src/tables.h index 6fe767a4f..085174892 100644 --- a/src/tables.h +++ b/src/tables.h @@ -100,7 +100,7 @@ typedef uint32 angle_t; // note: remove the call to 'abs' since unsigned values cannot be negative inline angle_t absangle(angle_t a) { - return (angle_t)abs((int32)a); + return (angle_t)abs((int32_t)a); } // Effective size is 2049; diff --git a/src/textures/textures.h b/src/textures/textures.h index 82fdac9bf..8f5998954 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -205,7 +205,6 @@ public: int GetScaledWidth () { int foo = (Width << 17) / xScale; return (foo >> 1) + (foo & 1); } int GetScaledHeight () { int foo = (Height << 17) / yScale; return (foo >> 1) + (foo & 1); } - int GetScaledHeight(double scale) { int foo = (Height << 17) / FLOAT2FIXED(scale); return (foo >> 1) + (foo & 1); } double GetScaledWidthDouble () { return (Width * 65536.) / xScale; } double GetScaledHeightDouble () { return (Height * 65536.) / yScale; } double GetScaleY() const { return FIXED2DBL(yScale); } diff --git a/src/vectors.h b/src/vectors.h index af19d72b5..32c7508c7 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -43,6 +43,7 @@ #include #include #include "m_fixed.h" +#include "tables.h" #include "math/cmath.h" @@ -1036,11 +1037,6 @@ struct TAngle return TVector2(length * Cos(), length * Sin()); } - int FixedAngle() // for ACS. This must be normalized so it just converts to BAM first and then shifts 16 bits right. - { - return FLOAT2ANGLE(Degrees) >> 16; - } - vec_t Cos() const { return vec_t(g_cosdeg(Degrees)); diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 8a6e7e50f..4bf3716e2 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -3074,7 +3074,8 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints, DAngle rotation, FDynamicColormap *colormap, int lightlevel) { // Use an equation similar to player sprites to determine shade - fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT; + double fadelevel = clamp((LIGHT2SHADE(lightlevel)/65536. - 12) / NUMCOLORMAPS, 0.0, 1.0); + BufferedTris *quad; FBVERTEX *verts; D3DTex *tex; @@ -3128,7 +3129,6 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints, quad->ShaderNum = BQS_InGameColormap; quad->Desat = colormap->Desaturate; color0 = D3DCOLOR_ARGB(255, colormap->Color.r, colormap->Color.g, colormap->Color.b); - double fadelevel = clamp(shade / (NUMCOLORMAPS * 65536.0), 0.0, 1.0); color1 = D3DCOLOR_ARGB(DWORD((1 - fadelevel) * 255), DWORD(colormap->Fade.r * fadelevel), DWORD(colormap->Fade.g * fadelevel), diff --git a/src/xs_Float.h b/src/xs_Float.h index b4b5218c5..33150e4ea 100644 --- a/src/xs_Float.h +++ b/src/xs_Float.h @@ -15,6 +15,8 @@ #ifndef _xs_FLOAT_H_ #define _xs_FLOAT_H_ +#include + // ==================================================================================================================== // Defines // ==================================================================================================================== @@ -37,15 +39,18 @@ #define finline __forceinline #endif +typedef double real64; + + union _xs_doubleints { real64 val; - uint32 ival[2]; + uint32_t ival[2]; }; #if 0 -#define _xs_doublecopysgn(a,b) ((int32*)&a)[_xs_iexp_]&=~(((int32*)&b)[_xs_iexp_]&0x80000000) -#define _xs_doubleisnegative(a) ((((int32*)&a)[_xs_iexp_])|0x80000000) +#define _xs_doublecopysgn(a,b) ((int32_t*)&a)[_xs_iexp_]&=~(((int32_t*)&b)[_xs_iexp_]&0x80000000) +#define _xs_doubleisnegative(a) ((((int32_t*)&a)[_xs_iexp_])|0x80000000) #endif // ==================================================================================================================== @@ -59,37 +64,37 @@ const real64 _xs_doublemagicroundeps = (.5f-_xs_doublemagicdelta); //almos // ==================================================================================================================== // Prototypes // ==================================================================================================================== -static int32 xs_CRoundToInt (real64 val, real64 dmr = _xs_doublemagic); -static int32 xs_ToInt (real64 val, real64 dme = -_xs_doublemagicroundeps); -static int32 xs_FloorToInt (real64 val, real64 dme = _xs_doublemagicroundeps); -static int32 xs_CeilToInt (real64 val, real64 dme = _xs_doublemagicroundeps); -static int32 xs_RoundToInt (real64 val); +static int32_t xs_CRoundToInt (real64 val, real64 dmr = _xs_doublemagic); +static int32_t xs_ToInt (real64 val, real64 dme = -_xs_doublemagicroundeps); +static int32_t xs_FloorToInt (real64 val, real64 dme = _xs_doublemagicroundeps); +static int32_t xs_CeilToInt (real64 val, real64 dme = _xs_doublemagicroundeps); +static int32_t xs_RoundToInt (real64 val); -//int32 versions -finline static int32 xs_CRoundToInt (int32 val) {return val;} -finline static int32 xs_ToInt (int32 val) {return val;} +//int32_t versions +finline static int32_t xs_CRoundToInt (int32_t val) {return val;} +finline static int32_t xs_ToInt (int32_t val) {return val;} // ==================================================================================================================== // Fix Class // ==================================================================================================================== -template class xs_Fix +template class xs_Fix { public: - typedef int32 Fix; + typedef int32_t Fix; // ==================================================================================================================== // Basic Conversion from Numbers // ==================================================================================================================== - finline static Fix ToFix (int32 val) {return val<>N;} + finline static int32_t ToInt (Fix f) {return f>>N;} @@ -97,7 +102,7 @@ protected: // ==================================================================================================================== // Helper function - mainly to preserve _xs_DEFAULT_CONVERSION // ==================================================================================================================== - finline static int32 xs_ConvertToFixed (real64 val) + finline static int32_t xs_ConvertToFixed (real64 val) { #if _xs_DEFAULT_CONVERSION==0 return xs_CRoundToInt(val, _xs_doublemagic/(1<int conversion, but unfortunately, // checking for SSE support every time you need to do a // conversion completely negates its performance advantage. - return int32(val); + return int32_t(val); #else #if _xs_DEFAULT_CONVERSION==0 return (val<0) ? xs_CRoundToInt(val-dme) : xs_CRoundToInt(val+dme); #else - return int32(val); + return int32_t(val); #endif #endif } // ==================================================================================================================== -finline static int32 xs_FloorToInt(real64 val, real64 dme) +finline static int32_t xs_FloorToInt(real64 val, real64 dme) { #if _xs_DEFAULT_CONVERSION==0 return xs_CRoundToInt (val - dme); @@ -167,7 +172,7 @@ finline static int32 xs_FloorToInt(real64 val, real64 dme) // ==================================================================================================================== -finline static int32 xs_CeilToInt(real64 val, real64 dme) +finline static int32_t xs_CeilToInt(real64 val, real64 dme) { #if _xs_DEFAULT_CONVERSION==0 return xs_CRoundToInt (val + dme); @@ -178,7 +183,7 @@ finline static int32 xs_CeilToInt(real64 val, real64 dme) // ==================================================================================================================== -finline static int32 xs_RoundToInt(real64 val) +finline static int32_t xs_RoundToInt(real64 val) { #if _xs_DEFAULT_CONVERSION==0 // Yes, it is important that two fadds be generated, so you cannot override the dmr @@ -197,24 +202,24 @@ finline static int32 xs_RoundToInt(real64 val) // Unsigned variants // ==================================================================================================================== // ==================================================================================================================== -finline static uint32 xs_CRoundToUInt(real64 val) +finline static uint32_t xs_CRoundToUInt(real64 val) { - return (uint32)xs_CRoundToInt(val); + return (uint32_t)xs_CRoundToInt(val); } -finline static uint32 xs_FloorToUInt(real64 val) +finline static uint32_t xs_FloorToUInt(real64 val) { - return (uint32)xs_FloorToInt(val); + return (uint32_t)xs_FloorToInt(val); } -finline static uint32 xs_CeilToUInt(real64 val) +finline static uint32_t xs_CeilToUInt(real64 val) { - return (uint32)xs_CeilToInt(val); + return (uint32_t)xs_CeilToInt(val); } -finline static uint32 xs_RoundToUInt(real64 val) +finline static uint32_t xs_RoundToUInt(real64 val) { - return (uint32)xs_RoundToInt(val); + return (uint32_t)xs_RoundToInt(val); }