player.cpp
来自「一个symbian 冒险游戏代码」· C++ 代码 · 共 1,095 行 · 第 1/3 页
CPP
1,095 行
#include "Player.h"
#include "Map.h"
#include "GameApp.h"
#include "ImageResample.h"
#include <io/InputStream.h>
#include <io/OutputStream.h>
#include <lang/Exception.h>
#include <string.h>
#include <config.h>
using namespace lang;
static const char* const WEAPON_NAMES[] =
{
"sword",
"spear",
"shotgun",
""
};
Player::Player() :
MapObject( "Player" ),
m_killer( 0 ),
m_time( 0 ),
m_speedModifier( Fixf(0) ),
m_speedModifyTime( Fixf(0) ),
m_itemCount( 0 ),
m_currentWeapon( 0 ),
m_nextWeapon( -1 ),
m_state( BODY_IDLE ),
m_virtualState( BODY_NONE ),
m_previousAnim( 0 ),
m_previousRefX( 0 ),
m_previousRefY( 0 ),
m_freezeAnim( false ),
m_weaponInHand( false )
{
m_animationSwitchBoard[ BODY_IDLE ] = ANIM_IDLE;
m_animationSwitchBoard[ BODY_WALK ] = ANIM_WALK_BASE | ANIM_WEAPON_DEPENDENT;
m_animationSwitchBoard[ BODY_WALK_WOUNDED ] = ANIM_WALK_BASE | ANIM_WEAPON_DEPENDENT;
m_animationSwitchBoard[ BODY_ATTACK ] = ANIM_ATTACK_BASE | ANIM_WEAPON_DEPENDENT;
m_animationSwitchBoard[ BODY_DRINK ] = ANIM_DRINK;
m_animationSwitchBoard[ BODY_DEATH ] = ANIM_DEATH;
m_animationSwitchBoard[ BODY_DEAD ] = ANIM_DEATH;
m_animationSwitchBoard[ BODY_TAKE_WEAPON ] = ANIM_CHANGEWEAPON_BASE | ANIM_WEAPON_DEPENDENT;
m_animationSwitchBoard[ BODY_PUT_WEAPON ] = ANIM_CHANGEWEAPON_BASE | ANIM_WEAPON_DEPENDENT;
m_animationSwitchBoard[ BODY_STILL ] = ANIM_NONE;
memset( m_itemList, 0, sizeof(m_itemList) );
addItem( (char*) WEAPON_NAMES[0] ); // sword
addItem( (char*) WEAPON_NAMES[1] ); // spear
// no shotgun
}
Player::~Player()
{
}
void Player::addItem( const char* name )
{
const int maxItemCount = sizeof(m_itemList) / sizeof(m_itemList[0]);
if ( name[0] == 0 ) return;
if ( !hasItem( name ) )
{
int index = findEmptyItemSlot();
if ( ( index >= 0 ) && ( index < maxItemCount ) )
{
// add
String::cpy( m_itemList[index], sizeof(m_itemList[index]), name );
m_itemCount++;
}
else
{
// too many items
throwError( Exception(Format("Player's maximum item count exceeded while adding item", name)) );
}
}
}
int Player::findEmptyItemSlot()
{
const int maxItemCount = sizeof(m_itemList) / sizeof(m_itemList[0]);
if ( m_itemCount >= maxItemCount ) return -1;
for ( int i = 0; i < maxItemCount; i++ )
{
if ( m_itemList[i][0] == 0 )
{
// found
return i;
}
}
return -1;
}
void Player::removeItem( const char* name )
{
const int maxItemCount = sizeof(m_itemList) / sizeof(m_itemList[0]);
if ( name[0] == 0 ) return;
int checkedItemCount = 0;
for ( int i = 0; i < maxItemCount; i++ )
{
if ( checkedItemCount >= m_itemCount ) break;
if ( m_itemList[i][0] != 0 )
{
if ( strcmp( name, m_itemList[i] ) == 0 )
{
// remove
m_itemList[i][0] = 0;
m_itemCount--;
}
checkedItemCount++;
}
}
}
bool Player::hasItem( const char* name )
{
const int maxItemCount = sizeof(m_itemList) / sizeof(m_itemList[0]);
if ( name[0] == 0 )
return false;
int checkedItemCount = 0;
for ( int i = 0; i < maxItemCount; i++ )
{
if ( checkedItemCount >= m_itemCount ) break;
if ( m_itemList[i][0] != 0 )
{
if ( strcmp( name, m_itemList[i] ) == 0 )
{
// found
return true;
}
checkedItemCount++;
}
}
return false;
}
void Player::read( io::InputStream* in )
{
MapObject::read( in );
char* begin = (char*) &Player_storeStart;
char* end = (char*) &Player_storeEnd;
in->read( begin, end-begin );
}
void Player::write( io::OutputStream* out )
{
MapObject::write( out );
char* begin = (char*) &Player_storeStart;
char* end = (char*) &Player_storeEnd;
out->write( begin, end-begin );
}
void Player::initStatic()
{
GameApp* app = GameApp::get();
ImageResample* resampler = app->getImageResamplingEngine();
bool halfRes = app->isHalfResolution();
//Idle
app->playerAnims[ANIM_IDLE][DIR_0].loadCustom( expandPath("data/anims/hero/hero_idle_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_IDLE][DIR_315].loadCustom( expandPath("data/anims/hero/hero_idle_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_IDLE][DIR_270].loadCustom( expandPath("data/anims/hero/hero_idle_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_IDLE][DIR_90].loadCustom( expandPath("data/anims/hero/hero_idle_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_IDLE][DIR_45].loadCustom( expandPath("data/anims/hero/hero_idle_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_IDLE][DIR_135] = Surface( app->playerAnims[ANIM_IDLE][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_IDLE][DIR_180] = Surface( app->playerAnims[ANIM_IDLE][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_IDLE][DIR_225] = Surface( app->playerAnims[ANIM_IDLE][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_0, 17, 76 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_315, 18, 77 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_270, 22, 86 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_90, 23, 85 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_45, 23, 78 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_225, 18, 77 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_180, 17, 76 );
app->setPlayerAnimationReferencePoint( ANIM_IDLE, DIR_135, 23, 78 );
//Walk, sword
app->playerAnims[ANIM_WALK_SWORD][DIR_0].loadCustom( expandPath("data/anims/hero/hero_walk_sword_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SWORD][DIR_315].loadCustom( expandPath("data/anims/hero/hero_walk_sword_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SWORD][DIR_270].loadCustom( expandPath("data/anims/hero/hero_walk_sword_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SWORD][DIR_90].loadCustom( expandPath("data/anims/hero/hero_walk_sword_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SWORD][DIR_45].loadCustom( expandPath("data/anims/hero/hero_walk_sword_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SWORD][DIR_135] = Surface( app->playerAnims[ANIM_WALK_SWORD][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_WALK_SWORD][DIR_180] = Surface( app->playerAnims[ANIM_WALK_SWORD][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_WALK_SWORD][DIR_225] = Surface( app->playerAnims[ANIM_WALK_SWORD][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_0, 16, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_315, 22, 75 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_270, 33, 83 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_90, 37, 82 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_45, 22, 79 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_225, 22, 75 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_180, 16, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SWORD, DIR_135, 22, 79 );
//Walk, spear
app->playerAnims[ANIM_WALK_SPEAR][DIR_0].loadCustom( expandPath("data/anims/hero/hero_walk_spear_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SPEAR][DIR_315].loadCustom( expandPath("data/anims/hero/hero_walk_spear_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SPEAR][DIR_270].loadCustom( expandPath("data/anims/hero/hero_walk_spear_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SPEAR][DIR_90].loadCustom( expandPath("data/anims/hero/hero_walk_spear_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SPEAR][DIR_45].loadCustom( expandPath("data/anims/hero/hero_walk_spear_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SPEAR][DIR_135] = Surface( app->playerAnims[ANIM_WALK_SPEAR][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_WALK_SPEAR][DIR_180] = Surface( app->playerAnims[ANIM_WALK_SPEAR][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_WALK_SPEAR][DIR_225] = Surface( app->playerAnims[ANIM_WALK_SPEAR][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_0, 20, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_315, 20, 82 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_270, 45, 82 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_90, 44, 116 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_45, 22, 79 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_225, 20, 82 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_180, 20, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SPEAR, DIR_135, 22, 79 );
//Walk, shotgun
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_0].loadCustom( expandPath("data/anims/hero/hero_walk_shotgun_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_315].loadCustom( expandPath("data/anims/hero/hero_walk_shotgun_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_270].loadCustom( expandPath("data/anims/hero/hero_walk_shotgun_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_90].loadCustom( expandPath("data/anims/hero/hero_walk_shotgun_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_45].loadCustom( expandPath("data/anims/hero/hero_walk_shotgun_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_135] = Surface( app->playerAnims[ANIM_WALK_SHOTGUN][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_180] = Surface( app->playerAnims[ANIM_WALK_SHOTGUN][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_WALK_SHOTGUN][DIR_225] = Surface( app->playerAnims[ANIM_WALK_SHOTGUN][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_0, 15, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_315, 17, 73 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_270, 25, 79 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_90, 25, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_45, 20, 79 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_225, 17, 73 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_180, 15, 78 );
app->setPlayerAnimationReferencePoint( ANIM_WALK_SHOTGUN, DIR_135, 20, 79 );
//Attack, sword
app->playerAnims[ANIM_ATTACK_SWORD][DIR_0].loadCustom( expandPath("data/anims/hero/hero_hit_sword_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_315].loadCustom( expandPath("data/anims/hero/hero_hit_sword_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_270].loadCustom( expandPath("data/anims/hero/hero_hit_sword_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_90].loadCustom( expandPath("data/anims/hero/hero_hit_sword_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_45].loadCustom( expandPath("data/anims/hero/hero_hit_sword_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_135] = Surface( app->playerAnims[ANIM_ATTACK_SWORD][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_180] = Surface( app->playerAnims[ANIM_ATTACK_SWORD][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_ATTACK_SWORD][DIR_225] = Surface( app->playerAnims[ANIM_ATTACK_SWORD][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_0, 44, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_315, 53, 77 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_270, 53, 95 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_90, 35, 122 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_45, 56, 97 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_225, 53, 77 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_180, 44, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SWORD, DIR_135, 56, 97 );
//Attack, spear
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_0].loadCustom( expandPath("data/anims/hero/hero_hit_spear_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_315].loadCustom( expandPath("data/anims/hero/hero_hit_spear_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_270].loadCustom( expandPath("data/anims/hero/hero_hit_spear_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_90].loadCustom( expandPath("data/anims/hero/hero_hit_spear_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_45].loadCustom( expandPath("data/anims/hero/hero_hit_spear_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_135] = Surface( app->playerAnims[ANIM_ATTACK_SPEAR][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_180] = Surface( app->playerAnims[ANIM_ATTACK_SPEAR][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_ATTACK_SPEAR][DIR_225] = Surface( app->playerAnims[ANIM_ATTACK_SPEAR][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_0, 18, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_315, 18, 95 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_270, 46, 108 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_90, 50, 105 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_45, 25, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_225, 18, 95 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_180, 18, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SPEAR, DIR_135, 25, 80 );
//Attack, shotgun
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_0].loadCustom( expandPath("data/anims/hero/hero_hit_shotgun_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_315].loadCustom( expandPath("data/anims/hero/hero_hit_shotgun_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_270].loadCustom( expandPath("data/anims/hero/hero_hit_shotgun_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_90].loadCustom( expandPath("data/anims/hero/hero_hit_shotgun_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_45].loadCustom( expandPath("data/anims/hero/hero_hit_shotgun_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_135] = Surface( app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_180] = Surface( app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_225] = Surface( app->playerAnims[ANIM_ATTACK_SHOTGUN][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_0, 23, 83 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_315, 37, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_270, 40, 86 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_90, 48, 83 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_45, 38, 86 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_225, 37, 80 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_180, 23, 83 );
app->setPlayerAnimationReferencePoint( ANIM_ATTACK_SHOTGUN, DIR_135, 38, 86 );
//Drink
app->playerAnims[ANIM_DRINK][DIR_0].loadCustom( expandPath("data/anims/hero/hero_drink_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_DRINK][DIR_315].loadCustom( expandPath("data/anims/hero/hero_drink_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_DRINK][DIR_270].loadCustom( expandPath("data/anims/hero/hero_drink_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_DRINK][DIR_90].loadCustom( expandPath("data/anims/hero/hero_drink_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_DRINK][DIR_45].loadCustom( expandPath("data/anims/hero/hero_drink_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_DRINK][DIR_135] = Surface( app->playerAnims[ANIM_DRINK][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_DRINK][DIR_180] = Surface( app->playerAnims[ANIM_DRINK][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_DRINK][DIR_225] = Surface( app->playerAnims[ANIM_DRINK][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_0, 18, 77 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_315, 19, 78 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_270, 23, 79 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_90, 25, 78 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_45, 22, 78 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_225, 19, 78 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_180, 18, 77 );
app->setPlayerAnimationReferencePoint( ANIM_DRINK, DIR_135, 22, 78 );
//Death
app->playerAnims[ANIM_DEATH][DIR_0].loadCustom( expandPath("data/anims/hero/hero_death_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_DEATH][DIR_315].loadCustom( expandPath("data/anims/hero/hero_death_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_DEATH][DIR_270].loadCustom( expandPath("data/anims/hero/hero_death_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_DEATH][DIR_90].loadCustom( expandPath("data/anims/hero/hero_death_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_DEATH][DIR_45].loadCustom( expandPath("data/anims/hero/hero_death_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_DEATH][DIR_135] = Surface( app->playerAnims[ANIM_DEATH][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_DEATH][DIR_180] = Surface( app->playerAnims[ANIM_DEATH][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_DEATH][DIR_225] = Surface( app->playerAnims[ANIM_DEATH][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_0, 144, 96 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_315, 105, 93 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_270, 47, 172 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_90, 43, 84 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_45, 108, 87 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_225, 105, 93 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_180, 144, 96 );
app->setPlayerAnimationReferencePoint( ANIM_DEATH, DIR_135, 108, 87 );
//Change weapon, sword
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_0].loadCustom( expandPath("data/anims/hero/hero_changew_sword_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_315].loadCustom( expandPath("data/anims/hero/hero_changew_sword_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_270].loadCustom( expandPath("data/anims/hero/hero_changew_sword_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_90].loadCustom( expandPath("data/anims/hero/hero_changew_sword_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_45].loadCustom( expandPath("data/anims/hero/hero_changew_sword_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_135] = Surface( app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_180] = Surface( app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_225] = Surface( app->playerAnims[ANIM_CHANGEWEAPON_SWORD][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_0, 17, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_315, 22, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_270, 24, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_90, 24, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_45, 20, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_225, 22, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_180, 17, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SWORD, DIR_135, 20, 78 );
//Change weapon, spear
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_0].loadCustom( expandPath("data/anims/hero/hero_changew_spear_e.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_315].loadCustom( expandPath("data/anims/hero/hero_changew_spear_se.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_270].loadCustom( expandPath("data/anims/hero/hero_changew_spear_s.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_90].loadCustom( expandPath("data/anims/hero/hero_changew_spear_n.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_45].loadCustom( expandPath("data/anims/hero/hero_changew_spear_ne.nan"), resampler, halfRes );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_135] = Surface( app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_45], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_180] = Surface( app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_0], Surface::FLAG_MIRROR );
app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_225] = Surface( app->playerAnims[ANIM_CHANGEWEAPON_SPEAR][DIR_315], Surface::FLAG_MIRROR );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_0, 17, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_315, 22, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_270, 45, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_90, 41, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_45, 20, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_225, 22, 78 );
app->setPlayerAnimationReferencePoint( ANIM_CHANGEWEAPON_SPEAR, DIR_180, 17, 78 );
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?