|
|
|
|
@ -1482,7 +1482,7 @@ bool InitNewSpell(Player &player, uint16_t wParamSpellID, uint16_t wParamSpellTy
|
|
|
|
|
|
|
|
|
|
size_t OnSpellWall(const TCmd *pCmd, Player &player) |
|
|
|
|
{ |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdLocParam5 *>(pCmd); |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdLocParam4 *>(pCmd); |
|
|
|
|
const Point position { message.x, message.y }; |
|
|
|
|
|
|
|
|
|
if (gbBufferMsgs == 1) |
|
|
|
|
@ -1495,7 +1495,7 @@ size_t OnSpellWall(const TCmd *pCmd, Player &player)
|
|
|
|
|
if (wParamDirection > static_cast<uint16_t>(Direction::SouthEast)) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
if (!InitNewSpell(player, message.wParam1, message.wParam2, message.wParam5)) |
|
|
|
|
if (!InitNewSpell(player, message.wParam1, message.wParam2, message.wParam4)) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
ClrPlrPath(player); |
|
|
|
|
@ -1503,14 +1503,14 @@ size_t OnSpellWall(const TCmd *pCmd, Player &player)
|
|
|
|
|
player.destParam1 = position.x; |
|
|
|
|
player.destParam2 = position.y; |
|
|
|
|
player.destParam3 = wParamDirection; |
|
|
|
|
player.destParam4 = SDL_SwapLE16(message.wParam4); // Spell Level
|
|
|
|
|
player.destParam4 = player.GetSpellLevel(player.queuedSpell.spellId); |
|
|
|
|
|
|
|
|
|
return sizeof(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
size_t OnSpellTile(const TCmd *pCmd, Player &player) |
|
|
|
|
{ |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdLocParam4 *>(pCmd); |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdLocParam3 *>(pCmd); |
|
|
|
|
const Point position { message.x, message.y }; |
|
|
|
|
|
|
|
|
|
if (gbBufferMsgs == 1) |
|
|
|
|
@ -1520,14 +1520,14 @@ size_t OnSpellTile(const TCmd *pCmd, Player &player)
|
|
|
|
|
if (!InDungeonBounds(position)) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
if (!InitNewSpell(player, message.wParam1, message.wParam2, message.wParam4)) |
|
|
|
|
if (!InitNewSpell(player, message.wParam1, message.wParam2, message.wParam3)) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
ClrPlrPath(player); |
|
|
|
|
player.destAction = ACTION_SPELL; |
|
|
|
|
player.destParam1 = position.x; |
|
|
|
|
player.destParam2 = position.y; |
|
|
|
|
player.destParam3 = SDL_SwapLE16(message.wParam3); // Spell Level
|
|
|
|
|
player.destParam3 = player.GetSpellLevel(player.queuedSpell.spellId); |
|
|
|
|
|
|
|
|
|
return sizeof(message); |
|
|
|
|
} |
|
|
|
|
@ -1609,7 +1609,7 @@ size_t OnRangedAttackPlayer(const TCmd *pCmd, Player &player)
|
|
|
|
|
|
|
|
|
|
size_t OnSpellMonster(const TCmd *pCmd, Player &player) |
|
|
|
|
{ |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdParam5 *>(pCmd); |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdParam4 *>(pCmd); |
|
|
|
|
|
|
|
|
|
if (gbBufferMsgs == 1) |
|
|
|
|
return sizeof(message); |
|
|
|
|
@ -1619,20 +1619,20 @@ size_t OnSpellMonster(const TCmd *pCmd, Player &player)
|
|
|
|
|
if (monsterIdx >= MaxMonsters) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
if (!InitNewSpell(player, message.wParam2, message.wParam3, message.wParam5)) |
|
|
|
|
if (!InitNewSpell(player, message.wParam2, message.wParam3, message.wParam4)) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
ClrPlrPath(player); |
|
|
|
|
player.destAction = ACTION_SPELLMON; |
|
|
|
|
player.destParam1 = monsterIdx; |
|
|
|
|
player.destParam2 = SDL_SwapLE16(message.wParam4); // Spell Level
|
|
|
|
|
player.destParam2 = player.GetSpellLevel(player.queuedSpell.spellId); |
|
|
|
|
|
|
|
|
|
return sizeof(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
size_t OnSpellPlayer(const TCmd *pCmd, Player &player) |
|
|
|
|
{ |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdParam5 *>(pCmd); |
|
|
|
|
const auto &message = *reinterpret_cast<const TCmdParam4 *>(pCmd); |
|
|
|
|
|
|
|
|
|
if (gbBufferMsgs == 1) |
|
|
|
|
return sizeof(message); |
|
|
|
|
@ -1642,13 +1642,13 @@ size_t OnSpellPlayer(const TCmd *pCmd, Player &player)
|
|
|
|
|
if (playerIdx >= Players.size()) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
if (!InitNewSpell(player, message.wParam2, message.wParam3, message.wParam5)) |
|
|
|
|
if (!InitNewSpell(player, message.wParam2, message.wParam3, message.wParam4)) |
|
|
|
|
return sizeof(message); |
|
|
|
|
|
|
|
|
|
ClrPlrPath(player); |
|
|
|
|
player.destAction = ACTION_SPELLPLR; |
|
|
|
|
player.destParam1 = playerIdx; |
|
|
|
|
player.destParam2 = SDL_SwapLE16(message.wParam4); // Spell Level
|
|
|
|
|
player.destParam2 = player.GetSpellLevel(player.queuedSpell.spellId); |
|
|
|
|
|
|
|
|
|
return sizeof(message); |
|
|
|
|
} |
|
|
|
|
@ -2954,29 +2954,6 @@ void NetSendCmdLocParam4(bool bHiPri, _cmd_id bCmd, Point position, uint16_t wPa
|
|
|
|
|
MyPlayer->UpdatePreviewCelSprite(bCmd, position, wParam1, wParam3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void NetSendCmdLocParam5(bool bHiPri, _cmd_id bCmd, Point position, uint16_t wParam1, uint16_t wParam2, uint16_t wParam3, uint16_t wParam4, uint16_t wParam5) |
|
|
|
|
{ |
|
|
|
|
if (WasPlayerCmdAlreadyRequested(bCmd, position, wParam1, wParam2, wParam3, wParam4, wParam5)) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
TCmdLocParam5 cmd; |
|
|
|
|
|
|
|
|
|
cmd.bCmd = bCmd; |
|
|
|
|
cmd.x = position.x; |
|
|
|
|
cmd.y = position.y; |
|
|
|
|
cmd.wParam1 = SDL_SwapLE16(wParam1); |
|
|
|
|
cmd.wParam2 = SDL_SwapLE16(wParam2); |
|
|
|
|
cmd.wParam3 = SDL_SwapLE16(wParam3); |
|
|
|
|
cmd.wParam4 = SDL_SwapLE16(wParam4); |
|
|
|
|
cmd.wParam5 = SDL_SwapLE16(wParam5); |
|
|
|
|
if (bHiPri) |
|
|
|
|
NetSendHiPri(MyPlayerId, (std::byte *)&cmd, sizeof(cmd)); |
|
|
|
|
else |
|
|
|
|
NetSendLoPri(MyPlayerId, (std::byte *)&cmd, sizeof(cmd)); |
|
|
|
|
|
|
|
|
|
MyPlayer->UpdatePreviewCelSprite(bCmd, position, wParam1, wParam3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void NetSendCmdParam1(bool bHiPri, _cmd_id bCmd, uint16_t wParam1) |
|
|
|
|
{ |
|
|
|
|
if (WasPlayerCmdAlreadyRequested(bCmd, {}, wParam1)) |
|
|
|
|
@ -3007,19 +2984,18 @@ void NetSendCmdParam2(bool bHiPri, _cmd_id bCmd, uint16_t wParam1, uint16_t wPar
|
|
|
|
|
NetSendLoPri(MyPlayerId, (std::byte *)&cmd, sizeof(cmd)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void NetSendCmdParam5(bool bHiPri, _cmd_id bCmd, uint16_t wParam1, uint16_t wParam2, uint16_t wParam3, uint16_t wParam4, uint16_t wParam5) |
|
|
|
|
void NetSendCmdParam4(bool bHiPri, _cmd_id bCmd, uint16_t wParam1, uint16_t wParam2, uint16_t wParam3, uint16_t wParam4) |
|
|
|
|
{ |
|
|
|
|
if (WasPlayerCmdAlreadyRequested(bCmd, {}, wParam1, wParam2, wParam3, wParam4)) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
TCmdParam5 cmd; |
|
|
|
|
TCmdParam4 cmd; |
|
|
|
|
|
|
|
|
|
cmd.bCmd = bCmd; |
|
|
|
|
cmd.wParam1 = SDL_SwapLE16(wParam1); |
|
|
|
|
cmd.wParam2 = SDL_SwapLE16(wParam2); |
|
|
|
|
cmd.wParam3 = SDL_SwapLE16(wParam3); |
|
|
|
|
cmd.wParam4 = SDL_SwapLE16(wParam4); |
|
|
|
|
cmd.wParam5 = SDL_SwapLE16(wParam5); |
|
|
|
|
if (bHiPri) |
|
|
|
|
NetSendHiPri(MyPlayerId, (std::byte *)&cmd, sizeof(cmd)); |
|
|
|
|
else |
|
|
|
|
|