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] Switch Activated Pushwalls
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials 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
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Sun Dec 19, 2004 4:40 pm
   Subject: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

After Beta Testing EoD and playing with ideas for my Wolfplus/Advanced I decided to attempt the same Switch activated pushwalls as MCS did for EoD. Below is the result of my effort.. It's probably close to what MCS did, although without seeing his code, I can't be 100% sure... Anyhow...

Using whatever vswap modifier program you choose (Floedit, Wdc, etc)... Insert your switch graphics into the vswap. There should be two pictures for UP and two for DOWN as per the same convention for adding walls. If you are NOT using the "Darkone Raycastor Code" the switch graphic positions should be below 64 in the vswap.

(In the code below it is assumed that your switch graphics are 63 and 64 in the vswap).

Open wl_def.h and add the following:

::: CODE :::

#define SWITCHTILE       63  // First graphic for switch location
extern byte  pwx,pwy,pw2x,pw2y,pw3x,pw3y,pw4x,pw4y;


Next open the wl_game.c file Near the Top add:
::: CODE :::

   byte pwx,pw2x,pw3x,pw4x,pwy,pw2y,pw3y,pw4y; // Pushwall by Switch


and in the ScanInfoPlane routine add:

::: CODE :::

         case 704: // Pushwall by Switch - North
         case 705: // South
         case 706: // East
         case 707: // West   
            pwx = x; pwy = y;
            break;
         case 712: // Pushwall2 by Switch - North
         case 713: // South
         case 714: // East
         case 715: // West
            pw2x = x; pw2y = y;
            break;
         case 720: // Pushwall3 by Switch - North
         case 721: // South
         case 722: // East
         case 723: // West
            pw3x = x; pw3y = y;
            break;
         case 728: // Pushwall4 by Switch - North
         case 729: // South
         case 730: // East
         case 731: // West
            pw4x = x; pw4y = y;
            break;



Next... Open the wl_agent.c file and in the Cmd_Use routine, insert the following code AFTER the "if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)" code brackets, so you have:

if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)
{

code ommited for space

}
// New code goes here

::: CODE :::

   else if (!buttonheld[bt_use] && doornum >= SWITCHTILE)
   {
      buttonheld[bt_use] = true;
      if (doornum >= SWITCHTILE && doornum <= SWITCHTILE+1)
      {
         switch (doornum)   // Flip the switch
         {
            case SWITCHTILE:
               tilemap[checkx][checky]++;
               break;
            case SWITCHTILE+1:
               tilemap[checkx][checky]--;
               break;
         }
         switch (MAPSPOT(checkx,checky,1))  // activate/deactivate item
         {
            case 700: // Pushwall North
               PushWall (pwx,pwy,di_north);
               break;
            case 701: // Pushwall South
               PushWall (pwx,pwy,di_south);
               break;
            case 702: // Pushwall East
               PushWall (pwx,pwy,di_east);
               break;
            case 703: // Pushwall West
               PushWall (pwx,pwy,di_west);
               break;
            case 708: // Pushwall2 North
               PushWall (pw2x,pw2y,di_north);
               break;
            case 709: // Pushwall2 South
               PushWall (pw2x,pw2y,di_south);
               break;
            case 710: // Pushwall2 East
               PushWall (pw2x,pw2y,di_east);
               break;
            case 711: // Pushwall2 West
               PushWall (pw2x,pw2y,di_west);
               break;
            case 716: // Pushwall3 North
               PushWall (pw3x,pw3y,di_north);
               break;
            case 717: // Pushwall3 South
               PushWall (pw3x,pw3y,di_south);
               break;
            case 718: // Pushwall3 East
               PushWall (pw3x,pw3y,di_east);
               break;
            case 719: // Pushwall3 West
               PushWall (pw3x,pw3y,di_west);
               break;
            case 724: // Pushwall4 North
               PushWall (pw4x,pw4y,di_north);
               break;
            case 725: // Pushwall4 South
               PushWall (pw4x,pw4y,di_south);
               break;
            case 726: // Pushwall4 East
               PushWall (pw4x,pw4y,di_east);
               break;
            case 727: // Pushwall4 West
               PushWall (pw4x,pw4y,di_west);
               break;
         }
      }
   }


Now open up your objdata.wl6 file for MAPEDIT and insert the following:

::: CODE :::

02bc e00P SwModPwall N
02bd e00P SwModPwall S
02be e00P SwModPwall E
02bf e00P SwModPwall W
02c0 e00P PwallSwMod N
02c1 e00P PwallSwMod S
02c2 e00P PwallSwMod E
02c3 e00P PwallSwMod W
02c4 f00P SwModPwall2 N
02c5 f00P SwModPwall2 S
02c6 f00P SwModPwall2 E
02c7 f00P SwModPwall2 W
02c8 f00P PwallSwMod2 N
02c9 f00P PwallSwMod2 S
02ca f00P PwallSwMod2 E
02cb f00P PwallSwMod2 W
02cc c00P SwModPwall3 N
02cd c00P SwModPwall3 S
02ce c00P SwModPwall3 E
02cf c00P SwModPwall3 W
02d0 c00P PwallSwMod3 N
02d1 c00P PwallSwMod3 S
02d2 c00P PwallSwMod3 E
02d3 c00P PwallSwMod3 W
02d4 d00P SwModPwall4 N
02d5 d00P SwModPwall4 S
02d6 d00P SwModPwall4 E
02d7 d00P SwModPwall4 W
02d8 d00P PwallSwMod4 N
02d9 d00P PwallSwMod4 S
02da d00P PwallSwMod4 E
02db d00P PwallSwMod4 W


Save code and compile... There you have it... Switch activated Pushwalls.... To use the code, do the following in Mapedit:

Place a floor code where you want your switchwall to be...
Place the Switch Modifier on it (SwModPwall? in the defines above).
Place the Switch graphic (63 or 64) ontop of that..

Now decide where the actual pushwall is going to be...
Place a floor code down...
Place the proper PwallSwMod? modifier on it to signify the pushwall and the direction it will move...
Place the Wall Graphic on that spot to match the other walls in the room..

It couldn't be more simple... Enjoy...

Greg
BrotherTank


Last edited by BrotherTank on Sun Dec 19, 2004 4:51 pm; edited 1 time in total
ZuljinRaynor
DieHard Officer
DieHard Officer


Joined: 17 Jan 2004
Last Visit: 30 May 2018

Topics: 19
Posts: 559

usa.gif

PostPosted: Sun Dec 19, 2004 4:50 pm
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Aww Man... thanks a lot for this. I'm sorry I wasn't able to get it done myself. It was causing me much pain since my last post. Razz Thanks BrotherTank.
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 3:09 ago.

Topics: 73
Posts: 3774

blank.gif

PostPosted: Mon Jul 31, 2006 3:08 am
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've added the switch activated pushwalls, but everytime that I found all the pushwalls (the normal and the switch activated ones) I get 200%. How do I get rid of this?
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 02 Dec 2018

Topics: 55
Posts: 2152
Location: Canada
blank.gif

PostPosted: Mon Jul 31, 2006 4:38 am
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@ronwolf1705: My guess is that you would add something like this to ScanInfoPlane:

::: CODE :::
         case 704: // Pushwall by Switch - North
         case 705: // South
         case 706: // East
         case 707: // West   
            pwx = x; pwy = y;
            gamestate.secrettotal++;
            break;
         case 712: // Pushwall2 by Switch - North
         case 713: // South
         case 714: // East
         case 715: // West
            pw2x = x; pw2y = y;
            gamestate.secrettotal++;
            break;
         case 720: // Pushwall3 by Switch - North
         case 721: // South
         case 722: // East
         case 723: // West
            pw3x = x; pw3y = y;
            gamestate.secrettotal++;
            break;
         case 728: // Pushwall4 by Switch - North
         case 729: // South
         case 730: // East
         case 731: // West
            pw4x = x; pw4y = y;
            gamestate.secrettotal++;
            break;

It adds to gamestate.secretcount in Pushwall function already, without adding it in gamestate.secrettotal originally.. so that would expain your 200% ratios.
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 3:09 ago.

Topics: 73
Posts: 3774

blank.gif

PostPosted: Mon Jul 31, 2006 5:16 am
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It worked! Thanks.
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 08 Dec 2018

Topics: 53
Posts: 2205
Location: Australia
australia.gif

PostPosted: Sun Nov 04, 2007 10:08 pm
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sorry to bump such an old thread but I'm trying to install this and I've got a problem.

There are no errors in the code or when i compile it but when I go into the game I can't open any of the normal or locked doors! I've checked the code 10 times and it is 100% perfect.

Does anyone have any idea what might be causing this and if so how to fix it?

I've added new walls in so it's like this

53 switch up
54 switch down
55 new wall
56 new wall
57 new wall
58 new wall
59 new wall
60 Normal door
61 Door sides
62 Elevator
63 Silver/Gold door

The code in the wl_def.h says this
::: CODE :::
#define SWITCHTILE       53  // First graphic for switch location

_________________
... Still alive Razz
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 3:09 ago.

Topics: 73
Posts: 3774

blank.gif

PostPosted: Mon Nov 05, 2007 7:02 am
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I think you have switched something in the Cmd_Use function in WL_Agent. Does it look like this?

::: CODE :::

void Cmd_Use (void)
{
   objtype    *check;
   int         checkx,checky,doornum,dir;
   boolean      elevatorok;


//
// find which cardinal direction the player is facing
//
   if (player->angle < ANGLES/8 || player->angle > 7*ANGLES/8)
   {
      checkx = player->tilex + 1;
      checky = player->tiley;
      dir = di_east;
      elevatorok = true;
   }
   else if (player->angle < 3*ANGLES/8)
   {
      checkx = player->tilex;
      checky = player->tiley-1;
      dir = di_north;
      elevatorok = false;
   }
   else if (player->angle < 5*ANGLES/8)
   {
      checkx = player->tilex - 1;
      checky = player->tiley;
      dir = di_west;
      elevatorok = true;
   }
   else
   {
      checkx = player->tilex;
      checky = player->tiley + 1;
      dir = di_south;
      elevatorok = false;
   }

   doornum = tilemap[checkx][checky];
   if (*(mapsegs[1]+farmapylookup[checky]+checkx) == PUSHABLETILE)
   {
   //
   // pushable wall
   //

      PushWall (checkx,checky,dir);
      return;
   }
   if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)
   {
   //
   // use elevator
   //
      buttonheld[bt_use] = true;

      tilemap[checkx][checky]++;      // flip switch
      if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)
         playstate = ex_secretlevel;
      else
         playstate = ex_completed;
      SD_PlaySound (LEVELDONESND);
      SD_WaitSoundDone();
   }
   else if (!buttonheld[bt_use] && doornum & 0x80)
   {
      buttonheld[bt_use] = true;
      OperateDoor (doornum & ~0x80);
   }

   else if (!buttonheld[bt_use] && doornum >= SWITCHTILE)
   {
      buttonheld[bt_use] = true;
      if (doornum >= SWITCHTILE && doornum <= SWITCHTILE+1)
      {
         switch (doornum)   // Flip the switch
         {
            case SWITCHTILE:
               tilemap[checkx][checky]++;
               break;
            case SWITCHTILE+1:
               tilemap[checkx][checky]--;
               break;
         }
         switch (MAPSPOT(checkx,checky,1))  // activate/deactivate item
         {
            case 700: // Pushwall North
               PushWall (pwx,pwy,di_north);
               break;
            case 701: // Pushwall South
               PushWall (pwx,pwy,di_south);
               break;
            case 702: // Pushwall East
               PushWall (pwx,pwy,di_east);
               break;
            case 703: // Pushwall West
               PushWall (pwx,pwy,di_west);
               break;
            case 708: // Pushwall2 North
               PushWall (pw2x,pw2y,di_north);
               break;
            case 709: // Pushwall2 South
               PushWall (pw2x,pw2y,di_south);
               break;
            case 710: // Pushwall2 East
               PushWall (pw2x,pw2y,di_east);
               break;
            case 711: // Pushwall2 West
               PushWall (pw2x,pw2y,di_west);
               break;
            case 716: // Pushwall3 North
               PushWall (pw3x,pw3y,di_north);
               break;
            case 717: // Pushwall3 South
               PushWall (pw3x,pw3y,di_south);
               break;
            case 718: // Pushwall3 East
               PushWall (pw3x,pw3y,di_east);
               break;
            case 719: // Pushwall3 West
               PushWall (pw3x,pw3y,di_west);
               break;
            case 724: // Pushwall4 North
               PushWall (pw4x,pw4y,di_north);
               break;
            case 725: // Pushwall4 South
               PushWall (pw4x,pw4y,di_south);
               break;
            case 726: // Pushwall4 East
               PushWall (pw4x,pw4y,di_east);
               break;
            case 727: // Pushwall4 West
               PushWall (pw4x,pw4y,di_west);
               break;
         }
      }
   }
}
Dean
Moderator
<B>Moderator</B>


Joined: 10 Jan 2006
Last Visit: 08 Dec 2018

Topics: 53
Posts: 2205
Location: Australia
australia.gif

PostPosted: Tue Nov 06, 2007 12:32 am
   Subject: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

AHA, that fixed it! I had put this;

::: CODE :::
else if (!buttonheld[bt_use] && doornum & 0x80)
   {
      buttonheld[bt_use] = true;
      OperateDoor (doornum & ~0x80);
   }


After the case defines instead or before it. D'oh <slaps head>

Thanks a lot for your help RonWolf Thumbs Up

_________________
... Still alive Razz
Black Man
Registered User
Registered User


Joined: 19 May 2006
Last Visit: 09 Aug 2016

Topics: 8
Posts: 22

germany.gif

PostPosted: Sat Nov 17, 2007 9:53 am
   Subject: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I have made this Tutorial but when i build my exe i got these two errors:

Error WL_AGENT.C 1176: Declaration terminated incorrectly
Error WL_AGENT.C 1207: Unexpected }

And this is my Cmd_Use code:

::: CODE :::
/*
===============
=
= Cmd_Use
=
===============
*/
void Cmd_Use (void)
{
   objtype    *check;
   int         checkx,checky,doornum,dir;
   boolean      elevatorok;


//
// find which cardinal direction the player is facing
//
   if (player->angle < ANGLES/8 || player->angle > 7*ANGLES/8)
   {
      checkx = player->tilex + 1;
      checky = player->tiley;
      dir = di_east;
      elevatorok = true;
   }
   else if (player->angle < 3*ANGLES/8)
   {
      checkx = player->tilex;
      checky = player->tiley-1;
      dir = di_north;
      elevatorok = false;
   }
   else if (player->angle < 5*ANGLES/8)
   {
      checkx = player->tilex - 1;
      checky = player->tiley;
      dir = di_west;
      elevatorok = true;
   }
   else
   {
      checkx = player->tilex;
      checky = player->tiley + 1;
      dir = di_south;
      elevatorok = false;
   }

   doornum = tilemap[checkx][checky];
   if (*(mapsegs[1]+farmapylookup[checky]+checkx) == PUSHABLETILE)
   {
   //
   // pushable wall
   //

      PushWall (checkx,checky,dir);
      return;
   }
   if (!buttonheld[bt_use] && doornum == ELEVATORTILE && elevatorok)
   {
   //
   // use elevator
   //
      buttonheld[bt_use] = true;

      tilemap[checkx][checky]++;      // flip switch
      if (*(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) == ALTELEVATORTILE)
         playstate = ex_secretlevel;
      else
         playstate = ex_completed;
      SD_PlaySound (LEVELDONESND);
      SD_WaitSoundDone();
   }
   else if (!buttonheld[bt_use] && doornum & 0x80)
   {
      buttonheld[bt_use] = true;
      OperateDoor (doornum & ~0x80);
   }

   else if (!buttonheld[bt_use] && doornum >= SWITCHTILE)
   {
      buttonheld[bt_use] = true;
      if (doornum >= SWITCHTILE && doornum <= SWITCHTILE+1)
      {
         switch (doornum)   // Flip the switch
         {
            case SWITCHTILE:
               tilemap[checkx][checky]++;
               break;
            case SWITCHTILE+1:
               tilemap[checkx][checky]--;
               break;
         }
         switch (MAPSPOT(checkx,checky,1))  // activate/deactivate item
         {
            case 700: // Pushwall North
               PushWall (pwx,pwy,di_north);
               break;
            case 701: // Pushwall South
               PushWall (pwx,pwy,di_south);
               break;
            case 702: // Pushwall East
               PushWall (pwx,pwy,di_east);
               break;
            case 703: // Pushwall West
               PushWall (pwx,pwy,di_west);
               break;
            case 708: // Pushwall2 North
               PushWall (pw2x,pw2y,di_north);
               break;
            case 709: // Pushwall2 South
               PushWall (pw2x,pw2y,di_south);
               break;
            case 710: // Pushwall2 East
               PushWall (pw2x,pw2y,di_east);
               break;
            case 711: // Pushwall2 West
               PushWall (pw2x,pw2y,di_west);
               break;
            case 716: // Pushwall3 North
               PushWall (pw3x,pw3y,di_north);
               break;
            case 717: // Pushwall3 South
               PushWall (pw3x,pw3y,di_south);
               break;
            case 718: // Pushwall3 East
               PushWall (pw3x,pw3y,di_east);
               break;
            case 719: // Pushwall3 West
               PushWall (pw3x,pw3y,di_west);
               break;
            case 724: // Pushwall4 North
               PushWall (pw4x,pw4y,di_north);
               break;
            case 725: // Pushwall4 South
               PushWall (pw4x,pw4y,di_south);
               break;
            case 726: // Pushwall4 East
               PushWall (pw4x,pw4y,di_east);
               break;
            case 727: // Pushwall4 West
               PushWall (pw4x,pw4y,di_west);
               break;
         }
      }
   }
}

// Ammo Rack

      if(!buttonheld[bt_use] && doornum == 48)
                {
      buttonheld[bt_use] = true;
      if(gamestate.ammo >= 100)
                return;
      tilemap[checkx][checky]++;
      SD_PlaySound(GETAMMOSND);
      GiveAmmo (30);
      GetMessage("You get some Ammo.");
      StartBonusFlash();
      }

// Health Rack

      if(!buttonheld[bt_use] && doornum == 50)
                {
      buttonheld[bt_use] = true;
   if (gamestate.health == 100)
   return;
      tilemap[checkx][checky]++;
   SD_PlaySound (HEALTH2SND);
         GetMessage("You get some First Aid.");
   HealSelf (30);
      StartBonusFlash();
      }
   else if (!buttonheld[bt_use] && doornum & 0x80)
   {
      buttonheld[bt_use] = true;
      OperateDoor (doornum & ~0x80);
   }
   else
      SD_PlaySound (DONOTHINGSND);
}


Please help my with this.

Blacky
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 03 Dec 2018

Topics: 46
Posts: 2317
Location: USA
usa.gif

PostPosted: Mon Nov 19, 2007 7:33 pm
   Subject: Re: [Code] Switch Activated Pushwalls
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

::: CODE :::
           case 727: // Pushwall4 West
               PushWall (pw4x,pw4y,di_west);
               break;
         }
      }
   }
}

I think the last } should not be there...

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials 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 [Code] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 14703 Tue Mar 11, 2008 12:02 am
AlumiuN View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2962 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 2153 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2469 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3314 Sun Oct 26, 2003 1:21 am
Guest 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