Chris
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 13 Apr 2018
Topics: 55
Posts: 2128
Location: Canada

|
Posted: Fri Jun 10, 2016 9:48 pm
Subject: [Code] 128 Doors
[ IP : Logged ]
|

 
|
|
I noticed there wasn't a DOS tutorial for this, so I did a remix of the 190 walls one to get 128 doors like this:
::: CODE :::
diff -ru BC/WOLFSRC/WL_ACT1.C BC2/WOLFSRC/WL_ACT1.C
--- BC/WOLFSRC/WL_ACT1.C 1993-02-04 15:57:52.000000000 -0500
+++ BC2/WOLFSRC/WL_ACT1.C 2016-06-10 23:11:52.000000000 -0400
@@ -352,8 +352,8 @@
int areanumber;
unsigned far *map;
- if (doornum==64)
- Quit ("64+ doors on level!");
+ if (doornum==MAXDOORS)
+ Quit ("128+ doors on level!");
doorposition[doornum] = 0; // doors start out fully closed
lastdoorobj->tilex = tilex;
@@ -720,6 +720,7 @@
unsigned pwallpos; // amount a pushable wall has been moved (0-63)
unsigned pwallx,pwally;
int pwalldir;
+byte pwalltile;
/*
===============
@@ -737,7 +738,7 @@
return;
- oldtile = tilemap[checkx][checky];
+ pwalltile = oldtile = tilemap[checkx][checky];
if (!oldtile)
return;
@@ -790,7 +791,7 @@
pwalldir = dir;
pwallstate = 1;
pwallpos = 0;
- tilemap[pwallx][pwally] |= 0xc0;
+ tilemap[pwallx][pwally] = MOVINGTILE;
*(mapsegs[1]+farmapylookup[pwally]+pwallx) = 0; // remove P tile info
SD_PlaySound (PUSHWALLSND);
@@ -820,7 +821,7 @@
if (pwallstate/128 != oldblock)
{
// block crossed into a new block
- oldtile = tilemap[pwallx][pwally] & 63;
+ oldtile = pwalltile;
//
// the tile can now be walked into
@@ -889,7 +890,7 @@
break;
}
- tilemap[pwallx][pwally] = oldtile | 0xc0;
+ tilemap[pwallx][pwally] = MOVINGTILE;
}
}
::: CODE :::
diff -ru BC/WOLFSRC/WL_DEF.H BC2/WOLFSRC/WL_DEF.H
--- BC/WOLFSRC/WL_DEF.H 2016-06-10 23:44:21.000000000 -0400
+++ BC2/WOLFSRC/WL_DEF.H 2016-06-10 22:52:42.000000000 -0400
@@ -48,7 +48,7 @@
#define MAXACTORS 150 // max number of nazis, etc / map
#define MAXSTATS 400 // max number of lamps, bonus, etc
-#define MAXDOORS 64 // max number of sliding doors
+#define MAXDOORS 128 // max number of sliding doors
#define MAXWALLTILES 64 // max number of wall tiles
//
@@ -57,6 +57,7 @@
#define ICONARROWS 90
#define PUSHABLETILE 98
+#define MOVINGTILE 255
#define EXITTILE 99 // at end of castle
#define AREATILE 107 // first of NUMAREAS floor tiles
#define NUMAREAS 37
@@ -1155,6 +1156,7 @@
extern unsigned pwallpos; // amount a pushable wall has been moved (0-63)
extern unsigned pwallx,pwally;
extern int pwalldir;
+extern byte pwalltile;
void InitDoorList (void);
::: CODE :::
diff -ru BC/WOLFSRC/WL_DR_A.ASM BC2/WOLFSRC/WL_DR_A.ASM
--- BC/WOLFSRC/WL_DR_A.ASM 1993-02-04 15:57:58.000000000 -0500
+++ BC2/WOLFSRC/WL_DR_A.ASM 2016-06-10 20:50:26.000000000 -0400
@@ -539,8 +539,8 @@
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
- test al,040h ; both high bits set == pushable wall
- jnz horizpushwall
+ cmp al,255
+ je horizpushwall
mov bx,ax
and bx,7fh ; strip high bit
@@ -641,8 +641,8 @@
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
- test al,040h ; both high bits set == pushable wall
- jnz vertpushwall
+ cmp al,255
+ je vertpushwall
mov bx,ax
and bx,7fh ; strip high bit
::: CODE :::
diff -ru BC/WOLFSRC/WL_DRAW.C BC2/WOLFSRC/WL_DRAW.C
--- BC/WOLFSRC/WL_DRAW.C 1993-02-04 15:57:58.000000000 -0500
+++ BC2/WOLFSRC/WL_DRAW.C 2016-06-10 20:28:40.000000000 -0400
@@ -801,7 +801,7 @@
postx = pixx;
postwidth = 1;
- wallpic = horizwall[tilehit&63];
+ wallpic = horizwall[pwalltile];
*( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);
(unsigned)postsource = texture;
@@ -865,7 +865,7 @@
postx = pixx;
postwidth = 1;
- wallpic = vertwall[tilehit&63];
+ wallpic = vertwall[pwalltile];
*( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);
(unsigned)postsource = texture;
::: CODE :::
diff -ru BC/WOLFSRC/WL_MAIN.C BC2/WOLFSRC/WL_MAIN.C
--- BC/WOLFSRC/WL_MAIN.C 1994-04-13 08:08:20.000000000 -0400
+++ BC2/WOLFSRC/WL_MAIN.C 2016-06-10 19:20:24.000000000 -0400
@@ -350,6 +350,7 @@
sizeof(pwallx) +
sizeof(pwally) +
sizeof(pwalldir) +
+ sizeof(pwalltile) +
sizeof(pwallpos);
if (avail < size)
@@ -419,6 +420,8 @@
checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum);
CA_FarWrite (file,(void far *)&pwalldir,sizeof(pwalldir));
checksum = DoChecksum((byte far *)&pwalldir,sizeof(pwalldir),checksum);
+ CA_FarWrite (file,(void far *)&pwalltile,sizeof(pwalltile));
+ checksum = DoChecksum((byte far *)&pwalltile,sizeof(pwalltile),checksum);
CA_FarWrite (file,(void far *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte far *)&pwallpos,sizeof(pwallpos),checksum);
@@ -516,6 +519,8 @@
checksum = DoChecksum((byte far *)&pwally,sizeof(pwally),checksum);
CA_FarRead (file,(void far *)&pwalldir,sizeof(pwalldir));
checksum = DoChecksum((byte far *)&pwalldir,sizeof(pwalldir),checksum);
+ CA_FarRead (file,(void far *)&pwalltile,sizeof(pwalltile));
+ checksum = DoChecksum((byte far *)&pwalltile,sizeof(pwalltile),checksum);
CA_FarRead (file,(void far *)&pwallpos,sizeof(pwallpos));
checksum = DoChecksum((byte far *)&pwallpos,sizeof(pwallpos),checksum);
::: CODE :::
diff -ru BC/WOLFSRC/WL_STATE.C BC2/WOLFSRC/WL_STATE.C
--- BC/WOLFSRC/WL_STATE.C 1993-02-04 15:58:06.000000000 -0500
+++ BC2/WOLFSRC/WL_STATE.C 2016-06-10 19:37:44.000000000 -0400
@@ -171,7 +171,7 @@
if (temp<128) \
return false; \
if (temp<256) \
- doornum = temp&63; \
+ doornum = temp&127; \
else if (((objtype *)temp)->flags&FL_SHOOTABLE)\
return false; \
} \
Basically the lines with + means add and - means remove. Maybe opening it in Geany or Notepad++ will show more colors.
The Tilemap structure will look like this after:
1-63 - Walls
65-127 - Wall sides
128-254 - Doors
255 - Pushwall (tile number is saved in pwalltile)
The 128th door will contain the current pushwall image and state so probably best not to use it except for the Lolz.
I think you need 384-768 near bytes to raise MAXDOORS by 64 (depending on how you compile and play with the struct). |
|
|