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

Fix teleports #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Projects/TMProject/TMFieldScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7857,7 +7857,7 @@ int TMFieldScene::FrameMove(unsigned int dwServerTime)
int x = (int)m_pMyHuman->m_vecPosition.x & 0xFFFC;
int y = (int)m_pMyHuman->m_vecPosition.y & 0xFFFC;

for (int ll = 0; ll < 37; ++ll)
for (int ll = 0; ll < 42; ++ll)
{
if (g_TeleportTable[ll].nX == x && g_TeleportTable[ll].nY == y)
{
Expand Down
9 changes: 7 additions & 2 deletions Projects/TMProject/TMGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const static TMVector3 g_vecItemBillPos[28] =
{0.76899999f, 0.509f, -1.143f},
};

const static stTeleportPos g_TeleportTable[37] =
const static stTeleportPos g_TeleportTable[42] =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vamos aproveitar e mudar para

constexpr std::array g_TeleportTable

A inicialização fica assim (sem contar com a parte que você adicionou):

constexpr std::array g_TeleportTable =
{
  stTeleportPos { 2116, 2100, 700, g_pMessageStringTable[209] },
  stTeleportPos { 2480, 1716, 700, g_pMessageStringTable[209] },
  stTeleportPos { 2456, 2016, 700, g_pMessageStringTable[209] },
  stTeleportPos { 3648, 3108, 0, g_pMessageStringTable[209] },
  stTeleportPos { 1044, 1724, 0, g_pMessageStringTable[125] },
  stTeleportPos { 1044, 1716, 0, g_pMessageStringTable[126] },
  stTeleportPos { 1044, 1708, 0, g_pMessageStringTable[173] },
  stTeleportPos { 1048, 1764, 0, g_pMessageStringTable[210] },
  stTeleportPos { 2140, 2068, 0, g_pMessageStringTable[213] },
  stTeleportPos { 2468, 1716, 0, g_pMessageStringTable[211] },
  stTeleportPos { 2364, 2284, 0, g_pMessageStringTable[212] },
  stTeleportPos { 144, 3788, 0, g_pMessageStringTable[213] },
  stTeleportPos { 2668, 2156, 0, g_pMessageStringTable[212] },
  stTeleportPos { 144, 3772, 0, g_pMessageStringTable[213] },
  stTeleportPos { 148, 3780, 0, g_pMessageStringTable[215] },
  stTeleportPos { 144, 3780, 0, g_pMessageStringTable[215] },
  stTeleportPos { 1004, 4028, 0, g_pMessageStringTable[214] },
  stTeleportPos { 408, 4072, 0, g_pMessageStringTable[215] },
  stTeleportPos { 1004, 4064, 0, g_pMessageStringTable[214] },
  stTeleportPos { 744, 3820, 0, g_pMessageStringTable[215] },
  stTeleportPos { 1004, 3992, 0, g_pMessageStringTable[214] },
  stTeleportPos { 680, 4076, 0, g_pMessageStringTable[216] },
  stTeleportPos { 916, 3820, 0, g_pMessageStringTable[215] },
  stTeleportPos { 876, 3872, 0, g_pMessageStringTable[216] },
  stTeleportPos { 932, 3820, 0, g_pMessageStringTable[215] },
  stTeleportPos { 188, 188, 0, g_pMessageStringTable[126] },
  stTeleportPos { 2548, 1740, 1000, g_pMessageStringTable[322] },
  stTeleportPos { 1824, 1772, 0, g_pMessageStringTable[218] },
  stTeleportPos { 1172, 4080, 0, g_pMessageStringTable[211] },
  stTeleportPos { 1516, 3996, 0, g_pMessageStringTable[220] },
  stTeleportPos { 1304, 3816, 0, g_pMessageStringTable[219] },
  stTeleportPos { 2452, 1716, 0, g_pMessageStringTable[211] },
  stTeleportPos { 2452, 1988, 0, g_pMessageStringTable[211] },
  stTeleportPos { 3648, 3140, 700, g_pMessageStringTable[211] },
  stTeleportPos { 2480, 1648, 700, g_pMessageStringTable[301] },
  stTeleportPos { 1052, 1708, 0, g_pMessageStringTable[321] },
  stTeleportPos { 1056, 1724, 0, g_pMessageStringTable[485] }
};

Sendo assim, trocaremos os acessos para um range-based for loop ou pelo menos usar o size() para iterar usando o índice. Solicito isto porque chequei o código, e você alterou apenas um dos acessos a array g_TeleportTable, e alterando já para .len() ou range-based for torna mais difícil de errar no futuro.

{
{ 2116, 2100, 700, g_pMessageStringTable[209] },
{ 2480, 1716, 700, g_pMessageStringTable[209] },
Expand Down Expand Up @@ -228,7 +228,12 @@ const static stTeleportPos g_TeleportTable[37] =
{ 3648, 3140, 700, g_pMessageStringTable[211] },
{ 2480, 1648, 700, g_pMessageStringTable[301] },
{ 1052, 1708, 0, g_pMessageStringTable[321] },
{ 1056, 1724, 0, g_pMessageStringTable[485] }
{ 1056, 1724, 0, g_pMessageStringTable[485] },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fiquei na dúvida quanto as posições.
Você seguiu o padrão das posições acima? Se não me engano, a posição fica centralizada no teleporte. Gostaria apenas de confirmar

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Segui conforme o padrão dos outros teleports, com exceção do portal da sala do kefra.



Copy link

@DaviCardosoDaCunha DaviCardosoDaCunha Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eu fiz como solicitado , o teleporte de Noatun -> Khepra foi corrigido . Mas o teleporte de Khepra -> Noatun ainda continua bugado mesmo eu colocando a coordenada da forma que vc pôs na imagem 2364, 4072

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bom, eu vou dar uma olhada nas coordenadas e analisar o problema melhor antes de mergear.

De qualquer forma, eu solicite mudanças quanto a array. Quando tiver um tempo para isso :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opa meu querido acabei de notar que tem que alterar aqui tb
em : TMFieldScene.cpp
na linha 7860 : for (int ll = 0; ll < 42; ++ll)

{ 1312, 1900, 0, g_pMessageStringTable[322] }, // Noatun -> Kefra
{ 2364, 4072, 0, g_pMessageStringTable[209] }, // Kefra -> Noatun
{ 2360, 3892, 0, g_pMessageStringTable[322] }, // Kefra -> KefraBoss
{ 2364, 3892, 0, g_pMessageStringTable[322] }, // Kefra -> KefraBoss
{ 2368, 3892, 0, g_pMessageStringTable[322] } // Kefra -> KefraBoss
};

static unsigned int g_dwFoodColor[7] =
Expand Down