Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP So close yet so far #210

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/engine/N3Base/N3FXBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,15 @@ bool CN3FXBundle::Load(HANDLE hFile) {
ReadFile(hFile, &m_bStatic, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion == 3) {
ReadFile(hFile, &m_bEarthQuake, sizeof(bool), &dwRWC, NULL);
if (m_bEarthQuake) {
ReadFile(hFile, &m_fEarthQuakeStartTime, sizeof(float), &dwRWC, NULL);
} else {
m_fEarthQuakeStartTime = 0;
}
}

return true;
}

Expand Down
2 changes: 2 additions & 0 deletions src/engine/N3Base/N3FXBundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class CN3FXBundle : public CN3BaseFileAccess {
int m_iSourceJoint;

bool m_bDependScale;
bool m_bEarthQuake; // Needs Implementation
float m_fEarthQuakeStartTime; // Needs Implementation
//__Vector3 m_vTargetScale;
float m_fTargetScale;

Expand Down
8 changes: 8 additions & 0 deletions src/engine/N3Base/N3FXPartBillBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ bool CN3FXPartBillBoard::Load(HANDLE hFile) {
ReadFile(hFile, &m_mtxRot, sizeof(m_mtxRot), &dwRWC, NULL);
}

if (m_iVersion >= 6) {
ReadFile(hFile, &m_bRotationRate, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion >= 7) {
ReadFile(hFile, &m_bOnScreen, sizeof(bool), &dwRWC, NULL); // is this on screen bool?
}

CreateVB();
Init();

Expand Down
2 changes: 2 additions & 0 deletions src/engine/N3Base/N3FXPartBillBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class CN3FXPartBillBoard : public CN3FXPartBase {
float m_fRotBillBoardY;
float m_fRotBillBoardZ;

bool m_bRotationRate; // Needs Implementation
bool m_bOnScreen; // Needs Implementation
protected:
__Vector3 m_vUnit[4];

Expand Down
4 changes: 4 additions & 0 deletions src/engine/N3Base/N3FXPartMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ bool CN3FXPartMesh::Load(HANDLE hFile) {
ReadFile(hFile, &m_vUnitScale, sizeof(__Vector3), &dwRWC, NULL);
}

if (m_iVersion == 6) {
ReadFile(hFile, &m_bShapeLoop, sizeof(bool), &dwRWC, NULL); //?<shape_loop> true <view_fix> true <usefadeshowlife> false
}

if (m_pShape) {
for (int i = 0; i < m_pShape->PartCount(); i++) {
m_pShape->Part(i)->m_fTexFPS = m_fTexFPS;
Expand Down
1 change: 1 addition & 0 deletions src/engine/N3Base/N3FXPartMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CN3FXPartMesh : public CN3FXPartBase {

bool m_bTexLoop;
float m_fMeshFPS;
bool m_bShapeLoop; // Needs Implementation

protected:
bool IsDead();
Expand Down
18 changes: 17 additions & 1 deletion src/engine/N3Base/N3FXPartParticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,22 @@ bool CN3FXPartParticles::Load(HANDLE hFile) {
ReadFile(hFile, &m_fScaleVelY, sizeof(float), &dwRWC, NULL);
}

if (m_iVersion >= 6) {
ReadFile(hFile, &m_bDistanceNumFix, sizeof(bool), &dwRWC, NULL);
}
if (m_iVersion >= 7) {
ReadFile(hFile, &m_bParticleYAxisFix, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion >= 8) {
/*
ReadFile(hFile, &m_bParticle_Not_Rot, sizeof(bool), &dwRWC, NULL);
ReadFile(hFile, &m_vParticle_Not_Rot, sizeof(__Vector3), &dwRWC, NULL);
ReadFile(hFile, &m_fPtRangeMin, sizeof(float), &dwRWC, NULL);
ReadFile(hFile, &m_fPtRangeMax, sizeof(float), &dwRWC, NULL);
*/
}

Init();

return true;
Expand Down Expand Up @@ -1287,7 +1303,7 @@ void CN3FXPartParticles::Duplicate(CN3FXPartParticles * pSrc) {
if (m_dwEmitType == FX_PART_PARTICLE_EMIT_TYPE_SPREAD) {
m_uEmitCon.fEmitAngle = pSrc->m_uEmitCon.fEmitAngle;
} else if (m_dwEmitType == FX_PART_PARTICLE_EMIT_TYPE_GATHER) {
m_uEmitCon.vGatherPoint = m_uEmitCon.vGatherPoint;
m_uEmitCon.vGatherPoint = pSrc->m_uEmitCon.vGatherPoint;
}

m_vPtEmitDir = pSrc->m_vPtEmitDir;
Expand Down
3 changes: 3 additions & 0 deletions src/engine/N3Base/N3FXPartParticles.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class CN3FXPartParticles : public CN3FXPartBase {
float m_fScaleVelX;
float m_fScaleVelY;

bool m_bDistanceNumFix; // Needs Implementation
bool m_bParticleYAxisFix; // Needs Implementation

protected:
void Rotate();
void Scaling();
Expand Down
7 changes: 6 additions & 1 deletion src/engine/N3Base/N3ShapeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ void CN3ShapeMgr::ReleaseShapes() {
bool CN3ShapeMgr::Load(HANDLE hFile) {
DWORD dwRWC;
int nL = 0;

int TempVersion, TempIntStringLength;
ReadFile(hFile, &(TempVersion), sizeof(int), &dwRWC, NULL); // Read the map version
ReadFile(hFile, &(TempIntStringLength), sizeof(int), &dwRWC, NULL); // Read the map name char length
CHAR * TempOPDMapNamebuffer = new CHAR[TempIntStringLength / sizeof(char) + 1]{}; // Zero-initialized
ReadFile(hFile, TempOPDMapNamebuffer, TempIntStringLength, &dwRWC, NULL); // Now read it and push it back to the OPDMapName char buffer

if (false == LoadCollisionData(hFile)) {
return false;
}
Expand Down
21 changes: 19 additions & 2 deletions src/game/GameDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,11 @@ enum e_ItemSlot {
std::string szName; // ij���� �̸�
std::string szJointFN; // ���� ���� �̸�
std::string szAniFN; // ���ϸ��̼� ���� �̸�
std::string szPartFNs[7]; // �� Character Part - ��ü, ��ü, �Ӹ�, ��, �ٸ�, �Ӹ�ī��, ����
std::string szPartFNs[10]; // �� Character Part - ��ü, ��ü, �Ӹ�, ��, �ٸ�, �Ӹ�ī��, ����
std::string skipn3cskin0;
std::string skipn3char0;
std::string skipFXPlug;
int iunknownplooks0;

int iJointRH; // ������ �� ������ȣ
int iJointLH; // �޼� �� ������ȣ
Expand All @@ -1072,7 +1076,12 @@ enum e_ItemSlot {
int iSndID_Breathe0;
int iSndID_Breathe1;
int iSndID_Reserved0;
int iunknownplooks1; // not sure if this one is supposed to be here
int iSndID_Reserved1;
int iunknownplooks2; // not sure if this one is supposed to be here
BYTE byunknownplooks1;
BYTE byunknownplooks2;
BYTE byunknownplooks3;
} TABLE_PLAYER;

typedef struct __TABLE_EXCHANGE_QUEST {
Expand Down Expand Up @@ -1129,11 +1138,13 @@ typedef struct __TABLE_UPC_SKILL {
int iCastTime; // ij���� �ð�
int iReCastTime; // �ٽ� ij�����Ҷ����� �ɸ��� �ð�.

float fUnkown1; // TODO: implement
float fUnkown1; // TODO: implement does this have to do with cooldown timers ??
float fUnkown2; // TODO: implement does this have to do with cooldown timers ??
int iPercentSuccess; // ������
DWORD dw1stTableType; // ù��° Ÿ��.
DWORD dw2ndTableType; // �ι�° Ÿ��.
int iValidDist; // ��ȿ�Ÿ�
int iUnkown1; // TODO: implement

} TABLE_UPC_ATTACK_B;

Expand All @@ -1160,6 +1171,7 @@ typedef struct __TABLE_UPC_SKILL_TYPE_2 {

typedef struct __TABLE_UPC_SKILL_TYPE_3 {
DWORD dwID; // SKILL ���� ID
int iRadius; // TODO: Implement yo!
int iDDType;
int iStartDamage;
int iDuraDamage;
Expand All @@ -1170,14 +1182,18 @@ typedef struct __TABLE_UPC_SKILL_TYPE_3 {
typedef struct __TABLE_UPC_SKILL_TYPE_4 {
DWORD dwID; // �Ϸù�ȣ
int iBuffType; // ����Ÿ��
int iRadius; // TODO: implement
int iDuration;
int iAttackSpeed; // ���ݼӵ�
int iMoveSpeed; // �̵��ӵ�
int iAC; // ����
int iACPCT; // TODO: implement
int iAttack; // ���ݷ�
int iMagicAttack; // TODO: implement
int iMaxHP; // MAXHP
int iMaxHPPct; // TODO: implement
int iMaxMP; // TODO: implement
int iMaxMPPct; // TODO: implement
int iStr; // ��
int iSta; // ü��
int iDex; // ��ø
Expand All @@ -1189,6 +1205,7 @@ typedef struct __TABLE_UPC_SKILL_TYPE_4 {
int iMagicResist; // ��������
int iDeseaseResist; // ��������
int iPoisonResist; // ������
int iScrollMoveSpeed; // TODO: implement
} TABLE_UPC_SKILL_TYPE_4;

typedef struct __TABLE_UPC_SKILL_TYPE_5 {
Expand Down
2 changes: 1 addition & 1 deletion src/game/GameProcMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4173,7 +4173,7 @@ bool CGameProcMain::MsgSend_NPCEvent(short siIDTarget) {
int iOffset = 0;

CAPISocket::MP_AddByte(byBuff, iOffset, N3_WARP_LIST);
CAPISocket::MP_AddByte(byBuff, iOffset, WI.iID); // ���� ���̵� ������...
CAPISocket::MP_AddShort(byBuff, iOffset, WI.iID); // ���� ���̵� ������...
s_pSocket->Send(byBuff, iOffset);
}

Expand Down
96 changes: 77 additions & 19 deletions src/game/MagicSkillMng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,35 @@ bool CMagicSkillMng::CheckValidSkillMagic(__TABLE_UPC_SKILL * pSkill) {
int LeftItem = s_pPlayer->ItemClass_LeftHand();
int RightItem = s_pPlayer->ItemClass_RightHand();

if (pSkill->iNeedSkill == 1055 || pSkill->iNeedSkill == 2055) {
if ((LeftItem != ITEM_CLASS_SWORD && LeftItem != ITEM_CLASS_AXE && LeftItem != ITEM_CLASS_MACE) ||
(RightItem != ITEM_CLASS_SWORD && RightItem != ITEM_CLASS_AXE && RightItem != ITEM_CLASS_MACE)) {
if (pSkill->iNeedSkill == 1055 || pSkill->iNeedSkill == 2055 || pSkill->iNeedSkill == 1065 ||
pSkill->iNeedSkill == 2065)
{
// Check for a shield in the left hand or right hand
if (LeftItem == ITEM_CLASS_SHIELD || RightItem == ITEM_CLASS_SHIELD)
{
return false;
}
} else if (pSkill->iNeedSkill == 1056 || pSkill->iNeedSkill == 2056) {
if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H && RightItem != ITEM_CLASS_MACE_2H &&
RightItem != ITEM_CLASS_POLEARM) {

// Check for a weapon in the left hand
if (LeftItem != ITEM_CLASS_SWORD && LeftItem != ITEM_CLASS_AXE && LeftItem != ITEM_CLASS_MACE) {
// If there is no weapon in the left hand, check for a right-handed two-handed weapon
if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H && RightItem != ITEM_CLASS_MACE_2H &&
RightItem != ITEM_CLASS_POLEARM) {
return false;
}
}
}
else if (pSkill->iNeedSkill == 1056 || pSkill->iNeedSkill == 2056 || pSkill->iNeedSkill == 1066 ||
pSkill->iNeedSkill == 2066)
{
if (pSkill->dwNeedItem != 9)
{
// Check for a right-handed two-handed weapon
if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H && RightItem != ITEM_CLASS_MACE_2H &&
RightItem != ITEM_CLASS_POLEARM)
{
return false;
}
}
}

Expand All @@ -226,11 +246,12 @@ bool CMagicSkillMng::CheckValidSkillMagic(__TABLE_UPC_SKILL * pSkill) {
int LeftItem1 = LeftItem / 10;
int RightItem1 = RightItem / 10;

if (pSkill->dwNeedItem != 0 && pSkill->dwNeedItem != LeftItem1 && pSkill->dwNeedItem != RightItem1) {
if (pSkill->dwNeedItem != 0 && pSkill->dwNeedItem != 9 && pSkill->dwNeedItem != LeftItem1 &&
pSkill->dwNeedItem != RightItem1) {
return false;
}
if (pSkill->dwNeedItem == 0 && (pSkill->dw1stTableType == 1 || pSkill->dw2ndTableType == 1)) {
if (LeftItem != 11 && (LeftItem1 < 1 || LeftItem1 > 5) && RightItem1 != 11 &&
if (LeftItem != ITEM_CLASS_DAGGER && (LeftItem1 < 1 || LeftItem1 > 5) && RightItem1 != ITEM_CLASS_DAGGER &&
(RightItem1 < 1 || RightItem1 > 5)) {
return false;
}
Expand Down Expand Up @@ -558,23 +579,59 @@ bool CMagicSkillMng::CheckValidCondition(int iTargetID, __TABLE_UPC_SKILL * pSki
int LeftItem = s_pPlayer->ItemClass_LeftHand();
int RightItem = s_pPlayer->ItemClass_RightHand();

if (pSkill->iNeedSkill == 1055 || pSkill->iNeedSkill == 2055) {
if ((LeftItem != ITEM_CLASS_SWORD && LeftItem != ITEM_CLASS_AXE && LeftItem != ITEM_CLASS_MACE) ||
(RightItem != ITEM_CLASS_SWORD && RightItem != ITEM_CLASS_AXE && RightItem != ITEM_CLASS_MACE)) {
if (pSkill->iNeedSkill == 1055 || pSkill->iNeedSkill == 2055 || pSkill->iNeedSkill == 1065 ||
pSkill->iNeedSkill == 2065)
{
// Check for a shield in the left hand or right hand
if (LeftItem == ITEM_CLASS_SHIELD || RightItem == ITEM_CLASS_SHIELD)
{
std::string buff;
::_LoadStringFromResource(IDS_SKILL_FAIL_INVALID_ITEM, buff);
m_pGameProcMain->MsgOutput(buff, 0xffffff00);
return false;
}
} else if (pSkill->iNeedSkill == 1056 || pSkill->iNeedSkill == 2056) {
if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H && RightItem != ITEM_CLASS_MACE_2H &&
RightItem != ITEM_CLASS_POLEARM) {
std::string buff;
::_LoadStringFromResource(IDS_SKILL_FAIL_INVALID_ITEM, buff);
m_pGameProcMain->MsgOutput(buff, 0xffffff00);
return false;

// Check for a weapon in the left hand
if (LeftItem != ITEM_CLASS_SWORD && LeftItem != ITEM_CLASS_AXE && LeftItem != ITEM_CLASS_MACE ) {
// If there is no weapon in the left hand, check for a right-handed two-handed weapon
if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H && RightItem != ITEM_CLASS_MACE_2H &&
RightItem != ITEM_CLASS_POLEARM) {
std::string buff;
::_LoadStringFromResource(IDS_SKILL_FAIL_INVALID_ITEM, buff);
m_pGameProcMain->MsgOutput(buff, 0xffffff00);
return false;
}
}
}
else if (pSkill->iNeedSkill == 1056 || pSkill->iNeedSkill == 2056 || pSkill->iNeedSkill == 1066 ||
pSkill->iNeedSkill == 2066)
{
if (pSkill->dw1stTableType == 1 || pSkill->dw2ndTableType == 1)
{
// Check for a right-handed two-handed weapon
if (LeftItem != ITEM_CLASS_SWORD && LeftItem != ITEM_CLASS_AXE && LeftItem != ITEM_CLASS_MACE)
{
// If there is no weapon in the left hand, check for a right-handed two-handed weapon
if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H &&
RightItem != ITEM_CLASS_MACE_2H && RightItem != ITEM_CLASS_POLEARM)
{
std::string buff;
::_LoadStringFromResource(IDS_SKILL_FAIL_INVALID_ITEM, buff);
m_pGameProcMain->MsgOutput(buff, 0xffffff00);
return false;
}
}
}
}
//
//if (RightItem != ITEM_CLASS_SWORD_2H && RightItem != ITEM_CLASS_AXE_2H && RightItem != ITEM_CLASS_MACE_2H &&
// RightItem != ITEM_CLASS_POLEARM) {
// std::string buff;
// ::_LoadStringFromResource(IDS_SKILL_FAIL_INVALID_ITEM, buff);
// m_pGameProcMain->MsgOutput(buff, 0xffffff00);
// /*return false;*/
//}


if (pInfoBase->iHP < pSkill->iExhaustHP) {
std::string buff;
Expand All @@ -586,7 +643,8 @@ bool CMagicSkillMng::CheckValidCondition(int iTargetID, __TABLE_UPC_SKILL * pSki
int LeftItem1 = LeftItem / 10;
int RightItem1 = RightItem / 10;

if (pSkill->dwNeedItem != 0 && pSkill->dwNeedItem != LeftItem1 && pSkill->dwNeedItem != RightItem1) {
if (pSkill->dwNeedItem != 0 && pSkill->dwNeedItem != 9&& pSkill->dwNeedItem != LeftItem1 &&
pSkill->dwNeedItem != RightItem1) {
std::string buff;
::_LoadStringFromResource(IDS_SKILL_FAIL_INVALID_ITEM, buff);
m_pGameProcMain->MsgOutput(buff, 0xffffff00);
Expand Down
9 changes: 9 additions & 0 deletions src/game/N3FXBundleGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,15 @@ bool CN3FXBundleGame::Load(HANDLE hFile) {
ReadFile(hFile, &m_bStatic, sizeof(bool), &dwRWC, NULL);
}

if (m_iVersion == 3) {
ReadFile(hFile, &m_bEarthQuake, sizeof(bool), &dwRWC, NULL);
if (m_bEarthQuake) {
ReadFile(hFile, &m_fEarthQuakeStartTime, sizeof(float), &dwRWC, NULL);
} else {
m_fEarthQuakeStartTime = 0;
}
}

return true;
}

Expand Down
5 changes: 5 additions & 0 deletions src/game/N3Terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ bool CN3Terrain::Load(HANDLE hFile) {
}

DWORD dwRWC;
int TempVersion, TempIntStringLength;
ReadFile(hFile, &(TempVersion), sizeof(int), &dwRWC, NULL); // Read the map version
ReadFile(hFile, &(TempIntStringLength), sizeof(int), &dwRWC, NULL); // Read the map name char length
CHAR * TempGTDMapNamebuffer = new CHAR[TempIntStringLength / sizeof(char) + 1]{}; // Zero-initialized
ReadFile(hFile, TempGTDMapNamebuffer, TempIntStringLength, &dwRWC, NULL); // Now read it and push it back to the GTDMapName char buffer
ReadFile(hFile, &(m_ti_MapSize), sizeof(int), &dwRWC, NULL);
m_pat_MapSize = (m_ti_MapSize - 1) / PATCH_TILE_SIZE;

Expand Down
Loading