Skip to content

Commit

Permalink
Out-of-line CHECKSIDE.
Browse files Browse the repository at this point in the history
Increase wall compression block size.



git-svn-id: svn+ssh://jay/var/svn/wolf/trunk@125 32837ae5-38f0-4cfd-8401-3ff76d8497c4
  • Loading branch information
paul committed Aug 19, 2007
1 parent ba392e9 commit ed548fc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
11 changes: 6 additions & 5 deletions build_walls.c
Expand Up @@ -30,12 +30,13 @@ void compress_wall(int picnum)
for (i = 0; i < 64 * 64; i++) {
pixels[i] = pal4bit[pixels[i]];
}
printf ("static const byte ROMAREA Wall%d[64 * 18] = {\n", picnum);
printf ("static const byte ROMAREA Wall%d[%d] = {\n", picnum,
64 * 64 / 4 + WALLCBLOCK * 2);
p = pixels;
for (i = 0; i < 64; i++) {
for (i = 0; i < WALLCBLOCK; i++) {
for (j = 0; j < 16; j++)
data[j] = 0;
for (j = 0; j < 64; j++)
for (j = 0; j < WALLBLOCKSIZE; j++)
data[p[j]]++;
for (n = 0; n < 4; n++) {
bestmatch = 0;
Expand All @@ -55,7 +56,7 @@ void compress_wall(int picnum)
}
printf ("%d, %d, ", (val[0] << 4) | val[1], (val[2] << 4) | val[3]);
c = 0;
for (j = 0; j < 64; j++) {
for (j = 0; j < WALLBLOCKSIZE; j++) {
bestmatch = 16;
bestpos = 0;
for (n = 0; n < 4; n++) {
Expand All @@ -71,7 +72,7 @@ void compress_wall(int picnum)
}
}
printf ("\n");
p += 64;
p += WALLBLOCKSIZE;
}
printf("};\n");
}
Expand Down
4 changes: 2 additions & 2 deletions id_ca.c
Expand Up @@ -971,13 +971,13 @@ memptr PM_GetPage(myint pagenum)
addr = MM_AllocPool(&PageAddr[pagenum], 64 * 64);
p = (byte *)addr;
src = WallChunks[pagenum];
for (x = 0; x < 64; x++) {
for (x = 0; x < WALLCBLOCK; x++) {
pal[0] = 0x1f - (src[0] >> 4);
pal[1] = 0x1f - (src[0] & 0x0f);
pal[2] = 0x1f - (src[1] >> 4);
pal[3] = 0x1f - (src[1] & 0x0f);
src += 2;
for (y = 0; y < 16; y++) {
for (y = 0; y < WALLBLOCKSIZE / 4; y++) {
c = *(src++);
*(p++) = pal[c & 3];
c >>= 2;
Expand Down
2 changes: 2 additions & 0 deletions wl_def.h
Expand Up @@ -28,6 +28,8 @@ extern myint vwidth, vheight, vpitch; /* size of screen */
#define MAXSTATS 400 // max number of lamps, bonus, etc
#define MAXDOORS 64 // max number of sliding doors
#define MAXWALLTILES 64 // max number of wall tiles
#define WALLCBLOCK 16 // Number of compression blocks
#define WALLBLOCKSIZE ((64 * 64) / WALLCBLOCK)

//
// tile constants
Expand Down
27 changes: 15 additions & 12 deletions wl_state.c
Expand Up @@ -122,19 +122,20 @@ void NewState(objtype *ob, myint state) /* stateenum */
} \
}

#define CHECKSIDE(x,y) \
{ \
if (any_actor_at(x, y)) \
{ \
if (wall_actor_at(x, y)) \
return false; \
if (!obj_actor_at(x, y)) \
doornum = get_actor_at(x, y); \
else if (objlist[get_actor_at(x, y)].flags & FL_SHOOTABLE) \
return false; \
} \
static int do_checkside(int x, int y)
{
if (any_actor_at(x, y))
{
if (wall_actor_at(x, y))
return -2;
if (!obj_actor_at(x, y))
return get_actor_at(x, y);
else if (objlist[get_actor_at(x, y)].flags & FL_SHOOTABLE)
return -2;
}
return -1;
}

#define CHECKSIDE(x, y) doornum = do_checkside(x, y);

boolean TryWalk(objtype *ob)
{
Expand Down Expand Up @@ -276,6 +277,8 @@ boolean TryWalk(objtype *ob)
Quit ("Walk: Bad dir");
}

if (doornum == -2)
return false;
if (doornum != -1)
{
OpenDoor (doornum);
Expand Down

0 comments on commit ed548fc

Please sign in to comment.