Jump to content

energyWeapon Resource


Steve_Yorkshire

Recommended Posts

Found a crash caused by RefreshWeaponHUD not displaying the ammoAmount if a non-ammo weapon is the first one loaded at startup and then the player switches to an ammo-using weapon. No crash if first weapon loaded is an ammo-user. Makes no sense but hey, we're all used to that. :P

Fix posted in resource, also suggest fix goes into main repo.

 

function clientCmdRefreshWeaponHUD(%amount, %preview, %ret, %zoomRet, %amountInClips)
{
   if (!%amount)
   {
      //AmmoAmount.setVisible(false);//yorks bad! 
      //causes a crash if this weapon is the default and you change to an other weapon
      AmmoAmount.setText("");
   }
   else
   {
      AmmoAmount.setVisible(true);
      AmmoAmount.setText("Ammo: " @ %amount @ "/" @ %amountInClips);
   }
Link to comment
Share on other sites

@buckmaster

Seems to crash looking for a valid character in gfx/gFont.h. Only happens if there is no ammoAmount to show and thus ammoAmount in scripts/client/client.cs is hidden. And it only crashes if the first weapon on startup is non-ammo. Loading an ammo-wpn first and then switching back and forth between ammo and non-ammo weapons is fine.

// Update the Ammo Counter with current ammo, if not any then hide the counter. 
function clientCmdSetAmmoAmountHud(%amount, %amountInClips)
{
   if (!%amount)
      AmmoAmount.setVisible(false);
   else
   {
      AmmoAmount.setVisible(true);
      AmmoAmount.setText("Ammo: " @ %amount @ "/" @ %amountInClips);
   }
}

 

gfx/gFont.h

inline bool GFont::isValidChar(const UTF16 in_charIndex) const
{
   if(mRemapTable[in_charIndex] != -1)//dies here
      return true;
 
   if(mPlatformFont)
      return mPlatformFont->isValidChar(in_charIndex);
 
   return false;
}

 

I'll post the full stack - but if I'm honest I just like make gaemz and don't understand what makes them go. ;)

 

>	energyWeapon_DEBUG DLL.dll!GFont::isValidChar(const unsigned short in_charIndex) Line 185	C++
 	energyWeapon_DEBUG DLL.dll!GFont::getStrNWidthPrecise(const unsigned short * str, unsigned int n) Line 486	C++
 	energyWeapon_DEBUG DLL.dll!GFont::getStrNWidthPrecise(const char * str, unsigned int n) Line 466	C++
 	energyWeapon_DEBUG DLL.dll!GFont::getStrWidthPrecise(const char * in_pString) Line 419	C++
 	energyWeapon_DEBUG DLL.dll!GuiControl::renderJustifiedText(Point2I offset, Point2I extent, const char * text) Line 605	C++
 	energyWeapon_DEBUG DLL.dll!GuiTextCtrl::onRender(Point2I offset, const RectI & updateRect) Line 235	C++
 	energyWeapon_DEBUG DLL.dll!GuiControl::renderChildControls(Point2I offset, const RectI & updateRect) Line 574	C++
 	energyWeapon_DEBUG DLL.dll!GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI & updateRect) Line 135	C++
 	energyWeapon_DEBUG DLL.dll!GuiControl::renderChildControls(Point2I offset, const RectI & updateRect) Line 574	C++
 	energyWeapon_DEBUG DLL.dll!GuiTSCtrl::onRender(Point2I offset, const RectI & updateRect) Line 471	C++
 	energyWeapon_DEBUG DLL.dll!GameTSCtrl::onRender(Point2I offset, const RectI & updateRect) Line 179	C++
 	energyWeapon_DEBUG DLL.dll!GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap) Line 1760	C++
 	energyWeapon_DEBUG DLL.dll!GuiCanvas::handlePaintEvent(unsigned int did) Line 342	C++
 	energyWeapon_DEBUG DLL.dll!fastdelegate::FastDelegate1::operator()(unsigned int p1) Line 990	C++
 	energyWeapon_DEBUG DLL.dll!Signal::trigger(unsigned int a) Line 669	C++
 	energyWeapon_DEBUG DLL.dll!Journal::Call,unsigned int>(Signal * obj, void (unsigned int) * method, unsigned int a) Line 634	C++
 	energyWeapon_DEBUG DLL.dll!JournaledSignal::trigger(unsigned int a) Line 81	C++
 	energyWeapon_DEBUG DLL.dll!GuiCanvas::paint() Line 1522	C++
 	energyWeapon_DEBUG DLL.dll!fastdelegate::FastDelegate0::operator()() Line 905	C++
 	energyWeapon_DEBUG DLL.dll!Signal::trigger() Line 651	C++
 	energyWeapon_DEBUG DLL.dll!Process::processEvents() Line 95	C++
 	energyWeapon_DEBUG DLL.dll!StandardMainLoop::doMainLoop() Line 610	C++
 	energyWeapon_DEBUG DLL.dll!torque_enginetick() Line 120	C++
 	energyWeapon_DEBUG DLL.dll!TorqueMain(int argc, const char * * argv) Line 377	C++
 	energyWeapon_DEBUG DLL.dll!torque_winmain(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * lpszCmdLine, int __formal) Line 452	C++
 	energyWeapon_DEBUG.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpszCmdLine, int nCommandShow) Line 95	C++
 	[External Code]	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...