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] Extending the player's reach
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
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 589
Location: New Jersey, USA
usa.gif

PostPosted: Wed Sep 19, 2012 3:59 pm
   Subject: [tutorial] Extending the player's reach
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Bottom of Posts

Here's a trick I used to duplicate a weird phenomenon in Mac Wolfenstein's' Third Encounter, and to overcome a mapping bug in one of John Bucksnort's mods. In both cases, I needed to reach an object behind a blocking sprite.

(Add the code in blue)

In WL_DEF.H under the global constants add a unique optional object number (you can also use a floor code):
::: CODE :::
#define STARTAMMO       8
#define REACHFURTHER    101   

In WL_DEF.H under the WL_AGENT definitions:
::: CODE :::
extern  objtype  *LastAttacker;
extern  boolean  longreach;         

In WL_AGENT.CPP at the top:
::: CODE :::
boolean         longreach;         
objtype        *LastAttacker;

Further down in WL_AGENT.CPP in Thrust:
::: CODE :::
   offset = (player->tiley<<mapshift)+player->tilex;
    player->areanumber = *(mapsegs[0] + offset) -AREATILE;

    if (*(mapsegs[1] + offset) == REACHFURTHER) // [1]=obj plane, [0]=map plane (floor code instead of REACHFURTHER)   
        longreach = true;
    else
        longreach = false;   

    if (*(mapsegs[1] + offset) == EXITTILE)
        VictoryTile ();

In WL_DRAW.CPP's TransformTile:
::: CODE :::
//
// see if it should be grabbed
//
    if (nx<TILEGLOBAL && ny>-TILEGLOBAL/2 && ny<TILEGLOBAL/2)
        return true;
    else if ((nx<TILEGLOBAL*3/2 && ny>-TILEGLOBAL/2 && ny<TILEGLOBAL/2) && longreach)  // 3/2=1.5 x normal
        return true;

    else
        return false;
}

In WL_GAME.CPP at the end of Died:
::: CODE :::
             gamestate.ammo = STARTAMMO;
            }           
            longreach = false;             
             
            gamestate.keys = 0;

In WL_MAIN.CPP in NewGame:
::: CODE :::
    startgame = true;
    longreach = false;   


This should work in both DOS and SDL versions of the code. I used a conservative 3/2 as the extra reach length; using a huge number makes for a weird effect: you open a door and in one moment pick up all the treasures in that room with a great big sound (in the SDL version, anyway).

Enjoy,
Andy
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 9234 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Black & White Effect - Tutorial
Author: Guest
10 297 Thu Mar 17, 2005 6:24 pm
Dugtrio17 View latest post
No new posts [Code] Run with Stamina - TekZK
Author: BrotherTank
8 3109 Sun May 16, 2004 12:54 am
Codetech84 View latest post
This topic is locked: you cannot edit posts or make replies. [Info] Source code for Darkone's NewWolf Classic
Author: Raistlin
1 1718 Tue Feb 10, 2004 10:18 am
BrotherTank View latest post
No new posts [Info] Slideshows Between Levels? - SoD side of Code
Author: Hair Machine
2 1450 Fri Dec 26, 2003 11:02 am
jamez 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