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       

[WOLF4SDL Help] Blake Stone Style doors
Page 1 of 1
DieHard Wolfers Forum Index -> SDL 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
Haasboy
DieHard Officer
DieHard Officer


Joined: 23 Jul 2003
Last Visit: 04 Nov 2017

Topics: 58
Posts: 581
Location: South Africa, Johannesburg
southafrica.gif

PostPosted: Sun May 11, 2008 11:18 am
   Subject: [WOLF4SDL Help] Blake Stone Style doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I've managed to successfully to compile Adam Bisers Blake Stone style doors code in then Wolf4SDL code, but the only problem is that it doesn't show the door opening and closing properly. Here's a screenshot of what happens when I press the spacebar on the door to open it:

Don't worry about the messy graphics, that's just due to the palette change (I haven't replaced all the graphics)

EDIT:
I managed to fix the opening animation, but the closing animation is not even shown and the one side closes only, and after that it the one side will only show its opening or closing animation.

Here's the my code (altered code is in orange):
ACT1.CPP
::: CODE :::
doorobj_t       doorobjlist[MAXDOORS],*lastdoorobj;
short           doornum;

#ifdef BLAKEDOORS
word      ldoorposition[MAXDOORS],rdoorposition[MAXDOORS];   // leading edge of door 0=closed
#else
word            doorposition[MAXDOORS];             // leading edge of door 0=closed
#endif

SpawnDoor
::: CODE :::
        Quit ("64+ doors on level!");

#ifndef BLAKEDOORS
    doorposition[doornum] = 0;              // doors start out fully closed
#endif

#ifdef BLAKEDOORS
   switch (MAPSPOT(tilex,tiley,0))
      {
         case 90:
         case 91:
            lastdoorobj->doubledoor = true;
            break;
         default:
            lastdoorobj->doubledoor = false;
      }
      if (lastdoorobj->doubledoor)
      {
            ldoorposition[doornum] = 0x7fff;      // doors start out fully closed
            rdoorposition[doornum] = 0x8000;
      }
      else
      {
            ldoorposition[doornum] = 0;      // doors start out fully closed
            rdoorposition[doornum] = 0; // this will function like the original doorposition[]
      }
#endif

    lastdoorobj->tilex = tilex;

DoorOpening
::: CODE :::
int32_t position;

#ifndef BLAKEDOORS
    position = doorposition[door];
#endif

#ifdef BLAKEDOORS
   if (doorobjlist[door].doubledoor)
            position = 0x7fff-ldoorposition[door];
      else
            position = rdoorposition[door];
#endif

    if (!position)
...
...
    //
    // slide the door by an adaptive amount
    //
#ifdef BLAKEDOORS
   if (doorobjlist[door].doubledoor)
   {
      position += (tics<<10)/2;
      if (position >= 0x7fff)
      {
      //
      // door is all the way open
      //
         position = 0x7fff;
         doorobjlist[door].ticcount = 0;
         doorobjlist[door].action = dr_open;
         actorat[doorobjlist[door].tilex][doorobjlist[door].tiley] = 0;
      }
      ldoorposition[door] = 0x7fff-position;
      rdoorposition[door] = 0x8000+position;
   }
   else
   {
#endif

    position += tics<<10;
...
...
        actorat[doorobjlist[door].tilex][doorobjlist[door].tiley] = 0;
    }
#ifndef BLAKEDOORS
    doorposition[door] = (word) position;
#else
//   doorposition[door] = position;
      ldoorposition[door] = 0;
      rdoorposition[door] = position;
   }
#endif

}

DoorClosing
::: CODE :::
        OpenDoor (door);
        return;
    };

#ifndef BLAKEDOORS
    position = doorposition[door];

    //
    // slide the door by an adaptive amount
    //
    position -= tics<<10;
#else
   if (doorobjlist[door].doubledoor)
   {
      position = 0x7fff-ldoorposition[door];
      // slide the door by an adaptive amount
      position -= (tics<<10)/2;
   }
   else
   {
      position = rdoorposition[door];
      // slide the door by an adaptive amount
      position -= (tics<<10);
   }
#endif

    if (position <= 0)
    {
        //
        // door is closed all the way, so disconnect the areas
        //
#ifndef BLAKEDOORS
        position = 0;
#else
   if (doorobjlist[door].doubledoor)
   {
      ldoorposition[door] = 0x7fff-position;
      rdoorposition[door] = 0x8000+position;
   }
   else
   {
      ldoorposition[door] = 0;
      rdoorposition[door] = position;
   }
#endif


        doorobjlist[door].action = dr_closed;
...
...
            if (player->areanumber < NUMAREAS)
                ConnectAreas ();
        }
    }

#ifndef BLAKEDOORS
    doorposition[door] = (word) position;
#else
//   doorposition[door] = position;
      ldoorposition[door] = 0;
      rdoorposition[door] = position;
#endif

}

DEF.H
::: CODE :::
{
    byte     tilex,tiley;
    boolean  vertical;
    byte     lock;
    doortype action;
    short    ticcount;
#ifdef BLAKEDOORS
   boolean doubledoor;
#endif

} doorobj_t;

WL_ACT1 DEFINITIONS
::: CODE :::
extern  short     doornum;

#ifdef BLAKEDOORS
extern   word   ldoorposition[MAXDOORS],rdoorposition[MAXDOORS];
#else
extern  word      doorposition[MAXDOORS];
#endif


extern  byte      areaconnect[NUMAREAS][NUMAREAS];

WL_DRAW
::: CODE :::
#ifdef BLAKEDOORS
boolean   leftside;

void SetLeftDoorSide (void)
{
   leftside=true;
}
void SetRightDoorSide (void)
{
   leftside=false;
}
#endif


/*
====================
=
= HitHorizDoor
=
====================
*/

void HitHorizDoor (void)
{
    int doorpage;
    int doornum;
    int texture;

    doornum = tilehit&0x7f;
#ifdef BLAKEDOORS
   if (doorobjlist[doornum].doubledoor)
   {
      if (leftside)//left
         texture = ( (xintercept+0x7fff-ldoorposition[doornum]) >> TEXTUREFROMFIXEDSHIFT) &TEXTUREMASK;
      else
         texture = ( (xintercept+0x8000+ldoorposition[doornum]) >> TEXTUREFROMFIXEDSHIFT) &TEXTUREMASK;
   }
   else
      texture = ( (xintercept-rdoorposition[doornum]) >> TEXTUREFROMFIXEDSHIFT) &TEXTUREMASK;
#else
    texture = ((xintercept-doorposition[doornum])>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
#endif


    if(lasttilehit==tilehit)
    {

HitVertDoor
::: CODE :::
    doornum = tilehit&0x7f;
#ifdef BLAKEDOORS
   if (doorobjlist[doornum].doubledoor)
   {
      if (leftside)//left
         texture = ( (yintercept+0x7fff-ldoorposition[doornum]) >> TEXTUREFROMFIXEDSHIFT) &TEXTUREMASK;
      else
         texture = ( (yintercept+0x8000+ldoorposition[doornum]) >> TEXTUREFROMFIXEDSHIFT) &TEXTUREMASK;
   }
   else
      texture = ( (yintercept-rdoorposition[doornum]) >> TEXTUREFROMFIXEDSHIFT) &TEXTUREMASK;
#else
    texture = ((yintercept-doorposition[doornum])>>TEXTUREFROMFIXEDSHIFT)&TEXTUREMASK;
#endif


    if(lasttilehit==tilehit)

AsmRefresh
::: CODE :::
                if(tilehit&0x80)
                {
                    int32_t yintbuf=yintercept+(ystep>>1);
                    if((yintbuf>>16)!=(yintercept>>16))
                        goto passvert;
#ifdef BLAKEDOORS
                    SetLeftDoorSide();
                    if((word)yintbuf<ldoorposition[tilehit&0x7f])
                        goto drawvdoor;
                    SetRightDoorSide();
                    if((word)yintbuf<rdoorposition[tilehit&0x7f])
                        goto passvert;
#else
                    if((word)yintbuf<doorposition[tilehit&0x7f])
                        goto passvert;
#endif

#ifdef BLAKEDOORS
drawvdoor:
#endif

                    yintercept=yintbuf;
                    xintercept=(xtile<<TILESHIFT)|0x8000;
                    HitVertDoor();
...
...
                if(tilehit&0x80)
                {
                    int32_t xintbuf=xintercept+(xstep>>1);
                    if((xintbuf>>16)!=(xintercept>>16))
                        goto passhoriz;
#ifdef BLAKEDOORS
                    SetLeftDoorSide();
                    if((word)xintbuf<ldoorposition[tilehit&0x7f])
                        goto drawhdoor;

                    SetRightDoorSide();
                    if((word)xintbuf<rdoorposition[tilehit&0x7f])
                        goto passhoriz;
#else
                    if((word)xintbuf<doorposition[tilehit&0x7f])
                        goto passhoriz;
#endif

#ifdef BLAKEDOORS
drawhdoor:
#endif

                    xintercept=xintbuf;
                    yintercept=(ytile<<TILESHIFT)+0x8000;
                    HitHorizDoor();

WL_MAIN - SaveTheGame
::: CODE :::
            sizeof(statobjlist) +
#ifdef BLAKEDOORS
      sizeof(ldoorposition) +
      sizeof(rdoorposition) +
#else
            sizeof(doorposition) +
#endif

            sizeof(pwallstate) +
...
...
    }

    DiskFlopAnim(x,y);
#ifdef BLAKEDOORS
    fwrite (ldoorposition,sizeof(ldoorposition),1,file);
    checksum = DoChecksum((byte *)ldoorposition,sizeof(ldoorposition),checksum);
    DiskFlopAnim(x,y);
    fwrite (rdoorposition,sizeof(rdoorposition),1,file);
    checksum = DoChecksum((byte *)rdoorposition,sizeof(rdoorposition),checksum);
#else
    fwrite (doorposition,sizeof(doorposition),1,file);
    checksum = DoChecksum((byte *)doorposition,sizeof(doorposition),checksum);
#endif

    DiskFlopAnim(x,y);
    fwrite (doorobjlist,sizeof(doorobjlist),1,file);
    checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum);

LoadTheGame
::: CODE :::
        memcpy(statobjlist+i,&nullstat,sizeof(nullstat));
    }

#ifdef BLAKEDOORS
    DiskFlopAnim(x,y);
    fread (ldoorposition,sizeof(ldoorposition),1,file);
    checksum = DoChecksum((byte *)ldoorposition,sizeof(ldoorposition),checksum);
    DiskFlopAnim(x,y);
    fread (rdoorposition,sizeof(rdoorposition),1,file);
    checksum = DoChecksum((byte *)rdoorposition,sizeof(rdoorposition),checksum);
#else
    DiskFlopAnim(x,y);
    fread (doorposition,sizeof(doorposition),1,file);
    checksum = DoChecksum((byte *)doorposition,sizeof(doorposition),checksum);
#endif

    DiskFlopAnim(x,y);
    fread (doorobjlist,sizeof(doorobjlist),1,file);
    checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum);

_________________
Haasboy Engine - Currently under construction (To be used with future mods - F.A.D.E.D. - Mansion X - Rising Evil Series)
Ripper
Code Master - Developer
Code Master - Developer


Joined: 15 Mar 2003
Last Visit: 30 Sep 2008

Topics: 21
Posts: 527
Location: Germany
blank.gif

PostPosted: Mon Jul 14, 2008 2:52 pm
   Subject: Re: [WOLF4SDL Help] Blake Stone Style doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hm, this was never answered, so what's the status?
I guess nobody had a look at this, because you didn't provide either a diff file to be applied to the release version or directly an archive with the changed source code, so others could try it out quickly. At least this is why I never had a look at it.
If you still have the problem and provide the source code, I would be willing to help.

_________________
Life is an awful game, but the graphics resolution rocks ;D
Haasboy
DieHard Officer
DieHard Officer


Joined: 23 Jul 2003
Last Visit: 04 Nov 2017

Topics: 58
Posts: 581
Location: South Africa, Johannesburg
southafrica.gif

PostPosted: Mon Jul 14, 2008 3:01 pm
   Subject: Re: [WOLF4SDL Help] Blake Stone Style doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, I still never got it to work, and I used vers 1.4.

I'll have to dig for the source code on one of my cds, I'll send it to you this weekend once I've found it.......

_________________
Haasboy Engine - Currently under construction (To be used with future mods - F.A.D.E.D. - Mansion X - Rising Evil Series)
Haasboy
DieHard Officer
DieHard Officer


Joined: 23 Jul 2003
Last Visit: 04 Nov 2017

Topics: 58
Posts: 581
Location: South Africa, Johannesburg
southafrica.gif

PostPosted: Sun Jul 20, 2008 7:56 am
   Subject: Re: [WOLF4SDL Help] Blake Stone Style doors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

This code is finally working thanks to Ripper, and I'll post a tutorial on my site for it soon...

_________________
Haasboy Engine - Currently under construction (To be used with future mods - F.A.D.E.D. - Mansion X - Rising Evil Series)
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL 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 Announcement: Wolf4SDL released
Author: Ripper
522 149223 Mon May 22, 2017 2:04 pm
Tricob View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 7129 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 2352 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 2281 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [help] Wolf4sdl's implemented tutorials
Author: Mortimer
6 2437 Tue May 06, 2008 1:15 pm
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