Wolf3d Haven Forum

Please log in or register!
Today's Announcement:
Theres only 16 or less levels that you can contribute to! No need to sign up, just show up with a level! Again, up to 699 stactic objects are allowed. Don't be the only one who did not contribute!

Wolf3d Haven Forum

A Friendly Wolfenstein 3D Community, About Wolfenstein 3D, the game that gave birth to First Person Shooters...

  • Post new topic
  • Reply to topic

FF2 coding talk

Share

lilmanjs
Extreme Poster
Extreme Poster

Male
Number of posts: 1013
Age: 20
Location: kansas, U.S.A
Hobbie: playing wolf3d addons like crazy
Message: what would we do without wolf3d?
Registration date: 2007-04-17

FF2 coding talk

Post by lilmanjs

this is the topic for the FF2 coding talk. if you guys have ideas for the mod please say them in here and we can see if it fits with the theme of the mod.
later,
James


_________________


Mods being worked on:
The Mutant Uprising, Final Fight 2
Mod ideas:
Stargate SG-1 addon, Mega Man addon
Team Aardwolf Mods:
The Mutant Uprising, Ghost
Mods being worked on with other people:
Return to Castle Hollehammer with Raziel A. (Karharis)
Award winning mods:
The Final Fight
Share this post on: Excite BookmarksDiggRedditDel.icio.usGoogleLiveSlashdotNetscapeTechnoratiStumbleUponNewsvineFurlYahooSmarking

Post on Sat Sep 06, 2008 10:21 am by Codetech84

What is the current status of the code, have you changed it since my last updates?

Post on Sat Sep 06, 2008 12:19 pm by lilmanjs

all I've done since your last updates is change the menu colors to that yellow. other than that all I did was add in your coding updates and wait for more. also I'd love to know how to get textured menus in SDL.

Post on Sat Sep 06, 2008 12:23 pm by Codetech84

Just send me the files you modified, I've allready added the split doorways code.

Post on Sat Sep 06, 2008 12:28 pm by lilmanjs

you don't need them, I can just do it again. and plus its just one file and I'd rather have a textured menu, rather than yellow.

Post on Sat Sep 06, 2008 2:01 pm by Codetech84

All right.

Post on Sun Jan 11, 2009 1:43 am by Codetech84

Here's the modified version of "wl_floorceiling.cpp" with split doorways installed. Smile

Code:
#include "version.h"

#ifdef USE_FLOORCEILINGTEX

#include "wl_def.h"
#include "wl_shade.h"


//
// Codetech84's split doorways
//
unsigned GetSplitTexture (int u, int v, int x, int y, boolean vert)
{
  unsigned ret;

  if (vert)
  {
      if (u < 32)
        ret = MAPSPOT(x-1,y,2);
      else
        ret = MAPSPOT(x+1,y,2);
  }
  else
  {
      if (v < 32)
        ret = MAPSPOT(x,y+1,2);
      else
        ret = MAPSPOT(x,y-1,2);
  }
  return ret;
}



// Textured Floor and Ceiling by DarkOne
// With multi-textured floors and ceilings stored in lower and upper bytes of
// according tile in third mapplane, respectively.
void DrawFloorAndCeiling(byte *vbuf, unsigned vbufPitch, int min_wallheight)
{
    fixed dist;                                // distance to row projection
    fixed tex_step;                            // global step per one screen pixel
    fixed gu, gv, du, dv;                      // global texture coordinates
    int u, v;                                  // local texture coordinates
    byte *toptex, *bottex;
    unsigned curtex=0, door;
    byte  tile;
    unsigned lasttoptex = 0xffffffff, lastbottex = 0xffffffff;
    boolean uv;

    int halfheight = viewheight >> 1;
    int y0 = min_wallheight >> 3;              // starting y value
    if(y0 > halfheight)
        return;                                // view obscured by walls
    if(!y0) y0 = 1;                            // don't let division by zero
    unsigned bot_offset0 = vbufPitch * (halfheight + y0);
    unsigned top_offset0 = vbufPitch * (halfheight - y0 - 1);

    // draw horizontal lines
    for(int y = y0, bot_offset = bot_offset0, top_offset = top_offset0;
        y < halfheight; y++, bot_offset += vbufPitch, top_offset -= vbufPitch)
    {
        dist = (heightnumerator / y) << 5;
        gu =  viewx + FixedMul(dist, viewcos);
        gv = -viewy + FixedMul(dist, viewsin);
        tex_step = (dist << 8) / viewwidth / 175;
        du =  FixedMul(tex_step, viewsin);
        dv = -FixedMul(tex_step, viewcos);
        gu -= (viewwidth >> 1) * du;
        gv -= (viewwidth >> 1) * dv; // starting point (leftmost)
#ifdef USE_SHADING
        byte *curshades = shadetable[GetShade(y << 3)];
#endif
        for(int x = 0, bot_add = bot_offset, top_add = top_offset;
            x < viewwidth; x++, bot_add++, top_add++)
        {
            uv = false;
            if(wallheight[x] >> 3 <= y)
            {
                int curx = (gu >> TILESHIFT) & (MAPSIZE - 1);
                int cury = (-(gv >> TILESHIFT) - 1) & (MAPSIZE - 1);
                             
                tile = tilemap[curx][cury];
                if (tile & 0x80)
                {
                  u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
                  v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
                  uv = true;
                 
                  curtex = GetSplitTexture(u,v, curx,cury, doorobjlist[tile & 0x7f].vertical);
                }
                else
                  curtex = MAPSPOT(curx, cury, 2);
                 
                if(curtex)
                {                                         
                    unsigned curtoptex = curtex >> 8;
                    if (curtoptex != lasttoptex)
                    {
                        lasttoptex = curtoptex;
                        toptex = PM_GetTexture(curtoptex);
                    }
                    unsigned curbottex = curtex & 0xff;
                    if (curbottex != lastbottex)
                    {
                        lastbottex = curbottex;
                        bottex = PM_GetTexture(curbottex);
                    }

                    if (!uv)
                    {
                      u = (gu >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
                      v = (gv >> (TILESHIFT - TEXTURESHIFT)) & (TEXTURESIZE - 1);
                      uv = true;
                    }
                    unsigned texoffs = (u << TEXTURESHIFT) + (TEXTURESIZE - 1) - v;
#ifdef USE_SHADING
                    if(curtoptex)
                        vbuf[top_add] = curshades[toptex[texoffs]];
                    if(curbottex)
                        vbuf[bot_add] = curshades[bottex[texoffs]];
#else
                    if(curtoptex)
                        vbuf[top_add] = toptex[texoffs];
                    if(curbottex)
                        vbuf[bot_add] = bottex[texoffs];
#endif
                }
            }
            gu += du;
            gv += dv;
        }
    }
}

#endif

Post on Sun Jan 11, 2009 3:01 am by Codetech84

Here's the code for "not getting all weapons with chaingun". Smile

Before trying any of the following, back-up your code. It should be all done and tested, but something might go wrong when it's installed.


Add this to the gamestate structure in "wl_def.h":
Code:
weapontype  gotweapon;


Replace your CheckWeaponChange in "wl_agent.cpp" with this:
Code:
/*
======================
=
= CheckWeaponChange
=
= Keys 1-5 change weapons
=
======================
*/

void CheckWeaponChange (void)
{
    int i,newWeapon = -1;
    int start;   

#ifdef _arch_dreamcast
    int joyx, joyy;
    IN_GetJoyFineDelta (&joyx, &joyy);
    if(joyx < -64)
        buttonstate[bt_prevweapon] = true;
    else if(joyx > 64)
        buttonstate[bt_nextweapon] = true;
#endif

    if(buttonstate[bt_nextweapon] && !buttonheld[bt_nextweapon])
    {
        newWeapon = 0;
        buttonheld[bt_nextweapon] = true;
       
        if (gamestate.weapon == gamestate.bestweapon)
          start = 0; // jump to first weapon
        else
          start = gamestate.weapon+1; // jump to next weapon

        for (i=start; i<=gamestate.bestweapon; i++)
        {
          if (gamestate.gotweapon & (1<<i))
          {
              newWeapon = i;
              break;
          }
        }
    }
    else if(buttonstate[bt_prevweapon] && !buttonheld[bt_prevweapon])
    {
        newWeapon = 0;
        buttonheld[bt_prevweapon] = true;
       
        if (gamestate.weapon == 0)
          start = gamestate.bestweapon; // Jump to bestweapon
        else
          start = gamestate.weapon-1; // Jump to previous weapon

        for (i=start; i>=0; i--)
        {
          if (gamestate.gotweapon & (1<<i))
          {
              newWeapon = i;
              break;
          }
        }
    }
    else
    {
        for(int i = wp_knife; i <= gamestate.bestweapon; i++)
        {
            if ((gamestate.gotweapon & (1<<i)) && buttonstate[bt_readyknife + i - wp_knife])
            {
                newWeapon = i;
                break;
            }
        }
    }

    if(newWeapon != -1)
    {
        gamestate.weapon = gamestate.chosenweapon = (weapontype) newWeapon;
        DrawWeapon();
    }
}


Still in "wl_agent.cpp", modify your GiveWeapon routine to this:
Code:
void GiveWeapon (int weapon)
{
    GiveAmmo (6);

    if (gamestate.bestweapon<weapon)
        gamestate.bestweapon = gamestate.weapon = gamestate.chosenweapon = (weapontype) weapon;
       
    gamestate.gotweapon = (weapontype) (gamestate.gotweapon | (1<<weapon)); // Make the new weapon available for player

    DrawWeapon ();
}


In "wl_state.cpp", modify the "KillActor" routine for SS to this:
Code:
        case ssobj:
            GivePoints (500);
            NewState (ob,&s_ssdie1);
            if (!(gamestate.gotweapon & (1<<wp_machinegun)))
                PlaceItemType (bo_machinegun,tilex,tiley);
            else
                PlaceItemType (bo_clip2,tilex,tiley);
            break;


In "wl_game.cpp", make the following modifications to your Died routine.
Code:
if (gamestate.lives > -1)
    {
        gamestate.health = 110;
        gamestate.weapon = gamestate.bestweapon
            = gamestate.chosenweapon = wp_pistol;
           
        gamestate.gotweapon = (weapontype)0;                                      // Take away all weapons
        gamestate.gotweapon = (weapontype) (gamestate.gotweapon | (1<<wp_knife));  // Give knife
        gamestate.gotweapon = (weapontype) (gamestate.gotweapon | (1<<wp_pistol)); // and pistol for free...
           
        gamestate.ammo = STARTAMMO;


And in "wl_main.cpp" the following modifications to NewGame routine.
Code:
void NewGame (int difficulty,int episode)
{
    memset (&gamestate,0,sizeof(gamestate));
    gamestate.difficulty = difficulty;
    gamestate.weapon = gamestate.bestweapon
            = gamestate.chosenweapon = wp_pistol;
   
    gamestate.gotweapon = (weapontype)0;                                      // Take away all weapons
    gamestate.gotweapon = (weapontype) (gamestate.gotweapon | (1<<wp_knife));  // Give knife
    gamestate.gotweapon = (weapontype) (gamestate.gotweapon | (1<<wp_pistol)); // and pistol for free...
           
    gamestate.health = 110;
    gamestate.ammo = STARTAMMO;
    gamestate.lives = 3;
    gamestate.nextextra = EXTRAPOINTS;
    gamestate.episode=episode;

    startgame = true;
}


And if you want, you can give the player the machinegun when they hit "MLI", it's in "wl_play.cpp".
Code:
    //
    // SECRET CHEAT CODE: 'MLI'
    //
    if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I])
    {
        gamestate.health = 110;
        gamestate.ammo = 200;
        gamestate.keys = 3;
        gamestate.score = 0;
        gamestate.TimeCount += 42000L;
        GiveWeapon (wp_machinegun);  // Give the machinegun
        GiveWeapon (wp_chaingun);


Last edited by Codetech84 on Sat Feb 07, 2009 12:54 am; edited 1 time in total

Post on Sun Jan 25, 2009 3:28 pm by lilmanjs

that's really great. I don't think that has been done in SDL yet, has it?

Post on Sat Feb 07, 2009 12:59 am by Codetech84

I can't take full credit because part of it came from the "bestweapon" tutorial, but I did my own version of the code and added support for next/previous weapon buttons.

By the way I modified it a bit (Thanks to Metalor from DHW for reporting this):

Change the following in "wl_main.cpp" and "wl_game.cpp":

gamestate.gotweapon = 0;

to

gamestate.gotweapon = (weapontype)0;

Post on Wed Feb 11, 2009 5:38 pm by Dark_wizzie

Just out of curiosity, on a scale of 0 to 100% done, how much is done in making FF2?

Post on Thu Feb 12, 2009 12:52 pm by lilmanjs

Dark_wizzie wrote:Just out of curiosity, on a scale of 0 to 100% done, how much is done in making FF2?

I'd say about 90% but then again I'm not the one finishing up the coding.

Post on Tue May 12, 2009 8:02 am by Codetech84

Here's the code for removing the border overlaying the statusbar. Please make sure you made a backup of your wl_game.cpp before applying this tutorial.

Open up wl_game.cpp, change your DrawPlayBorder to this:

Code:
void DrawPlayBorder (void)
{
    const int px = scaleFactor; // size of one "pixel"

    if (bordercol != VIEWCOLOR)
        DrawStatusBorder(bordercol);

    if(viewheight == screenHeight) return;

    VWB_BarScaledCoord (0,0,screenWidth,screenHeight-px*STATUSLINES,bordercol);

    const int xl = screenWidth/2-viewwidth/2;
    const int yl = (screenHeight-px*STATUSLINES-viewheight)/2;
    VWB_BarScaledCoord (xl,yl,viewwidth,viewheight,0);

    if(xl != 0)
    {
        // Paint game view border lines
        VWB_BarScaledCoord(xl-px, yl-px, viewwidth+px, px, 0);                      // upper border
        VWB_BarScaledCoord(xl, yl+viewheight, viewwidth+px, px, bordercol-2);      // lower border
        VWB_BarScaledCoord(xl-px, yl-px, px, viewheight+px, 0);                    // left border
        VWB_BarScaledCoord(xl+viewwidth, yl-px, px, viewheight+2*px, bordercol-2);  // right border
        VWB_BarScaledCoord(xl-px, yl+viewheight, px, px, bordercol-3);              // lower left highlight
    }
    else
    {
        // Just paint a lower border line
        VWB_BarScaledCoord(0, yl+viewheight, viewwidth, px, bordercol-2);      // lower border
    }
}


Still in wl_game.cpp, make the following changes to ShowActStatus:

Code:
void ShowActStatus()
{
    // Draw status bar without borders
    byte *source = grsegs[STATUSBARPIC];
    int    picnum = STATUSBARPIC - STARTPICS;
    int width = pictable[picnum].width;
    int height = pictable[picnum].height;
    int destx = (screenWidth-scaleFactor*320)/2 * scaleFactor;
    int desty = screenHeight - height * scaleFactor;
    VL_MemToScreenScaledCoord(source, width, height, 0, 0, destx, desty, width, height);

    ingame = false;
    DrawFace ();
    DrawHealth ();
    DrawLives ();
    DrawLevel ();
    DrawAmmo ();
    DrawKeys ();
    DrawWeapon ();
    DrawScore ();
    ingame = true;
}
  • Post new topic
  • Reply to topic

Current date/time is Tue Nov 24, 2009 10:32 pm