Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Torvin Foundation

A code builder for the ZX Spectrum NEXT · By John Weatherley

Possible bug with Display256BMP() function

A topic by oscarbraindead created 20 days ago Views: 36 Replies: 4
Viewing posts 1 to 5

Hi John!

Thanks for create and share Torvin Foundation. 

I've been testing it for a few days now and I'm really enjoying it. Congratulations! I don't know if I've encountered a bug or if I'm doing something wrong, but if I load a BMP file with `Display256BMP()` and then load another one with the same function, the game freezes. The same thing happens if I use `Display256BMP()` after initializing the sprites with: 

`SpritesOn()`

`LoadSpritePatterns(64,0,SPRITE_BANK,0)`

the game freezes.

I don't know if it's a bug and if there's an easy fix.

Thank you very much!

Developer

Hi, thanks for downloading and trying out the Foundry.  When you say the game freezes, how are you controlling flow of the game?

(1 edit)

Hi John, 

Just a quick example based on the code generated by the Foundry for a new standard program:

#INCLUDE <torvin_next_foundry.bas> 
#INCLUDE <keys.bas> 
#INCLUDE <torvin_vortexmusic.bas> 
#INCLUDE <torvin_aysfx.bas>  
CONST   FONT_BANK AS UBYTE = 34 
CONST   DRIVER_BANK AS UBYTE = 36 
CONST   MUSIC_BANK AS UBYTE = 37 
CONST   SFX_BANK AS UBYTE = 39 
const   sprite_bank as ubyte = 50  
Init() 
Main()  
STOP  
SUB Init()     
LoadToBanks("ASSETS/font256_1.spr",FONT_BANK,0)     
LoadToBanks("ASSETS/ts4000.bin",DRIVER_BANK,0)     
LoadToBanks("ASSETS/TestMusic.pt3",MUSIC_BANK,0)     
LoadToBanks("ASSETS/gameSFX.afb",SFX_BANK,0)     
LoadToBanks("ASSETS/cubo.spr",sprite_bank,0)     '<---- add a spr file 
END SUB  
' ============================================================================================ 
'  Main Control Loop 
' ============================================================================================ 
SUB Main() 
    DIM sKeyReleased AS UBYTE 
    dim scrollamount as ubyte     
 
    Music_Init(DRIVER_BANK, MUSIC_BANK)     
    SFX_Init(SFX_BANK)     
    Layer256On(1,0)      
    Music_Start()      
    Display256BMP("ASSETS/prueba.bmp")
    SpritesOn()     
    'LoadSpritePatterns(64,0,sprite_bank,0)       '<------  is the problem here?
    InitSmallSprite(0,100,100,1)      
        
    DO         
        if multikeys(KEYL) then             
            while multikeys(KEYL)             
            wend             
            Display256BMP("ASSETS/font256_1.bmp")         
        end if          
        scrollamount=scrollamount+1         
        ScrollLayer256(scrollamount,0)          
        WaitScanLine(192)         
        Music_PlayFrame()         
        SFX_PlayFrame()     
    LOOP 
END SUB

While then program is running, if you press L key, it loads a new BMP and the scroll continues... but if you uncomment the 

LoadSpritePatterns

line, when you press the L key, the program freezes...

I hope it helps. Please, let me know if I must do another example.

Best regards

Hi! 

Another test:

#INCLUDE <torvin_next_foundry.bas>  
#INCLUDE <keys.bas>  
#INCLUDE <torvin_vortexmusic.bas>  
#INCLUDE <torvin_aysfx.bas>   
CONST   FONT_BANK AS UBYTE = 34  
CONST   DRIVER_BANK AS UBYTE = 36  
CONST   MUSIC_BANK AS UBYTE = 37  
CONST   SFX_BANK AS UBYTE = 39  
const   sprite_bank as ubyte = 50   
Init()  
Main()   
STOP   
SUB Init()      
    LoadToBanks("ASSETS/font256_1.spr",FONT_BANK,0)      
    LoadToBanks("ASSETS/ts4000.bin",DRIVER_BANK,0)      
    LoadToBanks("ASSETS/TestMusic.pt3",MUSIC_BANK,0)      
    LoadToBanks("ASSETS/gameSFX.afb",SFX_BANK,0)      
    LoadToBanks("ASSETS/cubo.spr",sprite_bank,0)     '<---- add a spr file  
END SUB   
' ============================================================================================  
'  Main Control Loop  
' ============================================================================================  
SUB Main()      
    DIM sKeyReleased AS UBYTE      
    dim scrollamount as ubyte            
    Music_Init(DRIVER_BANK, MUSIC_BANK)          
    SFX_Init(SFX_BANK)          
    Layer256On(1,0)           
    Music_Start()           
  
    SpritesOn()          
    'LoadSpritePatterns(64,0,sprite_bank,0)       '<------  is the problem here?     
    InitSmallSprite(0,100,100,1)                    
    Display256BMP("ASSETS/prueba.bmp")
    DO                  
        scrollamount=scrollamount+1                  
        ScrollLayer256(scrollamount,0)                   
        WaitScanLine(192)                  
        Music_PlayFrame()                  
        SFX_PlayFrame()          
    LOOP  
END SUB

If you run this example with the  LoadSpritePatterns command uncommented the program freezes in the Display256BMP statement. I think that any Display256BMP command AFTER a LoadSpritePatterns results in a freeze.

Please, let me know if I can do something to help. 

Thank you!

Hi John! Just tried the new version of Torvin and Display256BMP works fine after LoadSpritePatterns command.

Thank you!