![]() |
|||||||||||||||||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||||||||
CREATE A NEW USER CONTENT
Go in GENVS.H
:
...
#pragma GE_BrushContents
typedef enum
{
Water = 0x00010000,
Lava = 0x00020000,
Ladder = 0x00040000,
} UserContentsEnum;
...
Go in GMAIN.H
:
...
#define CONTENTS_WATER
GE_CONTENTS_USER1
#define CONTENTS_LAVA
GE_CONTENTS_USER2
#define CONTENTS_LADDER
GE_CONTENTS_USER3
...
Go in BOT.C
:
...
#define CONTENTS_WATER
GE_CONTENTS_USER1
#define CONTENTS_LAVA
GE_CONTENTS_USER2
#define CONTENTS_LADDER
GE_CONTENTS_USER3
...
Go in GPLAYER.H
:
...
typedef enum
{
// For clients, etc...
PSTATE_Normal = 0,
PSTATE_InAir,
PSTATE_InLava,
PSTATE_InWater,
PSTATE_InLadder,
PSTATE_Running,
PSTATE_Dead,
PSTATE_DeadOnGround,
//Etc…
} GPlayer_PState;
...
Go in GMAIN.C
inside the function "geBoolean UpdatePlayerContents":
...
if (geWorld_GetContents(World,
&Player->XForm.Translation, &Player->Mins, &Player->Maxs, GE_COLLIDE_MODELS,
0, NULL, NULL, &Contents))
{
// Check to see if player is in lava...
if (Contents.Contents & CONTENTS_WATER)
{
Player->State = PSTATE_InWater;
}
else if (Contents.Contents & CONTENTS_LAVA)
{
Player->State = PSTATE_InLava;
}
else if (Contents.Contents & CONTENTS_LADDER)
{
Player->State = PSTATE_InLadder;
}
else (PlayerLiquid(Player))
Player->State = PSTATE_Normal;
}
...
Go in GMAIN.C
inside the function "geBoolean PlayerPhysics"
:
...
switch (Player->State)
{
case PSTATE_InLava:
case PSTATE_InWater:
Player->Velocity.Y -= PLAYER_GRAVITY*Time*0.05f;
break;
case PSTATE_InLadder :
Player->Velocity.Y -= 0.0f;
break;
default:
Player->Velocity.Y -= PLAYER_GRAVITY*Time;
break;
}
...
Go in GMAIN.C
inside the function "int32 PlayerLiquid"
:
...
//=============================================================================
// PlayerLiquid
//=============================================================================
int32 PlayerLiquid(GPlayer *Player)
{
if (Player->State ==
PSTATE_InLava)
return 10;
else if (Player->State
== PSTATE_InWater || Player->State == PSTATE_InLadder)
return 5;
return 0;
}
...
Screen Shot of the
Brush Attributes dialog box using the new UserContent Ladder: