DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Code] 128 Doors
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 13 Nov 2019

Topics: 58
Posts: 2247
Location: Canada
blank.gif

PostPosted: Fri Jun 10, 2016 9:48 pm
   Subject: [Code] 128 Doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

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).
gerolf
DieHard Wolfer
DieHard Wolfer


Joined: 28 Jan 2010
Last Visit: 6:37 ago.

Topics: 162
Posts: 1108
Location: Virginia
usa.gif

PostPosted: Sat Jun 11, 2016 4:08 am
   Subject: Re: [Code] 128 Doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Excellent! Thanks for this!

_________________
Aryan_Wolf3D
DieHard Guard
DieHard Guard


Joined: 21 Jul 2011
Last Visit: 12 Nov 2019

Topics: 6
Posts: 261

blank.gif

PostPosted: Thu Apr 11, 2019 3:08 am
   Subject: Re: [Code] 128 Doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Chris wrote:
I think you need 384-768 near bytes to raise MAXDOORS by 64 (depending on how you compile and play with the struct).

In case anyone can't be bothered to go through the hassle of freeing up enough memory, here's a simpler method...

In WL_DEF.H, search for "doorobj_t doorobjlist", and you should see this line:

::: CODE :::
extern   doorobj_t   doorobjlist[MAXDOORS],*lastdoorobj;

For some reason, both of these are declared twice in WL_DEF.H, but you only need them to be declared once, so delete this first line. Then search for it again and change the 2nd one to this:

::: CODE :::
extern doorobj_t far doorobjlist[MAXDOORS],far *lastdoorobj;

Then in WL_ACT1.C, search for "doorobj_t doorobjlist" again and make the same change (without including the "extern".) This will stop the doorobjlist from eating up memory from the data segment, so you can add pretty much as many doors as you wish, provided they fit into tilemap. Wink

_________________
"Way too many #ifdefs in the code!" - John Carmack
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 11414 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Tricks - Dogs that shoot - Modifying Behaviour
Author: Guest
19 288 Sat Mar 20, 2004 7:31 am
Dugtrio17 View latest post
No new posts [Info] Alarm Sounding in game?? WSJ...??
Author: Guest
7 311 Tue Jun 17, 2003 10:04 pm
Reivax44 View latest post
No new posts [Info] Silent Gun? - Adding a Silencer
Author: Guest
4 194 Fri Apr 18, 2003 8:34 am
BrotherTank View latest post
No new posts [Info] Adding Locked Doors
Author: Guest
3 244 Thu Apr 17, 2003 6:30 am
Ripper View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group