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       

[tutorial] Interactive Objects with treasure!
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
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:32 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Tue Dec 22, 2009 7:05 pm
   Subject: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

You may have read how to do Interactive Objects, but not yet how to do Interactive Objects With Treasure. Well, here's how. The original Interactive Objects code was written by BT, and simply functioned as a treasure chest with random contents.

First, you'll need two sprites in your VSWAP to use for this feature. In this example, TABL_EMPTY has the empty table. TABL_TREAS1 has the table with the treasure.

Now, in WL_DEF.H, search for "block,". Right below that highlighted line, insert this line:
::: CODE :::
    tabletreas,

Now, in WL_ACT1.CPP, you can define this new object type by using code like this:
::: CODE :::
{TABL_TREAS1,tabletreas},                // Table w/cross

Do a search for "block:". You should be brought to this:
::: CODE :::
        case block:
            actorat[tilex][tiley] = (objtype *) 64;          // consider it a blocking tile

Right below that, insert this:
::: CODE :::
        case    tabletreas:
            actorat[tilex][tiley] = (objtype *) 64;          // consider it a blocking tile
            if (!loadedgame) gamestate.treasuretotal++;
            break;

It took me a *long* time to figure out how this was done! Smile
Now, enable it WL_GAME.CPP like you would any other Static Object.

Finally, in WL_AGENT.CPP, search for "pushable wall". You should be brought to something like this:
::: CODE :::
       ) // pushable wall
    {
        PushWall (checkx,checky,dir);
        return;
    }
Right below that, add this:
::: CODE :::
// Interactive Objects code, from BT's usable objects source
    for (statptr = &statobjlist[0] ; statptr !=laststatobj ; statptr++)
    {
            if(statptr->tilex == checkx && statptr->tiley == checky && !buttonheld[bt_use])
            {
                buttonheld[bt_use] = true;
                switch (statptr->shapenum)
                        {  case TABL_TREAS1:
                        SD_PlaySound (BONUS1SND);
                        GivePoints (100);
                        gamestate.treasurecount++;
                        statptr->shapenum = TABL_EMPTY;
                        StartBonusFlash ();
                        break; }


That's it, if I'm not mistaken. Hope the tutorial proves useful to someone. Smile

Edits: Removed Bunker-SDL specific code, so it should run in the virgin Wolf4SDL source.


Last edited by Tricob on Wed Apr 18, 2012 6:46 pm; edited 1 time in total
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 21:14 ago.

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Tue Dec 22, 2009 11:39 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

looks Good for Project: X 2

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:32 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Dec 23, 2009 7:43 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ha! I knew it would benefit someone. Very Happy
Fragstein3D
DieHard Guard
DieHard Guard


Joined: 06 Dec 2009
Last Visit: 17 Mar 2010

Topics: 13
Posts: 200


PostPosted: Fri Dec 25, 2009 7:42 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Taking treasure from tables? i'm a bit too tired to read the coding at this time.
but i might use it.

also could you drop by my coding topic, i threw out some wild idea's about modding the source code.
and i would like some opinions from experienced wolfers who have done C++++
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 21:14 ago.

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Sun Jan 31, 2010 7:18 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ok I got a question.....I was changing around this code to work like a gate as you can see here

::: CODE :::
 // Interactive Objects code, from BT's usable objects source
    for (statptr = &statobjlist[0] ; statptr !=laststatobj ; statptr++)
    {
            if(statptr->tilex == checkx && statptr->tiley == checky && !buttonheld[bt_use])
            {
                buttonheld[bt_use] = true;
                switch (statptr->shapenum)
                        { 
                                case SPR_GATECLOSED:
                        statptr->shapenum = SPR_GATEOPEN;
                        break;
                         }
                        }
                    }


but when I open the gate (per sey) Its still blocked and i cant get though

SPR_GATECLOSED is blocked but

SPR_GATEOPEN is not...but the game still thinks its blocked

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
WLHack
DieHard Wolfer
DieHard Wolfer


Joined: 10 Jul 2005
Last Visit: 18 Jan 2018

Topics: 66
Posts: 1241
Location: Loppi - Finland
finland.gif

PostPosted: Sun Jan 31, 2010 9:10 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

You have to tell the engine that the object is now non-blocking:
::: CODE :::
 
case SPR_GATECLOSED:
statptr->shapenum = SPR_GATEOPEN;
actorat[statptr->tilex][statptr->tiley] = (objtype *) 0;
break;

_________________
False Spear download
False Spear SDL download
Wolfenstein-blog
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:32 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Feb 01, 2010 6:10 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

WLHack - Couldn't you replace ...

::: CODE :::
(objtype *) 0;

... with ...
::: CODE :::
NULL;
? Smile
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 21:14 ago.

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Mon Sep 16, 2013 4:04 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sorry for bumpping this but I have reported a bug soo I have a fix

This part of the Tut

Do a search for "block:". You should be brought to this:
::: CODE :::
        case block:
            actorat[tilex][tiley] = (objtype *) 64;          // consider it a blocking tile

Right below that, insert this:
::: CODE :::
        case    tabletreas:
            actorat[tilex][tiley] = (objtype *) 64;          // consider it a blocking tile
            if (!loadedgame) gamestate.treasuretotal++;
            break;


If i did that.....then the case Block will count as part of a treasuretotal...


Here is the fix change this

::: CODE :::
        case block:
            actorat[tilex][tiley] = (objtype *) 64;          // consider it a blocking tile


To this

::: CODE :::
        case block:
            actorat[tilex][tiley] = (objtype *) 64;          // consider it a blocking tile
            break;

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:32 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Tue Sep 17, 2013 6:34 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Uh, Richter ... it's *supposed* to count as a treasure total. Check the code in WL_AGENT.CPP; "treasuretotal" is referenced once again. Thanks for the input, though. Smile
RichterBelmont12
DieHard Wolfer
DieHard Wolfer


Joined: 14 Aug 2004
Last Visit: 21:14 ago.

Topics: 97
Posts: 1508
Location: New Jersey
usa.gif

PostPosted: Tue Sep 17, 2013 6:47 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
Uh, Richter ... it's *supposed* to count as a treasure total. Check the code in WL_AGENT.CPP; "treasuretotal" is referenced once again. Thanks for the input, though. Smile


ummmm Not really tho if you add it under the Case Block without a Break; the Case Block Will count as a Treasure and impossable to get it :\

_________________
http://www.youtube.com/RichterBelmont12

https://www.facebook.com/RichterBelmont123

https://twitter.com/Richterbelmont6
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:32 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Wed Sep 18, 2013 2:17 pm
   Subject: Re: [tutorial] Interactive Objects with treasure!
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Ah, I see what you're saying. My apologies; I misunderstood your post (I seem to be doing that a lot lately). Yeah, the code will just have to be inserted elsewhere, *and* there'll have to be more code overall. I guess that's another bugfix I'm going to have to post in the future. Razz

Again, thanks for the bugfix. Thumbs Up
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 195621 Mon May 22, 2017 2:04 pm
Tricob View latest post
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 9988 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2836 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 3047 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3026 Sat May 17, 2008 11:26 am
Mortimer 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