From fe1bee706b8fd9cd92c726199a51f73e392ac11f Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 24 Jul 2004 14:04:40 +0000 Subject: [PATCH] Fixed loads of /W4 warnings, because it's easier than doing anything useful. Added some asserts to check potentially dangerous assumptions, implemented a few missing bits of code, adjusted some comments, etc. This was SVN commit r814. --- source/errorlist.pl | 1 - source/gui/CGUI.cpp | 26 ++--- source/gui/GUItext.cpp | 2 +- source/gui/GUIutil.cpp | 2 - source/gui/IGUIObject.cpp | 8 +- source/gui/IGUIObject.h | 4 +- source/gui/IGUIScrollBar.h | 4 +- source/gui/IGUITextOwner.cpp | 2 +- source/gui/scripting/JSInterface_GUITypes.cpp | 8 +- .../gui/scripting/JSInterface_IGUIObject.cpp | 17 ++-- source/lib/lib.h | 6 +- source/lib/res/unifont.cpp | 10 +- source/lib/sysdep/sysdep.cpp | 1 - source/lib/sysdep/win/wdbg.cpp | 6 +- source/lib/sysdep/win/win.cpp | 5 +- source/lib/sysdep/win/wsdl.cpp | 3 +- source/main.cpp | 17 ++-- .../maths/scripting/JSInterface_Vector3D.cpp | 2 +- source/ps/Errors.h | 4 +- source/ps/Hotkey.cpp | 4 +- source/ps/Interact.cpp | 6 +- source/ps/XMLUtils.cpp | 3 +- source/ps/XeroXMB.cpp | 4 +- source/ps/Xeromyces.cpp | 12 +-- source/renderer/PatchRData.cpp | 21 ++-- source/renderer/Renderer.cpp | 99 +++++++++---------- source/renderer/VertexBuffer.cpp | 6 +- source/scripting/ScriptCustomTypes.cpp | 2 +- source/scripting/ScriptGlue.cpp | 22 ++--- source/scripting/ScriptingHost.cpp | 2 + .../scripting/JSInterface_BaseEntity.cpp | 2 +- .../scripting/JSInterface_Entity.cpp | 2 +- source/terrain/terrainMain.cpp | 2 +- 33 files changed, 153 insertions(+), 162 deletions(-) diff --git a/source/errorlist.pl b/source/errorlist.pl index 4fb4e46cff..fd1834a75d 100755 --- a/source/errorlist.pl +++ b/source/errorlist.pl @@ -154,7 +154,6 @@ const wchar_t* GetErrorString(PSRETURN code) for (sort keys %types) { (my $name = $_) =~ s/~/_/; -# $name =~ s/.*?_//; print $out qq{\tcase 0x}.unpack('H*',$types{$_}).qq{: return L"$name"; break;\n}; } diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index d38227e0e3..013f2e9ae4 100755 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -45,12 +45,6 @@ JSClass GUIClass = { extern int g_xres, g_yres; -// TODO Gee: how to draw overlays? -void render(COverlayText* overlaytext) -{ - -} - //------------------------------------------------------------------- // called from main loop when (input) events are received. @@ -367,7 +361,9 @@ void CGUI::DrawSprite(const CStr& SpriteName, if (SpriteName == CStr()) return; + // TODO: Clipping? bool DoClipping = (Clipping != CRect()); + CGUISprite Sprite; // Fetch real sprite from name @@ -653,7 +649,7 @@ SGUIText CGUI::GenerateText(const CGUIString &string, /*const CColor &Color, */ prelim_line_height = max(prelim_line_height, Feedback.m_Size.cy); // If Width is 0, then there's no word-wrapping, disable NewLine. - if ((WordWrapping && (x > Width-BufferZone || Feedback.m_NewLine)) || i == string.m_Words.size()-2) + if ((WordWrapping && (x > Width-BufferZone || Feedback.m_NewLine)) || i == (int)string.m_Words.size()-2) { // Change from to i, but first keep a copy of its value. int temp_from = from; @@ -802,7 +798,7 @@ SGUIText CGUI::GenerateText(const CGUIString &string, /*const CColor &Color, */ Text.m_TextCalls.insert(Text.m_TextCalls.end(), Feedback2.m_TextCalls.begin(), Feedback2.m_TextCalls.end()); Text.m_SpriteCalls.insert(Text.m_SpriteCalls.end(), Feedback2.m_SpriteCalls.begin(), Feedback2.m_SpriteCalls.end()); - if (j == string.m_Words.size()-2) + if (j == (int)string.m_Words.size()-2) done = true; } @@ -883,23 +879,17 @@ void CGUI::ReportParseError(const CStr& str, ...) // Print header if (m_Errors==0) { -/// g_nemLog("*** GUI Tree Creation Errors"); + LOG(ERROR, "*** GUI Tree Creation Errors"); } - - // Important, set ParseError to true ++m_Errors; -/* TODO Gee: (MEGA) - char buffer[512]; - va_list args; - // get arguments + // Pass the varargs list to the CLogger + va_list args; va_start(args, str); - vsprintf(buffer, str.c_str(), args); + LOG(ERROR, str.c_str(), args); va_end(args); -*/ -/// g_nemLog(" %s", buffer); } /** diff --git a/source/gui/GUItext.cpp b/source/gui/GUItext.cpp index 6266554140..cd9be98630 100755 --- a/source/gui/GUItext.cpp +++ b/source/gui/GUItext.cpp @@ -240,7 +240,7 @@ void CGUIString::SetValue(const CStr& str) { m_RawString += str.GetSubstring(position, str.Length()-position); - if (from != m_RawString.Length()) + if (from != (long)m_RawString.Length()) { CurrentTextChunk.m_From = from; CurrentTextChunk.m_To = (int)m_RawString.Length(); diff --git a/source/gui/GUIutil.cpp b/source/gui/GUIutil.cpp index e0adb031bd..fd2ed283db 100755 --- a/source/gui/GUIutil.cpp +++ b/source/gui/GUIutil.cpp @@ -120,8 +120,6 @@ bool __ParseString(const CStr& Value, CColor &Output) template <> bool __ParseString(const CStr& Value, CGUIString &Output) { - const char * buf = Value; - Output.SetValue(Value); return true; } diff --git a/source/gui/IGUIObject.cpp b/source/gui/IGUIObject.cpp index 33f690acbe..cb119cd70c 100755 --- a/source/gui/IGUIObject.cpp +++ b/source/gui/IGUIObject.cpp @@ -54,8 +54,6 @@ IGUIObject::IGUIObject() : bool hidden=true; GUI::GetSetting(this, "hidden", hidden); - -int hej=23; } IGUIObject::~IGUIObject() @@ -464,8 +462,12 @@ void IGUIObject::ScriptEvent(const CStr& Action) jsval result; JSBool ok = JS_CallFunction(g_ScriptingHost.getContext(), jsGuiObject, (JSFunction*)((*it).second), 1, paramData, &result); + if (!ok) + { + JS_ReportError(g_ScriptingHost.getContext(), "Errors executing script action \"%s\"", Action.c_str()); + } - // Allow the temporary parameters to be collected + // Allow the temporary parameters to be garbage-collected JS_RemoveRoot(g_ScriptingHost.getContext(), &mouseObj); JS_RemoveRoot(g_ScriptingHost.getContext(), &jsGuiObject); } diff --git a/source/gui/IGUIObject.h b/source/gui/IGUIObject.h index 4c681d1f3f..5c916e76e1 100755 --- a/source/gui/IGUIObject.h +++ b/source/gui/IGUIObject.h @@ -312,7 +312,7 @@ protected: * * @param Message GUI Message */ - virtual void HandleMessage(const SGUIMessage &Message) {}; + virtual void HandleMessage(const SGUIMessage& UNUSEDPARAM(Message)) {}; /** * Draws the object. @@ -514,7 +514,7 @@ class CGUIDummyObject : public IGUIObject GUI_OBJECT(CGUIDummyObject) public: - virtual void HandleMessage(const SGUIMessage &Message) {} + virtual void HandleMessage(const SGUIMessage& UNUSEDPARAM(Message)) {} virtual void Draw() {} }; diff --git a/source/gui/IGUIScrollBar.h b/source/gui/IGUIScrollBar.h index ccc9c55d10..e5367f84a0 100755 --- a/source/gui/IGUIScrollBar.h +++ b/source/gui/IGUIScrollBar.h @@ -170,7 +170,7 @@ public: * @param m_y mouse y * @return True if mouse positions are hovering the button */ - virtual bool HoveringButtonMinus(const CPos &mouse) { return false; } + virtual bool HoveringButtonMinus(const CPos& UNUSEDPARAM(mouse)) { return false; } /** * Hovering the scroll plus button @@ -179,7 +179,7 @@ public: * @param m_y mouse y * @return True if mouse positions are hovering the button */ - virtual bool HoveringButtonPlus(const CPos &mouse) { return false; } + virtual bool HoveringButtonPlus(const CPos& UNUSEDPARAM(mouse)) { return false; } /** * Get scroll-position diff --git a/source/gui/IGUITextOwner.cpp b/source/gui/IGUITextOwner.cpp index b1deb60e0a..f3c5afda38 100755 --- a/source/gui/IGUITextOwner.cpp +++ b/source/gui/IGUITextOwner.cpp @@ -58,7 +58,7 @@ void IGUITextOwner::HandleMessage(const SGUIMessage &Message) } void IGUITextOwner::Draw(const int &index, const CColor &color, const CPos &pos, - const float &z, const CRect &clipping) + const float &z, const CRect &UNUSEDPARAM(clipping)) { if (index < 0 || index >= (int)m_GeneratedTexts.size()) // janwas fixed bug here; was i < 0 && i >= size - impossible. diff --git a/source/gui/scripting/JSInterface_GUITypes.cpp b/source/gui/scripting/JSInterface_GUITypes.cpp index cf675a0eec..32298761ad 100755 --- a/source/gui/scripting/JSInterface_GUITypes.cpp +++ b/source/gui/scripting/JSInterface_GUITypes.cpp @@ -1,4 +1,4 @@ -// $Id: JSInterface_GUITypes.cpp,v 1.4 2004/07/12 15:52:53 philip Exp $ +// $Id: JSInterface_GUITypes.cpp,v 1.5 2004/07/24 14:03:16 philip Exp $ #include "precompiled.h" @@ -35,7 +35,7 @@ JSFunctionSpec JSI_GUISize::JSI_methods[] = { 0 } }; -JSBool JSI_GUISize::construct(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* rval) +JSBool JSI_GUISize::construct(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval)) { if (argc == 8) { @@ -85,7 +85,7 @@ CStr ToPercentString(int pix, int per) return CStr(per)+CStr("%")+( pix == 0 ? CStr() : pix > 0 ? CStr("+")+CStr(pix) : CStr(pix) ); } -JSBool JSI_GUISize::toString(JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval) +JSBool JSI_GUISize::toString(JSContext* cx, JSObject* obj, uintN UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* rval) { char buffer[256]; snprintf(buffer, 256, "%s %s %s %s", @@ -130,7 +130,7 @@ JSFunctionSpec JSI_GUIColor::JSI_methods[] = { 0 } }; -JSBool JSI_GUIColor::construct(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* rval) +JSBool JSI_GUIColor::construct(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval)) { if (argc == 4) { diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 68a3ed7b58..e3d014b2ee 100755 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -1,4 +1,4 @@ -// $Id: JSInterface_IGUIObject.cpp,v 1.6 2004/07/17 17:05:10 philip Exp $ +// $Id: JSInterface_IGUIObject.cpp,v 1.7 2004/07/24 14:03:16 philip Exp $ #include "precompiled.h" @@ -33,7 +33,8 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval // Skip some things which are known to be functions rather than properties. // ("constructor" *must* be here, else it'll try to GetSettingType before // the private IGUIObject* has been set (and thus crash). The others are - // just for efficiency.) + // just for efficiency, and to allow correct reporting of attempts to access + // nonexistent properties.) if (propName == (CStr)"constructor" || propName == (CStr)"toString" || propName == (CStr)"getByName" @@ -66,6 +67,7 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, e->GetName())); return JS_TRUE; } + // Handle all other properties else { EGUISettingType Type; @@ -167,12 +169,7 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval assert(! "This shouldn't happen"); return JS_FALSE; } - - return JS_TRUE; } - - // Automatically falls through to methods - return JS_TRUE; } JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval* vp) @@ -315,7 +312,7 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsval id, jsval } -JSBool JSI_IGUIObject::construct(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* rval) +JSBool JSI_IGUIObject::construct(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval)) { if (argc == 0) { @@ -333,7 +330,7 @@ JSBool JSI_IGUIObject::construct(JSContext* cx, JSObject* obj, unsigned int argc } -JSBool JSI_IGUIObject::getByName(JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* rval) +JSBool JSI_IGUIObject::getByName(JSContext* cx, JSObject* UNUSEDPARAM(obj), unsigned int argc, jsval* argv, jsval* rval) { assert(argc == 1); @@ -360,7 +357,7 @@ void JSI_IGUIObject::init() g_ScriptingHost.DefineCustomObjectType(&JSI_class, construct, 1, JSI_props, JSI_methods, NULL, NULL); } -JSBool JSI_IGUIObject::toString(JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval) +JSBool JSI_IGUIObject::toString(JSContext* cx, JSObject* obj, uintN UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* rval) { IGUIObject* e = (IGUIObject*)JS_GetPrivate( cx, obj ); diff --git a/source/lib/lib.h b/source/lib/lib.h index f8e5e9ebdf..111cb70182 100755 --- a/source/lib/lib.h +++ b/source/lib/lib.h @@ -102,7 +102,7 @@ STMT(\ // recommended use: assert2(expr && "descriptive string") #define assert2(expr)\ {\ - static int suppress__;\ + static int suppress__ = 0;\ if(!suppress__ && !expr)\ switch(debug_assert_failed(__FILE__, __LINE__, #expr))\ {\ @@ -141,7 +141,11 @@ enum LibError #endif +// For insertion into code, to avoid unused warnings: #define UNUSED(param) (void)param; +// For using in parameters ("void f(int UNUSEDPARAM(x))"), +// to avoid 'unreferenced formal parameter' warnings: +#define UNUSEDPARAM(param) diff --git a/source/lib/res/unifont.cpp b/source/lib/res/unifont.cpp index 9a616b092e..9ff099317c 100755 --- a/source/lib/res/unifont.cpp +++ b/source/lib/res/unifont.cpp @@ -1,5 +1,5 @@ /* -$Id: unifont.cpp,v 1.9 2004/07/15 19:58:12 philip Exp $ +$Id: unifont.cpp,v 1.10 2004/07/24 14:03:25 philip Exp $ Unicode OpenGL texture font @@ -40,7 +40,7 @@ struct UniFont H_TYPE_DEFINE(UniFont); -static void UniFont_init(UniFont* f, va_list args) +static void UniFont_init(UniFont* f, va_list UNUSEDPARAM(args)) { f->glyphs_id = new glyphmap_id; f->glyphs_size = new glyphmap_size; @@ -55,7 +55,7 @@ static void UniFont_dtor(UniFont* f) } -static int UniFont_reload(UniFont* f, const char* fn, Handle h) +static int UniFont_reload(UniFont* f, const char* fn, Handle UNUSEDPARAM(h)) { // fn is the base filename, like "console" // The font definition file is "fonts/"+fn+".fnt" and the texture is "fonts/"+fn+".tga" @@ -94,6 +94,8 @@ static int UniFont_reload(UniFont* f, const char* fn, Handle h) int Codepoint, TextureX, TextureY, Width, Height, OffsetX, OffsetY, Advance; FNTStream >> Codepoint >> TextureX >> TextureY >> Width >> Height >> OffsetX >> OffsetY >> Advance; + assert(Codepoint <= 0xffff); + GLfloat u = (GLfloat)TextureX / (GLfloat)TextureWidth; GLfloat v = (GLfloat)TextureY / (GLfloat)TextureHeight; GLfloat w = (GLfloat)Width / (GLfloat)TextureWidth; @@ -109,7 +111,7 @@ static int UniFont_reload(UniFont* f, const char* fn, Handle h) glTranslatef((GLfloat)Advance, 0, 0); glEndList(); - (*f->glyphs_id)[(wchar_t)Codepoint] = i; + (*f->glyphs_id)[(wchar_t)Codepoint] = (unsigned short)i; (*f->glyphs_size)[(wchar_t)Codepoint] = Advance; } diff --git a/source/lib/sysdep/sysdep.cpp b/source/lib/sysdep/sysdep.cpp index bc94d8f9d3..7269596fb2 100755 --- a/source/lib/sysdep/sysdep.cpp +++ b/source/lib/sysdep/sysdep.cpp @@ -74,7 +74,6 @@ void debug_microlog(const wchar_t *fmt, ...) { va_list argp; wchar_t buffer[512]; - int count = 0; va_start(argp, fmt); vswprintf(buffer, sizeof(buffer), fmt, argp); diff --git a/source/lib/sysdep/win/wdbg.cpp b/source/lib/sysdep/win/wdbg.cpp index 749ac120c3..cc3b9ca9bf 100755 --- a/source/lib/sysdep/win/wdbg.cpp +++ b/source/lib/sysdep/win/wdbg.cpp @@ -653,7 +653,7 @@ static void set_exception_handler() void abort_timer(); // from wtime.cpp -int debug_main_exception_filter(unsigned int code, PEXCEPTION_POINTERS ep) +int debug_main_exception_filter(unsigned int UNUSEDPARAM(code), PEXCEPTION_POINTERS ep) { // If something crashes after we've already crashed (i.e. when shutting // down everything), don't bother logging it, because the first crash @@ -778,7 +778,6 @@ int debug_main_exception_filter(unsigned int code, PEXCEPTION_POINTERS ep) #endif exit(EXIT_FAILURE); - return EXCEPTION_EXECUTE_HANDLER; } @@ -838,6 +837,9 @@ static void DumpMiniDump(HANDLE hFile, PEXCEPTION_POINTERS excpInfo) eInfo.ExceptionPointers = excpInfo; eInfo.ClientPointers = FALSE; + // TODO: Store the crashlog.txt inside the UserStreamParam + // so that people only have to send us one file? + // note: MiniDumpWithIndirectlyReferencedMemory does not work on Win98 if (!_MiniDumpWriteDump( GetCurrentProcess(), diff --git a/source/lib/sysdep/win/win.cpp b/source/lib/sysdep/win/win.cpp index a2d47337f1..398cb82f30 100755 --- a/source/lib/sysdep/win/win.cpp +++ b/source/lib/sysdep/win/win.cpp @@ -255,7 +255,8 @@ void cursor_set(const char* name) assert(! "Invalid contents of cursor hotspot .txt file (should be like \"123 456\")"); return; } - // TODO: Do I have to unload the file? + + // TODO: Unload the file } sprintf(filename, "art/textures/cursors/%s.png", name); @@ -281,7 +282,7 @@ void cursor_set(const char* name) } else if (fmt == GL_RGBA) { - // Convert ABGR -> ARGB (assume little-endian) + // Convert ABGR -> ARGB (little-endian) imgdata_bgra = new u32[w*h]; for (int i=0; i= WM_APP ) { - ev->type = SDL_USEREVENT + ( msg.message - WM_APP ); + assert( SDL_USEREVENT+(msg.message-WM_APP) <= 0xff && "Message too far above WM_APP"); + ev->type = (u8)(SDL_USEREVENT+(msg.message-WM_APP)); ev->user.code = (int)msg.wParam; return 1; } diff --git a/source/main.cpp b/source/main.cpp index 48b75f5098..9ef0974b5f 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -540,10 +540,6 @@ static void Render() } -static void do_tick() -{ -} - ////////////////////////////////////////////////////////////////////////////////////////////// // UpdateWorld: update time dependent data in the simulation to account for changes over // some fixed simulation timestep. @@ -647,16 +643,16 @@ void ParseArgs(int argc, char* argv[]) } CConfigValue *val; - if (val=g_ConfigDB.GetValue(CFG_SYSTEM, "xres")) + if ((val=g_ConfigDB.GetValue(CFG_SYSTEM, "xres"))) val->GetInt(g_xres); - if (val=g_ConfigDB.GetValue(CFG_SYSTEM, "yres")) + if ((val=g_ConfigDB.GetValue(CFG_SYSTEM, "yres"))) val->GetInt(g_yres); - if (val=g_ConfigDB.GetValue(CFG_SYSTEM, "vsync")) + if ((val=g_ConfigDB.GetValue(CFG_SYSTEM, "vsync"))) val->GetBool(g_VSync); - if (val=g_ConfigDB.GetValue(CFG_SYSTEM, "novbo")) + if ((val=g_ConfigDB.GetValue(CFG_SYSTEM, "novbo"))) val->GetBool(g_NoGLVBO); - if (val=g_ConfigDB.GetValue(CFG_SYSTEM, "shadows")) + if ((val=g_ConfigDB.GetValue(CFG_SYSTEM, "shadows"))) val->GetBool(g_Shadows); LOG(NORMAL, "g_x/yres is %dx%d", g_xres, g_yres); @@ -1091,7 +1087,7 @@ static void Frame() #endif // #if defined(MOVIE_RECORD) || define(MOVIE_CREATE) // TODO: limiter in case simulation can't keep up? - const double TICK_TIME = 30e-3; // [s] +// const double TICK_TIME = 30e-3; // [s] const float SIM_UPDATE_INTERVAL = 1.0f / (float)SIM_FRAMERATE; // Simulation runs at 10 fps. MICROLOG(L"input"); @@ -1202,5 +1198,4 @@ int main(int argc, char* argv[]) #endif exit(0); - return 0; } diff --git a/source/maths/scripting/JSInterface_Vector3D.cpp b/source/maths/scripting/JSInterface_Vector3D.cpp index 265316972b..f351890fa8 100755 --- a/source/maths/scripting/JSInterface_Vector3D.cpp +++ b/source/maths/scripting/JSInterface_Vector3D.cpp @@ -117,7 +117,7 @@ JSBool JSI_Vector3D::setProperty( JSContext* cx, JSObject* obj, jsval id, jsval* return( JS_TRUE ); } -JSBool JSI_Vector3D::construct( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ) +JSBool JSI_Vector3D::construct( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* UNUSEDPARAM(rval) ) { if( argc == 0 ) { diff --git a/source/ps/Errors.h b/source/ps/Errors.h index 81dfa77ff0..e4166a782d 100755 --- a/source/ps/Errors.h +++ b/source/ps/Errors.h @@ -1,9 +1,9 @@ #ifndef _ERRORS_H_ #define _ERRORS_H_ -#include // for wchar_t +#include "lib/types.h" -typedef unsigned long PSRETURN; +typedef u32 PSRETURN; class PSERROR { diff --git a/source/ps/Hotkey.cpp b/source/ps/Hotkey.cpp index 0c78d5dbb0..1cf8312580 100755 --- a/source/ps/Hotkey.cpp +++ b/source/ps/Hotkey.cpp @@ -295,10 +295,10 @@ int hotkeyInputHandler( const SDL_Event* ev ) if( accept ) { hotkeys[it->mapsTo] = true; - if( ( closestMap == -1 ) || ( it->requires.size() > closestMapMatch ) ) + if( ( closestMap == -1 ) || ( it->requires.size() > (size_t)closestMapMatch ) ) { closestMap = it->mapsTo; - closestMapMatch = it->requires.size(); + closestMapMatch = (int)it->requires.size(); } } } diff --git a/source/ps/Interact.cpp b/source/ps/Interact.cpp index 343d139cf0..224b51590f 100755 --- a/source/ps/Interact.cpp +++ b/source/ps/Interact.cpp @@ -699,7 +699,8 @@ int interactInputHandler( const SDL_Event* ev ) default: if( ( ev->user.code >= HOTKEY_SELECTION_GROUP_0 ) && ( ev->key.keysym.sym <= HOTKEY_SELECTION_GROUP_19 ) ) { - u8 id = ev->user.code - HOTKEY_SELECTION_GROUP_0; + // The above test limits it to 20 groups, so don't worry about overflowing + u8 id = (u8)( ev->user.code - HOTKEY_SELECTION_GROUP_0 ); if( hotkeys[HOTKEY_SELECTION_GROUP_ADD] ) { @@ -726,7 +727,8 @@ int interactInputHandler( const SDL_Event* ev ) } else if( ( ev->user.code >= HOTKEY_CAMERA_BOOKMARK_0 ) && ( ev->user.code <= HOTKEY_CAMERA_BOOKMARK_9 ) ) { - u8 id = ev->user.code - HOTKEY_CAMERA_BOOKMARK_0; + // The above test limits it to 10 bookmarks, so don't worry about overflowing + u8 id = (u8)( ev->user.code - HOTKEY_CAMERA_BOOKMARK_0 ); if( hotkeys[HOTKEY_CAMERA_BOOKMARK_SAVE] ) { // Attempt to track the ground we're looking at diff --git a/source/ps/XMLUtils.cpp b/source/ps/XMLUtils.cpp index 863330a8db..8a5b2d9d97 100755 --- a/source/ps/XMLUtils.cpp +++ b/source/ps/XMLUtils.cpp @@ -108,7 +108,7 @@ const char *prevpathcomp(const char *end, const char *beginning) return end; } -InputSource *CVFSEntityResolver::resolveEntity(const XMLCh *const publicId, +InputSource *CVFSEntityResolver::resolveEntity(const XMLCh *const UNUSEDPARAM(publicId), const XMLCh *const systemId) { CVFSInputSource *ret=new CVFSInputSource(); @@ -117,7 +117,6 @@ InputSource *CVFSEntityResolver::resolveEntity(const XMLCh *const publicId, char abspath[VFS_MAX_PATH]; const char *end=strchr(m_DocName, '\0'); - const char *orgend=end; if (IS_PATH_SEP(*path)) path++; diff --git a/source/ps/XeroXMB.cpp b/source/ps/XeroXMB.cpp index 216237ac89..f1397566cd 100755 --- a/source/ps/XeroXMB.cpp +++ b/source/ps/XeroXMB.cpp @@ -1,4 +1,4 @@ -// $Id: XeroXMB.cpp,v 1.5 2004/07/12 15:49:31 philip Exp $ +// $Id: XeroXMB.cpp,v 1.6 2004/07/24 14:03:44 philip Exp $ #include "precompiled.h" @@ -19,7 +19,7 @@ void XMBFile::Initialise(char* FileData) int Header = *(int*)m_Pointer; m_Pointer += 4; assert(Header == HeaderMagic && "Invalid XMB header!"); - int Checksum = *(int*)m_Pointer; m_Pointer += 4; + /*int Checksum = *(int*)m_Pointer;*/ m_Pointer += 4; int i; diff --git a/source/ps/Xeromyces.cpp b/source/ps/Xeromyces.cpp index 4f351371a2..54e742658e 100755 --- a/source/ps/Xeromyces.cpp +++ b/source/ps/Xeromyces.cpp @@ -1,4 +1,4 @@ -// $Id: Xeromyces.cpp,v 1.9 2004/07/23 19:03:40 philip Exp $ +// $Id: Xeromyces.cpp,v 1.10 2004/07/24 14:03:44 philip Exp $ #include "precompiled.h" @@ -277,8 +277,8 @@ bool CXeromyces::ReadXMBFile(const char* filename, bool CheckCRC, unsigned long void* buffer; size_t bufferSize; - int err; - if ( (err=vfs_map(file, 0, buffer, bufferSize)) ) + int err = vfs_map(file, 0, buffer, bufferSize); + if (err) { LOG(ERROR, "CXeromyces: file '%s' couldn't be read (vfs_map: %d)", filename, err); vfs_close(file); @@ -332,7 +332,7 @@ std::string lowercase_ascii(const XMLCh *a) return b; } -void XeroHandler::startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs) +void XeroHandler::startElement(const XMLCh* const UNUSEDPARAM(uri), const XMLCh* const localname, const XMLCh* const UNUSEDPARAM(qname), const Attributes& attrs) { std::string elementName = lowercase_ascii(localname); ElementNames.insert(elementName); @@ -361,12 +361,12 @@ void XeroHandler::startElement(const XMLCh* const uri, const XMLCh* const localn ElementStack.push(e); } -void XeroHandler::endElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname) +void XeroHandler::endElement(const XMLCh* const UNUSEDPARAM(uri), const XMLCh* const UNUSEDPARAM(localname), const XMLCh* const UNUSEDPARAM(qname)) { ElementStack.pop(); } -void XeroHandler::characters(const XMLCh* const chars, const unsigned int length) +void XeroHandler::characters(const XMLCh* const chars, const unsigned int UNUSEDPARAM(length)) { ElementStack.top()->text += utf16string(chars, chars+XMLString::stringLen(chars)); } diff --git a/source/renderer/PatchRData.cpp b/source/renderer/PatchRData.cpp index 14b5ed0dfa..6cb3992cf2 100755 --- a/source/renderer/PatchRData.cpp +++ b/source/renderer/PatchRData.cpp @@ -35,9 +35,9 @@ inline int clamp(int x,int min,int max) static SColor4ub ConvertColor(const RGBColor& src) { SColor4ub result; - result.R=clamp(int(src.X*255),0,255); - result.G=clamp(int(src.Y*255),0,255); - result.B=clamp(int(src.Z*255),0,255); + result.R=(u8)clamp(int(src.X*255),0,255); + result.G=(u8)clamp(int(src.Y*255),0,255); + result.B=(u8)clamp(int(src.Z*255),0,255); result.A=0xff; return result; } @@ -131,12 +131,12 @@ void CPatchRData::BuildBlends() } } if (neighbourTextures.size()>0) { - u32 count=(u32)neighbourTextures.size(); // sort textures from lowest to highest priority std::sort(neighbourTextures.begin(),neighbourTextures.end()); // for each of the neighbouring textures .. - for (uint k=0;k<(uint)neighbourTextures.size();++k) { + uint count=(uint)neighbourTextures.size(); + for (uint k=0;km_Index; + assert(m_VBBlends->m_Index < 65536); + unsigned short base = (unsigned short)m_VBBlends->m_Index; std::set::iterator iter=splatTextures.begin(); for (;iter!=splatTextures.end();++iter) { Handle tex=*iter; diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index cafc02251b..03ed3d97ec 100755 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -72,9 +72,9 @@ static bool saveTGA(const char* filename,int width,int height,int bpp,unsigned c memset(header.pad,0,sizeof(header.pad)); header.d_x_origin=0; header.d_y_origin=0; - header.width=width; - header.height=height; - header.bpp=bpp; + header.width=(unsigned short)width; + header.height=(unsigned short)height; + header.bpp=(unsigned char)bpp; header.image_descriptor=(bpp==32) ? 8 : 0; if (fwrite(&header,sizeof(TGAHeader),1,fp)!=1) { @@ -597,41 +597,40 @@ void CRenderer::RenderShadowMap() glPushMatrix(); glLoadMatrixf(&m_LightTransform._11); - if (0) - { - // debug aid - render actual bounds of shadow casting objects; helps see where - // the lights projection/transform can be optimised - glColor3f(1.0,0.0,0.0); - const CBound& bounds=m_ShadowBound; +#if 0 + // debug aid - render actual bounds of shadow casting objects; helps see where + // the lights projection/transform can be optimised + glColor3f(1.0,0.0,0.0); + const CBound& bounds=m_ShadowBound; - glBegin(GL_LINE_LOOP); - glVertex3f(bounds[0].X,bounds[0].Y,bounds[0].Z); - glVertex3f(bounds[0].X,bounds[0].Y,bounds[1].Z); - glVertex3f(bounds[0].X,bounds[1].Y,bounds[1].Z); - glVertex3f(bounds[0].X,bounds[1].Y,bounds[0].Z); - glEnd(); + glBegin(GL_LINE_LOOP); + glVertex3f(bounds[0].X,bounds[0].Y,bounds[0].Z); + glVertex3f(bounds[0].X,bounds[0].Y,bounds[1].Z); + glVertex3f(bounds[0].X,bounds[1].Y,bounds[1].Z); + glVertex3f(bounds[0].X,bounds[1].Y,bounds[0].Z); + glEnd(); - glBegin(GL_LINE_LOOP); - glVertex3f(bounds[1].X,bounds[0].Y,bounds[0].Z); - glVertex3f(bounds[1].X,bounds[0].Y,bounds[1].Z); - glVertex3f(bounds[1].X,bounds[1].Y,bounds[1].Z); - glVertex3f(bounds[1].X,bounds[1].Y,bounds[0].Z); - glEnd(); + glBegin(GL_LINE_LOOP); + glVertex3f(bounds[1].X,bounds[0].Y,bounds[0].Z); + glVertex3f(bounds[1].X,bounds[0].Y,bounds[1].Z); + glVertex3f(bounds[1].X,bounds[1].Y,bounds[1].Z); + glVertex3f(bounds[1].X,bounds[1].Y,bounds[0].Z); + glEnd(); - glBegin(GL_LINE_LOOP); - glVertex3f(bounds[0].X,bounds[0].Y,bounds[0].Z); - glVertex3f(bounds[0].X,bounds[0].Y,bounds[1].Z); - glVertex3f(bounds[1].X,bounds[0].Y,bounds[1].Z); - glVertex3f(bounds[1].X,bounds[0].Y,bounds[0].Z); - glEnd(); + glBegin(GL_LINE_LOOP); + glVertex3f(bounds[0].X,bounds[0].Y,bounds[0].Z); + glVertex3f(bounds[0].X,bounds[0].Y,bounds[1].Z); + glVertex3f(bounds[1].X,bounds[0].Y,bounds[1].Z); + glVertex3f(bounds[1].X,bounds[0].Y,bounds[0].Z); + glEnd(); - glBegin(GL_LINE_LOOP); - glVertex3f(bounds[0].X,bounds[1].Y,bounds[0].Z); - glVertex3f(bounds[0].X,bounds[1].Y,bounds[1].Z); - glVertex3f(bounds[1].X,bounds[1].Y,bounds[1].Z); - glVertex3f(bounds[1].X,bounds[1].Y,bounds[0].Z); - glEnd(); - } + glBegin(GL_LINE_LOOP); + glVertex3f(bounds[0].X,bounds[1].Y,bounds[0].Z); + glVertex3f(bounds[0].X,bounds[1].Y,bounds[1].Z); + glVertex3f(bounds[1].X,bounds[1].Y,bounds[1].Z); + glVertex3f(bounds[1].X,bounds[1].Y,bounds[0].Z); + glEnd(); +#endif // 0 // setup client states glEnableClientState(GL_VERTEX_ARRAY); @@ -675,23 +674,21 @@ void CRenderer::RenderShadowMap() glPopMatrix(); glMatrixMode(GL_MODELVIEW); - if (0) - { -#if 1 - // debug aid - dump generated shadow map to file; helps verify shadow map - // space being well used (not that it is at the minute .. (TODO, RC)) - unsigned char* data=new unsigned char[m_ShadowMapWidth*m_ShadowMapHeight*3]; - glGetTexImage(GL_TEXTURE_2D,0,GL_BGR_EXT,GL_UNSIGNED_BYTE,data); - saveTGA("d:\\test4.tga",m_ShadowMapWidth,m_ShadowMapHeight,24,data); - delete[] data; -#else - unsigned char* data=new unsigned char[m_Width*m_Height*4]; - glReadBuffer(GL_BACK); - glReadPixels(0,0,m_Width,m_Height,GL_BGRA_EXT,GL_UNSIGNED_BYTE,data); - saveTGA("d:\\test3.tga",m_Width,m_Height,32,data); - delete[] data; -#endif - } +#if 0 + // debug aid - dump generated shadow map to file; helps verify shadow map + // space being well used (not that it is at the minute .. (TODO, RC)) + unsigned char* data=new unsigned char[m_ShadowMapWidth*m_ShadowMapHeight*3]; + glGetTexImage(GL_TEXTURE_2D,0,GL_BGR_EXT,GL_UNSIGNED_BYTE,data); + saveTGA("d:\\test4.tga",m_ShadowMapWidth,m_ShadowMapHeight,24,data); + delete[] data; +#endif // 0 +#if 0 + unsigned char* data=new unsigned char[m_Width*m_Height*4]; + glReadBuffer(GL_BACK); + glReadPixels(0,0,m_Width,m_Height,GL_BGRA_EXT,GL_UNSIGNED_BYTE,data); + saveTGA("d:\\test3.tga",m_Width,m_Height,32,data); + delete[] data; +#endif // 0 } void CRenderer::ApplyShadowMap() diff --git a/source/renderer/VertexBuffer.cpp b/source/renderer/VertexBuffer.cpp index bfcaedaaa4..8f23b36208 100755 --- a/source/renderer/VertexBuffer.cpp +++ b/source/renderer/VertexBuffer.cpp @@ -98,9 +98,9 @@ CVertexBuffer::VBChunk* CVertexBuffer::Allocate(size_t vertexSize,size_t numVert if (numVertices<=(*iter)->m_Count) { chunk=*iter; // remove this chunk from the free list - size_t size1=m_FreeList.size(); +// size_t size1=m_FreeList.size(); m_FreeList.erase(iter); - size_t size2=m_FreeList.size(); +// size_t size2=m_FreeList.size(); // no need to search further .. break; } @@ -154,7 +154,7 @@ void CVertexBuffer::ClearBatchIndices() /////////////////////////////////////////////////////////////////////////////// // AppendBatch: add a batch to the render list for this buffer -void CVertexBuffer::AppendBatch(VBChunk* chunk,Handle texture,size_t numIndices,u16* indices) +void CVertexBuffer::AppendBatch(VBChunk* UNUSEDPARAM(chunk),Handle texture,size_t numIndices,u16* indices) { // try and find a batch using this texture size_t i; diff --git a/source/scripting/ScriptCustomTypes.cpp b/source/scripting/ScriptCustomTypes.cpp index 150d0b8b6a..b5e12939b7 100755 --- a/source/scripting/ScriptCustomTypes.cpp +++ b/source/scripting/ScriptCustomTypes.cpp @@ -20,7 +20,7 @@ JSPropertySpec Point2dProperties[] = {0} }; -JSBool Point2d_Constructor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +JSBool Point2d_Constructor(JSContext* UNUSEDPARAM(cx), JSObject* obj, uintN argc, jsval* argv, jsval* UNUSEDPARAM(rval)) { if (argc == 2) { diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index a72394b040..6e86cb1984 100755 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -56,7 +56,7 @@ JSPropertySpec ScriptGlobalTable[] = }; // Allow scripts to output to the global log file -JSBool WriteLog(JSContext * context, JSObject * globalObject, unsigned int argc, jsval * argv, jsval * rval) +JSBool WriteLog(JSContext* context, JSObject* UNUSEDPARAM(globalObject), unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval)) { if (argc < 1) return JS_FALSE; @@ -87,7 +87,7 @@ JSBool WriteLog(JSContext * context, JSObject * globalObject, unsigned int argc, return JS_TRUE; } -JSBool writeConsole( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool writeConsole( JSContext* UNUSEDPARAM(context), JSObject* UNUSEDPARAM(globalObject), unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval) ) { assert( argc >= 1 ); CStr output = g_ScriptingHost.ValueToString( argv[0] ); @@ -95,7 +95,7 @@ JSBool writeConsole( JSContext* context, JSObject* globalObject, unsigned int ar return( JS_TRUE ); } -JSBool getEntityByHandle( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool getEntityByHandle( JSContext* context, JSObject* UNUSEDPARAM(globalObject), unsigned int argc, jsval* argv, jsval* rval ) { assert( argc >= 1 ); i32 handle; @@ -122,7 +122,7 @@ JSBool getEntityByHandle( JSContext* context, JSObject* globalObject, unsigned i return( JS_TRUE ); } -JSBool getEntityTemplate( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool getEntityTemplate( JSContext* context, JSObject* UNUSEDPARAM(globalObject), unsigned int argc, jsval* argv, jsval* rval ) { assert( argc >= 1 ); CStr templateName; @@ -149,7 +149,7 @@ JSBool getEntityTemplate( JSContext* context, JSObject* globalObject, unsigned i return( JS_TRUE ); } -JSBool setTimeout( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool setTimeout( JSContext* context, JSObject* UNUSEDPARAM(globalObject), unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval) ) { assert( argc >= 2 ); size_t delay; @@ -183,7 +183,7 @@ JSBool setTimeout( JSContext* context, JSObject* globalObject, unsigned int argc } } -JSBool setInterval( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool setInterval( JSContext* context, JSObject* UNUSEDPARAM(globalObject), unsigned int argc, jsval* argv, jsval* UNUSEDPARAM(rval) ) { assert( argc >= 2 ); size_t first, interval; @@ -227,19 +227,19 @@ JSBool setInterval( JSContext* context, JSObject* globalObject, unsigned int arg } } -JSBool cancelInterval( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool cancelInterval( JSContext* UNUSEDPARAM(context), JSObject* UNUSEDPARAM(globalObject), unsigned int UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* UNUSEDPARAM(rval) ) { g_Scheduler.m_abortInterval = true; return( JS_TRUE ); } -JSBool getGUIGlobal( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool getGUIGlobal( JSContext* UNUSEDPARAM(context), JSObject* UNUSEDPARAM(globalObject), unsigned int UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* rval ) { *rval = OBJECT_TO_JSVAL( g_GUI.GetScriptObject() ); return( JS_TRUE ); } -JSBool getGlobal( JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval ) +JSBool getGlobal( JSContext* UNUSEDPARAM(context), JSObject* globalObject, unsigned int UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* rval ) { *rval = OBJECT_TO_JSVAL( globalObject ); return( JS_TRUE ); @@ -248,13 +248,13 @@ JSBool getGlobal( JSContext* context, JSObject* globalObject, unsigned int argc, extern void kill_mainloop(); // from main.cpp -JSBool exitProgram(JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval) +JSBool exitProgram(JSContext* UNUSEDPARAM(context), JSObject* UNUSEDPARAM(globalObject), unsigned int UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* UNUSEDPARAM(rval)) { kill_mainloop(); return JS_TRUE; } -JSBool crash(JSContext* context, JSObject* globalObject, unsigned int argc, jsval* argv, jsval* rval) +JSBool crash(JSContext* UNUSEDPARAM(context), JSObject* UNUSEDPARAM(globalObject), unsigned int UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* UNUSEDPARAM(rval)) { MICROLOG(L"Crashing at user's request."); uintptr_t ptr = 0xDEADC0DE; diff --git a/source/scripting/ScriptingHost.cpp b/source/scripting/ScriptingHost.cpp index 8513a46f26..acb23f745a 100755 --- a/source/scripting/ScriptingHost.cpp +++ b/source/scripting/ScriptingHost.cpp @@ -308,6 +308,8 @@ double ScriptingHost::ValueToDouble(const jsval value) void ScriptingHost::ErrorReporter(JSContext * context, const char * message, JSErrorReport * report) { + UNUSED(context); + debug_out("%s(%d) : %s\n", report->filename, report->lineno, message); if (g_Console) diff --git a/source/simulation/scripting/JSInterface_BaseEntity.cpp b/source/simulation/scripting/JSInterface_BaseEntity.cpp index 267e151817..212d8359e7 100755 --- a/source/simulation/scripting/JSInterface_BaseEntity.cpp +++ b/source/simulation/scripting/JSInterface_BaseEntity.cpp @@ -62,7 +62,7 @@ void JSI_BaseEntity::init() g_ScriptingHost.DefineCustomObjectType( &JSI_class, NULL, 0, JSI_props, JSI_methods, NULL, NULL ); } -JSBool JSI_BaseEntity::toString( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ) +JSBool JSI_BaseEntity::toString( JSContext* cx, JSObject* obj, uintN UNUSEDPARAM(argc), jsval* UNUSEDPARAM(argv), jsval* rval ) { CBaseEntity* e = (CBaseEntity*)JS_GetPrivate( cx, obj ); diff --git a/source/simulation/scripting/JSInterface_Entity.cpp b/source/simulation/scripting/JSInterface_Entity.cpp index 01c50b8f6a..5fa0addd9a 100755 --- a/source/simulation/scripting/JSInterface_Entity.cpp +++ b/source/simulation/scripting/JSInterface_Entity.cpp @@ -65,7 +65,7 @@ JSBool JSI_Entity::setProperty( JSContext* cx, JSObject* obj, jsval id, jsval* v return( JS_TRUE ); } -JSBool JSI_Entity::construct( JSContext* cx, JSObject* obj, unsigned int argc, jsval* argv, jsval* rval ) +JSBool JSI_Entity::construct( JSContext* cx, JSObject* UNUSEDPARAM(obj), unsigned int argc, jsval* argv, jsval* rval ) { assert( argc >= 2 ); CBaseEntity* baseEntity = NULL; diff --git a/source/terrain/terrainMain.cpp b/source/terrain/terrainMain.cpp index a3e13625f3..a843fe879c 100755 --- a/source/terrain/terrainMain.cpp +++ b/source/terrain/terrainMain.cpp @@ -390,7 +390,7 @@ int terr_handler(const SDL_Event* ev) case HOTKEY_CAMERA_ROTATE_ABOUT_TARGET: { int x, z; - CHFTracer tracer( g_Terrain.GetHeightMap(), g_Terrain.GetVerticesPerSide(), CELL_SIZE, HEIGHT_SCALE ); + CHFTracer tracer( g_Terrain.GetHeightMap(), g_Terrain.GetVerticesPerSide(), (float)CELL_SIZE, HEIGHT_SCALE ); CVector3D origin, dir; origin = g_Camera.m_Orientation.GetTranslation(); dir = g_Camera.m_Orientation.GetIn();