dragonboy269

Messing around again with ACCF

Rate this Entry
So ,since I'm making the Search/Teleport code soon, I thought I'd completely remake Real-Time World Edit for practice. I added checks to make sure you don't write to the wrong place, so this should be the same as v2 right?
[spoiler][code]lis r17,0x80E6
lbzu r10,0x38D7(r17) //x coordinate
lbz r17,0x8(r17) //y coordinate

cmpwi r10,0x60 //check if we're after the map
bgelr
cmpwi r17,0x60 //check if we're after the map (to make sure we don't write somewhere we don't want to)
bgelr


subi r10,r10,0x10
subi r17,r17,0x10

andi. r14,r10,0xF //divide by 16, storing the remainder in r14
srwi r10,r10,0x4 //and the quotient in r10
andi. r30,r17,0xF //divide by 16, storing the remainder in r30
srwi r17,r17,0x4 //and quotient in r17

slwi r14,r14,0x1 //multiply slots going left to right by 2
slwi r30,r30,0x5 //multiply rows going up and down by 32 (16 slots, 2 each)
slwi r10,r10,0x9 //multiply acres left to right by 512 (256 slots per acre, 2 each)
mulli r17,r17,0xA00 //multiply acre rows by 2560 (5 acres one row, 512x5 is 2560)

add r14,r14,r30
add r14,r14,r10
add r14,r14,r17 //add all these totals to r14

TextToItem:

//not really mine to post, lets just say the item hex gets put in r5

StoreItem:
lis r9,0x90E8
ori r9, r9,0xF056 //load first mapslot
add r14,r9,r14 //add our totals to it
cmpw r14,r9 //check if we're before the map (if we started with coordinates that are below 0x10)
bltlr
sth r5,0(r14) //store the item :D
blr[/code][/spoiler]
Categories
Uncategorized

Comments