The Dink Network

Reply to Re: Data type hacks...

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
August 15th 2024, 09:52 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
editor_seq - can store integers of value between 0 and 65535, so there appears to be a binary relationship there, with that top value being an unsigned integer equivalent or some such thing, I'm way out of my depth here.

editor_frame - can store integers of value between 0 and 255, another binary thing I suspect, as it is 11111111 in the land of 0s and 1s.

So with each unused map screen having 99 sprite slots available to store 2 values, you've got 99 tuples available, with either 255 or 65535 possible values of the, switcheroos... I guess... my attempts at python programming are long behind me...

Or you could store a variable that holds 2 values by using a multiplication factor of 100 or 1000 of the first value and using math_mod operation in DinkC.

I've consider using this to store attributes of sprites such as the x and y coordinates they have died on, but stopped once I realised that the limit was 65535, as I would've like to do 1000s for the x and the mod or remainder for the y. (x, y) co-ordinates would become x*1000 + y.
&pos = sp_x(&current_sprite, -1);
&pos *= 1000;
&spy = sp_y(&current_sprite, -1);
&pos += &spy;

Then use math_mod and a divisor of 1000 to retrieve y coord from &pos, and then divide &pos by 1000 to get x coord... ho hum... I'm rambling...

Easier to use editor_seq for x coord, and halve y coord and store it in editor_frame, and just double it upon retrieval.