From 95dcffc9721f6497fd95fcf6285bc95967c761d4 Mon Sep 17 00:00:00 2001 From: Borja Ferrer Date: Sun, 11 Mar 2007 19:26:47 +0000 Subject: [PATCH] user messages tested and working fixed some floating point casts --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40603 --- core/UserMessages.cpp | 12 +++++++----- core/UserMessages.h | 1 + core/smn_entities.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/UserMessages.cpp b/core/UserMessages.cpp index 0f8a8c38..6e0b6f23 100644 --- a/core/UserMessages.cpp +++ b/core/UserMessages.cpp @@ -244,6 +244,7 @@ bf_write *CUserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_ty m_CurId = msg_type; m_CurRecFilter = filter; m_InHook = true; + m_BlockEndPost = false; if (!is_intercept_empty) { @@ -268,7 +269,7 @@ bf_write *CUserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_t void CUserMessages::OnMessageEnd_Post() { - if (!m_InHook || (META_RESULT_STATUS == MRES_SUPERCEDE)) + if (!m_InHook || m_BlockEndPost) { RETURN_META(MRES_IGNORED); } @@ -340,6 +341,8 @@ void CUserMessages::OnMessageEnd_Pre() pInfo->IsHooked = true; res = pInfo->Callback->InterceptUserMessage(m_CurId, &m_InterceptBuffer, m_CurRecFilter); + intercepted = true; + switch (res) { case Pl_Stop: @@ -375,10 +378,10 @@ void CUserMessages::OnMessageEnd_Pre() _DecRefCounter(); continue; } + break; } } pInfo->IsHooked = false; - intercepted = true; iter++; } @@ -395,8 +398,6 @@ void CUserMessages::OnMessageEnd_Pre() m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten()); engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten()); ENGINE_CALL(MessageEnd)(); - - goto supercede; } pList = &m_msgHooks[m_CurId]; @@ -418,8 +419,9 @@ void CUserMessages::OnMessageEnd_Pre() iter++; } - RETURN_META(MRES_IGNORED); + RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED); supercede: m_InHook = false; + m_BlockEndPost = true; RETURN_META(MRES_SUPERCEDE); } diff --git a/core/UserMessages.h b/core/UserMessages.h index b9d5abf0..5f833f7b 100644 --- a/core/UserMessages.h +++ b/core/UserMessages.h @@ -71,6 +71,7 @@ private: bf_read m_ReadBuffer; size_t m_HookCount; bool m_InHook; + bool m_BlockEndPost; Trie *m_Names; CellRecipientFilter m_CellRecFilter; diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index 5f0a9f4d..d38d1325 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -351,9 +351,9 @@ static cell_t GetEntDataVector(IPluginContext *pContext, const cell_t *params) cell_t *vec; pContext->LocalToPhysAddr(params[3], &vec); - vec[0] = v->x; - vec[1] = v->y; - vec[2] = v->z; + vec[0] = sp_ftoc(v->x); + vec[1] = sp_ftoc(v->y); + vec[2] = sp_ftoc(v->z); return 1; } @@ -379,9 +379,9 @@ static cell_t SetEntDataVector(IPluginContext *pContext, const cell_t *params) cell_t *vec; pContext->LocalToPhysAddr(params[3], &vec); - v->x = vec[0]; - v->y = vec[1]; - v->z = vec[2]; + v->x = sp_ctof(vec[0]); + v->y = sp_ctof(vec[1]); + v->z = sp_ctof(vec[2]); if (params[4]) {