How difficult would it be to add a "super locked"
Select messages from
# through # FAQ
[/[Print]\]

DieHard Wolfers -> Code Crackers

#1: How difficult would it be to add a "super locked" Author: Barry PostPosted: Sun Jun 19, 2016 6:38 pm
    —
If I wanted to add a new locked door that required all four keys to open instead of just one key, using the existing locked door graphic, how difficult would that be? If its too difficult, I probably won't want to do it for Wolf Forever Phase 1 since it's so close to release, but if it's simple, it would be perfect for a map I just finished.

#2: Re: How difficult would it be to add a "super locked" Author: ChrisLocation: Canada PostPosted: Sun Jun 19, 2016 8:06 pm
    —
Hi Barry,

You could try this: Open WL_DEF.H and add this in purple (including the comma after dr_elevator):

::: CODE :::
typedef enum {
   dr_normal,
   dr_lock1,
   dr_lock2,
   dr_lock3,
   dr_lock4,
   dr_elevator,
   dr_super

} door_t;

Then open up WL_GAME.C and in the spawn doors section of SetupGameLevel() change tile <= 101 to 103 and add two cases:

::: CODE :::
         tile = *map++;
         if (tile >= 90 && tile <= 103)
         {
         // door
            switch (tile)
            {
            case 90:
            case 92:
            case 94:
            case 96:
            case 98:
            case 100:
            case 102:

               SpawnDoor (x,y,1,(tile-90)/2);
               break;
            case 91:
            case 93:
            case 95:
            case 97:
            case 99:
            case 101:
            case 103:

               SpawnDoor (x,y,0,(tile-91)/2);
               break;
            }
         }

Then open up WL_DRAW.C and add a dr_super case into both HitHorizDoor() and HitVertDoor() so it shows the right texture:

::: CODE :::
      switch (doorobjlist[doornum].lock)
      {
      case dr_normal:
         doorpage = DOORWALL;
         break;
      case dr_lock1:
      case dr_lock2:
      case dr_lock3:
      case dr_lock4:
      case dr_super:

         doorpage = DOORWALL+6;
         break;
      case dr_elevator:
         doorpage = DOORWALL+4;
         break;
      }

Then add this 'else if' into OperateDoor() of WL_ACT1.C so it checks if all 4 keys have been acquired before opening:

::: CODE :::
   lock = doorobjlist[door].lock;
   if (lock >= dr_lock1 && lock <= dr_lock4)
   {
      if ( ! (gamestate.keys & (1 << (lock-dr_lock1) ) ) )
      {
         SD_PlaySound (NOWAYSND);      // locked
         return;
      }
   }
   else if (lock == dr_super && gamestate.keys != 15)
   {
      SD_PlaySound (NOWAYSND);      // locked
      return;
   }



   switch (doorobjlist[door].action)

Then add the map defines for the new super door somewhere into the MAPDATA file for Mapedit so it can be used:

::: CODE :::
0066 d070 Super Locked N/S
0067 d060 Super Locked E/S

I think that's it. gamestate.keys == 15 is the equivalent of key1 (1) + key2 (2) + key3 (4) + key4 (8) as they're saved in bits.

#3: Re: How difficult would it be to add a "super locked" Author: Barry PostPosted: Sun Jun 19, 2016 10:30 pm
    —
That worked!! Thanks a lot!!



DieHard Wolfers -> Code Crackers


output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group