Back to the Vavoom Forum Archives


Forum

Code refactoring thread

Wed, 02 Mar 2011 22:02:18

Crimson Wizard

Sometimes there are pieces of code that are not principally buggy but rather unoptimized or excessive. I wonder if it could be a good idea to have a thread for such cases. As a start, here's a code from Actor.Special final void A_KlaxonBlare(): Self exp
Wed, 02 Mar 2011 22:24:14

Crimson Wizard

actors/strife/strifestuff.txt
actor KneelingGyu 204
Spelling error in "guy".
Thu, 03 Mar 2011 06:09:28

b0rsuk

It's called "refactoring", right ? When you talk about optimization, the first thing that comes to my mind is execution speed. Am I to report typos in comments as well ? "Delfection angle" and so forth ? There's a lot of repetition i
Thu, 03 Mar 2011 06:24:44

Crimson Wizard

If you want to post something, consider yourself <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> (I wouldn't report lengthy functions though, unless same code is used more than once). BTW, I also noticed that sam
Thu, 03 Mar 2011 08:07:53

b0rsuk

When functions or methods are very long, it's harder to understand them. Take a look at HitMobj and HitLine in EntityEx.Physics.vc . I've found several bugs in the two methods already, and there are more coming ! A good rule of thumb is to avoid functions
Thu, 03 Mar 2011 08:39:34

Crimson Wizard

[quote="b0rsuk":1wf2m3km]When functions or methods are very long, it's harder to understand them. I am not going to report that because that's too obvious. Simply that. I just wanted to pay attention to less noticable things.
Thu, 03 Mar 2011 10:49:55

b0rsuk

    if (Special1 == 3)
 57         {
 58             damage <<= 1;
 59             power = 6.0;
 60             PuffType = HammerPuff;
 61         }
This is "third punch" of Hexen warrior (Spiked Gaunt
Thu, 03 Mar 2011 11:01:25

Crimson Wizard

LOL that's not the kind of "mistakes" I was going to post in this thread. <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? --> but, oh well....
Fri, 04 Mar 2011 07:58:24

BondEar

[quote="b0rsuk":k467vn37]I know bit shifting is faster than multiplication by 2, but performance gain here is marginal ! It has its place in the renderer, the engine etc. But this code is being run only once per 3 punches of the player, and it h
Fri, 04 Mar 2011 16:23:17

Firebrand

I also think that these type of problems reported here won't help much in terms of performance. Also, that class typo can't be changed without affecting ZDoom's compatibility, unfortunately, that's how the class is named in ZDoom, if we change it, that c
Fri, 04 Mar 2011 17:51:41

b0rsuk

[quote="Firebrand":2qs29df4]I also think that these type of problems reported here won't help much in terms of performance. Also, that class typo can't be changed without affecting ZDoom's compatibility, unfortunately, that's how the class is n
Mon, 07 Mar 2011 20:25:57

Janis Legzdinsh

[quote="BondEar":2ww7f8up]It would be interesting to know whether that was in the original Hexen source. Yes it was
Sat, 12 Mar 2011 00:52:38

Firebrand

The one reported by Crimson Wizard is fixed.
Sat, 12 Mar 2011 06:01:50

b0rsuk

I have one undeniable ugly bit, and one questionable one. 1. (questionable) in linespec/EntityEx.Morphvc, method Morph checks for bIsPlayer and calls either MorphMonster or MorphPlayer. Then in MorphMonster, there's another bIsPlayer check - but it wil
Mon, 14 Mar 2011 13:18:27

b0rsuk

I've found a really strange thing while debugging my special effects. In progs/linespec/EntityEx.Physics.vc, method HitFloorType:
1288     // Small splash for small masses
1289     if (Mass < 10.0 || bSmallSplash)
1290         smal
Wed, 16 Mar 2011 16:06:51

Firebrand

[quote="b0rsuk":g6q6ni9n]
1288     // Small splash for small masses
1289     if (Mass < 10.0 || bSmallSplash)
1290         smallsplash = true;
1291         print("Classname: %n", GetClassName(Class));
[/code:g

Back to the Vavoom Forum Archives