Share the same palette with custentity, summon...[Solved]

kimono

Well-known member
Hi everybody,

I'm almost finished the Street of Nightmare set and I'm wondering how I can have the same alternate palette for an entity spawned with custentity:
Code:
anim	death
	delay   8
	offset	46 71
	spawnframe 0 0 0 0 0
	custentity Xxx #I wish this entity have the same palette than this enemy
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

Here's the first screen of this scenario, I don't want to spoil you more :)
wETh9MK.png
 
The property you want is "colourmap". This is NOT the map index. Instead, it is a pointer to the memory space an entity's current color table (palette) occupies. You can get this value and apply it to another entity's "colormap" property. Now the second entity is using the exact same color table as the first.

Two things to note:

[list type=decimal]
[*]The color tables of the second entity's model sprites have to line up with the color tables from the first entity's model sprites. If they don't, you'll probably get rainbow diarrhea. This is logical when you think about it - you're making one entity use another's color table.
[*]If the first entity changes color tables for any reason, the second entity does not. This is also logical. You made the second entity use the first entity's active color table at a given moment, but now the first entity is using another color table from a different space in memory. If you want them to stay matched at all times, just repeat the "colourmap" assignment right after the first entity changes its color table.
[/list]

HTH,
DC
 
kimono: you can use this function:
Code:
void spawnM(void Name, float dx, float dy, float dz)
{ // Spawn certain entity and matches its map with own's map
   void self = getlocalvar("self");
   int map = getentityproperty(self,"map");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, dz);
   changeentityproperty(Spawn, "map", map);
}

Copy n paste that into animation.c

It spawns other entity similar to spawn01 function except that spawned entity will use same palette as spawner.
 
Bloodbane said:

Bloodbane, that isn't the same thing. Your script matches palette indexes, not the palette itself. While you can do that, it requires maintaining and loading an identical set of palette indexes for both models. It also doesn't work on direct draw sprites at all. By using colormap instead of map, you are not relying on the second model's alternate palettes. They can be completely different or have none at all. This is much more memory optimal and maintenance free.

Like this...

Code:
void spawnM(void Name, float dx, float dy, float dz)
{ // Spawn certain entity and matches its map with own's map
   void self = getlocalvar("self");
   void color_table = getentityproperty(self, "colourmap");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, dz);
   changeentityproperty(Spawn, "colourmap", color_table );
}

DC



 
Gurtag: Thanks for the suggestion, it's something like that I'm searching  ;)

I tested the two scripts with the following command:
Code:
@cmd spawnM "name_of_the_enemy" 0 0 0
and it works perfectly with any original or alternate palette with Bloodbane script and use only the original palette with DC script (maybye I've done something wrong here, I'll retry).

The result is fabulous, thank you both you'll try that ingame soon ;)
 
Back
Top Bottom