void cnfsave()
I knew it. This kind of store-the-state-in-an-array code is usually begotten because someone wants to be clever and simplify saving/loading.
And always with magic numbers, because that's how it was done in BASIC, where they first learned the technique.
Name:
Anonymous2010-08-16 20:15
That is some of the shittiest code I've ever seen.
And if you're Japanese, won't you be forced to use Ruby?
Name:
Anonymous2010-08-18 4:12
I had a Japanese professor for a couple CS classes and noticed he like 2-5 letter variable wherever possible, often giving things that should have been "blockOn" names like blkn
I had a Nipponese sensei for a couple of conpyuta sciensu classes and noticed he like the dibagga wherever possible, often giving things that should have been "traceOn" names like yelling TRACE ON!!! and jamming his p○n○s into my vag○○○ to replenish my magic
>>35
Is that even relevant to this thread, or just your way of saying ``I have read SICP to learn how to write spam bots''?
Name:
Anonymous2010-08-19 3:52
>>1
At first glance, I thought this was C, but what the hell is an alt statement? And why do all the case statements look like: case e7==something: where "e7" is not defined anywhere?
>>37
Macros and globals respectively. It's only a snippet.
Name:
Anonymous2010-08-19 4:23
>>33
I'm not talking about the braces dumbass. I'm talking about case e7==0:. That is completely fucked. Without macros, that's a boolean, and there are only two values of it. Cases cannot be repeated and have to be compile-time constants.
The only way this can compile as C is if e7 is some crazy-ass macro. The case statements also have no breaks, so unless case is also overridden, or e7 contains a break and opens a new case, then all these case statements fall through.
>>38
You're going to need to give us the macros for alt and e7, and possibly case as well if it's overridden by a macro.
>>39 I'm not talking about the braces dumbass. I'm talking about case e7==0:. That is completely fucked. Without macros, that's a boolean, and there are only two values of it.
Maybe you should actually look up how C works.
Cases cannot be repeated and have to be compile-time constants.
Maybe you should also look up how labels work in general.
Anyway.
Did Satoshi Nishimura write this code? Sure looks like his.
C99 6.8.4.2p3: The expression of each case label shall be an integer constant expression and no two of the case constant expressions in the same switch statement shall have the same value after conversion. [...]
>>42
C90 6.6.4.2 (3.6.4.2 in ANSI's C89): The controlling expression of a switch statement shall have integral type. The expression of each case label shall be an integral constant expression. No two of the case constant expressions in the same switch statement shall have the same value after conversion. [...]
Name:
Anonymous2010-08-19 7:45
>>1
This really doesn't look that bad. e probably means entity; ex/ey are current position, exx/eyy are the delta in the current tick. This is obvious from the top, right before the alt block, it makes sure the resulting movement will be bounded by reflecting off the world bounds. Before that looks like some gravity/repulsion code, maybe poor-man's collision detection. It is attracted or repulsed from another entity (possibly jiki or ENHnt).
Notice how at the end of each 'case' block, there's an if statement which will increment e7, and in the last case it sets e7 to zero. At first I thought this looks a whole lot like Duff's device, but judging from more of the code you posted, those case statements definitely don't fall through. I can't imagine any compiler macro for case that could make that compile. The include statements don't look correct either. Are you sure this is really C? Are you sure your C compiler hasn't been modified?
As far as the contents of the different cases in >>1, they look like different behaviors that the entity moves through sequentially and periodically. The behaviors all seem to randomly jitter the delta, except in the last case it may decay the speed exponentially instead of jittering (i.e. glide to a stop.) I don't know what the eb or ep arrays are.
It would help to have translations for "hant", "jiki", "ebhas", "ejmuteki", and a couple other identifiers. (The 'e's may be a prefix here.) Anyone speak Japanese?
hant is probably hantei, hitbox
jiki is probably jiki, own unit
ebhas no idea
ejmuteki, ej(?) muteki=invincible/invuln
Fire away!
Name:
Anonymous2010-08-19 8:58
>>46
So the top part is indeed a collision check with "own unit", probably player, and the entity bounces off at an angle.
ec looks like an animation counter. It gets reset to zero on each behavior/state change and increments each tick. ejmuteki switches on in e7==1 and back off at the start of e7==2, so that means the entity is invincible during the 1 behavior.
In the e7==0 behavior, the amount of time the entity spends in it seems to depend on the difficulty level. Without knowing what ebhas1 means I can't really tell what it does, but it governs all of their movements in all behaviors; it seems to have the side effect of actually moving the entity.
Name:
Anonymous2010-08-19 9:43
The Japanese as a society have the mental discipline required to remember what every symbol does without requiring overly long name. Furthermore, Japanese programmers are instilled the spirit of the samurai by their sensei: after years of practice, reading this sort of code becomes just as effortless as reading it, for they have mastered the art of Japanese minimalism. Any comment would just impede their reading.