Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sik_the_hedgehog

Member Since 31 Jan 2009
Offline Last Active Private

#5306945 Fast way to cast int to float!

Posted by on 20 August 2016 - 08:10 PM

In somewhat related news, today a coworker said two words that were never meant to go together: "Enterprise JavaScript". With systems like node.js being more popular we are seeing the rise of abominations that should have been killed on sight, without mercy. I told him I did not accept "Enterprise JavaScript" could possibly be a thing in a reality I participate in.

https://twitter.com/0x0961h/status/767109252196491264

 

"Enterprise HTML5" has also been mentioned in that thread.




#5306516 When you realize how dumb a bug is...

Posted by on 18 August 2016 - 05:26 AM

 

Why do I keep getting all the weird tool bugs?
You're too deadly for normal bugs, so they went to plan B, and attack you indirectly by hiding in tools.

 

Considering how once I got a game to travel backwards in time by pausing it, I think you probably aren't too far off from the truth.




#5306342 GUI Objects

Posted by on 17 August 2016 - 06:57 AM

Yeah, you need to do these things:

  1. Not use the depth buffer
  2. Use a different projection matrix (2D instead of 3D)
  3. Render it after the 3D scene (so it's on top of it)

That's the simplest way to render UI elements. And of course undo all that when you start rendering 3D again the next frame!




#5306105 When you realize how dumb a bug is...

Posted by on 16 August 2016 - 01:40 AM

Had a sound engine spazzing out because it turns out the last byte of the stream data got trimmed out somehow. It required three tools and the memory layout to align just right (wrong?) for this to happen.

 

Why do I keep getting all the weird tool bugs?




#5302826 When Tertiary Operators Become Confusing

Posted by on 27 July 2016 - 04:56 PM

Yeah, the example replacement in the first post is not that great because it's actually adding more stuff (and indeed adding enough to be way too much for the ternary operator to stay readable).

 

That said, if it was up to me I'd do:

move_speed = normal_speed;
if (running)
   move_speed *= run_speed;

I'm lame =P




#5302711 Why didn't somebody tell me?

Posted by on 26 July 2016 - 11:52 PM

I always thought the saying was "Disaster adverted" until I looked up the definition of adverted... It is "Disaster averted". =(

Disaster advertised.




#5302710 When you realize how dumb a bug is...

Posted by on 26 July 2016 - 11:49 PM

This is why I put indenting and // before the quotes and not inside them. (surprised the link stage didn't complain though? is that OK?)




#5301641 When you realize how dumb a bug is...

Posted by on 20 July 2016 - 05:07 PM

C++ allows overriding your parent's privates.

I'm having a hard time reading this with a straight face.


#5301506 Why didn't somebody tell me?

Posted by on 20 July 2016 - 05:24 AM

The bbq in omgwtfbbq stands for "be back quick", not for "barbacue". Apparently I ruined the day for several people already by revealing this.




#5301504 When you realize how dumb a bug is...

Posted by on 20 July 2016 - 05:18 AM

Wasted an entire day wondering why the heck graphics weren't being loaded. I examine RAM, the data is there. I look at the code in a debugger and it's indeed executing in the subroutines it should. I look at the code that sends the commands to the video hardware, pointers are OK, then I step and the loop is running, yet somehow the video hardware is ignoring them... wait a second, did an instruction just get misassembled?

 

This:

cmp.l a4, a5

became:

cmpm.l (a4)+, (a5)+

Huuuuh not only it got converted to the wrong instruction (CMPM instead of CMPA), where did the assembler get the idea of adding postincrement?




#5296198 Why didn't somebody tell me?

Posted by on 12 June 2016 - 05:34 AM

http://rhope.retrodev.com/repos/blastem/file/4db1a2e5d8e6/render_sdl.c#l557

Is this some GNU extension or actually part of the standard? o_O

 

EDIT: it's in C99, but not C++... https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Designated-Inits.html




#5293109 Some people just want to watch the world burn

Posted by on 23 May 2016 - 02:38 PM

I'm open to hearing about why it's insidious, but have yet to hear a good reason.

That the -> operator is actually a thing and I had to stop and think to figure out how it was supposed to be parsed (because I kept seeing - -> instead of -- >). You definitely don't want to slow down people like that, especially not during crunch period. (and yes, this is all a matter of where whitespace goes, the operation itself is fine)

 

Also I can attest to the string thing, I swear. I reduced loading times from 4-5 seconds to a fraction of a second just by computing a "quickhash" of each string (just add every character) when the list was first generated, then when it searched for a string it'd compare the quickhash first. Turns out that a lot of filenames differed only in their suffix (e.g. run_1, run_2, run_3, and so on - yeah, talking about animations here). A naïve comparison would have to scan practically the whole strings before failing, but the quickhash made them fail immediately. That the quickhash was stored alongside the pointer (and hence didn't need an extra dereference) probably also helped regarding the cache.

 

Obviously only useful for things like lists where you compute the quickhash of those strings only once then reuse it over and over, but it's definitely worth it even though it's quite simple to implement.




#5292868 Some people just want to watch the world burn

Posted by on 22 May 2016 - 08:55 AM

http://stackoverflow.com/questions/1642028/what-is-the-name-of-the-operator?rq=1

 

That's all I'm gonna say.




#5288792 Billborad is not aligned to view

Posted by on 26 April 2016 - 12:29 PM

Why are you pushing the matrix when you aren't using it? (and more importantly, you aren't even calling the matrix functions, not using the parenthesis means they're function pointers instead and on their own they do absolutely nothing)

 

Anyway, I'd argue that probably the easiest way for you would be to rotate (glRotate3f) the billboard the same angle as the camera, but the other way (i.e. -angle instead of angle). Less headaches to cope with. And if you ever switch to a more modern API than the old OpenGL 1.1, remember you can do whatever is the equivalent there.




#5288698 When you realize how dumb a bug is...

Posted by on 25 April 2016 - 09:03 PM

Today wondering why a file was 4KB instead of 3KB. Checked the parameters, they were fine. I had just changed the tool not much earlier on the feature that particular file was using so I wondered if I had introduced a bug? But wait, then why the other files relying on that feature aren't broken? Is this one of those subtle bugs?

 

Then I realized I was looking at the wrong file (ノ_<)






PARTNERS