mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
Merge remote-tracking branch 'gzdoom_upstream/master' into lightmath
This commit is contained in:
commit
8dd12c8216
15 changed files with 240 additions and 47 deletions
|
@ -923,10 +923,21 @@ static bool IsActorACountItem(AActor *mo)
|
||||||
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM;
|
return mo->IsKindOf(RUNTIME_CLASS(AInventory)) && mo->flags&MF_SPECIAL && mo->flags&MF_COUNTITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName)
|
// [SP] for all actors
|
||||||
|
static bool IsActor(AActor *mo)
|
||||||
|
{
|
||||||
|
if (mo->IsKindOf(RUNTIME_CLASS(AInventory)))
|
||||||
|
return static_cast<AInventory *>(mo)->Owner == NULL; // [SP] Exclude inventory-owned items
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [SP] modified - now allows showing count only, new arg must be passed. Also now still counts regardless, if lists are printed.
|
||||||
|
static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const char *FilterName, bool countOnly)
|
||||||
{
|
{
|
||||||
AActor *mo;
|
AActor *mo;
|
||||||
const PClass *FilterClass = NULL;
|
const PClass *FilterClass = NULL;
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
if (FilterName != NULL)
|
if (FilterName != NULL)
|
||||||
{
|
{
|
||||||
|
@ -943,10 +954,32 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
|
||||||
{
|
{
|
||||||
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
|
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
|
||||||
{
|
{
|
||||||
Printf ("%s at (%f,%f,%f)\n",
|
counter++;
|
||||||
mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
|
if (!countOnly)
|
||||||
|
Printf ("%s at (%f,%f,%f)\n",
|
||||||
|
mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Printf("%i match(s) found.\n", counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
CCMD(actorlist) // [SP] print all actors (this can get quite big?)
|
||||||
|
{
|
||||||
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
|
PrintFilteredActorList(IsActor, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(actornum) // [SP] count all actors
|
||||||
|
{
|
||||||
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
|
PrintFilteredActorList(IsActor, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -958,7 +991,14 @@ CCMD(monster)
|
||||||
{
|
{
|
||||||
if (CheckCheatmode ()) return;
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL);
|
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(monsternum) // [SP] count monsters
|
||||||
|
{
|
||||||
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
|
PrintFilteredActorList(IsActorAMonster, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -970,7 +1010,14 @@ CCMD(items)
|
||||||
{
|
{
|
||||||
if (CheckCheatmode ()) return;
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL);
|
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(itemsnum) // [SP] # of any items
|
||||||
|
{
|
||||||
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
|
PrintFilteredActorList(IsActorAnItem, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -982,7 +1029,14 @@ CCMD(countitems)
|
||||||
{
|
{
|
||||||
if (CheckCheatmode ()) return;
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL);
|
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(countitemsnum) // [SP] # of counted items
|
||||||
|
{
|
||||||
|
if (CheckCheatmode ()) return;
|
||||||
|
|
||||||
|
PrintFilteredActorList(IsActorACountItem, argv.argc() > 1 ? argv[1] : NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1108,7 +1108,7 @@ void DrawHUD()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CheckRatio(SCREENWIDTH, SCREENHEIGHT) == 4)
|
if (AspectTallerThanWide(WidescreenRatio))
|
||||||
{
|
{
|
||||||
hudheight = hudwidth * 30 / AspectMultiplier(WidescreenRatio); // BaseRatioSizes is inverted for this mode
|
hudheight = hudwidth * 30 / AspectMultiplier(WidescreenRatio); // BaseRatioSizes is inverted for this mode
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,17 @@ FFlatVertexBuffer::~FFlatVertexBuffer()
|
||||||
map = nullptr;
|
map = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FFlatVertexBuffer::OutputResized(int width, int height)
|
||||||
|
{
|
||||||
|
vbo_shadowdata[4].Set(0, 0, 0, 0, 0);
|
||||||
|
vbo_shadowdata[5].Set(0, (float)height, 0, 0, 0);
|
||||||
|
vbo_shadowdata[6].Set((float)width, 0, 0, 0, 0);
|
||||||
|
vbo_shadowdata[7].Set((float)width, (float)height, 0, 0, 0);
|
||||||
|
|
||||||
|
Map();
|
||||||
|
memcpy(map, &vbo_shadowdata[4], 4 * sizeof(FFlatVertex));
|
||||||
|
Unmap();
|
||||||
|
}
|
||||||
|
|
||||||
void FFlatVertexBuffer::BindVBO()
|
void FFlatVertexBuffer::BindVBO()
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,6 +131,8 @@ public:
|
||||||
FFlatVertexBuffer(int width, int height);
|
FFlatVertexBuffer(int width, int height);
|
||||||
~FFlatVertexBuffer();
|
~FFlatVertexBuffer();
|
||||||
|
|
||||||
|
void OutputResized(int width, int height);
|
||||||
|
|
||||||
void BindVBO();
|
void BindVBO();
|
||||||
|
|
||||||
void CreateVBO();
|
void CreateVBO();
|
||||||
|
|
|
@ -107,6 +107,44 @@ static const float LARGE_VALUE = 1e19f;
|
||||||
|
|
||||||
void GLSprite::CalculateVertices(FVector3 *v)
|
void GLSprite::CalculateVertices(FVector3 *v)
|
||||||
{
|
{
|
||||||
|
if (actor != nullptr && (actor->renderflags & RF_SPRITETYPEMASK) == RF_FLATSPRITE)
|
||||||
|
{
|
||||||
|
Matrix3x4 mat;
|
||||||
|
mat.MakeIdentity();
|
||||||
|
|
||||||
|
// [MC] Rotate around the center or offsets given to the sprites.
|
||||||
|
// Counteract any existing rotations, then rotate the angle.
|
||||||
|
// Tilt the actor up or down based on pitch (increase 'somersaults' forward).
|
||||||
|
// Then counteract the roll and DO A BARREL ROLL.
|
||||||
|
|
||||||
|
FAngle pitch = (float)-actor->Angles.Pitch.Degrees;
|
||||||
|
pitch.Normalized180();
|
||||||
|
|
||||||
|
mat.Translate(x, z, y);
|
||||||
|
mat.Rotate(0, 1, 0, 270. - actor->Angles.Yaw.Degrees);
|
||||||
|
mat.Rotate(1, 0, 0, pitch.Degrees);
|
||||||
|
|
||||||
|
if (actor->renderflags & RF_ROLLCENTER)
|
||||||
|
{
|
||||||
|
float cx = (x1 + x2) * 0.5;
|
||||||
|
float cy = (y1 + y2) * 0.5;
|
||||||
|
|
||||||
|
mat.Translate(cx - x, 0, cy - y);
|
||||||
|
mat.Rotate(0, 1, 0, - actor->Angles.Roll.Degrees);
|
||||||
|
mat.Translate(-cx, -z, -cy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mat.Rotate(0, 1, 0, - actor->Angles.Roll.Degrees);
|
||||||
|
mat.Translate(-x, -z, -y);
|
||||||
|
}
|
||||||
|
v[0] = mat * FVector3(x1, z, y2);
|
||||||
|
v[1] = mat * FVector3(x2, z, y2);
|
||||||
|
v[2] = mat * FVector3(x1, z, y1);
|
||||||
|
v[3] = mat * FVector3(x2, z, y1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// [BB] Billboard stuff
|
// [BB] Billboard stuff
|
||||||
const bool drawWithXYBillboard = ((particle && gl_billboard_particles) || (!(actor && actor->renderflags & RF_FORCEYBILLBOARD)
|
const bool drawWithXYBillboard = ((particle && gl_billboard_particles) || (!(actor && actor->renderflags & RF_FORCEYBILLBOARD)
|
||||||
//&& GLRenderer->mViewActor != NULL
|
//&& GLRenderer->mViewActor != NULL
|
||||||
|
@ -363,15 +401,8 @@ void GLSprite::Draw(int pass)
|
||||||
gl_RenderState.Apply();
|
gl_RenderState.Apply();
|
||||||
|
|
||||||
FVector3 v[4];
|
FVector3 v[4];
|
||||||
if (actor != nullptr && (actor->renderflags & RF_SPRITETYPEMASK) == RF_FLATSPRITE)
|
CalculateVertices(v);
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CalculateVertices(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FQuadDrawer qd;
|
FQuadDrawer qd;
|
||||||
qd.Set(0, v[0][0], v[0][1], v[0][2], ul, vt);
|
qd.Set(0, v[0][0], v[0][1], v[0][2], ul, vt);
|
||||||
qd.Set(1, v[1][0], v[1][1], v[1][2], ur, vt);
|
qd.Set(1, v[1][0], v[1][1], v[1][2], ur, vt);
|
||||||
|
@ -595,7 +626,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
sector_t * rendersector;
|
sector_t * rendersector;
|
||||||
|
|
||||||
// Don't waste time projecting sprites that are definitely not visible.
|
// Don't waste time projecting sprites that are definitely not visible.
|
||||||
if (thing == NULL || thing->sprite == 0 || !thing->IsVisibleToPlayer())
|
if (thing == nullptr || thing->sprite == 0 || !thing->IsVisibleToPlayer())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +759,8 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
|
|
||||||
float rightfac = -r.left;
|
float rightfac = -r.left;
|
||||||
float leftfac = rightfac - r.width;
|
float leftfac = rightfac - r.width;
|
||||||
|
float bottomfac = -r.top;
|
||||||
|
float topfac = bottomfac - r.height;
|
||||||
z1 = z - r.top;
|
z1 = z - r.top;
|
||||||
z2 = z1 - r.height;
|
z2 = z1 - r.height;
|
||||||
|
|
||||||
|
@ -753,11 +785,15 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
y1 = y + viewvecX*leftfac;
|
y1 = y + viewvecX*leftfac;
|
||||||
y2 = y + viewvecX*rightfac;
|
y2 = y + viewvecX*rightfac;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RF_FLATSPRITE:
|
case RF_FLATSPRITE:
|
||||||
// needs careful rethinking
|
{
|
||||||
return;
|
x1 = x + leftfac;
|
||||||
|
x2 = x + rightfac;
|
||||||
|
y1 = y - topfac;
|
||||||
|
y2 = y - bottomfac;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case RF_WALLSPRITE:
|
case RF_WALLSPRITE:
|
||||||
viewvecX = thing->Angles.Yaw.Cos();
|
viewvecX = thing->Angles.Yaw.Cos();
|
||||||
viewvecY = thing->Angles.Yaw.Sin();
|
viewvecY = thing->Angles.Yaw.Sin();
|
||||||
|
|
|
@ -192,6 +192,7 @@ void OpenGLFrameBuffer::Update()
|
||||||
{
|
{
|
||||||
Resize(clientWidth, clientHeight);
|
Resize(clientWidth, clientHeight);
|
||||||
V_OutputResized(Width, Height);
|
V_OutputResized(Width, Height);
|
||||||
|
GLRenderer->mVBO->OutputResized(Width, Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BuildModesList (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
|
BuildModesList (screen->VideoWidth, screen->VideoHeight, DisplayBits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public:
|
||||||
|
|
||||||
DVideoModeMenu()
|
DVideoModeMenu()
|
||||||
{
|
{
|
||||||
SetModesMenu (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
|
SetModesMenu (screen->VideoWidth, screen->VideoHeight, DisplayBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuEvent(int mkey, bool fromcontroller)
|
bool MenuEvent(int mkey, bool fromcontroller)
|
||||||
|
@ -163,13 +163,13 @@ public:
|
||||||
{
|
{
|
||||||
if (!GetSelectedSize (&NewWidth, &NewHeight))
|
if (!GetSelectedSize (&NewWidth, &NewHeight))
|
||||||
{
|
{
|
||||||
NewWidth = SCREENWIDTH;
|
NewWidth = screen->VideoWidth;
|
||||||
NewHeight = SCREENHEIGHT;
|
NewHeight = screen->VideoHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OldWidth = SCREENWIDTH;
|
OldWidth = screen->VideoWidth;
|
||||||
OldHeight = SCREENHEIGHT;
|
OldHeight = screen->VideoHeight;
|
||||||
OldBits = DisplayBits;
|
OldBits = DisplayBits;
|
||||||
NewBits = BitTranslate[DummyDepthCvar];
|
NewBits = BitTranslate[DummyDepthCvar];
|
||||||
setmodeneeded = true;
|
setmodeneeded = true;
|
||||||
|
@ -297,11 +297,11 @@ void M_RestoreMode ()
|
||||||
void M_SetDefaultMode ()
|
void M_SetDefaultMode ()
|
||||||
{
|
{
|
||||||
// Make current resolution the default
|
// Make current resolution the default
|
||||||
vid_defwidth = SCREENWIDTH;
|
vid_defwidth = screen->VideoWidth;
|
||||||
vid_defheight = SCREENHEIGHT;
|
vid_defheight = screen->VideoHeight;
|
||||||
vid_defbits = DisplayBits;
|
vid_defbits = DisplayBits;
|
||||||
testingmode = 0;
|
testingmode = 0;
|
||||||
SetModesMenu (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
|
SetModesMenu (screen->VideoWidth, screen->VideoHeight, DisplayBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ void M_SetDefaultMode ()
|
||||||
|
|
||||||
void M_RefreshModesList ()
|
void M_RefreshModesList ()
|
||||||
{
|
{
|
||||||
BuildModesList (SCREENWIDTH, SCREENHEIGHT, DisplayBits);
|
BuildModesList (screen->VideoWidth, screen->VideoHeight, DisplayBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_InitVideoModesMenu ()
|
void M_InitVideoModesMenu ()
|
||||||
|
@ -385,8 +385,8 @@ void M_SetVideoMode()
|
||||||
{
|
{
|
||||||
if (!GetSelectedSize (&NewWidth, &NewHeight))
|
if (!GetSelectedSize (&NewWidth, &NewHeight))
|
||||||
{
|
{
|
||||||
NewWidth = SCREENWIDTH;
|
NewWidth = screen->VideoWidth;
|
||||||
NewHeight = SCREENHEIGHT;
|
NewHeight = screen->VideoHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -850,6 +850,9 @@ DFrameBuffer::DFrameBuffer (int width, int height)
|
||||||
{
|
{
|
||||||
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
|
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
|
||||||
Accel2D = false;
|
Accel2D = false;
|
||||||
|
|
||||||
|
VideoWidth = width;
|
||||||
|
VideoHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1352,6 +1355,7 @@ void V_OutputResized (int width, int height)
|
||||||
{
|
{
|
||||||
StatusBar->ScreenSizeChanged();
|
StatusBar->ScreenSizeChanged();
|
||||||
}
|
}
|
||||||
|
C_NewModeAdjust();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2)
|
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2)
|
||||||
|
|
|
@ -422,6 +422,10 @@ public:
|
||||||
virtual bool Is8BitMode() = 0;
|
virtual bool Is8BitMode() = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The original size of the framebuffer as selected in the video menu.
|
||||||
|
int VideoWidth = 0;
|
||||||
|
int VideoHeight = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DrawRateStuff ();
|
void DrawRateStuff ();
|
||||||
void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest);
|
void CopyFromBuff (BYTE *src, int srcPitch, int width, int height, BYTE *dest);
|
||||||
|
|
|
@ -156,6 +156,15 @@ enum
|
||||||
ATAG_RNG, // pointer to FRandom
|
ATAG_RNG, // pointer to FRandom
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EVMAbortException
|
||||||
|
{
|
||||||
|
X_READ_NIL,
|
||||||
|
X_WRITE_NIL,
|
||||||
|
X_TOO_MANY_TRIES,
|
||||||
|
X_ARRAY_OUT_OF_BOUNDS,
|
||||||
|
X_DIVISION_BY_ZERO,
|
||||||
|
};
|
||||||
|
|
||||||
class VMFunction : public DObject
|
class VMFunction : public DObject
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(VMFunction, DObject);
|
DECLARE_ABSTRACT_CLASS(VMFunction, DObject);
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#define ASSERTKA(x) assert(sfunc != NULL && (unsigned)(x) < sfunc->NumKonstA)
|
#define ASSERTKA(x) assert(sfunc != NULL && (unsigned)(x) < sfunc->NumKonstA)
|
||||||
#define ASSERTKS(x) assert(sfunc != NULL && (unsigned)(x) < sfunc->NumKonstS)
|
#define ASSERTKS(x) assert(sfunc != NULL && (unsigned)(x) < sfunc->NumKonstS)
|
||||||
|
|
||||||
#define THROW(x)
|
#define THROW(x) throw(EVMAbortException(x))
|
||||||
|
|
||||||
#define CMPJMP(test) \
|
#define CMPJMP(test) \
|
||||||
if ((test) == (a & CMP_CHECK)) { \
|
if ((test) == (a & CMP_CHECK)) { \
|
||||||
|
@ -54,14 +54,6 @@
|
||||||
pc += 1; \
|
pc += 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
X_READ_NIL,
|
|
||||||
X_WRITE_NIL,
|
|
||||||
X_TOO_MANY_TRIES,
|
|
||||||
X_ARRAY_OUT_OF_BOUNDS
|
|
||||||
};
|
|
||||||
|
|
||||||
#define GETADDR(a,o,x) \
|
#define GETADDR(a,o,x) \
|
||||||
if (a == NULL) { THROW(x); } \
|
if (a == NULL) { THROW(x); } \
|
||||||
ptr = (VM_SBYTE *)a + o
|
ptr = (VM_SBYTE *)a + o
|
||||||
|
|
|
@ -786,27 +786,51 @@ begin:
|
||||||
|
|
||||||
OP(DIV_RR):
|
OP(DIV_RR):
|
||||||
ASSERTD(a); ASSERTD(B); ASSERTD(C);
|
ASSERTD(a); ASSERTD(B); ASSERTD(C);
|
||||||
|
if (reg.d[C] == 0)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.d[a] = reg.d[B] / reg.d[C];
|
reg.d[a] = reg.d[B] / reg.d[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(DIV_RK):
|
OP(DIV_RK):
|
||||||
ASSERTD(a); ASSERTD(B); ASSERTKD(C);
|
ASSERTD(a); ASSERTD(B); ASSERTKD(C);
|
||||||
|
if (konstd[C] == 0)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.d[a] = reg.d[B] / konstd[C];
|
reg.d[a] = reg.d[B] / konstd[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(DIV_KR):
|
OP(DIV_KR):
|
||||||
ASSERTD(a); ASSERTKD(B); ASSERTD(C);
|
ASSERTD(a); ASSERTKD(B); ASSERTD(C);
|
||||||
|
if (reg.d[C] == 0)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.d[a] = konstd[B] / reg.d[C];
|
reg.d[a] = konstd[B] / reg.d[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
|
|
||||||
OP(MOD_RR):
|
OP(MOD_RR):
|
||||||
ASSERTD(a); ASSERTD(B); ASSERTD(C);
|
ASSERTD(a); ASSERTD(B); ASSERTD(C);
|
||||||
|
if (reg.d[C] == 0)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.d[a] = reg.d[B] % reg.d[C];
|
reg.d[a] = reg.d[B] % reg.d[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(MOD_RK):
|
OP(MOD_RK):
|
||||||
ASSERTD(a); ASSERTD(B); ASSERTKD(C);
|
ASSERTD(a); ASSERTD(B); ASSERTKD(C);
|
||||||
|
if (konstd[C] == 0)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.d[a] = reg.d[B] % konstd[C];
|
reg.d[a] = reg.d[B] % konstd[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(MOD_KR):
|
OP(MOD_KR):
|
||||||
ASSERTD(a); ASSERTKD(B); ASSERTD(C);
|
ASSERTD(a); ASSERTKD(B); ASSERTD(C);
|
||||||
|
if (reg.d[C] == 0)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.d[a] = konstd[B] % reg.d[C];
|
reg.d[a] = konstd[B] % reg.d[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
|
|
||||||
|
@ -981,14 +1005,26 @@ begin:
|
||||||
|
|
||||||
OP(DIVF_RR):
|
OP(DIVF_RR):
|
||||||
ASSERTF(a); ASSERTF(B); ASSERTF(C);
|
ASSERTF(a); ASSERTF(B); ASSERTF(C);
|
||||||
|
if (reg.f[C] == 0.)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.f[a] = reg.f[B] / reg.f[C];
|
reg.f[a] = reg.f[B] / reg.f[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(DIVF_RK):
|
OP(DIVF_RK):
|
||||||
ASSERTF(a); ASSERTF(B); ASSERTKF(C);
|
ASSERTF(a); ASSERTF(B); ASSERTKF(C);
|
||||||
|
if (konstf[C] == 0.)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.f[a] = reg.f[B] / konstf[C];
|
reg.f[a] = reg.f[B] / konstf[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(DIVF_KR):
|
OP(DIVF_KR):
|
||||||
ASSERTF(a); ASSERTKF(B); ASSERTF(C);
|
ASSERTF(a); ASSERTKF(B); ASSERTF(C);
|
||||||
|
if (reg.f[C] == 0.)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.f[a] = konstf[B] / reg.f[C];
|
reg.f[a] = konstf[B] / reg.f[C];
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
|
|
||||||
|
@ -996,6 +1032,10 @@ begin:
|
||||||
ASSERTF(a); ASSERTF(B); ASSERTF(C);
|
ASSERTF(a); ASSERTF(B); ASSERTF(C);
|
||||||
fb = reg.f[B]; fc = reg.f[C];
|
fb = reg.f[B]; fc = reg.f[C];
|
||||||
Do_MODF:
|
Do_MODF:
|
||||||
|
if (fc == 0.)
|
||||||
|
{
|
||||||
|
THROW(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
reg.f[a] = luai_nummod(fb, fc);
|
reg.f[a] = luai_nummod(fb, fc);
|
||||||
NEXTOP;
|
NEXTOP;
|
||||||
OP(MODF_RK):
|
OP(MODF_RK):
|
||||||
|
|
|
@ -407,6 +407,44 @@ int VMFrameStack::Call(VMFunction *func, VMValue *params, int numparams, VMRetur
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
catch (EVMAbortException exception)
|
||||||
|
{
|
||||||
|
if (allocated)
|
||||||
|
{
|
||||||
|
PopFrame();
|
||||||
|
}
|
||||||
|
if (trap != nullptr)
|
||||||
|
{
|
||||||
|
*trap = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Printf("VM execution aborted: ");
|
||||||
|
switch (exception)
|
||||||
|
{
|
||||||
|
case X_READ_NIL:
|
||||||
|
Printf("tried to read from address zero.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case X_WRITE_NIL:
|
||||||
|
Printf("tried to write to address zero.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case X_TOO_MANY_TRIES:
|
||||||
|
Printf("too many try-catch blocks.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case X_ARRAY_OUT_OF_BOUNDS:
|
||||||
|
Printf("array access out of bounds.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case X_DIVISION_BY_ZERO:
|
||||||
|
Printf("division by zero.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Printf("\n");
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
if (allocated)
|
if (allocated)
|
||||||
|
|
|
@ -5,9 +5,10 @@ vec4 ProcessTexel()
|
||||||
{
|
{
|
||||||
vec2 texCoord = vTexCoord.st;
|
vec2 texCoord = vTexCoord.st;
|
||||||
vec4 basicColor = getTexel(texCoord);
|
vec4 basicColor = getTexel(texCoord);
|
||||||
|
ivec2 texSize = textureSize(tex, 0);
|
||||||
|
|
||||||
texCoord.x = float( int(texCoord.x * 128.0) ) / 128.0;
|
texCoord.x = float( int(texCoord.x * texSize.x) ) / texSize.x;
|
||||||
texCoord.y = float( int(texCoord.y * 128.0) ) / 128.0;
|
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;
|
||||||
|
|
||||||
float texX = sin(mod(texCoord.x * 100.0 + timer*5.0, 3.489)) + texCoord.x / 4.0;
|
float texX = sin(mod(texCoord.x * 100.0 + timer*5.0, 3.489)) + texCoord.x / 4.0;
|
||||||
float texY = cos(mod(texCoord.y * 100.0 + timer*5.0, 3.489)) + texCoord.y / 4.0;
|
float texY = cos(mod(texCoord.y * 100.0 + timer*5.0, 3.489)) + texCoord.y / 4.0;
|
||||||
|
|
|
@ -5,9 +5,10 @@ vec4 ProcessTexel()
|
||||||
{
|
{
|
||||||
vec2 texCoord = vTexCoord.st;
|
vec2 texCoord = vTexCoord.st;
|
||||||
vec4 basicColor = getTexel(texCoord);
|
vec4 basicColor = getTexel(texCoord);
|
||||||
|
ivec2 texSize = textureSize(tex, 0);
|
||||||
|
|
||||||
texCoord.x = float( int(texCoord.x * 128.0) ) / 128.0;
|
texCoord.x = float( int(texCoord.x * texSize.x) ) / texSize.x;
|
||||||
texCoord.y = float( int(texCoord.y * 128.0) ) / 128.0;
|
texCoord.y = float( int(texCoord.y * texSize.y) ) / texSize.y;
|
||||||
|
|
||||||
float texX = texCoord.x / 3.0 + 0.66;
|
float texX = texCoord.x / 3.0 + 0.66;
|
||||||
float texY = 0.34 - texCoord.y / 3.0;
|
float texY = 0.34 - texCoord.y / 3.0;
|
||||||
|
|
Loading…
Reference in a new issue