IGNORED

# DEFINE usage

## Recommended Posts

I need a suggestion: I would like to replace this code

```		' animate explosion here
if (mytimer) then mytimer = mytimer - 1
n = mx and 6
if n=0 then
DEFINE 0,6,varptr myshipexp_3x2_00_bitmaps(6*4*(3 - (mytimer/16)))
elseif n=2 then
DEFINE 0,6,varptr myshipexp_3x2_02_bitmaps(6*4*(3 - (mytimer/16)))
elseif n=4 then
DEFINE 0,6,varptr myshipexp_3x2_04_bitmaps(6*4*(3 - (mytimer/16)))
elseif n=6 then
DEFINE 0,6,varptr myshipexp_3x2_06_bitmaps(6*4*(3 - (mytimer/16)))
end if
wait
```

by something more compact using an auxiliary table using a pointer to pointer... How should it work in in intybasic ?

Using n as above I was expecting something like this

DEFINE 0,6, varprt (varprt myshipexp_3x2(n/2)) (6*4*(3 - (mytimer/16)))

Where myshipexp_3x2 is an array of addresses:

myshipexp_3x2:
DATA    varptr myshipexp_3x2_00_bitmaps(0)
DATA    varptr myshipexp_3x2_02_bitmaps(0)
DATA    varptr myshipexp_3x2_04_bitmaps(0)
DATA    varptr myshipexp_3x2_06_bitmaps(0)

But it fails....

Did I something wrong or is it impossible in Intybasic ?

Edited by artrag
##### Share on other sites

I don't know all the wild and wooly ways of IntyBASIC, but my first guess would be:

```		if n=0 then
DEFINE 0,6,myshipexp_3x2(0) + (6*4*(3 - (mytimer/16)))
elseif n=2 then
DEFINE 0,6,myshipexp_3x2(1) + (6*4*(3 - (mytimer/16)))
elseif n=4 then
DEFINE 0,6,myshipexp_3x2(2) + (6*4*(3 - (mytimer/16)))
elseif n=6 then
DEFINE 0,6,myshipexp_3x2(3) + (6*4*(3 - (mytimer/16)))
end if

'...

myshipexp_3x2:
DATA    varptr myshipexp_3x2_00_bitmaps(0)
DATA    varptr myshipexp_3x2_02_bitmaps(0)
DATA    varptr myshipexp_3x2_04_bitmaps(0)
DATA    varptr myshipexp_3x2_06_bitmaps(0)```

Seems like you only need one level of VARPTR.

I'm assuming, of course VARPTR array(x) is equivalent to x + VARPTR array(0).

If the code above is correct, you can shrink it further:

```		if (n AND 2)=0 then
DEFINE 0,6,myshipexp_3x2(n/2) + (6*4*(3 - (mytimer/16)))
end if```

##### Share on other sites

I've moved the data in the 4 tables (of 96 words each) in one single large array, so now I use:

n = mx and 6
DEFINE 0,6,varptr myshipexp_3x2(n*48 + 24*(3 - mytimer/16))
wait

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.