mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Fix up CON to work with Q16.16 values
git-svn-id: https://svn.eduke32.com/eduke32@6727 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5f13160dd6
commit
3b6bb3b7a3
5 changed files with 68 additions and 24 deletions
|
@ -371,7 +371,7 @@ void G_DisplayRest(int32_t smoothratio);
|
|||
void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothratio);
|
||||
void G_DrawBackground(void);
|
||||
void G_DrawFrags(void);
|
||||
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, fix16_t horiz, int32_t smoothratio);
|
||||
void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t horiz, int32_t smoothratio);
|
||||
void G_DrawRooms(int32_t snum,int32_t smoothratio);
|
||||
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
|
||||
int G_FPSLimit(void);
|
||||
|
|
|
@ -1211,7 +1211,14 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, int32_t a, int32_t horiz, int32_t sec
|
|||
y2 = scale(y2,ydim-1,199);
|
||||
}
|
||||
|
||||
horiz = clamp(horiz, HORIZ_MIN, HORIZ_MAX);
|
||||
// support the old range of values
|
||||
if ((horiz & 0xFFFF0000) == 0)
|
||||
horiz = fix16_from_int(horiz);
|
||||
|
||||
if ((a & 0xFFFF0000) == 0)
|
||||
a = fix16_from_int(a);
|
||||
|
||||
horiz = fix16_clamp(horiz, F16(HORIZ_MIN), F16(HORIZ_MAX));
|
||||
|
||||
int const onewaspect = newaspect_enable;
|
||||
newaspect_enable = r_usenewaspect;
|
||||
|
@ -1225,14 +1232,14 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, int32_t a, int32_t horiz, int32_t sec
|
|||
G_HandleMirror(vec.x, vec.y, vec.z, a, horiz, smoothratio);
|
||||
#ifdef POLYMER
|
||||
if (getrendermode() == REND_POLYMER)
|
||||
polymer_setanimatesprites(G_DoSpriteAnimations, vec.x,vec.y,a,smoothratio);
|
||||
polymer_setanimatesprites(G_DoSpriteAnimations, vec.x, vec.y, fix16_to_int(a), smoothratio);
|
||||
#endif
|
||||
yax_preparedrawrooms();
|
||||
drawrooms(vec.x,vec.y,vec.z,a,horiz,sect);
|
||||
drawrooms(vec.x, vec.y, vec.z, a, horiz, sect);
|
||||
yax_drawrooms(G_DoSpriteAnimations, sect, 0, smoothratio);
|
||||
|
||||
display_mirror = 2;
|
||||
G_DoSpriteAnimations(vec.x,vec.y,a,smoothratio);
|
||||
G_DoSpriteAnimations(vec.x, vec.y, fix16_to_int(a), smoothratio);
|
||||
display_mirror = 0;
|
||||
drawmasks();
|
||||
G_RestoreInterpolations();
|
||||
|
|
|
@ -652,6 +652,10 @@ int __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
|
|||
case GAMEVAR_INT32PTR: returnValue = *(int32_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_INT16PTR: returnValue = *(int16_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_UINT8PTR: returnValue = *(char *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_Q16PTR:
|
||||
returnValue = aGameVars[gameVar].flags & GAMEVAR_SPECIAL ? *(int32_t *)aGameVars[gameVar].global
|
||||
: fix16_to_int(*(fix16_t *)aGameVars[gameVar].global);
|
||||
break;
|
||||
default: EDUKE32_UNREACHABLE_SECTION(returnValue = 0; break);
|
||||
}
|
||||
|
||||
|
@ -803,9 +807,13 @@ void __fastcall Gv_SetVar(int const gameVar, int const newValue, int const sprit
|
|||
{
|
||||
switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_INT16PTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
case GAMEVAR_Q16PTR:
|
||||
*(fix16_t *)aGameVars[gameVar].global
|
||||
= aGameVars[gameVar].flags & GAMEVAR_SPECIAL ? (int32_t)newValue : fix16_from_int((int16_t)newValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -1001,9 +1009,13 @@ int __fastcall Gv_GetVarX(int gameVar)
|
|||
returnValue = aGameVars[gameVar].pValues[vm.spriteNum];
|
||||
else switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INT32PTR: returnValue = (*((int32_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT16PTR: returnValue = (*((int16_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_UINT8PTR: returnValue = (*((uint8_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT32PTR: returnValue = (*(int32_t *)aGameVars[gameVar].global); break;
|
||||
case GAMEVAR_INT16PTR: returnValue = (*(int16_t *)aGameVars[gameVar].global); break;
|
||||
case GAMEVAR_UINT8PTR: returnValue = (*(uint8_t *)aGameVars[gameVar].global); break;
|
||||
case GAMEVAR_Q16PTR:
|
||||
returnValue = aGameVars[gameVar].flags & GAMEVAR_SPECIAL ? *(int32_t *)aGameVars[gameVar].global
|
||||
: fix16_to_int(*(fix16_t *)aGameVars[gameVar].global);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,9 +1069,13 @@ void __fastcall Gv_GetManyVars(int const numVars, int32_t * const outBuf)
|
|||
{
|
||||
switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INT32PTR: value = (*((int32_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT16PTR: value = (*((int16_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_UINT8PTR: value = (*((uint8_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT32PTR: value = *(int32_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_INT16PTR: value = *(int16_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_UINT8PTR: value = *(uint8_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_Q16PTR:
|
||||
value = aGameVars[gameVar].flags & GAMEVAR_SPECIAL ? *(int32_t *)aGameVars[gameVar].global
|
||||
: fix16_to_int(*(fix16_t *)aGameVars[gameVar].global);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1088,9 +1104,13 @@ void __fastcall Gv_SetVarX(int const gameVar, int const newValue)
|
|||
}
|
||||
else switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_INT16PTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
case GAMEVAR_INT32PTR: *(int32_t *)aGameVars[gameVar].global = (int32_t)newValue; break;
|
||||
case GAMEVAR_INT16PTR: *(int16_t *)aGameVars[gameVar].global = (int16_t)newValue; break;
|
||||
case GAMEVAR_UINT8PTR: *(uint8_t *)aGameVars[gameVar].global = (uint8_t)newValue; break;
|
||||
case GAMEVAR_Q16PTR:
|
||||
*(fix16_t *)aGameVars[gameVar].global
|
||||
= aGameVars[gameVar].flags & GAMEVAR_SPECIAL ? (int32_t)newValue : fix16_from_int((int16_t)newValue);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1543,8 +1563,10 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("camerax",(intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameray",(intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameraz",(intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameraang",(intptr_t)&ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR); // XXX FIXME
|
||||
Gv_NewVar("camerahoriz",(intptr_t)&ud.cameraq16horiz, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR); // XXX FIXME
|
||||
Gv_NewVar("cameraang",(intptr_t)&ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR);
|
||||
Gv_NewVar("camerahoriz",(intptr_t)&ud.cameraq16horiz, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR);
|
||||
Gv_NewVar("cameraq16ang", (intptr_t) &ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR | GAMEVAR_SPECIAL);
|
||||
Gv_NewVar("cameraq16horiz", (intptr_t) &ud.cameraq16horiz, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR | GAMEVAR_SPECIAL);
|
||||
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
|
||||
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
|
@ -1702,6 +1724,8 @@ void Gv_RefreshPointers(void)
|
|||
aGameVars[Gv_GetVarIndex("cameraz")].global = (intptr_t)&ud.camerapos.z;
|
||||
aGameVars[Gv_GetVarIndex("cameraang")].global = (intptr_t)&ud.cameraq16ang; // XXX FIXME
|
||||
aGameVars[Gv_GetVarIndex("camerahoriz")].global = (intptr_t)&ud.cameraq16horiz; // XXX FIXME
|
||||
aGameVars[Gv_GetVarIndex("cameraq16ang")].global = (intptr_t) &ud.cameraq16ang; // XXX FIXME
|
||||
aGameVars[Gv_GetVarIndex("cameraq16horiz")].global = (intptr_t) &ud.cameraq16horiz; // XXX FIXME
|
||||
aGameVars[Gv_GetVarIndex("camerasect")].global = (intptr_t)&ud.camerasect;
|
||||
aGameVars[Gv_GetVarIndex("cameradist")].global = (intptr_t)&g_cameraDistance;
|
||||
aGameVars[Gv_GetVarIndex("cameraclock")].global = (intptr_t)&g_cameraClock;
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define gamevars_h_
|
||||
|
||||
#include "gamedef.h"
|
||||
#include "fix16.hpp"
|
||||
|
||||
#define MAXGAMEVARS 2048 // must be a power of two
|
||||
#define MAXVARLABEL 26
|
||||
|
@ -42,10 +43,11 @@ enum GamevarFlags_t
|
|||
GAMEVAR_INT32PTR = 0x00002000, // plValues is a pointer to an int32_t
|
||||
GAMEVAR_INT16PTR = 0x00008000, // plValues is a pointer to a short
|
||||
GAMEVAR_UINT8PTR = 0x00010000, // plValues is a pointer to a char
|
||||
GAMEVAR_PTR_MASK = (GAMEVAR_INT32PTR | GAMEVAR_INT16PTR | GAMEVAR_UINT8PTR),
|
||||
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
|
||||
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
|
||||
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets
|
||||
GAMEVAR_Q16PTR = 0x00100000, // plValues is a pointer to a q16.16
|
||||
GAMEVAR_PTR_MASK = (GAMEVAR_INT32PTR | GAMEVAR_INT16PTR | GAMEVAR_UINT8PTR | GAMEVAR_Q16PTR),
|
||||
};
|
||||
|
||||
#if !defined LUNATIC
|
||||
|
@ -172,9 +174,15 @@ void Gv_FinalizeWeaponDefaults(void);
|
|||
break; \
|
||||
aGameVars[id].pValues[vm.spriteNum] operator operand; \
|
||||
break; \
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[id].global) operator(int32_t) operand; break; \
|
||||
case GAMEVAR_INT16PTR: *((int16_t *)aGameVars[id].global) operator(int16_t) operand; break; \
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[id].global) operator(uint8_t) operand; break; \
|
||||
case GAMEVAR_INT32PTR: *(int32_t *)aGameVars[id].global operator(int32_t) operand; break; \
|
||||
case GAMEVAR_INT16PTR: *(int16_t *)aGameVars[id].global operator(int16_t) operand; break; \
|
||||
case GAMEVAR_UINT8PTR: *(uint8_t *)aGameVars[id].global operator(uint8_t) operand; break; \
|
||||
case GAMEVAR_Q16PTR: \
|
||||
{ \
|
||||
Fix16 *pfix = (Fix16 *)aGameVars[id].global; \
|
||||
*pfix operator operand; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -220,6 +228,12 @@ skip:
|
|||
var = (uint8_t)libdivide_s32_do(var, dptr);
|
||||
return;
|
||||
}
|
||||
case GAMEVAR_Q16PTR:
|
||||
{
|
||||
fix16_t & var = *(fix16_t *)aGameVars[id].global;
|
||||
var = fix16_div(var, fix16_from_int(operand));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*iptr = libdivide_s32_do(*iptr, dptr);
|
||||
|
|
|
@ -1228,8 +1228,7 @@ static uint8_t *svdiff;
|
|||
#include "gamedef.h"
|
||||
|
||||
#if !defined LUNATIC
|
||||
# define SV_SKIPMASK (/*GAMEVAR_SYSTEM|*/GAMEVAR_READONLY|GAMEVAR_INT32PTR| \
|
||||
GAMEVAR_INT16PTR|GAMEVAR_UINT8PTR /*|GAMEVAR_NORESET*/ |GAMEVAR_SPECIAL)
|
||||
#define SV_SKIPMASK (/*GAMEVAR_SYSTEM|*/ GAMEVAR_READONLY | GAMEVAR_PTR_MASK | /*GAMEVAR_NORESET |*/ GAMEVAR_SPECIAL)
|
||||
|
||||
static char svgm_vars_string [] = "blK:vars";
|
||||
// setup gamevar data spec for snapshotting and diffing... gamevars must be loaded when called
|
||||
|
|
Loading…
Reference in a new issue