@@ -757,6 +757,10 @@ function start.f_animGet(ref, side, member, paramsSide, params, loop, srcAnim)
757757 animSetFacing (a , params .facing )
758758 animSetXShear (a , params .xshear )
759759 animSetAngle (a , params .angle )
760+ animSetXAngle (a , params .xangle )
761+ animSetYAngle (a , params .yangle )
762+ animSetProjection (a , params .projection )
763+ animSetfLength (a , params .focallength )
760764 animSetWindow (a , params .window [1 ], params .window [2 ], params .window [3 ], params .window [4 ])
761765 if srcAnim ~= nil then
762766 animApplyVel (a , srcAnim )
@@ -1024,22 +1028,66 @@ function start.f_getCursorData(pn)
10241028 return motif .select_info [' p' .. (pn - 1 ) % 2 + 1 ]
10251029end
10261030
1027- local function getCellFacing (default , col , row )
1028- local cell = motif .select_info .cell [col .. ' -' .. row ]
1029- if cell ~= nil and cell .facing ~= 0 then
1030- return cell .facing
1031+ local function getCellOverride (col , row )
1032+ local cells = motif .select_info .cell
1033+ local exact = col .. ' -' .. row
1034+ local colWild = col .. ' -*'
1035+ local rowWild = ' *-' .. row
1036+ if cells [exact ] then
1037+ return cells [exact ]
1038+ end
1039+ if cells [colWild ] then
1040+ return cells [colWild ]
1041+ end
1042+ if cells [rowWild ] then
1043+ return cells [rowWild ]
1044+ end
1045+ if cells [' *-*' ] then
1046+ return cells [' *-*' ]
1047+ end
1048+ return nil
1049+ end
1050+
1051+ function getCellFacing (default , col , row )
1052+ local override = getCellOverride (col , row )
1053+ if override ~= nil and override .facing ~= 0 then
1054+ return override .facing
10311055 end
10321056 return default
10331057end
10341058
1035- local function getCellOffset (col , row )
1036- local cell = motif . select_info . cell [ col .. ' - ' .. row ]
1037- if cell ~= nil and cell .offset ~= nil then
1038- return cell .offset
1059+ function getCellOffset (col , row )
1060+ local override = getCellOverride ( col , row )
1061+ if override ~= nil and override .offset ~= nil then
1062+ return override .offset
10391063 end
10401064 return {0 , 0 }
10411065end
10421066
1067+ function getCellTransform (col , row , paramName , default )
1068+ local override = getCellOverride (col , row )
1069+ if override ~= nil then
1070+ local val = override [paramName ]
1071+ -- Table Validation
1072+ if type (val ) == " table" then
1073+ if paramName == " scale" then
1074+ if val [1 ] ~= 0 or val [2 ] ~= 0 then return val end
1075+ else
1076+ return val
1077+ end
1078+ elseif type (val ) == " string" then
1079+ if val ~= " " then
1080+ return val
1081+ end
1082+ elseif type (val ) == " number" then
1083+ if val ~= 0 then
1084+ return val
1085+ end
1086+ end
1087+ end
1088+ return default
1089+ end
1090+
10431091-- draw cursor
10441092function start .f_drawCursor (pn , x , y , param , done )
10451093 -- in non-coop modes only p1 and p2 cursors are used
@@ -1109,8 +1157,21 @@ function start.f_drawCursor(pn, x, y, param, done)
11091157 if motif .select_info [' p' .. pn ].cursor [param ][key ] ~= nil then
11101158 params = motif .select_info [' p' .. pn ].cursor [param ][key ]
11111159 end
1160+ local a = params .AnimData
1161+ if a then -- inherit cell transformation
1162+ animSetFacing (a , getCellFacing (params .facing , x , y ))
1163+ local scale = getCellTransform (x , y , " scale" , params .scale )
1164+ animSetScale (a , scale [1 ], scale [2 ])
1165+ animSetXShear (a , getCellTransform (x , y , " xshear" , params .xshear ))
1166+ animSetAngle (a , getCellTransform (x , y , " angle" , params .angle ))
1167+ animSetXAngle (a , getCellTransform (x , y , " xangle" , params .xangle ))
1168+ animSetYAngle (a , getCellTransform (x , y , " yangle" , params .yangle ))
1169+ animSetProjection (a , getCellTransform (x , y , " projection" , params .projection ))
1170+ animSetfLength (a , getCellTransform (x , y , " focallength" , params .focallength ))
1171+ animUpdate (a )
1172+ end
11121173 main .f_animPosDraw (
1113- params . AnimData ,
1174+ a ,
11141175 cd .currentPos [1 ],
11151176 cd .currentPos [2 ],
11161177 getCellFacing (params .facing , x , y )
@@ -2044,34 +2105,46 @@ function start.updateDrawList()
20442105 for col = 1 , motif .select_info .columns do
20452106 local cellIndex = (row - 1 ) * motif .select_info .columns + col
20462107 local t = start .t_grid [row ][col ]
2108+ local c = col - 1
2109+ local r = row - 1
20472110
20482111 if t .skip ~= 1 then
20492112 local charData = start .f_selGrid (cellIndex )
2113+ local function getTransforms (defaultFacing )
2114+ return {
2115+ facing = getCellFacing (defaultFacing , c , r ),
2116+ scale = getCellTransform (c , r , " scale" , nil ),
2117+ xshear = getCellTransform (c , r , " xshear" , nil ),
2118+ angle = getCellTransform (c , r , " angle" , nil ),
2119+ xangle = getCellTransform (c , r , " xangle" , nil ),
2120+ yangle = getCellTransform (c , r , " yangle" , nil ),
2121+ projection = getCellTransform (c , r , " projection" , nil ),
2122+ focallength = getCellTransform (c , r , " focallength" , nil )
2123+ }
2124+ end
2125+
20502126 if (charData and charData .char ~= nil and (charData .hidden == 0 or charData .hidden == 3 )) or motif .select_info .showemptyboxes then
2051- table.insert (drawList , {
2052- anim = motif .select_info .cell .bg .AnimData ,
2053- x = motif .select_info .pos [1 ] + t .x ,
2054- y = motif .select_info .pos [2 ] + t .y ,
2055- facing = getCellFacing (motif .select_info .cell .bg .facing , col - 1 , row - 1 )
2056- })
2127+ local item = getTransforms (motif .select_info .cell .bg .facing )
2128+ item .anim = motif .select_info .cell .bg .AnimData
2129+ item .x = motif .select_info .pos [1 ] + t .x
2130+ item .y = motif .select_info .pos [2 ] + t .y
2131+ table.insert (drawList , item )
20572132 end
20582133
20592134 if charData and (charData .char == ' randomselect' or charData .hidden == 3 ) then
2060- table.insert (drawList , {
2061- anim = motif .select_info .cell .random .AnimData ,
2062- x = motif .select_info .pos [1 ] + t .x + motif .select_info .portrait .offset [1 ],
2063- y = motif .select_info .pos [2 ] + t .y + motif .select_info .portrait .offset [2 ],
2064- facing = getCellFacing (motif .select_info .cell .random .facing , col - 1 , row - 1 )
2065- })
2135+ local item = getTransforms (motif .select_info .cell .random .facing )
2136+ item .anim = motif .select_info .cell .random .AnimData
2137+ item .x = motif .select_info .pos [1 ] + t .x + motif .select_info .portrait .offset [1 ]
2138+ item .y = motif .select_info .pos [2 ] + t .y + motif .select_info .portrait .offset [2 ]
2139+ table.insert (drawList , item )
20662140 end
20672141
20682142 if charData and charData .char_ref ~= nil and charData .hidden == 0 then
2069- table.insert (drawList , {
2070- anim = charData .cell_data ,
2071- x = motif .select_info .pos [1 ] + t .x + motif .select_info .portrait .offset [1 ],
2072- y = motif .select_info .pos [2 ] + t .y + motif .select_info .portrait .offset [2 ],
2073- facing = getCellFacing (motif .select_info .portrait .facing , col - 1 , row - 1 )
2074- })
2143+ local item = getTransforms (motif .select_info .portrait .facing )
2144+ item .anim = charData .cell_data
2145+ item .x = motif .select_info .pos [1 ] + t .x + motif .select_info .portrait .offset [1 ]
2146+ item .y = motif .select_info .pos [2 ] + t .y + motif .select_info .portrait .offset [2 ]
2147+ table.insert (drawList , item )
20752148 end
20762149 end
20772150 end
0 commit comments