View Single Post
Seren

JCF Member

Joined: Feb 2010

Posts: 868

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Jul 17, 2014, 06:31 AM
Seren is offline
Reply With Quote
Violet's answers are perfectly correct in a way but I wanted to elaborate on the first point.
Quote:
Originally Posted by AvalancheMaster View Post
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.
This is a complex question and I'm going to split it. How can you palshift the colors of all instances of an object? This is not too difficult. In most cases, all you have to do is change their preset's behavior to something like this on level load:
Code:
void newBehavior(jjOBJ@ obj) {
  obj.behave(BEHAVIOR::oldBehavior, false);
  jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, value);
}
where the parts in red should be replaced by appropriate identifiers / literals.

Now, getting to the "namely snow" part; this doesn't solve your problem because you seem to have gotten it wrong. Snow instances are not objects. Or, to be unambiguous, they are not jjOBJ instances. They are particles, i.e. jjPARTICLE instances. As such, their options are much more limited. The main problem, as you can imagine, is that you cannot change their behavior. This is a major obstacle but can be overcome by creating snow that is either stored in jjOBJ instances or, preferably, instances of a custom class created for it. In either case you would need to know the default behavior of snow instances, which I believe I'm allowed to provide, and base the new one on that, and that would essentially do the trick, but you would have to prepare to face another problem - this time of much more prosaic nature. You said "144-159". You should be informed that the default snow sprite uses entries 128-136 and entry 201. I suspect that last one could, depending on the exact palette, force a change in your plans.

Anyway, the point is, although it requires an inadequate amount of effort, applying PALSHIFT to snowflakes is essentially possible.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.