[-]
Shout:
Click Refresh to load shouts.

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[FASM] Tibia sprite to RGB(A)
03-02-2010, 01:28 PM (This post was last modified: 03-02-2010 09:21 PM by Ian. Edit Reason: Added highlighting)
Post: #1
[FASM] Tibia sprite to RGB(A)
To read single sprite you need to:
  1. open Tibia.spr file
  2. go to 6+SpriteID*4
  3. read four-byte address
  4. read some bytes from file at this address as offset, at least 4KB
  5. allocate 32*32*4 byte buffer
  6. pass buffer and readed data to function
  7. remember to free 'some bytes'

To read all sprites you should get whole file at once. It can process 30 000 sprites in 1 second:

select asm
proc readSprSprite dest, source
	cld
	mov esi, [source]
	mov edi, [dest]
	add esi, 3
	lodsw
	movzx ecx, ax
;	test ecx, ecx		it may not be useful
;	jz .skip
	add ecx, esi
	.petla:
		push ecx
		lodsw
		movzx ecx, ax
		xor eax, eax		;ONLY RGBA
		rep stosd			;ONLY RGBA
		;mov eax, 0800080h	;RGB color for transparency
		;.alpha:			;RGB
		;	stosw		;RGB
		;	ror eax, 16		;RGB
		;	stosb			;RGB
		;	ror eax, 16		;RGB
		;	loop .alpha		;RGB
 
		lodsw
		movzx ecx, ax
		.petla2:
			movsw
			movsb
			mov al, 0FFh	;ONLY RGBA
			stosb			;ONLY RGBA
			loop .petla2
		pop ecx
		cmp ecx, esi
		ja .petla
	.skip:
	ret
endp
Find all posts by this user
Quote this message in a reply
03-02-2010, 03:23 PM
Post: #2
RE: [FASM] Tibia sprite to RGB(A)
Thats freaking sexy.

Find all posts by this user
Quote this message in a reply
Post Reply 



Contact UsTProgrammingReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication