- fixed some uses of postincre,ment/decrements on narrow types.

THe VM has no opcode for this, all these places produced code with undefined behavior.
This commit is contained in:
Christoph Oelckers 2021-05-17 12:42:22 +02:00
parent a94f5dd1b3
commit 668f8f2cf6
5 changed files with 13 additions and 7 deletions

View File

@ -239,8 +239,13 @@ void VkRenderBuffers::CreateShadowmap()
ImageBuilder builder; ImageBuilder builder;
builder.setSize(gl_shadowmap_quality, 1024); builder.setSize(gl_shadowmap_quality, 1024);
builder.setFormat(VK_FORMAT_R32_SFLOAT); builder.setFormat(SceneNormalFormat);
builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
if (!builder.isFormatSupported(fb->device, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
{
SceneNormalFormat = VK_FORMAT_R8G8B8A8_UNORM;
builder.setFormat(SceneNormalFormat);
}
Shadowmap.Image = builder.create(fb->device); Shadowmap.Image = builder.create(fb->device);
Shadowmap.Image->SetDebugName("VkRenderBuffers.Shadowmap"); Shadowmap.Image->SetDebugName("VkRenderBuffers.Shadowmap");

View File

@ -318,8 +318,8 @@ public:
// This avoids anomalies with such things as Boom ice and conveyors. // This avoids anomalies with such things as Boom ice and conveyors.
DVector2 Vel = { 0,0 }; DVector2 Vel = { 0,0 };
int turnticks = 0;
bool centering = false; bool centering = false;
uint8_t turnticks = 0;
bool attackdown = false; bool attackdown = false;
@ -344,7 +344,7 @@ public:
int cheats = 0; // bit flags int cheats = 0; // bit flags
int timefreezer = 0; // Player has an active time freezer int timefreezer = 0; // Player has an active time freezer
short refire = 0; // refired shots are less accurate int refire = 0; // refired shots are less accurate
short inconsistant = 0; short inconsistant = 0;
bool waiting = 0; bool waiting = 0;
int killcount = 0, itemcount = 0, secretcount = 0; // for intermission int killcount = 0, itemcount = 0, secretcount = 0; // for intermission

View File

@ -218,7 +218,8 @@ class FireDemon : Actor
// Normal movement // Normal movement
if (!fdstrafecount) if (!fdstrafecount)
{ {
if (--movecount<0 || !MonsterMove ()) movecount = movecount - 1;
if (movecount < 0 || !MonsterMove ())
{ {
NewChaseDir (); NewChaseDir ();
} }

View File

@ -406,7 +406,7 @@ class StateProvider : Inventory
if ((player.cmd.buttons & BT_ATTACK) if ((player.cmd.buttons & BT_ATTACK)
&& !player.ReadyWeapon.bAltFire && !pending && player.health > 0) && !player.ReadyWeapon.bAltFire && !pending && player.health > 0)
{ {
player.refire = player.refire + 1; player.refire++;
player.mo.FireWeapon(ResolveState(flash)); player.mo.FireWeapon(ResolveState(flash));
} }
else if ((player.cmd.buttons & BT_ALTATTACK) else if ((player.cmd.buttons & BT_ALTATTACK)

View File

@ -2652,7 +2652,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native double bob; native double bob;
native vector2 vel; native vector2 vel;
native bool centering; native bool centering;
native uint8 turnticks; native int turnticks;
native bool attackdown; native bool attackdown;
native bool usedown; native bool usedown;
native uint oldbuttons; native uint oldbuttons;
@ -2670,7 +2670,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native PSprite psprites; native PSprite psprites;
native int cheats; native int cheats;
native int timefreezer; native int timefreezer;
native int16 refire; native int refire;
native int16 inconsistent; native int16 inconsistent;
native bool waiting; native bool waiting;
native int killcount; native int killcount;