smitelli / cosmore

A reconstruction of the source code of Cosmo's Cosmic Adventure.
https://www.scottsmitelli.com/projects/cosmore
Other
113 stars 6 forks source link

ConstructActor very confusing; Comments do not specify what each segment of the array does. #2

Closed T-SquaredProductions closed 3 years ago

T-SquaredProductions commented 3 years ago

For a random example: For the floating star actor, I don't know what the various numbers and logic switches do: ConstructActor(SPR_STAR, x, y, F, F, F, F, ActPrize, 0, 0, 0, 0, 4);

On one hand, I thought the final number in the array was for frame count, but it doesn't make sense for other actor constructors.

smitelli commented 3 years ago

The function definition for ConstructActor() makes it a little clearer. The 13 parameters are, in order:

For the example you gave specifically (looks like ACT_STAR_FLOAT), I can quickly trace through and explain what the data arguments are. The tick_func is ActPrize(), so I jump to that function to see:

There are other side-effects and interactions in there as well. If data1 is nonzero, the actor is also drawn flipped. This is supposed to make it possible for ceiling-mounted prizes, but it interferes with "sparkly" objects -- if you look at the actor tiles and compare them to what the game draws, "sparkly" prizes are drawn flipped too because their data1 holds a width which is nonzero. The game is full of kludges like that.

Needless to say, every actor type is different. If there was a way to unify the behavior with a more useful name, I would have done so. ;)

An aside: Values for true/false are abbreviated as T/F here for space reasons, and I tried to convert all numeric constants I was sure about to named things to make it a little clearer what was being passed. Unfortunately for many of these, you'll have to read the source.

smitelli commented 3 years ago

This is also quite important -- it specifies what happens when the player touches an actor of the SPR_STAR sprite type.

T-SquaredProductions commented 3 years ago

Thanks. I'm not trying to act dumb or look for hand-holding. 😜 I'm just not familiar with the more complex intricacies of the program, and my knowledge of C is rather limited (Only to 3D printing). I do have a bit of programming experience from QBasic, and I learned about arrays and logic switches later, so I do know some of the arguments that the program uses, and I have learned how to make my own custom text boxes in the game. (Although for the actor logic switches, I figured acrophile was the "floating in air" switch, so there's one of my blunders right there.)

I'm actually better at making the graphics, story, and some of the music for the game idea I have in mind using your reconstruction. It's just that I'm itching to get it done, because it's been in development for almost 14 years. XD Yes, you read that right. I started in 2007, when I found out there were editing tools for the game. Although, my artistic skills since then have amazingly improved.

smitelli commented 3 years ago

Not a problem. I'm happy to point out where things are, or how specific behaviors work. The reconstruction is pretty solid, but the comments are lacking in many respects and I can see how that might make things difficult for somebody who hasn't been looking at it for five years. (That's about how long it took me.)

smitelli commented 3 years ago

I'm going to close this issue since it looks like the root question has been answered. I'll keep #3 open as my reminder to revisit the comments to try to make the code a little clearer.