mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-08 10:50:42 +00:00
A start on followers
This commit is contained in:
parent
a294d103a5
commit
d627b6564f
5 changed files with 104 additions and 1 deletions
|
@ -442,6 +442,9 @@ typedef struct player_s
|
|||
// SRB2kart
|
||||
UINT8 kartspeed; // Kart speed stat between 1 and 9
|
||||
UINT8 kartweight; // Kart weight stat between 1 and 9
|
||||
|
||||
mobj_t *follower; // Kart: This is the follower object we have. (If any)
|
||||
|
||||
//
|
||||
|
||||
fixed_t normalspeed; // Normal ground
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "r_things.h" // for followers
|
||||
|
||||
#include "m_cond.h"
|
||||
|
||||
|
@ -684,6 +685,71 @@ static void readfreeslots(MYFILE *f)
|
|||
Z_Free(s);
|
||||
}
|
||||
|
||||
// This here is our current only way to make followers.
|
||||
INT32 numfollowers = 0;
|
||||
|
||||
static void readfollower(MYFILE *f)
|
||||
{
|
||||
|
||||
if (numfollowers > MAXSKINS)
|
||||
{
|
||||
CONS_Printf("Error: Too many followers, cannot add anymore.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word, *word2;
|
||||
char *tmp;
|
||||
|
||||
CONS_Printf("Adding follower, please bear with me...\n");
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
{
|
||||
if (s[0] == '\n')
|
||||
break;
|
||||
|
||||
tmp = strchr(s, '#');
|
||||
if (tmp)
|
||||
*tmp = '\0';
|
||||
if (s == tmp)
|
||||
continue; // Skip comment lines, but don't break.
|
||||
|
||||
word = strtok(s, " ");
|
||||
if (word)
|
||||
strupr(word);
|
||||
else
|
||||
break;
|
||||
|
||||
word2 = strtok(NULL, " = ");
|
||||
if (word2)
|
||||
strupr(word2);
|
||||
else
|
||||
break;
|
||||
if (word2[strlen(word2)-1] == '\n')
|
||||
word2[strlen(word2)-1] = '\0';
|
||||
|
||||
if (fastcmp(word, "ATANGLE"))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", followers[numfollowers].atangle), UNDO_NONE);
|
||||
followers[numfollowers].atangle = (INT32)atoi(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ZOFFSET") || (fastcmp(word, "ZOFFS")))
|
||||
{
|
||||
DEH_WriteUndoline(word, va("%d", followers[numfollowers].zoffs), UNDO_NONE);
|
||||
followers[numfollowers].zoffs = (INT32)atoi(word2);
|
||||
}
|
||||
else
|
||||
deh_warning("Follower %d: unknown word '%s'", numfollowers, word);
|
||||
}
|
||||
} while (!myfeof(f)); // finish when the line is empty
|
||||
|
||||
CONS_Printf("We are done adding the follower.\n");
|
||||
numfollowers++;
|
||||
Z_Free(s);
|
||||
}
|
||||
|
||||
static void readthing(MYFILE *f, INT32 num)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
|
@ -3469,6 +3535,11 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
|||
readpatch(f, word2, wad);
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "FOLLOWER"))
|
||||
{
|
||||
readfollower(f); // at the same time this will be our only way to ADD followers for now. Yikes.
|
||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
||||
}
|
||||
else if (fastcmp(word, "THING") || fastcmp(word, "MOBJ") || fastcmp(word, "OBJECT"))
|
||||
{
|
||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
extern FILE *logstream;
|
||||
#endif
|
||||
|
||||
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
|
||||
#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
|
||||
#ifdef DEVELOP
|
||||
#define VERSION 0 // Game version
|
||||
#define SUBVERSION 0 // more precise version number
|
||||
|
|
|
@ -2499,7 +2499,10 @@ void R_DrawMasked(void)
|
|||
//
|
||||
// ==========================================================================
|
||||
|
||||
// We can assume those are tied to skins somewhat, hence why they're defined here.
|
||||
INT32 numskins = 0;
|
||||
follower_t followers[MAXSKINS];
|
||||
|
||||
skin_t skins[MAXSKINS];
|
||||
// FIXTHIS: don't work because it must be inistilised before the config load
|
||||
//#define SKINVALUES
|
||||
|
|
|
@ -115,6 +115,30 @@ typedef struct
|
|||
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
|
||||
} skin_t;
|
||||
|
||||
//
|
||||
// for followers.
|
||||
//
|
||||
// We'll define these here because they're really just a mobj that'll follow some rules behind a player
|
||||
//
|
||||
typedef struct follower_s
|
||||
{
|
||||
char name[SKINNAMESIZE+1]; // Name. This is used for the menus. We'll just follow the same rules as skins for this.
|
||||
|
||||
// some position shenanigans:
|
||||
INT32 atangle; // angle the object will be at around the player. The object itself will always face the same direction as the player.
|
||||
INT32 zoffs; // Z offset relative to the player's height. Cannot be negative.
|
||||
|
||||
// from there on out, everything is STATES to allow customization
|
||||
// these are only set once when the action is performed and are then free to animate however they want.
|
||||
|
||||
INT32 idlestate; // state when the player is at a standstill
|
||||
INT32 followstate; // state when the player is moving
|
||||
INT32 hurtstate; // state when the player is being hurt
|
||||
INT32 winstate; // state when the player has won
|
||||
INT32 losestate; // state when the player has lost
|
||||
|
||||
} follower_t;
|
||||
|
||||
// -----------
|
||||
// NOT SKINS STUFF !
|
||||
// -----------
|
||||
|
@ -193,6 +217,8 @@ typedef struct drawnode_s
|
|||
|
||||
extern INT32 numskins;
|
||||
extern skin_t skins[MAXSKINS];
|
||||
extern INT32 numfollowers;
|
||||
extern follower_t followers[MAXSKINS]; // again, use the same rules as skins, no reason not to.
|
||||
|
||||
void SetPlayerSkin(INT32 playernum,const char *skinname);
|
||||
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
|
||||
|
|
Loading…
Reference in a new issue