![]() |
![]() |
#261 |
Registered User
Join Date: Mar 2018
Location: Austria
Posts: 620
|
Tried it. Works super fine. Thanks a lot Rob!
![]() ![]() |
![]() |
![]() |
#262 | |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
Quote:
http://amigadev.elowar.com/read/ADCD.../node0485.html |
|
![]() |
![]() |
#263 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Hi everyone ! A couple of noobs questions !
![]() 1) Regarding UsePath - does it make the code any faster or is that just to save the coder time ? I thought the latter was pretty obvious but I read the former somewhere in a Blitz guide... - can I use it with a complex expression, like the following one in which Enemy is a list of newtypes and chord is a newtype ? Doesn't seem to work. UsePath Enemy()\chord The program runs but the value returned is incorrect. - is it possible to "reset" UsePath ? 2) A more general question when using lists, newtypes etc... Is it possible / useful / advised to optimize by reducing the number of sub-levels ? I guess each indirection level is cpu cycles consuming ? (not sure indirection is the right English term) 3) Regarding the TED editor - Sometimes I have to write a line of code which exceeded the max number of allowed characters. Is it possible to split a line of code into several lines ? 4) Updating text - Playing with FNS library to display bitmap fonts. I guess, in order to update some text at a given position, I should blit a black rectangle over the already existing text ? Is there a faster way ? Or maybe I should use Shapes or Sprites (in which case, maybe the FNS lib is not the solution ?!) 5) CLS I get the message "command only available from the Amiga mode" when using this command from a Statement. BUT this is invoked from my main game loop which is in Blitz mode. And if I call CLS from the main loop, it works ?! Alternatively : how am I supposed to clear the bitmap in Blitz mode then ? Thanks everyone :-) Last edited by mahen; 30 May 2024 at 13:17. |
![]() |
![]() |
#264 | ||||||||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Quote:
Quote:
Code:
UsePath Enemy()\chord NPrint \x Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||
![]() |
![]() |
#265 | |||||
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Daedalus : wow, that was extremely helpful ! THANK YOU !
Quote:
I have to check whether it's an issue in the .guide or in the Multiview / datatypes provided with OS 3.2.x. Quote:
Also, I think I'll optimize by pre-computing some calculations involving * and / at the relevant time. More memory used but faster code. In general, I should look for a way to profile my code. Quote:
Quote:
![]() Quote:
Thank you again so much for your help. There more I tinker with Blitz 2 the more I think I would have been a HUGE fan of it back in the days. I only had AmigaBasic. BTW I quickly gave AmiBlitz 3 a try, but I guess my machine being on the lower end side, it's not optimal. (030@50) Last edited by mahen; 31 May 2024 at 08:50. |
|||||
![]() |
![]() |
#266 | |||||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||
![]() |
![]() |
#267 | |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Hi ! I'm a bit lost regarding the pointers...
I could find very little information about them actually. In the BB manual, there is only this : Quote:
I have a list of the Enemy newtype. This newtype contains a look-up table initialized when it's created. (an array) called precalcSat which contains intermediate RGB values. (in this test, 1 enemy = a copper bar of variable size and colour) Instead of invoking the following from my main loop : Enemies()\precalcSat[i] I'd like to use a pointer to the beginning of the precalcSat array. I tried : *pt = Enemis()\precalcSat[0] and tried accessing to pt(i) but to no avail. Tried many different syntaxes. Thanks a lot ![]() (for some reason using this LUT doesn't speed up the code as much as expected. But it's better when removing those accesses) Last edited by mahen; 31 May 2024 at 13:32. |
|
![]() |
![]() |
#268 | |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
So you're creating that pointer outside the main loop? You have to be careful because in a dynamic list array, the elements aren't necessarily contiguous so you can't use pointer arithmetic to jump around. However, the contents of the Newtype should allow that sort of navigation.
Quote:
To get the address of a variable, use the & symbol: Code:
*pt = &Enemis()\precalcSat[0] NPrint "Sat value 2: ", peek.b(*pt + 2) Regarding the LUT speedup, it's indeed possible the problem is memory accesses. What type of variables are you using, and on which CPU? By default Blitz uses "quick" types, which are a fixed-point, 32-bit type, and despite their name are actually quite slow to deal with, especially on the 68000. You're better of using a word type (16-bit integer) for things like array indices and anywhere else that integers work. |
|
![]() |
![]() |
#269 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Hi !
Yep, I use words as the default type ! But if I only plan to use the content of the precalcSat array (which itself is part of a Newtype list), values will be contiguous anyway, so no issue ? Nope, I didn't pre-declare the pointer. I thought pointers were longs ? Thank you ! ![]() edit : 030@50 setup, btw ! Edit : so I tried this *pt = Enemies()\precalcSat[0] And Peek.w(*pt+i) But it doesn't return the right value... hm... Last edited by mahen; 31 May 2024 at 14:11. |
![]() |
![]() |
#270 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Hi ! I have new questions :-)
1) When using the dual playfield mode : is it possible to have some kind of "mask" or "window" so that, for instance, the background is only visible in the center of the screen and not in the border ? (otherwise, the easy solution is just to make sure the foreground has a colour different from 0 so that it gets opaque). Just asking as I'm aiming at very lightweight 2*1 bit playfields. If I have so sacrifice one colour to add opacity, well, I'll have to switch to 2 bits playfields ;-) 2) Also, another question : is there somewhere an example of "CustomSprites" ? (sprites multiplexing). As usual, the manual is pretty... obscure to me ![]() Last edited by mahen; 10 June 2024 at 12:53. |
![]() |
![]() |
#271 | ||||||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Sorry, could've sworn I replied to this...
Quote:
Quote:
Quote:
Also, if it's an array of words, you need to skip 2 bytes at a time: Code:
Peek.w(*pt + (i * 2)) Code:
Peek.w(*pt + (i LSL 1)) Quote:
Quote:
Quote:
The manual lists (4 x numsprites + 2) as the amount of space needed, so for 8 sprites it should be 4 x 8 + 2, which is 34. Use this value with InitCoplist. If you have any other custom copper commands, you'll need to calculate their offsets on the coplist, but for simplicity just use one to start with. Once that's done, you declare your sprite break Y position with CustomSprites. The CCOffset is to accommodate other Custom... commands, so leave that at 0. Then you should be able to use a second set of sprite channels numbered 8-15 in the area below the declared Y position. |
||||||
![]() |
![]() |
#272 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Thank you so much for the replies !!
![]() I have yet another issue :-) with dual playfields. I have 2*2 bits bitmaps, and hence, a 8 colours copperlist. I understood the first 4 colours of the palette were for the "back playfield" and the following 4 for the "front playfield". I can indeed use AGAPalRGB to define the first 4 correctly. However, altering colours 4-7 of my palette make no difference at all to the front playfield. For instance, I blit some aliens in the foreground, and they always appear in a kind of dark blue which does NOT belong to the palette at all. Any idea ? (out of curiosity, I tried to swap the playfields, and, obviously, it has the same consequences : I cannot alter the values of the front playfield - which used to be the back one). BTW, when invoking DisplayBitmap I specify the foreground, then the background. I have probably overlooked something obvious ![]() I have read somewhere there could be an offset of 16. Tried that to no avail. EDIT : anyway, it's not good. Because actually it appears that, DisplayBitmap must be invoked with the background THEN the foreground (which is not what I read in the manual). So... The first colours of my palette would be for the foreground. Which is not what I had read... Sigh ! In both cases, I cannot alter the colours of the other playfield so the problem remains. Last edited by mahen; 11 June 2024 at 11:31. |
![]() |
![]() |
#273 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Stumbled upon this : https://eab.abime.net/showthread.php?t=104666
Which probably answers my issues. "you need to bear in mind that the palettes will overlap by default, since AGA defaults to OCS/ECS compatibility mode. This means that the palette for the second playfield starts at 8, not 16, so your first picture will use pens 0-15, the second will use pens 8-23. Use DisplayControls to adjust BPLCON3 (I can't remember the exact bits) to adjust the offset so that the second playfield uses pens 16-31." I'm not 100% conviced yet, though. As I use 4 colours playfields, the overlap should not be an issue... Also, it doesn't explain why, for the moment, I can see stuff in a dark blue which does NOT belong to my palette (I tried to set the whole palette to white to make sure), or why for fore/background seem to be inverted. |
![]() |
![]() |
#274 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Yeah, I think the foreground and background are mixed up in the manual. What you need to keep in mind is that the offset doesn't care about how many bitplanes you use - it's always 8. So in your case, where you have colours 0-3 for your first field, the second field will use colours 8-12, leaving colours 4-7 doing nothing. Sprite colours then are offset to 16.
When you set up your display and your palette, you need to take this into account - specify 16 colours even if you're only using 2+2 bitplanes so that the entries in the palette are available to you. |
![]() |
![]() |
#275 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Thanks !
Hmm... Still no luck. Then I "upgraded" my CopList to 16 colours instead of 8 and... The background which used to be invisible suddenly showed the right colours. Even though I have 2 2 bits bitmaps... Is 8+8 colours dual playfield illegal ? Mysterious stuff ! |
![]() |
![]() |
#276 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,416
|
Yeah, that's the expected behaviour. Sorry, I should have been clearer - both the palette and the display (which means the Coplist declaration) need to have enough colours to cover the palette entries you need, regardless of bitplanes used. You'll need to set both to 32 colours to use sprites, for example, because they use palette entries 16-31.
|
![]() |
![]() |
#277 |
Registered User
Join Date: Apr 2008
Location: France
Age: 42
Posts: 475
|
Ah, okay, it makes sense then ! I guess that won't make me lose the benefit of having lightweight bitmaps (2 bitplanes) in terms of speed of blitting & memory !
thanks again ![]() |
![]() |
![]() |
#278 | |
Registered User
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 41
Posts: 1,017
|
Quote:
If by a center and not in the boder you mean exactly not smaller than other playfiled you could poke bplcon3 border balnk. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blitz basic] How much amiga-blitz friendly is this? | saimon69 | Coders. Blitz Basic | 105 | 21 April 2022 19:45 |
Blitz Basic (1) | Retro1234 | Coders. Blitz Basic | 9 | 18 February 2016 17:54 |
Blitz basic 2 Help | Havie | Coders. Blitz Basic | 30 | 08 September 2013 09:15 |
Blitz Basic 2 anyone? | jobro | request.Apps | 12 | 28 November 2005 18:15 |
Blitz Basic 2 | LaundroMat | Retrogaming General Discussion | 5 | 24 July 2001 08:10 |
|
|