[Calc Wars] Help with tilemap?

Projects that are no longer in development anymore.

Moderator: MaxCoderz Staff

Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

[Calc Wars] Help with tilemap?

Post by Patori »

Copied from my aw_tilem.z80 file.

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) + width;
;      }
;      //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*height)+x]);
;      return 0;
;   }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; In theory, (at least in my theory) this will work. I had to re-re-re-code this like 5 or 6 times.
; Pretty much cuz I was an idiot and didn't think to check X Positions or Y Positions... ^*^. I'll let
;Maxcoderz look over it before I convert it into ASM. BTW, units are gonna be loaded in a completely different
;way, they start off as arrays of data structures that will be loaded, and checked for relevence with the current
;viewpoint that is being displayed.
;Well, I'm gonna be really proud if this works :-D
;Looking over this code, I realize that it will take forever, and at least 1-2kb to code this in ASM. *gulp*.
;I WILL FINISH THIS FOR TICALC.ORG POTY 2005.
;
;Maxcoderz people (wow! I'm one of these elitists! yay!): I'm sorry that I have not shown any real work as of late,
;my home life has went down a toilet. We cannot afford internet, my dad looks for scrap steel for a living, and
;I cannot graduate until I can come up with $1.7k for tuition. (To go to this school, costs $7k, I have scholarship for $5k)
;I've been looking for a job as of late, and even when I get one it will be difficult to save up money for internet
;(I need a phone line turned back on first), and I will likely not have much free time when I work. I'm not asking for pity,
; I'm begging for patience and understanding. My life sucks. lol. I'd happy with it though... not really... *goes back to
;being a goth at home*
;
; "It's hard to be a goth when you are an optimist" - A teacher of mine, to me... :-S
;
; my life may turn around. Mrs. Sinha (Java teacher) spoke of a Database developing job over the summer, and I'm filling out
; tons of apps at various places by my school.



Do you think this code'll work? Ideas please?
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

more help

Post by Patori »

I'd also appreciate help with my load level loop's termination. I'm simply storing the mem addresses in saferam1, saferam1 and saferam1+1 as a pointer to where data was last entered, saferam1+2 data entry point.

Code: Select all

#define LookSpot saferam3
#define LevelList saferam1 ;1 and two for last entry, rest is data
            ;In theory, cannot be filled up :) "Luhcky!" - N. Dynamite

aw_load_detect:         
   ld hl,(ProgPtr)
   ld (LookSpot),hl
   ld de,saferam1+2
   ld (LevelList),de
aw_load_detect_loop:
   ld hl,(LevelList)
   push hl
   ld hl,(LookSpot)
   ld ix,aw_load_token
   call iondetect
   pop hl
   ;;ex de,hl   ;Erm, rethink, not sure if it will work... hehe. Forum time!, nvm, solved by self.
   ld (hl),d
   inc hl
   ld (hl),e
   inc hl
   ld (LevelList),hl   ;Will it float?! Will it float?! - Late Show

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ; Okay, I've determined that there is no real way to check if all of the RAM has ;
   ;been scanned with iondetect, at least in the way that I'm using it... So I guess;
   ;I'll have to ask those "elitist teenagers" (w00t!) at Maxcoderz for some help,  ;
   ;or I can kill myself recoding it... I'll prefer to ask for help at this point...;
   ;               -Patori 2/22/05             ;
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;ld hl,$0000      ;REALLY NEED TO DOUBLE CHECK... Tired though
   ;bcall(_cphlde)
   ;jp nc
   jp aw_load_detect_loop   ;Infinte for now, until i can Break.
aw_load_token:      ;For file detection. Fooly - Coolyin' it up, ^^ Don't wanna be a statistic, "Death by motorbike!" -FLCL
   .db "FLCL",0   ;God, if I use obscure Anime references throughout my code, I'll be famous.
aw_list_token:
   .db "EVAG",0   ;THAT'S RIGHT... Evangelion. "Basically giant robot anime" -FLCL (Go Gainix!)

;

Anyways, I need some help with terminating this loop. I believe that there is no safe way of telling whether all RAM has been checked, but I dunno. I may need to re-re-rewrite the code...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Re: Help with tilemap?

Post by Patori »

Patori wrote:; drawSprite((x*16),(y*16),MAR[bytetostart+(y*height)+x]);
; return 0;
; }


height should be width above... oops.
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
DarkAuron
Maxcoderz Staff
Posts: 1349
Joined: Sat 18 Dec, 2004 6:53 pm

Post by DarkAuron »

Shoudn't this be in the programming help forum?
[Gridwars Score] - E: 1860037 M: 716641 H: 261194
lloydkirk1989
Calc Wizard
Posts: 680
Joined: Wed 22 Dec, 2004 5:37 am
Location: West Palm Beach,FL
Contact:

Post by lloydkirk1989 »

Well im not an expert in C or ASM for that matter, but I would like to wish you the best of luck with this project and I hope that you will recieve all the money you need. :)
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

DarkAuron wrote:Shoudn't this be in the programming help forum?


Well, it directly has to do with a project, so... I dunno.
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
DarkAuron
Maxcoderz Staff
Posts: 1349
Joined: Sat 18 Dec, 2004 6:53 pm

Post by DarkAuron »

Just figured it'd be more fitting in there since people that can help will probably look in there to help people.
[Gridwars Score] - E: 1860037 M: 716641 H: 261194
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

yes...I will be able to understand sprites now ^_^
Life is getting better.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4120
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Jeebus, i didnt think you had put this much thought into the game patori! This will be awesome when you complete it :).

Above all else, i hope your home situation works out.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

tr1p1ea wrote:Jeebus, i didnt think you had put this much thought into the game patori! This will be awesome when you complete it :).

Above all else, i hope your home situation works out.


Um... I've thought alot about this... I think that that tilemap routine will work....

Currently building a computer outta spare parts from closet... Gonna make a 1337 233mhz, 128mb RAM, 8 GB HDD, 52xCDRom 40x24x40x Burner, floppy drives, and a USB 1.whatever PCI Card... all running windows 98... w00t. Will use specifically for programming on Calc...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4120
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Hehehe that sounds fun ... but 233? Anyway, devoting an entire machine to calc coding means comitiment, and i like that! :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Patori
Maxcoderz Staff
Posts: 1477
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

tr1p1ea wrote:Hehehe that sounds fun ... but 233? Anyway, devoting an entire machine to calc coding means comitiment, and i like that! :).


Well... playing mp3's too... I need to be able to listen to music at night to get to sleep.... :).. I'm having trouble building it though... 233 is the fast processor I could find... the family's fastest comp is a 500 mhz...
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
the_unknown_one
Calc Master
Posts: 1089
Joined: Fri 17 Dec, 2004 9:53 am
Location: Belgium

whatta!

Post by the_unknown_one »

500 mhz fastest! Here is 2.7 ghz fastest (my bro's GGRRR), i've got 2.4 ghz 2nd fastest :p Smallest 233 or 500 mhz, not sure which :p Ur so unlucky man...
TI-calculator = good time
User avatar
dysfunction
Calc Master
Posts: 1454
Joined: Wed 22 Dec, 2004 3:07 am
Location: Through the Aura

Post by dysfunction »

If only you lived in my area, I could give you a computer, or at least parts... UMass Amherst is basically giving away 450 mhz PIIs with 256 mb RAm and I think 10 gb HDs... I'm using one as a workstation. 233 mhz, that really bites! My main comp is a 1.7 ghz (but it's an athlon xp, so itsfaster than the clock speed would lead you to believe) with 512 RAm and 120 gb HD.
Image


"You're very clever, young man, but it's turtles all the way down!"
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

TigerDirect.com selled Mobos+Cpu's at 1300 or 5$.
Life is getting better.
Locked