Commit b9b752ed authored by Steven Fuller's avatar Steven Fuller

Intel C Compiler cleanups.

parent 4ad2885f
......@@ -5,7 +5,6 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <inttypes.h>
#include <glob.h>
#include <ctype.h>
......
......@@ -8,6 +8,10 @@
#include <fcntl.h>
#include <unistd.h>
/* TODO: this code is seriously braindead. Needs to be rewritten.
Debug adlib sound issue with intel compiler
*/
#include "fmopl.h"
#define PACKED __attribute__((packed))
......
......@@ -160,7 +160,7 @@ void A_Smoke(objtype *ob)
new->x = ob->x;
new->y = ob->y;
new->obclass = inertobj;
new->active = true;
new->active = ac_yes;
new->flags = FL_NEVERMARK;
}
......@@ -433,7 +433,7 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir)
new->hitpoints = starthitpoints[gamestate.difficulty][which];
new->distance = TILEGLOBAL;
new->flags |= FL_SHOOTABLE;
new->active = true;
new->active = ac_yes;
actorat[new->tilex][new->tiley] = 0; // don't use original spot
......@@ -1087,7 +1087,7 @@ void T_Launch(objtype *ob)
new->angle = iangle;
new->speed = 0x2000l;
new->flags = FL_NONMARK;
new->active = true;
new->active = ac_yes;
}
void A_Slurpie(objtype *ob)
......@@ -1442,7 +1442,7 @@ void T_SchabbThrow (objtype *ob)
new->speed = 0x2000l;
new->flags = FL_NONMARK;
new->active = true;
new->active = ac_yes;
PlaySoundLocActor(SCHABBSTHROWSND, new);
}
......@@ -1481,7 +1481,7 @@ void T_GiftThrow(objtype *ob)
new->angle = iangle;
new->speed = 0x2000l;
new->flags = FL_NONMARK;
new->active = true;
new->active = ac_yes;
PlaySoundLocActor(MISSILEFIRESND, new);
}
......@@ -1906,7 +1906,7 @@ void T_FakeFire (objtype *ob)
new->obclass = fireobj;
new->speed = 0x1200l;
new->flags = FL_NEVERMARK;
new->active = true;
new->active = ac_yes;
PlaySoundLocActor(FLAMETHROWERSND, new);
}
......
......@@ -1011,7 +1011,7 @@ void Cmd_Use()
void SpawnPlayer (int tilex, int tiley, int dir)
{
player->obclass = playerobj;
player->active = true;
player->active = ac_yes;
player->tilex = tilex;
player->tiley = tiley;
player->areanumber =
......
......@@ -8,6 +8,8 @@
extern int vwidth, vheight; /* size of screen */
#define NOASM
/*
=============================================================================
......@@ -853,7 +855,7 @@ extern fixed viewsin, viewcos;
extern int horizwall[], vertwall[];
fixed FixedByFrac(fixed a, fixed b);
void BuildTables();
void CalcTics();
void ThreeDRefresh();
......@@ -1005,4 +1007,16 @@ extern void EndText();
#include "wl_act3.h"
/* FixedByFrac */
fixed FixedByFrac(fixed a, fixed b);
#ifndef NOASM
#define FixedByFrac(x, y) \
__extension__ \
({ unsigned long z; \
asm("imull %2; shrdl $16, %%edx, %%eax" : "=a" (z) : "a" (x), "q" (y) : "%edx"); \
z; \
})
#endif
#endif
......@@ -29,17 +29,6 @@ static long heightnumerator;
static void AsmRefresh();
#define NOASM
#ifndef NOASM
#define FixedByFrac(x, y) \
__extension__ \
({ unsigned long z; \
asm("imull %2; shrdl $16, %%edx, %%eax" : "=a" (z) : "a" (x), "q" (y) : "%edx"); \
z; \
})
#endif
void ScaleShape(int xcenter, int shapenum, unsigned height);
void SimpleScaleShape(int xcenter, int shapenum, unsigned height);
......@@ -335,7 +324,7 @@ static void DrawScaleds()
|| (*(visspot+64) && !*(tilespot+64))
|| (*(visspot+63) && !*(tilespot+63)))
{
obj->active = true;
obj->active = ac_yes;
TransformActor(obj);
if (!obj->viewheight)
continue; // too close or far away
......@@ -803,14 +792,25 @@ static void DeCompileSprite(int shapenum)
void ScaleShape(int xcenter, int shapenum, unsigned height)
{
unsigned int scaler = (64 << 16) / (height >> 2);
unsigned int x, p;
unsigned int x;
int p;
if (spritegfx[shapenum] == NULL)
DeCompileSprite(shapenum);
for (p = xcenter - (height >> 3), x = 0; x < (64 << 16); x += scaler, p++) {
if ((p < 0) || (p >= viewwidth) || (wallheight[p] >= height))
p = xcenter - (height >> 3);
if (p < 0) {
x = (-p)*scaler;
p = 0;
} else {
x = 0;
}
for (; x < (64 << 16); x += scaler, p++) {
if (p >= viewwidth)
break;
if (wallheight[p] >= height)
continue;
ScaleLineTrans(height >> 2, spritegfx[shapenum] + ((x >> 16) << 6), p);
}
}
......@@ -818,14 +818,23 @@ void ScaleShape(int xcenter, int shapenum, unsigned height)
void SimpleScaleShape(int xcenter, int shapenum, unsigned height)
{
unsigned int scaler = (64 << 16) / height;
unsigned int x, p;
unsigned int x;
int p;
if (spritegfx[shapenum] == NULL)
DeCompileSprite(shapenum);
for (p = xcenter - (height / 2), x = 0; x < (64 << 16); x += scaler, p++) {
if ((p < 0) || (p >= viewwidth))
continue;
p = xcenter - (height / 2);
if (p < 0) {
x = (-p)*scaler;
p = 0;
} else {
x = 0;
}
for (; x < (64 << 16); x += scaler, p++) {
if (p >= viewwidth)
break;
ScaleLineTrans(height, spritegfx[shapenum] + ((x >> 16) << 6), p);
}
}
......
......@@ -52,7 +52,10 @@ char **_argv;
=
========================
*/
#ifdef NOASM
#if defined(__INTEL_COMPILER)
typedef _int64 int64_t;
#endif
fixed FixedByFrac(fixed a, fixed b)
{
int64_t ra = a;
......@@ -63,6 +66,7 @@ fixed FixedByFrac(fixed a, fixed b)
r >>= TILESHIFT;
return (fixed)r;
}
#endif
/*
=====================
......
......@@ -778,7 +778,7 @@ void GetNewActor()
lastobj->next = new;
new->prev = lastobj; // new->next is already NULL from memset
new->active = false;
new->active = ac_no;
lastobj = new;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment