?? char.cpp
字號:
/*****************************************************************************\
* Copyright (c), Future Entertainment World / Seoul, Republic of Korea *
* All Rights Reserved. *
* *
* This document contains proprietary and confidential information. No *
* parts of this document or the computer program it embodies may be in *
* any way copied, duplicated, reproduced, translated into a different *
* programming language, or distributed to any person, company, or *
* corporation without the prior written consent of Future Entertainment World *
\*****************************************************************************/
#include "stdafx.h"
#include <Ddraw.h>
#include <Math.h>
#include "sys/stat.h"
#include "Dragon.h"
#include "Hong_Sprite.h"
#include "Hong_Sub.h"
#include "char.h"
#include "map.h"
#include "Path.h"
#include "DirectSound.h"
#include "CharDataTable.h"
#include "Menu.h"
#include "Effect.h"
//#include "MenuDef.h"
#include "NumberAniMgr.h"
#include "ItemTable.h"
#include "NetWork.h"
#include "GameProc.h"
#include "Hangul.h"
#include "Item.h"
#include "Tool.h"
#include "Hong_Light.h"
#include "House.h"
#include "Skill.h"
#include "kh_cpp.h"
#include "Horse.h" // LTS HORSERIDER
#include "StrikeSys.h"
#include "CombatSys.h"
using namespace battle;
#define COLOR_FROZEN ReturnBlendRGB(100, 100, 255)
#define COLOR_SLOW ReturnBlendRGB(255, 255, 100)
#define COLOR_DAZE ReturnBlendRGB(255, 100, 100)
#define COLOR_POISON ReturnBlendRGB(100, 255, 100)
#define COLOR_STONE ReturnBlendRGB(100, 100, 100)
extern cHorseRider g_HorseRider; // LTS HORSERIDER
extern int g_ActionAnger; // LTS ACTION
extern void ChangeItem( int start ); // 烙矯 酒撈袍 官操扁
////////////////////// 0531 lkh 薦瀝 ////////////////////////
extern int GetItemAttr(int item_id, int attr);
extern int GetItemAttr2(int sprno, int item_id, int attr); //011018 KHS 噶肚
extern int GetIndexOfCondition( BYTE );
int IDCount;
///////////////////////////////////////////////////////////////////////////////
//
extern SCharacter SCharacterData;
extern SCharacter SCharSource;
extern CHARACTERLIST g_CharacterList;
//extern int aItemInventory[3][3][8];
extern void SendReqGuildInfo1( int guild_code ); // 010719 YGI
BOOL BuildCharacterList( LPCHARACTERLIST lpCharacterList );
void DestroyCharacterList( LPCHARACTERLIST lpCharacterList );
void DestroyCharacterListAll( LPCHARACTERLIST lpCharacterList );
void DisplayPC( LPCHARACTER ch, int tag );
BOOL AddCharacter( LPCHARACTERLIST lpCharacterList, LPCHARACTER ch, LPGPCHARINFO gpch );
void DeleteCharacter( LPCHARACTERLIST lpCharacterList, LPCHARACTER ch );
LPCHARACTER FindCharacter( LPCHARACTERLIST lpCharacterList, DWORD dwID );
void SetCharacterPosition( LPCHARACTER ch, POINT position );
LPPOINT GetCharacterPosition( LPCHARACTER ch );
BOOL ChangeDirection( DIRECTION* lpDirection, int sx, int sy, int dx, int dy );
BYTE SpriteOrder[ 4][ 8][ 75];
int EndOfAnimationFlag;
int AttackRangeTable[2][ CHARACTER_ACCESSORY_MAX_][ 10];
void GetAttacked( LPCHARACTER ch );
NPC_INFO g_infNpc[MAX_CHARACTER_SPRITE_];
GPCHARINFO gpCharInfo;
BOOL BuildCharacterList( LPCHARACTERLIST lpCharacterList )
{
gpCharInfo.type = SPRITETYPE_CHARACTER;
gpCharInfo.id = 0;
gpCharInfo.sprno = 0;
// gpCharInfo.position.x = gpCharInfo.position.y = 0;
gpCharInfo.position.x = 195* TILE_SIZE;
gpCharInfo.position.y = 151* TILE_SIZE;
CharUpper( MapName );
if( strcmp( "FIREDUN1", MapName ) == 0 )
{
gpCharInfo.position.x = 195* TILE_SIZE;
gpCharInfo.position.y = 151* TILE_SIZE;
}
else if( strcmp( "K_SUNG2", MapName ) == 0 )
{
}else if( strcmp( "MA-IN", MapName ) == 0 )
{
}else if( strcmp( "SUNG_TILE_00", MapName ) == 0 )
{
gpCharInfo.position.x = 52* TILE_SIZE;
gpCharInfo.position.y = 22* TILE_SIZE;
}else if( strcmp( "SOURCE", MapName ) == 0 )
{
gpCharInfo.position.x = 200* TILE_SIZE;
gpCharInfo.position.y = 130* TILE_SIZE;
}else if( strcmp( "ICE-W01", MapName ) == 0 )
{
gpCharInfo.position.x = 91* TILE_SIZE;
gpCharInfo.position.y = 119* TILE_SIZE;
}
gpCharInfo.direction = DIRECTION_DOWN;
gpCharInfo.nCurrentAction = ACTION_NONE;
gpCharInfo.basicAction = ACTION_BATTLE_NONE;
gpCharInfo.basicWalk = ACTION_BATTLE_WALK_OWNHAND;
gpCharInfo.animationType= ANIMATION_TYPE_WOMAN;
gpCharInfo.bodyr = 255;
gpCharInfo.bodyg = 255;
gpCharInfo.bodyb = 255;
gpCharInfo.clothr = 255;
gpCharInfo.clothg = 0;
gpCharInfo.clothb = 0;
SCharacterData.nCharacterHP = gpCharInfo.hp = 2000;
SCharacterData.nCharacterMP = gpCharInfo.mp = 3000;
SCharacterData.nCharacterSP = gpCharInfo.sp = 4000;
SCharacterData.nCharacterMAXHP = gpCharInfo.hpmax = 2100;
SCharacterData.nCharacterMAXMP = gpCharInfo.mpmax = 3100;
SCharacterData.nCharacterMAXSP = gpCharInfo.spmax = 4100;
SCharSource.nCharacterData[0] = 1;
gpCharInfo.sex = SCharSource.nCharacterData[0];
gpCharInfo.sight = 300;
switch( gpCharInfo.sprno )
{
case 0 : gpCharInfo.accessory[0] = 11;
gpCharInfo.accessory[1] = 0;
gpCharInfo.accessory[2] = 61;
gpCharInfo.accessory[3] = 0;
break;
case 1 : gpCharInfo.accessory[0] = 7;
gpCharInfo.accessory[1] = 0;
gpCharInfo.accessory[2] = 61;
gpCharInfo.accessory[3] = 0;
break;
}
int tx = gpCharInfo.position.x - 10;
if( tx < 0 ) tx = 0;
int ty = gpCharInfo.position.y - 7;
if( ty < 0 ) ty = 0;
RECT rect;
rect.left = tx;
rect.top = ty;
rect.right = tx + 20;
rect.bottom = ty + 11;
int id = 0;
int i,j;
for( i = 0 ; i < 5 ; i ++ )
for( j = 0 ; j < 5 ; j ++)
{
gpCharInfo.position.x = (195 + i*2 )* TILE_SIZE;
gpCharInfo.position.y = (151 + j*2 )* TILE_SIZE;
gpCharInfo.id = id++;
AddCharacter( lpCharacterList, g_CharacterList.lpLast, &gpCharInfo );
}
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////// Another PC
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////// NPC Monster...
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
gpCharInfo.type = SPRITETYPE_MONSTER; //SPRITETYPE_MONSTER;
gpCharInfo.id = 7;
gpCharInfo.sprno = 16;
// gpCharInfo.position.x = gpCharInfo.position.y = 0;
gpCharInfo.position.x = 192* TILE_SIZE;
gpCharInfo.position.y = 152* TILE_SIZE;
if( strcmp( "FIREDUN1", MapName ) == 0 )
{
gpCharInfo.position.x = 193* TILE_SIZE;
gpCharInfo.position.y = 151* TILE_SIZE;
}
else if( strcmp( "K_SUNG2", MapName ) == 0 )
{
}else if( strcmp( "MA-IN", MapName ) == 0 )
{
}else if( strcmp( "SUNG_TILE_00", MapName ) == 0 )
{
gpCharInfo.position.x = 53* TILE_SIZE;
gpCharInfo.position.y = 27* TILE_SIZE;
}else if( strcmp( "SOURCE", MapName ) == 0 )
{
gpCharInfo.position.x = 200* TILE_SIZE;
gpCharInfo.position.y = 133* TILE_SIZE;
}else if( strcmp( "ICE-W01", MapName ) == 0 )
{
gpCharInfo.position.x = 94* TILE_SIZE;
gpCharInfo.position.y = 121* TILE_SIZE;
}
gpCharInfo.direction = DIRECTION_DOWN;
gpCharInfo.nCurrentAction = MON1_NONE;
gpCharInfo.basicAction = MON1_NONE;
gpCharInfo.basicWalk = MON1_BATTLE_WALK;
gpCharInfo.animationType = ANIMATION_TYPE_MON1;
gpCharInfo.sex = 0;
gpCharInfo.hp = 2000;
gpCharInfo.mp = 3000;
gpCharInfo.sp = 4000;
gpCharInfo.hpmax = 2100;
gpCharInfo.mpmax = 3100;
gpCharInfo.spmax = 4100;
if ( !AddCharacter( lpCharacterList, g_CharacterList.lpLast, &gpCharInfo ) )
{
return FALSE;
}
return TRUE;
}
void DestroyCharacterList( LPCHARACTERLIST lpCharacterList )
{
while ( lpCharacterList->lpLast != NULL )
DeleteCharacter( lpCharacterList, lpCharacterList->lpLast );
lpCharacterList->nCount = 0;
}
void DestroyCharacterListExceptHero( void )
{
LPCHARACTER temp = NULL;
if(!g_CharacterList.lpFirst)
{
return;
}
LPCHARACTER ch = g_CharacterList.lpFirst->lpNext;
while( ch != NULL )
{
temp = ch->lpNext;
DeleteCharacter( &g_CharacterList, ch );
ch = temp;
}
}
void PutWeapon(CHARACTER* pTarget, int nX, int nY)
{ //< CSD-031029
if (pTarget == NULL)
{
return;
}
if (pTarget->peacests == 0)
{
return;
}
if (pTarget->idWeaponItem/1000 != 6)
{ //< CSD-031101
PutCompressedImage(nX, nY, pTarget->sp2);
return;
} //> CSD-031101
CItem_Weapon* pWeapon = static_cast<CItem_Weapon*>(ItemUnit(pTarget->idWeaponItem));
if (pWeapon == NULL)
{
return;
}
const int nEffect = pWeapon->effect;
const int nFrame = pTarget->AnimationTable[pTarget->nCurrentAction].cFrame[pTarget->nCurrentFrame];
CharacterSprite* pAccessorySprite = CharAccessorySpr[pTarget->sprno];
Spr* pWeaponSprite = &(pAccessorySprite + nEffect)->sp[pTarget->direction][nFrame];
switch (pWeapon->nRange)
{
case 0:
{
if (nEffect > 0)
{
PutCompressedImageFX(nX, nY, pWeaponSprite, 10 + Random(4), 2);
}
PutCompressedImage(nX, nY, pTarget->sp2);
break;
}
case 1:
{
PutCompressedImage(nX, nY, pTarget->sp2);
if (nEffect > 0)
{
PutCompressedImageFX(nX, nY, pWeaponSprite, 10 + Random(4), 2);
}
break;
}
}
} //> CSD-031014
void PutWeapon(CHARACTER* pTarget, int nX, int nY, DWORD dwColor)
{ //< CSD-031014
if (pTarget == NULL)
{
return;
}
if (pTarget->peacests == 0)
{
return;
}
if (pTarget->idWeaponItem/1000 != 6)
{ //< CSD-031101
PutCompressedImageCharRGB(nX, nY, pTarget->sp2, dwColor);
return;
} //> CSD-031101
CItem_Weapon* pWeapon = static_cast<CItem_Weapon*>(ItemUnit(pTarget->idWeaponItem));
if (pWeapon == NULL)
{
return;
}
const int nEffect = pWeapon->effect;
if (nEffect > 0)
{
CharacterSprite* pAccessorySprite = CharAccessorySpr[pTarget->sprno];
const int nFrame = pTarget->AnimationTable[pTarget->nCurrentAction].cFrame[pTarget->nCurrentFrame];
Spr* pWeaponSprite = &(pAccessorySprite + nEffect)->sp[pTarget->direction][nFrame];
PutCompressedImageFX(nX, nY, pWeaponSprite, 10 + Random(4), 2);
}
PutCompressedImageCharRGB(nX, nY, pTarget->sp2, dwColor);
} //> CSD-031029
void PutBody( LPCHARACTER ch, int x, int y, Spr *sp, DWORD bodycolor )
{
PutCompressedImageCharRGB( x,y, sp, bodycolor);
}
void PutHead(int ac1, CharacterSprite *cas, int dir, int sprc, int x, int y) // 010412 YGI
{ //< CSD-031029
switch (ac1)
{
case 0:
{
PutCompressedImage(x, y, &(cas + 104)->sp[dir][sprc]);
break; // default 捧備
}
case 1:
{
break;
}
default:
{
PutCompressedImage(x, y, &(cas + ac1)->sp[dir ][sprc]);
break;
}
}
} //> CSD-031029
void PutHead(int ac1, CharacterSprite *cas, int dir, int sprc, int x, int y, DWORD dwColor)
{ //< CSD-031029
switch (ac1)
{
case 0:
{
PutCompressedImageCharRGB(x, y, &(cas + 104)->sp[dir][sprc], dwColor);
break; // default 捧備
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -