From 8c76dc34aff2a5c277bf93d22bab4244cf0f3771 Mon Sep 17 00:00:00 2001 From: janwas Date: Mon, 31 Oct 2005 16:26:51 +0000 Subject: [PATCH] g_keys[] has been made redundant by SDL's key array; use SDL_GetKeyState instead to get address of new keys array fix W4 warnings (unused param and type conversion mostly) This was SVN commit r3068. --- source/graphics/TerrainProperties.cpp | 13 ++++++++++- source/gui/CGUI.cpp | 5 +++-- source/gui/CInput.cpp | 22 +++++++++++-------- source/lib/sysdep/win/wsdl.cpp | 16 +++++++++++--- source/lib/sysdep/win/wsdl.h | 2 +- source/ps/CConsole.cpp | 10 +++++---- source/ps/Globals.cpp | 13 ----------- source/ps/Globals.h | 1 - source/ps/Hotkey.cpp | 19 ++++++++-------- source/ps/Hotkey.h | 17 +++++++------- .../renderer/FixedFunctionModelRenderer.cpp | 6 ++--- source/renderer/HWLightingModelRenderer.cpp | 7 +++--- source/renderer/InstancingModelRenderer.cpp | 10 ++++----- source/renderer/ModelRenderer.cpp | 2 +- source/renderer/PlayerRenderer.cpp | 6 ++--- source/renderer/RenderModifiers.cpp | 22 +++++++++---------- source/renderer/TransparencyRenderer.cpp | 19 ++++++++-------- source/renderer/VertexArray.h | 2 +- 18 files changed, 103 insertions(+), 89 deletions(-) diff --git a/source/graphics/TerrainProperties.cpp b/source/graphics/TerrainProperties.cpp index c65963033f..915ea281ba 100644 --- a/source/graphics/TerrainProperties.cpp +++ b/source/graphics/TerrainProperties.cpp @@ -101,7 +101,18 @@ void CTerrainProperties::LoadXML(XMBElement node, CXeromyces *pFile) ATTR(on); #undef ELMT #undef ATTR - + + // stomp on "unused" warnings + UNUSED2(attr_effect); + UNUSED2(attr_name); + UNUSED2(attr_type); + UNUSED2(attr_on); + UNUSED2(attr_speed); + UNUSED2(attr_max); + UNUSED2(elmt_event); + UNUSED2(elmt_passable); + UNUSED2(elmt_doodad); + XMBAttributeList attribs = node.getAttributes(); for (int i=0;itype == SDL_KEYDOWN && ev->key.keysym.sym != SDLK_ESCAPE && - !g_keys[SDLK_LCTRL] && !g_keys[SDLK_RCTRL] && - !g_keys[SDLK_LALT] && !g_keys[SDLK_RALT]) + !keys[SDLK_LCTRL] && !keys[SDLK_RCTRL] && + !keys[SDLK_LALT] && !keys[SDLK_RALT]) || ev->type == SDL_HOTKEYDOWN ) { diff --git a/source/gui/CInput.cpp b/source/gui/CInput.cpp index bb2e822b1d..ae7f519a8c 100755 --- a/source/gui/CInput.cpp +++ b/source/gui/CInput.cpp @@ -63,6 +63,8 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) // pointer and edit that. CStrW *pCaption = (CStrW*)m_Settings["caption"].m_pSetting; + Uint8* keys = SDL_GetKeyState(0); + if (ev->type == SDL_HOTKEYDOWN) { if (ev->user.code == HOTKEY_CONSOLE_PASTE) @@ -149,7 +151,7 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) case SDLK_HOME: // If there's not a selection, we should create one now - if (!g_keys[SDLK_RSHIFT] && !g_keys[SDLK_LSHIFT]) + if (!keys[SDLK_RSHIFT] && !keys[SDLK_LSHIFT]) { // Make sure a selection isn't created. m_iBufferPos_Tail = -1; @@ -168,7 +170,7 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) case SDLK_END: // If there's not a selection, we should create one now - if (!g_keys[SDLK_RSHIFT] && !g_keys[SDLK_LSHIFT]) + if (!keys[SDLK_RSHIFT] && !keys[SDLK_LSHIFT]) { // Make sure a selection isn't created. m_iBufferPos_Tail = -1; @@ -211,11 +213,11 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) // reset m_WantedX, very important m_WantedX=0.f; - if (g_keys[SDLK_RSHIFT] || g_keys[SDLK_LSHIFT] || + if (keys[SDLK_RSHIFT] || keys[SDLK_LSHIFT] || !SelectingText()) { // If there's not a selection, we should create one now - if (!SelectingText() && !g_keys[SDLK_RSHIFT] && !g_keys[SDLK_LSHIFT]) + if (!SelectingText() && !keys[SDLK_RSHIFT] && !keys[SDLK_LSHIFT]) { // Make sure a selection isn't created. m_iBufferPos_Tail = -1; @@ -243,11 +245,11 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) case SDLK_RIGHT: m_WantedX=0.f; - if (g_keys[SDLK_RSHIFT] || g_keys[SDLK_LSHIFT] || + if (keys[SDLK_RSHIFT] || keys[SDLK_LSHIFT] || !SelectingText()) { // If there's not a selection, we should create one now - if (!SelectingText() && !g_keys[SDLK_RSHIFT] && !g_keys[SDLK_LSHIFT]) + if (!SelectingText() && !keys[SDLK_RSHIFT] && !keys[SDLK_LSHIFT]) { // Make sure a selection isn't created. m_iBufferPos_Tail = -1; @@ -296,7 +298,7 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) case SDLK_UP: { // If there's not a selection, we should create one now - if (!g_keys[SDLK_RSHIFT] && !g_keys[SDLK_LSHIFT]) + if (!keys[SDLK_RSHIFT] && !keys[SDLK_LSHIFT]) { // Make sure a selection isn't created. m_iBufferPos_Tail = -1; @@ -344,7 +346,7 @@ InReaction CInput::ManuallyHandleEvent(const SDL_Event* ev) case SDLK_DOWN: { // If there's not a selection, we should create one now - if (!g_keys[SDLK_RSHIFT] && !g_keys[SDLK_LSHIFT]) + if (!keys[SDLK_RSHIFT] && !keys[SDLK_LSHIFT]) { // Make sure a selection isn't created. m_iBufferPos_Tail = -1; @@ -452,6 +454,8 @@ void CInput::HandleMessage(const SGUIMessage &Message) // TODO Gee: IGUIScrollBarOwner::HandleMessage(Message); + Uint8* keys = SDL_GetKeyState(0); + switch (Message.type) { case GUIM_SETTINGS_UPDATED: @@ -529,7 +533,7 @@ void CInput::HandleMessage(const SGUIMessage &Message) // instance, if we press between a and b, the point // should of course be placed accordingly. Other // special cases are handled like the input box norms. - if (g_keys[SDLK_RSHIFT] || g_keys[SDLK_LSHIFT]) + if (keys[SDLK_RSHIFT] || keys[SDLK_LSHIFT]) { m_iBufferPos = GetMouseHoveringTextPosition(); } diff --git a/source/lib/sysdep/win/wsdl.cpp b/source/lib/sysdep/win/wsdl.cpp index ca967be227..c8807a1cff 100755 --- a/source/lib/sysdep/win/wsdl.cpp +++ b/source/lib/sysdep/win/wsdl.cpp @@ -232,7 +232,7 @@ int SDL_SetGamma(float r, float g, float b) //---------------------------------------------------------------------------- -static bool keys[SDLK_LAST]; +static Uint8 keys[SDLK_LAST]; static void init_vkmap(SDLKey (&VK_keymap)[256]) { @@ -344,6 +344,16 @@ static void reset_all_keys() } +Uint8* SDL_GetKeyState(int* num_keys) +{ + if(num_keys) + *num_keys = SDLK_LAST; + return keys; +} + + +//---------------------------------------------------------------------------- + static LRESULT CALLBACK wndproc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam) { if(is_shutdown) @@ -449,7 +459,7 @@ static LRESULT CALLBACK wndproc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lPar { uint sdlk = vkmap((int)wParam); if(sdlk != SDLK_UNKNOWN) - keys[sdlk] = false; + keys[sdlk] = 0; SDL_Event ev; ev.type = SDL_KEYUP; @@ -464,7 +474,7 @@ static LRESULT CALLBACK wndproc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lPar { uint sdlk = vkmap((int)wParam); if(sdlk != SDLK_UNKNOWN) - keys[sdlk] = true; + keys[sdlk] = 1; break; } diff --git a/source/lib/sysdep/win/wsdl.h b/source/lib/sysdep/win/wsdl.h index 9d78475660..6fffd14ebc 100755 --- a/source/lib/sysdep/win/wsdl.h +++ b/source/lib/sysdep/win/wsdl.h @@ -282,7 +282,7 @@ extern int SDL_PushEvent(SDL_Event* ev); extern void SDL_WM_SetCaption(const char *title, const char *icon); - +extern Uint8* SDL_GetKeyState(int* num_keys); diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index c6a749cd93..f0a4196479 100755 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -301,6 +301,8 @@ void CConsole::InsertChar(const int szChar, const wchar_t cooked ) if (!m_bVisible) return; + Uint8* keys = SDL_GetKeyState(0); + switch (szChar){ case '\r': case '\n': @@ -344,7 +346,7 @@ void CConsole::InsertChar(const int szChar, const wchar_t cooked ) return; case SDLK_HOME: - if (g_keys[SDLK_RCTRL] || g_keys[SDLK_LCTRL]) + if (keys[SDLK_RCTRL] || keys[SDLK_LCTRL]) { int linesShown = (int)m_fHeight/m_iFontHeight - 4; m_iMsgHistPos = clamp((int)m_deqMsgHistory.size() - linesShown, 1, (int)m_deqMsgHistory.size()); @@ -356,7 +358,7 @@ void CConsole::InsertChar(const int szChar, const wchar_t cooked ) return; case SDLK_END: - if (g_keys[SDLK_RCTRL] || g_keys[SDLK_LCTRL]) + if (keys[SDLK_RCTRL] || keys[SDLK_LCTRL]) { m_iMsgHistPos = 1; } @@ -671,8 +673,8 @@ InReaction conInputHandler(const SDL_Event* ev) // SB: Not safe, really.. Swedish keyboards have {[]} on AltGr (Ctrl-Alt) // for example, so I commented those tests. if( ( ev->key.keysym.sym != SDLK_ESCAPE ) && - /*!g_keys[SDLK_LCTRL] && !g_keys[SDLK_RCTRL] && - !g_keys[SDLK_LALT] && !g_keys[SDLK_RALT] &&*/ + /*!keys[SDLK_LCTRL] && !keys[SDLK_RCTRL] && + !keys[SDLK_LALT] && !keys[SDLK_RALT] &&*/ !hotkeys[HOTKEY_CONSOLE_TOGGLE] ) g_Console->InsertChar(sym, (wchar_t)ev->key.keysym.unicode ); diff --git a/source/ps/Globals.cpp b/source/ps/Globals.cpp index 127a78ca6c..d909cde24f 100644 --- a/source/ps/Globals.cpp +++ b/source/ps/Globals.cpp @@ -31,19 +31,6 @@ InReaction GlobalsInputHandler(const SDL_Event* ev) g_mouse_y = ev->motion.y; return IN_PASS; - case SDL_KEYDOWN: - case SDL_KEYUP: - c = ev->key.keysym.sym; - if(c < ARRAY_SIZE(g_keys)) - g_keys[c] = (ev->type == SDL_KEYDOWN); - else - { - // don't complain: this happens when the hotkey system - // spoofs keys (it assigns values starting from SDLK_LAST) - //debug_warn("invalid key"); - } - return IN_PASS; - case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: c = ev->button.button; diff --git a/source/ps/Globals.h b/source/ps/Globals.h index a00d24b26d..a4acac793c 100644 --- a/source/ps/Globals.h +++ b/source/ps/Globals.h @@ -1,6 +1,5 @@ extern bool g_active; -extern bool g_keys[SDLK_LAST]; extern int g_mouse_x, g_mouse_y; diff --git a/source/ps/Hotkey.cpp b/source/ps/Hotkey.cpp index 38b8635bda..5d36705a03 100755 --- a/source/ps/Hotkey.cpp +++ b/source/ps/Hotkey.cpp @@ -10,7 +10,7 @@ extern CConsole* g_Console; -static bool unified[5]; +static Uint8 unified[5]; /* SDL-type */ @@ -47,7 +47,7 @@ const int HK_MAX_KEYCODES = UNIFIED_SUPER + 1; static KeyMapping hotkeyMap[HK_MAX_KEYCODES]; // An array of the status of virtual keys -bool hotkeys[HOTKEY_LAST]; +Uint8 hotkeys[HOTKEY_LAST]; struct SHotkeyInfo @@ -320,6 +320,7 @@ void hotkeyRegisterGUIObject( const CStr& objName, const CStr& hotkeyName ) InReaction hotkeyInputHandler( const SDL_Event* ev ) { int keycode = 0; + Uint8* keys = SDL_GetKeyState(0); switch( ev->type ) { @@ -425,17 +426,17 @@ InReaction hotkeyInputHandler( const SDL_Event* ev ) for( itKey = it->requires.begin(); itKey != it->requires.end(); itKey++ ) { int keyCode = *itKey & ~HOTKEY_NEGATION_FLAG; // Clear the negation-modifier bit - bool rqdState = !( *itKey & HOTKEY_NEGATION_FLAG ); + Uint8 rqdState = ( *itKey & HOTKEY_NEGATION_FLAG ) == 0; // debug_assert( !rqdState ); if( keyCode < SDLK_LAST ) { - if( g_keys[keyCode] != rqdState ) accept = false; + if( keys[keyCode] != rqdState ) accept = false; } else if( keyCode < UNIFIED_SHIFT ) { - if( g_mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false; + if( (Uint8)g_mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false; } else if( (uint)(keyCode-UNIFIED_SHIFT) < ARRAY_SIZE(unified) ) { @@ -496,15 +497,15 @@ InReaction hotkeyInputHandler( const SDL_Event* ev ) for( itKey = itGUI->requires.begin(); itKey != itGUI->requires.end(); itKey++ ) { int keyCode = *itKey & ~HOTKEY_NEGATION_FLAG; // Clear the negation-modifier bit - bool rqdState = !( *itKey & HOTKEY_NEGATION_FLAG ); + Uint8 rqdState = ( *itKey & HOTKEY_NEGATION_FLAG ) == 0; if( keyCode < SDLK_LAST ) { - if( g_keys[keyCode] != rqdState ) accept = false; + if( keys[keyCode] != rqdState ) accept = false; } else if( keyCode < UNIFIED_SHIFT ) { - if( g_mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false; + if( (Uint8)g_mouse_buttons[keyCode-SDLK_LAST] != rqdState ) accept = false; } else if( (uint)(keyCode-UNIFIED_SHIFT) < ARRAY_SIZE(unified) ) { @@ -571,7 +572,7 @@ InReaction hotkeyInputHandler( const SDL_Event* ev ) { if( *itKey < SDLK_LAST ) { - if( !g_keys[*itKey] ) accept = false; + if( !keys[*itKey] ) accept = false; } else if( *itKey < UNIFIED_SHIFT ) { diff --git a/source/ps/Hotkey.h b/source/ps/Hotkey.h index d62e12b21f..eda36a4c18 100755 --- a/source/ps/Hotkey.h +++ b/source/ps/Hotkey.h @@ -17,7 +17,6 @@ // For SDL_HOTKEYDOWN, SDL_HOTKEYUP, the constant is passed in as ev->user.code. // - Add some bindings to the config file. -#include "precompiled.h" #include "CStr.h" #include "lib/input.h" @@ -103,14 +102,14 @@ enum HOTKEY_NEGATION_FLAG = 65536 }; -void loadHotkeys(); -InReaction hotkeyInputHandler( const SDL_Event* ev ); -void hotkeyRegisterGUIObject( const CStr& objName, const CStr& hotkeyName ); +extern void loadHotkeys(); +extern InReaction hotkeyInputHandler( const SDL_Event* ev ); +extern void hotkeyRegisterGUIObject( const CStr& objName, const CStr& hotkeyName ); -void initKeyNameMap(); -CStr getKeyName( int keycode ); -int getKeyCode( CStr keyname ); +extern void initKeyNameMap(); +extern CStr getKeyName( int keycode ); +extern int getKeyCode( CStr keyname ); -bool keyRespondsTo( int hotkey, int sdlkey ); +extern bool keyRespondsTo( int hotkey, int sdlkey ); -extern bool hotkeys[HOTKEY_LAST]; +extern Uint8 hotkeys[HOTKEY_LAST]; diff --git a/source/renderer/FixedFunctionModelRenderer.cpp b/source/renderer/FixedFunctionModelRenderer.cpp index 907572e916..348f8027e6 100644 --- a/source/renderer/FixedFunctionModelRenderer.cpp +++ b/source/renderer/FixedFunctionModelRenderer.cpp @@ -205,7 +205,7 @@ void FixedFunctionModelRenderer::UpdateModelData(CModel* model, void* data, u32 // Cleanup per-model data. // Note that per-CModelDef data is deleted by the CModelDef itself. -void FixedFunctionModelRenderer::DestroyModelData(CModel* model, void* data) +void FixedFunctionModelRenderer::DestroyModelData(CModel* UNUSED(model), void* data) { FFModel* ffmodel = (FFModel*)data; @@ -254,8 +254,8 @@ void FixedFunctionModelRenderer::RenderModel(CModel* model, void* data) // render the lot size_t numFaces = mdldef->GetNumFaces(); - pglDrawRangeElementsEXT(GL_TRIANGLES, 0, mdldef->GetNumVertices(), - numFaces*3, GL_UNSIGNED_SHORT, m->ffmodeldef->m_Indices); + pglDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdldef->GetNumVertices(), + (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->ffmodeldef->m_Indices); // bump stats g_Renderer.m_Stats.m_DrawCalls++; diff --git a/source/renderer/HWLightingModelRenderer.cpp b/source/renderer/HWLightingModelRenderer.cpp index 433b620c83..d7199943b0 100644 --- a/source/renderer/HWLightingModelRenderer.cpp +++ b/source/renderer/HWLightingModelRenderer.cpp @@ -196,6 +196,7 @@ void HWLightingModelRenderer::UpdateModelData(CModel* model, void* data, u32 upd { CModelDefPtr mdef = model->GetModelDef(); size_t numVertices = mdef->GetNumVertices(); + UNUSED2(numVertices); // build vertices VertexArrayIterator Position = hwlmodel->m_Position.GetIterator(); @@ -211,7 +212,7 @@ void HWLightingModelRenderer::UpdateModelData(CModel* model, void* data, u32 upd // Cleanup per-model data. // Note that per-CModelDef data is deleted by the CModelDef itself. -void HWLightingModelRenderer::DestroyModelData(CModel* model, void* data) +void HWLightingModelRenderer::DestroyModelData(CModel* UNUSED(model), void* data) { HWLModel* hwlmodel = (HWLModel*)data; @@ -261,8 +262,8 @@ void HWLightingModelRenderer::RenderModel(CModel* model, void* data) // render the lot size_t numFaces = mdldef->GetNumFaces(); - pglDrawRangeElementsEXT(GL_TRIANGLES, 0, mdldef->GetNumVertices(), - numFaces*3, GL_UNSIGNED_SHORT, m->hwlmodeldef->m_Indices); + pglDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdldef->GetNumVertices(), + (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->hwlmodeldef->m_Indices); // bump stats g_Renderer.m_Stats.m_DrawCalls++; diff --git a/source/renderer/InstancingModelRenderer.cpp b/source/renderer/InstancingModelRenderer.cpp index 1a55984722..0acf0a448e 100644 --- a/source/renderer/InstancingModelRenderer.cpp +++ b/source/renderer/InstancingModelRenderer.cpp @@ -187,13 +187,13 @@ void* InstancingModelRenderer::CreateModelData(CModel* model) } -void InstancingModelRenderer::UpdateModelData(CModel* model, void* data, u32 updateflags) +void InstancingModelRenderer::UpdateModelData(CModel* UNUSED(model), void* UNUSED(data), u32 UNUSED(updateflags)) { // We have no per-CModel data } -void InstancingModelRenderer::DestroyModelData(CModel* model, void* data) +void InstancingModelRenderer::DestroyModelData(CModel* UNUSED(model), void* UNUSED(data)) { // We have no per-CModel data, and per-CModelDef data is deleted by the CModelDef } @@ -229,7 +229,7 @@ void InstancingModelRenderer::PrepareTexture(CTexture* texture) // Render one model -void InstancingModelRenderer::RenderModel(CModel* model, void* data) +void InstancingModelRenderer::RenderModel(CModel* model, void* UNUSED(data)) { m->modifier->PrepareModel(m->pass, model); @@ -255,8 +255,8 @@ void InstancingModelRenderer::RenderModel(CModel* model, void* data) // render the lot size_t numFaces = mdldef->GetNumFaces(); - pglDrawRangeElementsEXT(GL_TRIANGLES, 0, mdldef->GetNumVertices(), - numFaces*3, GL_UNSIGNED_SHORT, m->imodeldef->m_Indices); + pglDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdldef->GetNumVertices(), + (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, m->imodeldef->m_Indices); // bump stats g_Renderer.m_Stats.m_DrawCalls++; diff --git a/source/renderer/ModelRenderer.cpp b/source/renderer/ModelRenderer.cpp index dffec10b02..9166090fd7 100644 --- a/source/renderer/ModelRenderer.cpp +++ b/source/renderer/ModelRenderer.cpp @@ -335,7 +335,7 @@ void BatchModelRenderer::Submit(CModel* model) bmrdata->m_Data = CreateModelData(model); rdata = bmrdata; model->SetRenderData(bmrdata); - model->SetDirty(~0); + model->SetDirty(~0u); g_Renderer.LoadTexture(model->GetTexture(), GL_CLAMP_TO_EDGE); } diff --git a/source/renderer/PlayerRenderer.cpp b/source/renderer/PlayerRenderer.cpp index 0120e1693e..f4654534b7 100644 --- a/source/renderer/PlayerRenderer.cpp +++ b/source/renderer/PlayerRenderer.cpp @@ -98,7 +98,7 @@ u32 FastPlayerColorRender::BeginPass(uint pass) } -bool FastPlayerColorRender::EndPass(uint pass) +bool FastPlayerColorRender::EndPass(uint UNUSED(pass)) { // Restore state pglActiveTextureARB(GL_TEXTURE1); @@ -110,14 +110,14 @@ bool FastPlayerColorRender::EndPass(uint pass) return true; } -void FastPlayerColorRender::PrepareTexture(uint pass, CTexture* texture) +void FastPlayerColorRender::PrepareTexture(uint UNUSED(pass), CTexture* texture) { g_Renderer.SetTexture(2, texture); g_Renderer.SetTexture(1, texture); g_Renderer.SetTexture(0, texture); } -void FastPlayerColorRender::PrepareModel(uint pass, CModel* model) +void FastPlayerColorRender::PrepareModel(uint UNUSED(pass), CModel* model) { // Get the player color SMaterialColor colour = model->GetMaterial().GetPlayerColor(); diff --git a/source/renderer/RenderModifiers.cpp b/source/renderer/RenderModifiers.cpp index d362cbeb22..55d7f07b3b 100644 --- a/source/renderer/RenderModifiers.cpp +++ b/source/renderer/RenderModifiers.cpp @@ -29,7 +29,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // RenderModifier implementation -void RenderModifier::PrepareModel(uint pass, CModel* model) +void RenderModifier::PrepareModel(uint UNUSED(pass), CModel* UNUSED(model)) { } @@ -73,7 +73,7 @@ u32 PlainRenderModifier::BeginPass(uint pass) return STREAM_POS|STREAM_COLOR|STREAM_UV0; } -bool PlainRenderModifier::EndPass(uint pass) +bool PlainRenderModifier::EndPass(uint UNUSED(pass)) { // We didn't modify blend state or higher texenvs, so we don't have // to reset OpenGL state here. @@ -81,12 +81,12 @@ bool PlainRenderModifier::EndPass(uint pass) return true; } -void PlainRenderModifier::PrepareTexture(uint pass, CTexture* texture) +void PlainRenderModifier::PrepareTexture(uint UNUSED(pass), CTexture* texture) { g_Renderer.SetTexture(0, texture); } -void PlainRenderModifier::PrepareModel(uint pass, CModel* model) +void PlainRenderModifier::PrepareModel(uint UNUSED(pass), CModel* UNUSED(model)) { } @@ -123,7 +123,7 @@ u32 WireframeRenderModifier::BeginPass(uint pass) } -bool WireframeRenderModifier::EndPass(uint pass) +bool WireframeRenderModifier::EndPass(uint UNUSED(pass)) { // .. restore the renderstates glDisable(GL_BLEND); @@ -136,12 +136,12 @@ bool WireframeRenderModifier::EndPass(uint pass) } -void WireframeRenderModifier::PrepareTexture(uint pass, CTexture* texture) +void WireframeRenderModifier::PrepareTexture(uint UNUSED(pass), CTexture* UNUSED(texture)) { } -void WireframeRenderModifier::PrepareModel(uint pass, CModel* model) +void WireframeRenderModifier::PrepareModel(uint UNUSED(pass), CModel* UNUSED(model)) { } @@ -158,22 +158,22 @@ SolidColorRenderModifier::~SolidColorRenderModifier() { } -u32 SolidColorRenderModifier::BeginPass(uint pass) +u32 SolidColorRenderModifier::BeginPass(uint UNUSED(pass)) { g_Renderer.SetTexture(0,0); return STREAM_POS; } -bool SolidColorRenderModifier::EndPass(uint pass) +bool SolidColorRenderModifier::EndPass(uint UNUSED(pass)) { return true; } -void SolidColorRenderModifier::PrepareTexture(uint pass, CTexture* texture) +void SolidColorRenderModifier::PrepareTexture(uint UNUSED(pass), CTexture* UNUSED(texture)) { } -void SolidColorRenderModifier::PrepareModel(uint pass, CModel* model) +void SolidColorRenderModifier::PrepareModel(uint UNUSED(pass), CModel* UNUSED(model)) { } diff --git a/source/renderer/TransparencyRenderer.cpp b/source/renderer/TransparencyRenderer.cpp index 571109e8e0..35efd7d470 100755 --- a/source/renderer/TransparencyRenderer.cpp +++ b/source/renderer/TransparencyRenderer.cpp @@ -146,7 +146,7 @@ float TModel::BackToFrontIndexSort(const CMatrix3D& worldToCam) tmpvtx = worldToCam.Transform(tmpvtx); float distsqrd = SQR(tmpvtx.X)+SQR(tmpvtx.Y)+SQR(tmpvtx.Z); - IndexSorter[i].first = i; + IndexSorter[i].first = (int)i; IndexSorter[i].second = distsqrd; } @@ -228,7 +228,7 @@ void TransparencyRenderer::Submit(CModel* model) tmdl = new TModel(m, model); rdata = tmdl; model->SetRenderData(rdata); - model->SetDirty(~0); + model->SetDirty(~0u); g_Renderer.LoadTexture(model->GetTexture(), GL_CLAMP_TO_EDGE); } @@ -373,8 +373,8 @@ void TransparencyRenderer::Render(RenderModifierPtr modifier, u32 flags) // render the lot size_t numFaces = mdef->GetNumFaces(); - pglDrawRangeElementsEXT(GL_TRIANGLES, 0, mdef->GetNumVertices(), - numFaces*3, GL_UNSIGNED_SHORT, tmdl->m_Indices); + pglDrawRangeElementsEXT(GL_TRIANGLES, 0, (GLuint)mdef->GetNumVertices(), + (GLsizei)numFaces*3, GL_UNSIGNED_SHORT, tmdl->m_Indices); // bump stats g_Renderer.m_Stats.m_DrawCalls++; @@ -466,12 +466,12 @@ bool TransparentRenderModifier::EndPass(uint pass) return true; } -void TransparentRenderModifier::PrepareTexture(uint pass, CTexture* texture) +void TransparentRenderModifier::PrepareTexture(uint UNUSED(pass), CTexture* texture) { g_Renderer.SetTexture(0, texture); } -void TransparentRenderModifier::PrepareModel(uint pass, CModel* model) +void TransparentRenderModifier::PrepareModel(uint UNUSED(pass), CModel* UNUSED(model)) { // No per-model setup nececssary } @@ -511,7 +511,7 @@ u32 TransparentShadowRenderModifier::BeginPass(uint pass) return STREAM_POS|STREAM_UV0; } -bool TransparentShadowRenderModifier::EndPass(uint pass) +bool TransparentShadowRenderModifier::EndPass(uint UNUSED(pass)) { glDepthMask(1); glDisable(GL_BLEND); @@ -519,13 +519,12 @@ bool TransparentShadowRenderModifier::EndPass(uint pass) return true; } -void TransparentShadowRenderModifier::PrepareTexture(uint pass, CTexture* texture) +void TransparentShadowRenderModifier::PrepareTexture(uint UNUSED(pass), CTexture* texture) { g_Renderer.SetTexture(0, texture); } -void TransparentShadowRenderModifier::PrepareModel(uint pass, CModel* model) +void TransparentShadowRenderModifier::PrepareModel(uint UNUSED(pass), CModel* UNUSED(model)) { // No per-model setup nececssary } - diff --git a/source/renderer/VertexArray.h b/source/renderer/VertexArray.h index ce2d34e20e..f4ef37b770 100644 --- a/source/renderer/VertexArray.h +++ b/source/renderer/VertexArray.h @@ -36,7 +36,7 @@ public: // Accessors T& operator*() const { return *(T*)m_Data; } T* operator->() const { return (T*)m_Data; } - T& operator[](ssize_t idx) const { return *(T*)(m_Data + idx*m_Stride); } + T& operator[](size_t idx) const { return *(T*)(m_Data + idx*m_Stride); } // Walking VertexArrayIterator& operator++()