I need a simple Top 10 board for a pacman like game i'm making.
I have no ideia on how to do this...i was thinking on something that would start a timer then the game started and, at the end of the game it would be asked the player for his name, and then it would save his name and score to a file.
but this file should also save the score of other 9 players and display them in order of score time.

Can anyone help me?
Posted on 2007-06-05 15:01:27 by IndioDoido

  • sorting of arbitrary objects by some criteria (struct-member)

  • drawing text in your game

  • drawing an array of text-lines in your game

  • save/load from file, if you don't know it yet

Have two structs like

HiScore struct
Score dd ?
Name db 28 dup (?)
HiScore ends

GameSettings struct ; <-- save this struct into the savefile

CurScore dd ?
PosX dd ? ; x-position of pac
PosY dd ?
; .... add whatever here

Scores HiScore 9 dup (<>)
GameSettings ends

game GameSettings <>

It really depends on your 2D engine how you'll handle the virtual-dialog, where you list stuff. 
Posted on 2007-06-05 15:19:56 by Ultrano
tnx Ultrano ;-)

by the way...can you tell how can i do this compare:

lea dx, variable
jmp function
cmp dx, variable    ; <--- error!
je function2

cmp dx, variable2  ; <--- error!
je function3

Posted on 2007-06-05 15:54:15 by IndioDoido
probably your variable is 32-bit or 8-bit, while DX is 16-bit. You need to either make the variable 16-bit ("dw" instead of dd or db), or use EDX or DL.
Posted on 2007-06-05 16:14:45 by Ultrano
the variable is db

menu_config  db  'config.txt',0

like this it gives me a error on complie...value is to big i think.

menu_config  dw  'config.txt',0

Posted on 2007-06-05 16:18:17 by IndioDoido
for text, do not use ' but "
Posted on 2007-06-05 16:43:19 by Ultrano

for text, do not use ' but "

Either works in MASM, with the caveat that only ' will end a string started with ' and only " will end a string started with ".

IndioDoido, it seems strange that you'd be comparing a string with something in dx.  Strings are sequences of some number of bytes (or words for unicode), whereas dx is exactly 2 bytes, so to compare two strings, you would need to compare them byte by byte until they are different or until they both have their terminating 0.  Is this what you're intending to do?
Posted on 2007-06-05 18:57:01 by hackulous
XD didn't notice this was his problem, I thought he just mentioned another prob.
Anyway, I don't see a reason to compare this string to anything. It's destined to have its address only passed as a parameter to CreateFile.
Posted on 2007-06-05 19:04:26 by Ultrano
hey gays!

I've found a way arround this problem.
I'm new to assebley, so i thought it was possible to compare that way  :sad:

By the way...i have another question.

I want to use get time to start counting the amount of seconds between "start game" and "end game".

INT 21, 2c

And i want to send the value that has the seconds (DH i think) to a variable so that i can save that time in a file.

The variable where i want to save the time in seconds from DH is:

ano    dw   

how can i do this?
Posted on 2007-06-06 11:59:01 by IndioDoido