Fox, on 05 October 2015 - 04:23 PM, said:
If I get it, you are using the hitag to store the ID of another sprites? That's a no-no. Sprites are not supposed to keep their ID when the map is loaded by the game.
No. The hitag is used as the "channel" that marks an actor as part of that group. The idea was during initialisation this would be used to set up linked list pointers (implemented as per-actor gamevars). Where sorting was needed that was done via lotag. Advantages:
1) After initialisation, lotag and hitag are redundant
2) When I fire an activation (a jonz version at this point in time) I just scoot across the first sprites in the group and flag that they've been activated and need to do something when it is their turn.
3) When moving a group of sprites they absolutely have to move at exactly the same time and not wait for their respective EVENT_GAME calls else they will flicker. A linked list of exactly the ones to move is quick and simple.
All in all a brilliant plan - right up to the point where ID's change
The effects are totally configured via standard mapster, so primarily they need configuring via lotag/hitag, 'extra' if I need a bit more, and so on (I've a csutom mapster with a menu system which will simplify this setup, but the effects will always be configurable via standard mapster). Part of initialisation is to stash these values and if necessary reset them. With very few exceptions, I leave standard sprite array data well alone after initialisation.
Mblackwell, on 05 October 2015 - 07:08 PM, said:
You should always save hi and lo tags into a var and then set them to 0, I assume you're doing that already.
Indeed. Other than borrowing a few flags in cstat (which has some debugging advantages) I'm avoiding reusing standard sprite variables.
Mblackwell, on 05 October 2015 - 07:08 PM, said:
A couple of better bets might be:
1) Use custom statnums and headspritestat. (This is great for random stuff)
I didn't think I could use statnum (
wiki page) as I infered it might change in, or influence, the game operation.
"Unassigned status numbers are reserved for future EDuke32 features. Please ask the developers to allocate an official user statnum range for CON-side features, should this be desired." You start the petition to allocate statnum > 1024 for user defined use whilst I print the campaign t-shirts and mugs
With luck, the Eduke developers need do no more than update the wiki so very little effort required?
Mblackwell, on 05 October 2015 - 07:08 PM, said:
2) A better method still for LOCATOR type things would probably be to create arrays with offsets.
Do you mean that, using my previous example sprites {223,220,208}, their ID's may move but their relative ID's will always be the same e.g. {222,219,207}, or {23,20,08} etc ? Otherwise I don't see how an array will help.
Mblackwell, on 05 October 2015 - 07:08 PM, said:
To do it of course you'll need to figure out the max/how many points you want in each path. The hitag would be ordered rather than a random unique number. Each mylocator would simply have to insert its sprite id at position mylotag*MAXPOINTS+myhitag in the array.
But the ID changes and its been suggested this isn't just on completion of initialisation but also if during the game something is spawned.
Mblackwell, on 05 October 2015 - 07:08 PM, said:
So for 30 separate paths with 30 different points you'd need an array size of 930 (actually you'd get 31 paths I think due to path 0 but I'm not going to do the math atm). Then individual actors just need to traverse their assigned set of mylocators.
Again, how do they find their associated locators as the ID's of these locators may change?
OK, example. My group of sprites, lets say {42,69}, are moving from locator 100 to locator 110. Suddenly, something is spawned and causes sprite ID's to change, lets say my locators are now 98 and 108 and group of sprites {22,49}. How does my group of sprites find these locators? Bear in mind this is unsynchronised, that is, the group of sprites may move after the locator's ID's have changed but before the locator's have been processed so that they could update some table to reflect their new ID's ?
AH! (lightbulb finally flickers into life), maybe I've just seen where you were going. Assign each group a unique statnum value and use this as the linking mechanism e.g. sprites with statnum 1025 follow the path of locators statnum 1234. I'll take a peek in the code for the size of statnum - if I'm _real_ lucky I could simply use statnum = 1024 + original hitag value. No need for any extra tables at all. Mblackwell, I owe you one.
Right, off to re-write half me darn code
TTFN,
Jon
[Edit] Sprites that are blocking, hitable and have hitag (=>destructable) have their statnums set to 17 so above method for grouping needs to be to iterate all sprites with matching statnums AND all sprites with satnum 17 and matching hitag. Given I'm not interacting with enemies,players,weapons,projectiles and so forth- only inanimate objects - additional checking for statnum 17's is the only extra effort I need. I hope.