ref: 460f482ad05aeb12a7ed3bb92adeb03d8c6e4c0a
parent: 3a322e9f329909c3c751de6cb5da33e7280c2738
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Sep 4 19:02:37 EDT 2014
doom: fix alignment issues for arm
--- a/sys/src/games/doom/doomdata.h
+++ b/sys/src/games/doom/doomdata.h
@@ -211,7 +211,6 @@
short options;
} mapthing_t;
-
#pragma pack off
--- a/sys/src/games/doom/f_wipe.c
+++ b/sys/src/games/doom/f_wipe.c
@@ -184,7 +184,7 @@
width/=2;
- while (ticks--)
+ while (ticks-- >= 0)
{
for (i=0;i<width;i++)
{
--- a/sys/src/games/doom/p_mobj.c
+++ b/sys/src/games/doom/p_mobj.c
@@ -396,7 +396,7 @@
// inherit attributes from deceased one
mo = P_SpawnMobj (x,y,z, mobj->type);
- mo->spawnpoint = mobj->spawnpoint;
+ memcpy (&mo->spawnpoint, mthing, sizeof(*mthing));
mo->angle = ANG45 * (mthing->angle/45);
if (mthing->options & MTF_AMBUSH)
@@ -552,7 +552,7 @@
&& (mobj->type != MT_INV)
&& (mobj->type != MT_INS))
{
- itemrespawnque[iquehead] = mobj->spawnpoint;
+ memcpy (&itemrespawnque[iquehead], &mobj->spawnpoint, sizeof(mobj->spawnpoint));
itemrespawntime[iquehead] = leveltime;
iquehead = (iquehead+1)&(ITEMQUESIZE-1);
@@ -625,7 +625,7 @@
z = ONFLOORZ;
mo = P_SpawnMobj (x,y,z, i);
- mo->spawnpoint = *mthing;
+ memcpy (&mo->spawnpoint, mthing, sizeof(*mthing));
mo->angle = ANG45 * (mthing->angle/45);
// pull it from the que
@@ -728,10 +728,10 @@
}
// check for players specially
- if (mthing->type <= 4)
+ if (mthing->type <= MAXPLAYERS)
{
// save spots for respawning in network games
- playerstarts[mthing->type-1] = *mthing;
+ memcpy (&playerstarts[mthing->type-1], mthing, sizeof(*mthing));
if (!deathmatch)
P_SpawnPlayer (mthing);
@@ -784,7 +784,7 @@
z = ONFLOORZ;
mobj = P_SpawnMobj (x,y,z, i);
- mobj->spawnpoint = *mthing;
+ memcpy (&mobj->spawnpoint, mthing, sizeof(*mthing));
if (mobj->tics > 0)
mobj->tics = 1 + (P_Random () % mobj->tics);
--- a/sys/src/games/doom/r_data.c
+++ b/sys/src/games/doom/r_data.c
@@ -91,6 +91,7 @@
mappatch_t patches[1];
} maptexture_t;
+#pragma pack off
/* A single patch from a texture definition,
** basically a rectangular area within
@@ -125,10 +126,6 @@
short patchcount;
texpatch_t patches[1];
} texture_t;
-
-
-#pragma pack off
-
int firstflat;
int lastflat;
--- a/sys/src/games/doom/r_things.c
+++ b/sys/src/games/doom/r_things.c
@@ -173,12 +173,12 @@
/* char** check; */
int i;
int l;
- int intname;
int frame;
int rotation;
int start;
int end;
int patched;
+ char* name;
/* BUG
This would work if the namelist was NULL terminated which it is not.
@@ -213,13 +213,13 @@
memset (sprtemp,-1, sizeof(sprtemp));
maxframe = -1;
- intname = *(int *)namelist[i];
+ name = namelist[i];
// scan the lumps,
// filling in the frames for whatever is found
for (l=start+1 ; l<end ; l++)
{
- if (*(int *)lumpinfo[l].name == intname)
+ if (memcmp(lumpinfo[l].name, name, 4) == 0)
{
frame = lumpinfo[l].name[4] - 'A';
rotation = lumpinfo[l].name[5] - '0';