artrag Posted June 21, 2020 Share Posted June 21, 2020 (edited) 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 June 21, 2020 by artrag Quote Link to comment Share on other sites More sharing options...
intvnut Posted June 21, 2020 Share Posted June 21, 2020 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 Quote Link to comment Share on other sites More sharing options...
artrag Posted June 21, 2020 Author Share Posted June 21, 2020 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 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.