![Smile :)](./images/smilies/icon_smile.gif)
Does anyone have experience with making such nice diagrams out of some code? I think taht it would be cool to do it for arbitrary QuakeC, it can make it easier to orient in your code and easier for others to dive into it.
![Smile :)](./images/smilies/icon_smile.gif)
I believe each person has its own way of understanding. BUt, I would really like to recommend you just getting to know some UML, I found some of them usable. They are quite obvious and they are standard.Sajt wrote:Those sort of diagrams are confusingThe code is much easier to understand for me...
Code: Select all
1) do I have a movetarget ? If so, then I'll run self.th_walk towards it;
2) if not, I'll just hang on here running my self.th_stand function every 0.1 seconds(*), hopeffuly awaiting some player find me;
3) if I see a client, I'll set my .enemy field to point him, play my sight sound to show how pissed off I am, turn to him calling ai_face() and exec my self.th_run function;
4) if my self.th_missile is set and I have a clear path, I'll call it randomly;
5) if I am close enough and I have self.th_melee set, I'll exec it;
6) at any time, if somebody hurts me I may (or may not) play my pain animation and, if it has a different classname(**), I'll save my current value for self.enemy in self.oldenemy, set self.enemy with my agressor entity and go on;
7) if my health is below zero, I'm done. I play one of my cool death animations, turn non-solid(***) and eventually I'll drop a backpack with some goodies. If my health is too low, I'll just turn a rain of rotten meat giblets;
8) I am very stupid to deal with obstacles, specially long walls, and human clients abuse this limitation in several ways. Also, I have no understanding of the world where I roam aimlessly: I use to avoid water, even small puddles that would be otherwise safe to cross on foot. I don't distinguish water from lava or slime, and gaps deeper than 32 Quake units are virtually show stoppers to me.