Skip to content

Maniacs Patch - Expand Show/Move Picture features - #3658

Open
jetrotal wants to merge 1 commit into
EasyRPG:masterfrom
EasyRPG-NewFeatures:maniacs/pictures-updates
Open

Maniacs Patch - Expand Show/Move Picture features#3658
jetrotal wants to merge 1 commit into
EasyRPG:masterfrom
EasyRPG-NewFeatures:maniacs/pictures-updates

Conversation

@jetrotal

@jetrotal jetrotal commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

This update requires new entries on liblcf savepicture.h:

		int32_t spritesheet_start = 0;
		int32_t spritesheet_end = 0;

Adds missing Maniacs behavior for picture commands: proper bitfield parsing (fixed-to-map and independent Y scaling), move options (relative/preserve fields/position-scaled origin), and scaled-origin handling during origin application. Also adds spritesheet animation range support (start/end frames), persists those fields in show params, and updates animation looping to honor custom frame ranges.

Test files included (Girl charset to the left):
Expressions_Test_Suite.zip

TPC Script for testing purposes:
// ============================================================================
// PICTURE & STRING PICTURE TEST SUITE
// Covers Maniac Patch Picture operations natively processed
// by the RM2k3 engine, including scaling, origins, blend modes,
// spritesheet animations, relative movement, property preservation,
// string picture generation, and string variable arguments.
// ============================================================================

// ----------------------------------------------------------------------------
// Renderer Component & Test Flow Handlers
// ----------------------------------------------------------------------------
__fn nextTest $title $desc {
    // Render Background (Semi-transparent black to improve text readability)
    @pic[90].strpic {
        ""
        .pos 160, 120 .center
        .size 320, 240
        .rgbs 0, 0, 0, 150
        .chromakey 1 .skin "" .stretch
        .mapLayer 6 .eraseWhenTransfer
    }

    // Render Title
    @pic[91].strpic {
        $title
        .pos 16, 8 .topLeft
        .font "", 12 .noShadow
        .chromakey 1 .noframe .noPadding .nobg .noGradation
        .mapLayer 7 .eraseWhenTransfer
    }
    
    // Render Description
    @pic[92].strpic {
        $desc
        .pos 16, 28 .topLeft
        .font "", 10 .spacing 0, 4 .noShadow
        .chromakey 1 .noframe .noPadding .nobg .noGradation
        .mapLayer 7 .eraseWhenTransfer
    }
    
    // Render Footer
    @pic[93].strpic {
        "\C[1](Press Action to continue)\C[0]"
        .pos 160, 224 .center
        .font "", 10 .noShadow
        .chromakey 1 .noframe .noPadding .nobg .noGradation
        .mapLayer 7 .eraseWhenTransfer
    }
    @wait 5
}

__fn endTest {
    @wait .input
    @pic.erase .all
}

// ----------------------------------------------------------------------------
// Page 1: @pic.show - Independent Scaling & Scaled Origin
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 1. pic.show: Scale2 & Scaled Origin ---\C[0]", "ID 1: Normal scale (100%)
ID 2: .scale2 200, 50 (Wide & Short)
ID 3: .scale2 50, 200 + .scaledOrigin")

@pic[1].show "../charset/actor1" .pos 80, 140 .center .grid 12, 8 .cell 2
@pic[2].show "../charset/actor1" .pos 160, 140 .center .scale2 200, 50 .grid 12, 8 .cell 2
@pic[3].show "../charset/actor1" .pos 240, 140 .center .scale2 50, 200 .scaledOrigin .grid 12, 8 .cell 2

endTest()

// ----------------------------------------------------------------------------
// Page 2: @pic.show - Blend Modes & Flipping
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 2. pic.show: Blend Modes & Flipping ---\C[0]", "Top Row:   .multi,  .add,   .overlay
Bottom Row: .hrev,   .vrev,  .hvrev")

@pic[1].show "../charset/actor1" .pos 80, 100 .center .multi .grid 12, 8 .cell 2
@pic[2].show "../charset/actor1" .pos 160, 100 .center .add .grid 12, 8 .cell 2
@pic[3].show "../charset/actor1" .pos 240, 100 .center .overlay .grid 12, 8 .cell 2

@pic[4].show "../charset/actor1" .pos 80, 170 .center .hrev .grid 12, 8 .cell 2
@pic[5].show "../charset/actor1" .pos 160, 170 .center .vrev .grid 12, 8 .cell 2
@pic[6].show "../charset/actor1" .pos 240, 170 .center .hvrev .grid 12, 8 .cell 2

endTest()

// ----------------------------------------------------------------------------
// Page 3: @pic.show - Spritesheet Range Animation
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 3. pic.show: Range Animation ---\C[0]", "ID 1: .rangeAnim 10, 1, 3 .repeat (Walk Down)
ID 2: .rangeAnim 5, 13, 15 .once (Walk Right, stops)")

@pic[1].show "../charset/actor1" .pos 100, 140 .center .scale 200 .grid 12, 8 .rangeAnim 10, 1, 3 .repeat
@pic[2].show "../charset/actor1" .pos 220, 140 .center .scale 200 .grid 12, 8 .rangeAnim 5, 13, 15 .once

endTest()

// ----------------------------------------------------------------------------
// Page 4: @pic.move - Relative Movement
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 4. pic.move: Relative Movement ---\C[0]", "ID 1: Moves +50 X, -50 Y relative to its current
position over 60 frames.")

@pic[1].show "../charset/actor1" .pos 160, 140 .center .scale 200 .grid 12, 8 .cell 2
@wait 20
@pic[1].move .pos 50, -50 .relative .time 60 .wait

endTest()

// ----------------------------------------------------------------------------
// Page 5: @pic.move - Keep Properties (.keep flags)
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 5. pic.move: Keep Properties ---\C[0]", "ID 1 (Left): Keeps RGB, Flip, and Blend flags.
ID 2 (Right): Omits .keep flags (Resets to normal).")

// Setup 2 identical pictures with special properties
@pic[1].show "../charset/actor1" .pos 100, 100 .center .rgbs 255, 100, 100, 100 .hrev .add .grid 12, 8 .cell 2
@pic[2].show "../charset/actor1" .pos 220, 100 .center .rgbs 255, 100, 100, 100 .hrev .add .grid 12, 8 .cell 2
@wait 30

// Move 1 with .keep flags (retains red tint, flip, and add blend)
@pic[1].move .pos 100, 180 .time 60 .keepRgbs .keepFlip .keepBlend
// Move 2 without flags (resets to default color, normal flip, normal blend)
@pic[2].move .pos 220, 180 .time 60 .wait

endTest()

// ----------------------------------------------------------------------------
// Page 6: @pic.erase - Single, Range, All
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 6. pic.erase: Single, Range, All ---\C[0]", "Erasing ID 1.
Then erasing ID 3..4.
Then erasing .all (which clears the UI too!)")

@pic[1].show "../charset/actor1" .pos 40, 140 .center .grid 12, 8 .cell 2
@pic[2].show "../charset/actor1" .pos 100, 140 .center .grid 12, 8 .cell 2
@pic[3].show "../charset/actor1" .pos 160, 140 .center .grid 12, 8 .cell 2
@pic[4].show "../charset/actor1" .pos 220, 140 .center .grid 12, 8 .cell 2
@pic[5].show "../charset/actor1" .pos 280, 140 .center .grid 12, 8 .cell 2

@wait 30
@pic.erase [1]
@wait 30
@pic.erase [3..4]
@wait 30

// We skip endTest() here to manually demonstrate .all
@wait .input
@pic.erase .all
@wait 20

// ----------------------------------------------------------------------------
// Page 7: @pic.strpic - Dynamic Text Expressions
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 7. pic.strpic: Text Expressions ---\C[0]", "Testing dynamic string rendering using
native escape codes for variables inside the string.")

t[50] .asg "Alex"
v[50] = 99

@pic[1].strpic {
    "Hero: \t[50]
Level: \v[50]"
    .pos 160, 120 .center
    .size 150, 60
    .font "", 12
    .nobg
}

endTest()

// ----------------------------------------------------------------------------
// Page 8: @pic.strpic - Background Styles & Layout
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 8. pic.strpic: Background Styles & Layout ---\C[0]", "Testing .stretch, .tiled, .noframe, and .spacing")

@pic[1].strpic {
    "Stretched Bg"
    .pos 160, 90 .center .size 140, 30
    .skin "System" .stretch
}

@pic[2].strpic {
    "Tiled Bg"
    .pos 160, 140 .center .size 140, 30
    .skin "System" .tiled
}

@pic[3].strpic {
    "N o   F r a m e
S p a c i n g !"
    .pos 160, 190 .center .size 140, 40
    .skin "System" .noframe .spacing 4, 8
}

endTest()

// ----------------------------------------------------------------------------
// Page 9: @pic.strpic - Picture Effects
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 9. pic.strpic: Picture Effects ---\C[0]", "Applying wave, angle, add, and scale2 to Text!")

@pic[1].strpic {
    "Wavy Text!"
    .pos 160, 100 .center .size 150, 30
    .font "", 14 .nobg .wave 2
}

@pic[2].strpic {
    "Angled & Additive"
    .pos 160, 140 .center .size 150, 30
    .font "", 14 .nobg .add .angle 15, 1
}

@pic[3].strpic {
    "S Q U I S H"
    .pos 160, 180 .center .size 150, 30
    .font "", 14 .nobg .scale2 150, 50
}

endTest()

// ----------------------------------------------------------------------------
// Page 10: @pic.show & @pic.strpic - String Variables as Arguments
// ----------------------------------------------------------------------------
nextTest("\C[6]--- 10. String Variables as Arguments ---\C[0]", "Testing t[x] used dynamically as the Filename,
Font name, Window Skin, and the Text Content itself.")

// Setup string variables
t[10] .asg "../charset/actor1"
t[11] .asg "TinyUnicode"
t[12] .asg "System"
t[13] .asg "Text, Font & Skin 
from t[x]!"

// 1. t[x] as filename in @pic.show
@pic[1].show t[10] .pos 80, 150 .center .grid 12, 8 .cell 2

// 2. t[x] used for content, font, and skin in @pic.strpic
@pic[2].strpic {
    t[13]
    .pos 220, 150 .center .size 140, 40
    .font t[11], 10
    .skin t[12] .stretch
}

endTest()

This update requires new entries on liblcf savepicture.h:
```cpp
		int32_t spritesheet_start = 0;
		int32_t spritesheet_end = 0;
```

Adds missing Maniacs behavior for picture commands: proper bitfield parsing (fixed-to-map and independent Y scaling), move options (relative/preserve fields/position-scaled origin), and scaled-origin handling during origin application. Also adds spritesheet animation range support (start/end frames), persists those fields in show params, and updates animation looping to honor custom frame ranges.

Test files included.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant