Go Back   BWHacks > Development > Reverse Engineering > Code Snippets and Tutorials

Code Snippets and Tutorials The place for open source releases, great information, and tutorials written by other members.

Reply
 
LinkBack Thread Tools

Old 03-06-2007, 01:27 AM   #1 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default [Diablo] Drawing Static Text and Windows (v1.09b)

Yeah, so I was bored and decided to do some Starspeak-like work with the original Diablo. Here are my results, maybe someone can learn something from them.

PrintXY with Color Selection (Available colors: 0-white, 1-blue, 2-red, 3-gold)
Code:
D1_StaticText proc     xinfo:DWORD, yinfo:DWORD, colorinfo:DWORD, textinfo:DWORD

        pushad
        push colorinfo
        push textinfo
        mov ecx, xinfo
        mov edx, yinfo
        call 00405681h
        popad
        ret

D1_StaticText endp

Printing Gold Client-Sided Text
Code:
D1_PrintText proc       textaddr:DWORD

        pushad
        push textaddr
        call 0043D97Dh
        add esp, 04h
        popad
        ret

D1_PrintText endp
As a note for the above, Diablo has a built-in delay for displaying the gold client-sided text. Zynastor developed a fix for this but seeing as it isn't mine I will let him post it if he is interested.


Box Drawing Function
Code:
D1_DrawBox proc         xstart:DWORD, xend:DWORD, ystart:DWORD, yend:DWORD, col:DWORD

        push ecx
        mov ecx, xstart
        .while ecx <= xend
               invoke D1_StaticText, ecx, ystart, col, CTEXT(".")
               invoke D1_StaticText, ecx, yend, col, CTEXT(".")
               inc ecx
        .endw
        mov ecx, ystart
        .while ecx <= yend
               invoke D1_StaticText, xstart, ecx, col, CTEXT(".")
               invoke D1_StaticText, xend, ecx, col, CTEXT(".")
               inc ecx
        .endw
        pop ecx
        ret

D1_DrawBox endp
You can see that at this point I started to become lazy. Rather than search for a true drawing function, I created my own box drawing function using a method that would produce an array of periods in whatever size I wanted. This gave the illusion that the box was made up of solid lines. Aren't I clever? The same colors available for the PrintXY function are available for the above function as well.

Last edited by Perma : 02-07-2008 at 10:50 AM.
Perma 15 0FF11|\|3   Reply With Quote
Advertisement
 
Advertisement
Advertisement Sponsored links


Old 03-06-2007, 01:39 AM   #2 (permalink)
Mr.Lampy
Name's Lampy, Mr.Lampy
Senior Member
Moderator
Gold Member

Saint
 
Mr.Lampy's Avatar
 
Join Date: Aug 2004
Location: NO U
Posts: 5,955
Mr.Lampy has disabled reputation
Send a message via AIM to Mr.Lampy Send a message via MSN to Mr.Lampy Send a message via Yahoo to Mr.Lampy
Default

Hmm I might have to find my diablo1 cd and try learning masm again
Mr.Lampy 15 0FF11|\|3   Reply With Quote

Old 04-02-2007, 01:34 AM   #3 (permalink)
Hell-Lord

Deviant
 
Hell-Lord's Avatar
 
Join Date: Feb 2007
Posts: 115
Hell-Lord is on a distinguished road
Default

Very nice job Perma :D
__________________
Hell-Lord 15 0FF11|\|3   Reply With Quote

Old 04-02-2007, 01:39 AM   #4 (permalink)
John

Disciple
 
John's Avatar
 
Join Date: Mar 2006
Location: USA
Posts: 535
John is an unknown quantity at this point
Default

Looking good perma. you da man!
__________________
Quote:
Being gay is your own choice. Just don't bother me with your gay sh*t and I won't punch you in the face.
John 15 0FF11|\|3   Reply With Quote

Old 04-02-2007, 04:28 AM   #5 (permalink)
Hell-Lord

Deviant
 
Hell-Lord's Avatar
 
Join Date: Feb 2007
Posts: 115
Hell-Lord is on a distinguished road
Default

Perma what assembly language program do you use?
__________________
Hell-Lord 15 0FF11|\|3   Reply With Quote

Old 04-02-2007, 04:33 AM   #6 (permalink)
LCSBSSRHXXX
The Sexy Penguin
Senior Member
Retired Staff Member

Prophet
 
LCSBSSRHXXX's Avatar
 
Join Date: Feb 2005
Location: MOTHA ****IN BOULDER COLORADO
Posts: 7,198
LCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond reputeLCSBSSRHXXX has a reputation beyond repute
Send a message via AIM to LCSBSSRHXXX
Default

I use MASM and RadASM for IDE and I belive perma uses the same, maybe a different IDE though.
__________________
Quote:
Originally Posted by 707 View Post
Gotta throw the magnums down on the counter, and be like yeeeeah bitch.
we pop bitchez wit r gatz klub:
LCS, 707, BELPHEGOR

YEEEEEEEH BITCH

Quote:
Gorgy: so whats the new klub
Gorgy: poppin bitchez wit ur gat
707: WE GOT DICKS LIKE JESUS, SO WE GOTTA SPORT THE MAGS, AND BE LIKE YEEEEH BITCH
LCSBSSRHXXX 15 0FF11|\|3   Reply With Quote

Old 04-02-2007, 04:36 AM   #7 (permalink)
Hell-Lord

Deviant
 
Hell-Lord's Avatar
 
Join Date: Feb 2007
Posts: 115
Hell-Lord is on a distinguished road
Default

Thanks LCSBSSRHXXX
is the most current version 9.0 of MASM that is?
__________________
Hell-Lord 15 0FF11|\|3   Reply With Quote

Old 04-02-2007, 05:15 PM   #8 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

Yes, I use MASM 9.0 and the FASM IDE.
Perma 15 0FF11|\|3   Reply With Quote

Old 04-05-2007, 01:22 PM   #9 (permalink)
Hell-Lord

Deviant
 
Hell-Lord's Avatar
 
Join Date: Feb 2007
Posts: 115
Hell-Lord is on a distinguished road
Default

kk thanks
__________________
Hell-Lord 15 0FF11|\|3   Reply With Quote

Old 04-09-2007, 12:02 AM   #10 (permalink)
Jiggie=#1

Advocate
 
Jiggie=#1's Avatar
 
Join Date: Jul 2006
Location: Cream
Posts: 304
Jiggie=#1 is on a distinguished road
Default

If the addresses were converted, any chance that would work for starcraft?
Jiggie=#1 15 0FF11|\|3   Reply With Quote

Old 04-09-2007, 12:28 AM   #11 (permalink)
Perma
rol 3905h, 8
Senior Member
Administrator

Saint
 
Perma's Avatar
 
Join Date: Jul 2004
Location: Canada
Posts: 5,414
Perma has disabled reputation
Default

Starcraft has different drawing functions with different parameters. But this same idea could easily be implemented on any game if you found the correct functions (like Starspeak, for example).
Perma 15 0FF11|\|3   Reply With Quote

Old 05-16-2007, 10:55 PM   #12 (permalink)
Rufus

Disciple
 
Rufus's Avatar
 
Join Date: May 2007
Posts: 428
Rufus is on a distinguished road
Default

winasm ide 4tw
Rufus 15 0FF11|\|3   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Advertisement

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorials] Lots of them. gamepin126 Tips and Tricks 9 03-27-2007 10:11 AM
Useful Keyboard Shortcuts lpxxfaintxx Tips and Tricks 15 10-19-2006 12:45 AM
Useful Windows Software Dan Hardware and Software 12 12-28-2005 03:24 AM


All times are GMT. The time now is 02:21 AM.


vBulletin style developed by Transverse Styles

Powered by vBulletin Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright © 2004-2008 BWHacksAd Management by RedTyger