the cutting room mirror

The Sims: Bustin' Out (Game Boy Advance, N-Gage)

This article has a talk page!This article has a talk page!
view on tcrf.net

This page contains Lua scripts for the game The Sims: Bustin' Out (Game Boy Advance, N-Gage).

All scripts were written for mGBA. All addresses are hardcoded for USA revision 0,

Noclip#

Hacked over the existing movement system so all collisions slow you down, but you're still able to pass through walls and objects regardless. Hold B to go faster.

local xPosPtr = 0x200DD3A
local yPosPtr = 0x200DD3E

local speed = 1

local heldButtons = {}

function main()
    if emu:getKey(C.GBA_KEY.RIGHT) == 1 then
        emu:write16(xPosPtr, emu:read16(xPosPtr) + (speed * 2))
    end
    
    if emu:getKey(C.GBA_KEY.UP) == 1 then
        emu:write16(yPosPtr, emu:read16(yPosPtr) - speed)
    end
    
    if emu:getKey(C.GBA_KEY.LEFT) == 1 then
        emu:write16(xPosPtr, emu:read16(xPosPtr) - (speed * 2))
    end
    
    if emu:getKey(C.GBA_KEY.DOWN) == 1 then
        emu:write16(yPosPtr, emu:read16(yPosPtr) + speed)
    end
    
    if emu:getKey(C.GBA_KEY.B) == 1 then
        speed = 4
    else
        speed = 1
    end
end

callbacks:add("frame", main)

Character Appearance#

I suggest you load this script after interacting with a job sign while that job is closed and BEFORE you exit out of the dialog, as the refusal animation seems to correctly play back every animation and frame. Don't forget to save state once you load it!

local currentAnim = 0x0
local currentRotation = 0x3
local currentHead = 0x1
local currentFrame = 0x0

local bodyAnimPtr1 = 0x0200DE23
local bodyAnimPtr2 = 0x0200DE54

local framePtr1 = 0x0200DDFA
local framePtr2 = 0x0200DDFB

local xPosPtr = 0x200DD3A
local yPosPtr = 0x200DD3E

local bodyRotationPtr1 = 0x0200dd32
local bodyRotationPtr2 = 0x0200de55

local headPtr = 0x0200de38

local xPos = emu:read16(xPosPtr)
local yPos = emu:read16(yPosPtr)

local hairStyles = {
    -- Male
    0x2DEC,
    0x2F48,
    0x30A4,
    0x3200,
    0x335C,
    -- Female
    0x22F8,
    0x2454,
    0x25B0,
    0x270C,
    0x2868
}

local heldButtons = {}

inputBuffer = console:createBuffer("Sims Character Appearance/Anim")

function setAnim()
    emu:write8(bodyAnimPtr1, currentAnim)
    emu:write8(bodyAnimPtr2, currentAnim)
end

function setRotation()
    emu:write8(bodyRotationPtr1, currentRotation)
    emu:write8(bodyRotationPtr2, currentRotation)
end

function setHead()
    emu:write16(headPtr, hairStyles[currentHead])
end

function setFrame()
    emu:write8(framePtr1, currentFrame)
    emu:write8(framePtr2, currentFrame)
end

function blankPals(start, count)
    for i = 1, count do
        emu:write8(start + i, 0xff)
    end
end

function main()
    setAnim()
    setRotation()
    setHead()
    --setFrame()
    
    blankPals(0x5000000, 0x1FE) -- all BG palettes
    -- leave space for the character which is always palette 0
    blankPals(0x5000220, 0x1FE) -- rest of OBJ
    
    -- Heads
    if emu:getKey(C.GBA_KEY.UP) == 1 then
        if heldButtons[C.GBA_KEY.UP] == false then
            heldButtons[C.GBA_KEY.UP] = true
            
            if currentHead >= #hairStyles then
                currentHead = #hairStyles
            else
                currentHead = currentHead + 1
            end
            
            inputBuffer:print(string.format("Current Head: %x\n", currentHead))
        end
    else
        heldButtons[C.GBA_KEY.UP] = false
    end
    
    if emu:getKey(C.GBA_KEY.DOWN) == 1 then
        if heldButtons[C.GBA_KEY.DOWN] == false then
            heldButtons[C.GBA_KEY.DOWN] = true
            
            if currentHead <= 1 then
                currentHead = 1
            else
                currentHead = currentHead - 1
            end
            
            inputBuffer:print(string.format("Current Head: %x\n", currentHead))
        end
    else
        heldButtons[C.GBA_KEY.DOWN] = false
    end
    
    -- Body Anim
    if emu:getKey(C.GBA_KEY.R) == 1 then
        if heldButtons[C.GBA_KEY.R] == false then
            heldButtons[C.GBA_KEY.R] = true
            
            if currentAnim >= 256 then
                currentAnim = 256
            else
                currentAnim = currentAnim + 1
            end
            
            inputBuffer:print(string.format("Current Anim: %x\n", currentAnim))
        end
    else
        heldButtons[C.GBA_KEY.R] = false
    end
    
    if emu:getKey(C.GBA_KEY.L) == 1 then
        if heldButtons[C.GBA_KEY.L] == false then
            heldButtons[C.GBA_KEY.L] = true
            
            if currentAnim <= 0 then
                currentAnim = 0
            else
                currentAnim = currentAnim - 1
            end
            
            inputBuffer:print(string.format("Current Anim: %x\n", currentAnim))
        end
    else
        heldButtons[C.GBA_KEY.L] = false
    end
    
    -- Body Rotation
    if emu:getKey(C.GBA_KEY.RIGHT) == 1 then
        if heldButtons[C.GBA_KEY.RIGHT] == false then
            heldButtons[C.GBA_KEY.RIGHT] = true
            
            if currentRotation >= 4 then
                currentRotation = 4
            else
                currentRotation = currentRotation + 1
            end
            
            inputBuffer:print(string.format("Rotation: %x\n", currentRotation))
        end
    else
        heldButtons[C.GBA_KEY.RIGHT] = false
    end
    
    if emu:getKey(C.GBA_KEY.LEFT) == 1 then
        if heldButtons[C.GBA_KEY.LEFT] == false then
            heldButtons[C.GBA_KEY.LEFT] = true
            
            if currentRotation <= 0 then
                currentRotation = 0
            else
                currentRotation = currentRotation - 1
            end
            
            inputBuffer:print(string.format("Rotation: %x\n", currentRotation))
        end
    else
        heldButtons[C.GBA_KEY.LEFT] = false
    end
    -- anim frames
    -- this isn't working :(
    --[[
    if emu:getKey(C.GBA_KEY.A) == 1 then
        if heldButtons[C.GBA_KEY.A] == false then
            heldButtons[C.GBA_KEY.A] = true
            
            if currentFrame >= 256 then
                currentFrame = 256
            else
                currentFrame = currentFrame + 1
            end
            
            inputBuffer:print(string.format("Frame: %x\n", currentFrame))
        end
    else
        heldButtons[C.GBA_KEY.A] = false
    end
    
    if emu:getKey(C.GBA_KEY.B) == 1 then
        if heldButtons[C.GBA_KEY.B] == false then
            heldButtons[C.GBA_KEY.B] = true
            
            if currentFrame <= 0 then
                currentFrame = 0
            else
                currentFrame = currentFrame - 1
            end
            
            inputBuffer:print(string.format("Frame: %x\n", currentFrame))
        end
    else
        heldButtons[C.GBA_KEY.B] = false
    end
    ]]
    
    -- movement
    if emu:getKey(C.GBA_KEY.B) ~= 1 then
        emu:write16(xPosPtr, xPos)
        emu:write16(yPosPtr, yPos)
    end
    
end

inputBuffer:print(string.format("%s\n", emu:getGameTitle()))
inputBuffer:print("Usage:\nL: Previous Anim    R: Next Anim\nLeft: Previous Rotation    Right: Next Rotation\nDown: Previous Head    Up: Next Head\nB: Previous Frame (move when held)    A: Next Frame\n")
callbacks:add("frame", main)