Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BMP to PP256 Format?
#1
I everyone! Long time no see.... 8)

Is there a way to convert a .BMP picture so that it can be loaded with PP256?

Here's the image I want to convert:
[Image: tiles8lc.png]
Reply
#2
Here:

Uses Rellib.

Code:
DEFINT A-Z

'This File Does the converting of BMP tiles to pp256 format
'using the palette specified.
'you may have to edit the damn thing :*)

'$INCLUDE: 'Rellib.BI'
'$DYNAMIC
CLS
SCREEN 13


DIM SHARED PAL AS STRING * 768

Path$ = "C:\Images\Temp\"

Filer$ = "FF6chrs6.Pcx"
C = RelLoadPCX(VIDEO, 0, 0, Path$ + Filer$, PAL, TRUE)

FOR Y = 0 TO 199
FOR X = 0 TO 319
    IF POINT(X, Y) = 106 THEN
        PSET (X, Y), 175
    END IF
NEXT X
NEXT Y

stx = 30
sty = 30
Size = RelSize(0, 0, stx-1,sty-1)
MaxSize = (Size * 60)
DIM BMPS(MaxSize) AS INTEGER


sy = 12
sx = 11
Offset = 0
FOR X = sx TO 300 STEP stx
FOR Y = sy TO 170 STEP sty
            GET (X, Y)-STEP(stx - 1, sty - 1), BMPS((Offset * Size))
            LINE (X, Y)-STEP(stx - 1, sty - 1), 255, B
            Offset = Offset + 1
NEXT Y
NEXT X


'END

Leng& = MaxSize& * 2&
DEF SEG = VARSEG(BMPS(0))
BSAVE Path$ + "ArkWalk1.Put", VARPTR(BMPS(0)), UBOUND(BMPS) * 2&
DEF SEG

C$ = INPUT$(1)

CLS
SCREEN 0
WIDTH 80
END

You may want to tweak it a little bit because the tilesize it saves to is 30 x 30.

Vars to play with are STX,STY (the tile dimensions) and the for loop max values.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#3
Thanks, hope it works! 8)
Reply
#4
...and hey... where can I download Rellib? It wasn't included when I downloaded FreeBASIC... :roll:
Reply
#5
Rellib is a qb library. It wont work with FreeBASIC. Wink
Reply
#6
I get an Illegal function call here:

Code:
sy = 12
sx = 11
Offset = 0
FOR X = sx TO 300 STEP stx
FOR Y = sy TO 170 STEP sty
            GET (X, Y)-STEP(stx - 1, sty - 1), BMPS((Offset * Size))    ---- HERE
            LINE (X, Y)-STEP(stx - 1, sty - 1), 255, B
            Offset = Offset + 1
NEXT Y
NEXT X

It's silly maybe, but I haven't been coding for years so I need a little kick-start to get me going again...

Here's the dimensions of my sprites/tiles: 20x16
The BMP's dimensions is: 320x128

I also changed this:

Code:
FOR Y = 0 TO 199
FOR X = 0 TO 319
    IF POINT(X, Y) = 106 THEN
        PSET (X, Y), 175
    END IF
NEXT X
NEXT Y

To this:

Code:
FOR Y = 0 TO 127
FOR X = 0 TO 319
    IF POINT(X, Y) = 106 THEN
        PSET (X, Y), 175
    END IF
NEXT X
NEXT Y
Reply
#7
Is there maybe anyone who wanna help me out with this one?
Reply
#8
Make sure you dim the array large enough to hold the data for all of the sprites. It looks like that could be the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)