View Single Post
Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,047

Violet CLM has disabled reputation

Jul 16, 2014, 07:33 PM
Violet CLM is offline
Reply With Quote
Quote:
Originally Posted by AvalancheMaster View Post
If I change an object behavior, would it change just for one instance of the object, for every instance created after the change, or for all instances?
It depends on what you mean by "change an object behavior." Whenever an object is added (through jjAddObject or by some bit of native code), the contents of the corresponding jjObjectPresets entry are memcpy'd into a slot in jjObjects. So if you make a change to an object in jjObjects, it'll affect only that one object; if you make a change to an object in jjObjectPresets, it'll affect every object created from that preset after that point, but not any objects that were already created. (The same applies to nearly any other object property, except for the few that get set as part of adding an object like xOrg or creatorType.)
Code:
jjOBJ@ donutPreset = jjObjectPresets[OBJECT::DONUT];
jjOBJ@ donut1 = jjObjects[jjAddObject(OBJECT::DONUT, 0, 0)];
//donutPreset.behavior == donut1.behavior == BEHAVIOR::PICKUP

donutPreset.behavior = BEHAVIOR::MONITOR;
//now donutPreset's behavior is MONITOR, but donut1's behavior is still PICKUP

jjOBJ@ donut2 = jjObjects[jjAddObject(OBJECT::DONUT, 0, 0)];
//donut2 is copied from donutPreset, so donut2's behavior is also MONITOR

donut1.behavior = BEHAVIOR::CRATE;
//only donut1's behavior is changed by this, and subsequently added donuts will continue to use MONITOR, not CRATE, unless...

jjOBJ@ donut3 = jjObjects[jjAddObject(OBJECT::DONUT, 0, 0, 0, CREATOR::OBJECT, BEHAVIOR::PADDLE)];
//donut3's behavior is PADDLE, not MONITOR, because that was explicitly provided in the jjAddObject call. This option is provided because jjAddObject calls the object's behavior function before you get a chance to initialize any of its other properties, and sometimes you might want to circumvent that.
What's important to understand is that nothing separates one object from another besides its properties, almost every one of which you can set in AS. (The only exceptions are objectID, for obvious reasons, and another two bytes which are only used while loading the level but never again.) If jjObjects[1] is a lizard, and you change its eventID and behavior and curAnim and so on, once you've changed enough properties, there will be no respect in which it is still a lizard.

After that I have some bad news for you...

Quote:
1. How can I palshift the colors of all instances of an object, namely snow? I'm using a modified (through AS) version of Blade's FoFS tileset, and the dirt uses the same gradient as the "dirt", as seen below. I want to shift it to the "grass" (144-159) range.
Not in 4.3.
Quote:
2. A more complex question: how can I create a basic walking enemy that uses Jazz' stoned sprites, but with changed colors?
Not in 4.3. Well, you could use SPRITE::PALSHIFT, but it doesn't work with leftward facing sprites, and SPRITE::PLAYER would require that there actually be a player with the colors you want.
Quote:
3. Is it possible to rotate the texture of the textured background by 90 degrees?
Not in 4.3.
Quote:
4. Just an additional question to Violet, is it feasible to use different J2A file through AS? I know it's not a CURRENTLY AVAILABLE option, I'm asking if it's a possible one. Of course, the palette should match the original Jazz palette.
Completely possible. For example, we use native JJ2 code to read from plus.j2d, changing the string embedded in Jazz2+.exe to read "plus.j2d" instead of "data.j2d" before the function gets called, and the same approach could be used for .j2a files too if that seemed like a good idea.
__________________

Last edited by Violet CLM; Jul 16, 2014 at 07:45 PM.