FF2 coding talk

lilmanjs- Extreme Poster


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
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
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
so I'm having trouble getting the helpart and the endart. in the version.h file every other version of wolf3d has a way to compile with or without the readthis! section. how do I get the readthis! section and the endart to show up in my SDL port of Final Fight 1.
I got your pm, I'll see what I can do. I'm doing this for the Wolfenstein Reloaded SDL port too, so I'm working on it.
Once it's done, do you want me to plug it in your source code, or shall I try to explain the steps here?
Edit: Readme works now...
Once it's done, do you want me to plug it in your source code, or shall I try to explain the steps here?
Edit: Readme works now...
just give me the the files I need for the readthis to be enabled in the Gt version.
Ok. I will use original Wolf4SDL source files for it then.
and please post what you have to do, since I bet a lot of people don't have the appogee version.
I will, sorry that this is taking so long. By the way, you need to add a few vga pics to the vgagraph too.
ok. how would I go about doing that?
My school will start again tuesday, I should have some free time to finish this monday. I've been working the whole summer so I really haven't felt like doing much else. I'll be away for the weekend, but I'll tackle this challenge right after.
so I've gotten the textured ceilings/floors to work in SDL, but how do I add in the extra wall slots for the floors and ceilings.
You don't have to use all of the wall textures you know.. I dont use all anyway... You can choose some spare walls and make them as your ceiling/floor textures.. or just wait for BrotherTank to convert the 64+ walls tutorial.
What is the current status of the code, have you changed it since my last updates?
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.
Just send me the files you modified, I've allready added the split doorways code.
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.
All right.
Here's the modified version of "wl_floorceiling.cpp" with split doorways installed.
- 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
Here's the code for "not getting all weapons with chaingun". 
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":
Replace your CheckWeaponChange in "wl_agent.cpp" with this:
Still in "wl_agent.cpp", modify your GiveWeapon routine to this:
In "wl_state.cpp", modify the "KillActor" routine for SS to this:
In "wl_game.cpp", make the following modifications to your Died routine.
And in "wl_main.cpp" the following modifications to NewGame routine.
And if you want, you can give the player the machinegun when they hit "MLI", it's in "wl_play.cpp".
Last edited by Codetech84 on Sat Feb 07, 2009 12:54 am; edited 1 time in total
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
that's really great. I don't think that has been done in SDL yet, has it?
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;
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;
Just out of curiosity, on a scale of 0 to 100% done, how much is done in making FF2?
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.
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:
Still in wl_game.cpp, make the following changes to ShowActStatus:
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;
}





