@@ -1858,11 +1858,14 @@ func (fa *FightScreenFace) draw(layerno int16, charpn int, refFace *FightScreenF
18581858 refFace .face .PalTex = refFace .face .CachePalTex (charPal )
18591859 }
18601860
1861+ // Save current brightness
1862+ //oldBright := sys.brightness
1863+
18611864 // Reset system brightness if player initiated SuperPause (cancel "darken" parameter)
1862- oldBright := sys . brightness
1863- if refChar .ignoreDarkenTime > 0 {
1864- sys .brightness = 1.0
1865- }
1865+ // Update: This is an odd thing to do since the rest of the fight screen darkens
1866+ // if refChar.ignoreDarkenTime > 0 {
1867+ // sys.brightness = 1.0
1868+ // }
18661869
18671870 // Draw the actual face sprite
18681871 fa .face_lay .DrawFaceSprite ((float32 (fa .pos [0 ])+ sys .fightScreen .offsetX )* sys .fightScreen .scale , float32 (fa .pos [1 ])* sys .fightScreen .scale , layerno ,
@@ -1874,7 +1877,7 @@ func (fa *FightScreenFace) draw(layerno int16, charpn int, refFace *FightScreenF
18741877 }
18751878
18761879 // Restore original system brightness
1877- sys .brightness = oldBright
1880+ // sys.brightness = oldBright
18781881 }
18791882
18801883 // Draw top layer
@@ -1891,13 +1894,14 @@ func (fa *FightScreenFace) drawTeammates(layerno int16, charpn int) {
18911894 // return
18921895 //}
18931896
1894- refChar := sys .chars [charpn ][0 ]
1897+ // Save current brightness
1898+ oldBright := sys .brightness
18951899
18961900 // Reset system brightness if player initiated SuperPause (cancel "darken" parameter)
1897- oldBright := sys .brightness
1898- if refChar .ignoreDarkenTime > 0 {
1899- sys .brightness = 1.0
1900- }
1901+ //refChar := sys.chars[charpn][0]
1902+ // if refChar.ignoreDarkenTime > 0 {
1903+ // sys.brightness = 1.0
1904+ // }
19011905
19021906 teamSize := int32 (len (fa .teammate_face ))
19031907
@@ -2327,8 +2331,8 @@ type FightScreenCombo struct {
23272331 start_x float32
23282332 counter map [int32 ]* FSText
23292333 counter_shake bool
2330- counter_time int32
2331- counter_mult float32
2334+ counter_time int32 // Shake effect duration
2335+ counter_mult float32 // Shake effect scale correction factor
23322336 text map [int32 ]* FSText
23332337 bg AnimLayout
23342338 top AnimLayout
@@ -2343,7 +2347,7 @@ type FightScreenCombo struct {
23432347 shownPct float32
23442348 resttime int32
23452349 counterX float32
2346- shaketime int32
2350+ curShaketime int32
23472351 autoalign bool
23482352 newCombo bool
23492353}
@@ -2405,7 +2409,7 @@ func readFightScreenCombo(pre string, is IniSection,
24052409 return co
24062410}
24072411
2408- func (co * FightScreenCombo ) step (hits , damage int32 , percentage float32 , dizzy bool ) {
2412+ func (co * FightScreenCombo ) step (hits , damage int32 , percentage float32 ) {
24092413 co .bg .Action ()
24102414 co .top .Action ()
24112415
@@ -2422,22 +2426,31 @@ func (co *FightScreenCombo) step(hits, damage int32, percentage float32, dizzy b
24222426 // True hits are only updated by Char(). The live tally is only used for combo display behavior
24232427 //co.trueHits = hits
24242428
2429+ // Handle show/hide speed
24252430 if co .resttime > 0 {
2431+ // Slide in
24262432 co .counterX -= co .counterX / co .showspeed
2433+ // Snap to visible position
2434+ if Abs (co .counterX ) < 1 {
2435+ co .counterX = 0
2436+ }
24272437 } else if co .trueHits < 2 {
2438+ // Slide out when combo ends
24282439 co .counterX -= sys .fightScreen .fnt_scale * co .hidespeed * float32 (sys .fightScreen .localcoord [0 ]) / 320
2440+ // Snap to starting position
24292441 if co .counterX < co .start_x * 2 {
24302442 co .counterX = co .start_x * 2
24312443 }
24322444 }
24332445
2434- if co .shaketime > 0 {
2435- co .shaketime --
2446+ if co .curShaketime > 0 {
2447+ co .curShaketime --
24362448 }
24372449
2438- // TODO: Most commercial games don't rely on the dizzy flag
2439- // They keep the combo active as long as hits >= 2
2440- if Abs (co .counterX ) < 1 && ! dizzy {
2450+ // The displayed time only decrements when the counter is in the visible position
2451+ // Currently, the way the timer decrements while the combo is still ongoing can make it stay visible varying amounts of time past the end of the combo
2452+ // This makes it not always sync correctly with the "nice combo" actions
2453+ if co .counterX == 0 {
24412454 co .resttime --
24422455 }
24432456
@@ -2446,7 +2459,7 @@ func (co *FightScreenCombo) step(hits, damage int32, percentage float32, dizzy b
24462459 // Reset visuals when hits changed
24472460 if co .newCombo || co .shownHits != co .trueHits {
24482461 if co .counter_shake {
2449- co .shaketime = co .counter_time
2462+ co .curShaketime = co .counter_time
24502463 }
24512464 for i := range co .counter {
24522465 co .counter [i ].resetTxtPfx ()
@@ -2495,7 +2508,7 @@ func (co *FightScreenCombo) reset() {
24952508 co .shownPct = 0
24962509 co .resttime = 0
24972510 co .counterX = co .start_x * 2
2498- co .shaketime = 0
2511+ co .curShaketime = 0
24992512}
25002513
25012514func (co * FightScreenCombo ) draw (layerno int16 , f map [int ]* Fnt , side int ) {
@@ -2519,7 +2532,9 @@ func (co *FightScreenCombo) draw(layerno int16, f map[int]*Fnt, side int) {
25192532 }
25202533 }
25212534
2535+ // Replace operator with current combo value
25222536 counter := strings .Replace (co .counter [cv ].text , "%i" , fmt .Sprintf ("%v" , co .shownHits ), 1 )
2537+
25232538 x := float32 (co .pos [0 ])
25242539 if side == 0 {
25252540 if co .start_x <= 0 {
@@ -2536,8 +2551,14 @@ func (co *FightScreenCombo) draw(layerno int16, f map[int]*Fnt, side int) {
25362551 x -= co .counterX
25372552 }
25382553 }
2554+
2555+ // BG
25392556 co .bg .Draw (x + sys .fightScreen .offsetX , float32 (co .pos [1 ]), layerno , sys .fightScreen .scale )
2557+
2558+ // Track total string length
25402559 var length float32
2560+
2561+ // Text
25412562 if co .text [tv ].font [0 ] >= 0 && getFont (f , co .text [tv ].font [0 ]) != nil {
25422563 text := strings .Replace (co .text [tv ].text , "%i" , fmt .Sprintf ("%v" , co .shownHits ), 1 )
25432564 text = strings .Replace (text , "%d" , fmt .Sprintf ("%v" , co .shownDmg ), 1 )
@@ -2574,17 +2595,26 @@ func (co *FightScreenCombo) draw(layerno int16, f map[int]*Fnt, side int) {
25742595 co .text [tv ].palfx , co .text [tv ].frgba )
25752596 }
25762597 }
2598+
2599+ // Counter
25772600 if co .counter [cv ].font [0 ] >= 0 && getFont (f , co .counter [cv ].font [0 ]) != nil {
25782601 if side == 0 && co .autoalign {
25792602 if ff := getFont (f , co .counter [cv ].font [0 ]); ff != nil {
25802603 length = float32 (ff .TextWidth (counter , co .counter [cv ].font [1 ], 0 )) * co .counter [cv ].lay .scale [0 ] * sys .fightScreen .fnt_scale
25812604 }
25822605 }
25832606
2584- z := 1 + float32 (co .shaketime )* co .counter_mult * float32 (math .Sin (float64 (co .shaketime )* (math .Pi / 2.5 )))
2607+ // Shake effect
2608+ // TODO: More customizable parameters
2609+ // TODO: Maximum scale is currently determined by "time * correction factor". That seems especially odd
2610+ arg := float64 (co .counter_time - co .curShaketime ) * math .Pi / 2.5
2611+ z := 1 + float32 (co .curShaketime )* co .counter_mult * float32 (math .Cos (arg ))
2612+
25852613 co .counter [cv ].lay .DrawText ((x - length + sys .fightScreen .offsetX )/ z , float32 (co .pos [1 ])/ z , z * sys .fightScreen .scale , layerno ,
25862614 counter , getFont (f , co .counter [cv ].font [0 ]), co .counter [cv ].font [1 ], co .counter [cv ].font [2 ], co .counter [cv ].palfx , co .counter [cv ].frgba )
25872615 }
2616+
2617+ // Top
25882618 co .top .Draw (x + sys .fightScreen .offsetX , float32 (co .pos [1 ]), layerno , sys .fightScreen .scale )
25892619}
25902620
@@ -5156,7 +5186,7 @@ func (fs *FightScreen) step() {
51565186 }
51575187 // Time
51585188 fs .time .step ()
5159- cb , cd , cp , dz := [2 ]int32 {}, [2 ]int32 {}, [2 ]float32 {}, [ 2 ] bool {}
5189+ cb , cd , cp := [2 ]int32 {}, [2 ]int32 {}, [2 ]float32 {}
51605190 targets := [2 ]int32 {}
51615191 // Combo
51625192 for _ , ch := range sys .chars {
@@ -5169,9 +5199,6 @@ func (fs *FightScreen) step() {
51695199 // Perhaps helper percentages shouldn't be tracked, but ignoring them creates scenarios where the lifebars show 0% damage which looks wrong
51705200 cp [side ] += float32 (c .receivedDmg ) / float32 (c .lifeMax ) * 100
51715201 targets [side ]++
5172- if c .scf (SCF_dizzy ) {
5173- dz [side ] = true
5174- }
51755202 }
51765203 }
51775204 }
@@ -5181,7 +5208,7 @@ func (fs *FightScreen) step() {
51815208 }
51825209 }
51835210 for i := range fs .combos {
5184- fs .combos [i ].step (cb [i ], cd [i ], cp [i ], dz [ i ] ) // Combo hits, combo damage, combo damage percentage, dizzy flag
5211+ fs .combos [i ].step (cb [i ], cd [i ], cp [i ]) // Combo hits, combo damage, combo damage percentage
51855212 }
51865213 // Action
51875214 for i := range fs .actions {
0 commit comments