reman3/Rayman_X/cpa/tempgrp/GAM/HitPts.c

101 lines
4.6 KiB
C

/*=========================================================================
* HitPts.c : Hit points.
* This is a part of the Game project.
*
* Version 1.0
* Creation date 15/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#include "ToolsCPA.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/Objects.h"
#include "HitPts.h"
#include "InitEng.h"
#include "GameEng.h"
#include "ObjInit.h"
/**************************************************************************/
unsigned char fn_ucGetHitPoints(struct tdstEngineObject_ *_p_stObject)
{
return(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vSetHitPointsInit(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
fn_vStandardGameSetHitPointsInit ( _p_stObject -> h_StandardGame , _ucValue ) ;
}
/**************************************************************************/
void fn_vSetHitPoints(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,_ucValue);
}
/**************************************************************************/
void fn_vSetHitPointsToMaxValue(struct tdstEngineObject_ *_p_stObject)
{
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vAddHitPoints(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if (fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)+_ucValue<=fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame))
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)+_ucValue));
else
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
unsigned char fn_ucSubHitPoints(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if ((long)fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)-(long)_ucValue>0)
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)-_ucValue));
else
{
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,0);
}
return(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame));
}
/**************************************************************************/
unsigned char fn_ucGetHitPointsMax(struct tdstEngineObject_ *_p_stObject)
{
return(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vSetHitPointsMax(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,_ucValue);
}
/**************************************************************************/
void fn_vSetHitPointsMaxToMaxValue(struct tdstEngineObject_ *_p_stObject)
{
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMaxMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vAddHitPointsMax(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if (fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)+_ucValue<=fn_ucStandardGameGetHitPointsMaxMax(_p_stObject->h_StandardGame))
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)+_ucValue));
else
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMaxMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
unsigned char fn_ucSubHitPointsMax(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if ((long)fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)-(long)_ucValue>0)
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)-_ucValue));
else
{
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,0);
}
fn_vAddHitPoints(_p_stObject,0);
return(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/