LoginLogin

Loading a map from the map editor

Root / Submissions / [.]

HitomiHoshinoCreated:
Here's a short program function to load in files as saved by the map editor.
OPTION STRICT

' Loads a multi-layer map from a file
' Based on LOADSUB from GAME3JUMP/JUMP KUN
DEF LOAD_MAP FILENAME$
  VAR BGW, BGH, TMAX, LN, TN, ADDR
  DIM RAW%[0]
  LOAD FILENAME$, RAW%, FALSE
  BGW = RAW%[4] * RAW%[6]
  BGH = RAW%[5] * RAW%[7]
  TMAX = BGW * BGH
  DIM LDATA%[TMAX]
  FOR LN = 0 TO RAW%[3] - 1
    BGSCREEN LN, BGW ,BGH
	BGCLR LN
	FOR TN = 0 TO TMAX - 1 STEP 2
	  ADDR = TN DIV 2 + LN * TMAX / 2 + 264
	  LDATA%[TN] = RAW%[ADDR] AND &HFFFF
	  LDATA%[TN + 1] = (RAW%[ADDR] >> 16) AND &HFFFF
	NEXT
	BGLOAD LN, LDATA
  NEXT
END

ACLS
LOAD_MAP "DAT:MAP_YOURMAP"

No posts yet (will you be the first?)