Anyways, anyone wanna help, calc wars is gonna be open source... i guess... Basically I'm gonna release the code and algorithms here, I'll do my best to code, and us maxcoderz people can work together to debug and stuff, no?
Anyways.... here's my first algorithm... I asked for debugging earlier, and I ask for reaction to it now....
Code: Select all
;//Routines for tilemapping, by Patori
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Before doing anything, I think that it'd be best to plan
;ahead. hehehe. So anyways, I believe I should discuss the
;program structure, nyo? Ok:
;
;
; char 'F','L','C','L'
; byte width,height
; byte DATA --------------->
; ------------------------->
; ------------------------->
; End, no need for termination bytes, that'd be a waste.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; ///Anyways, the way that the tilemapper would work (or, simply put, it's Algorithm) would be as follows, in poorly written C:
;
; Variables:
; width = the map's width
; height = the map's height
; xentry = xposition to draw from
; yentry = yposition to draw from
; bytetostart = pointer to where to start drawing from
; MAR = Random Access Memory (Level data)
; tempy = temporary y value
; function drawsprite(x pos, y pos, sprite num) = self explanitory
;
; int tileMap(int width, int height,int xentry, int yentry)
; {
; //To calculate the max y.... height-4
; int bytetostart;
; if (yentry > (height-4))
; {
; tempy = height-4;
; }
; else
; {
; tempy = yentry;
; }
; if (yentry < 0)
; {
; yentry = 0;
; }
; if (xentry < 0)
; {
; bytetostart = (yentry*width);
; }
; if (xentry > (width-4))
; {
; bytetostart = (yentry*width) + (width-4);
; }
; if ((xentry < (width-4)) && (xentry > 0))
; {
; bytetostart = (yentry*width) + xentry;
; }
; //We are pretending that the RAM is a big array called MAR...
; //FIX THIS
; for (int y = 0; y < 4; y++)
; for (int x = 0; x < 4; x++)
; drawSprite((x*16),(y*16),MAR[bytetostart+(y*width)+x]);
; return 0;
; }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
