Path: blob/master/Sonic 2/Scripts/WFZ/WFZInvBlock.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: WFZ Inv Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timeAttackOnly1213private alias object.value0 : object.width14private alias object.value1 : object.height1516// Player Aliases17private alias object.type : player.type18private alias object.state : player.state19private alias object.gravity : player.gravity20private alias object.animation : player.animation2122// Modes23private alias 2 : MODE_TIMEATTACK242526// ========================27// Events28// ========================2930event ObjectUpdate31temp0 = object.width32FlipSign(temp0)33temp1 = object.height34FlipSign(temp1)3536foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)37if player[currentPlayer].state != Player_State_LedgePullUp38if player[currentPlayer].animation != ANI_FANROTATE39BoxCollisionTest(C_SOLID, object.entityPos, temp0, temp1, object.width, object.height, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)40switch checkResult41case COL_NONE42temp0 += 243temp1 += 244temp2 = object.width45temp3 = object.height46temp2 -= 247temp3 -= 248BoxCollisionTest(C_TOUCH, object.entityPos, temp0, temp1, temp2, temp3, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)49if checkResult == true50player[currentPlayer].gravity = GRAVITY_GROUND51end if52break5354case COL_BOTTOM55if player[currentPlayer].gravity == GRAVITY_GROUND56CallFunction(Player_Kill)57end if58break59end switch60end if61end if62next63end event646566event ObjectDraw67if player[0].type == TypeName[Debug Mode]68temp0 = object.xpos69temp1 = object.ypos7071temp2 = object.propertyValue72temp4 = temp273temp4 &= 0xF074temp4 <<= 1575temp2 >>= 476temp2++77temp6 = temp27879temp3 = object.propertyValue80temp3 &= 0x0F81temp5 = temp382temp5 <<= 1983temp3++8485temp0 -= temp486temp4 = temp087temp1 -= temp588while temp3 > 089while temp2 > 090DrawSpriteXY(0, temp0, temp1)91temp0 += 0x10000092temp2--93loop94temp2 = temp695temp0 = temp496temp1 += 0x10000097temp3--98loop99end if100end event101102103event ObjectStartup104LoadSpriteSheet("Global/Display.gif")105SpriteFrame(-8, -7, 16, 14, 1, 176)106107foreach (TypeName[WFZ Inv Block], arrayPos0, ALL_ENTITIES)108if object[arrayPos0].timeAttackOnly == true109if options.gameMode != MODE_TIMEATTACK110object[arrayPos0].type = TypeName[Blank Object]111end if112end if113114// Do note that these don't draw anything normally, they only display in Debug Mode115object[arrayPos0].drawOrder = 5116117object[arrayPos0].width = object[arrayPos0].propertyValue118object[arrayPos0].width &= 0xF0119object[arrayPos0].width += 16120object[arrayPos0].width >>= 1121122object[arrayPos0].height = object[arrayPos0].propertyValue123object[arrayPos0].height &= 0xF124object[arrayPos0].height++125object[arrayPos0].height <<= 3126next127end event128129130// ========================131// Editor Events132// ========================133134event RSDKEdit135if editor.returnVariable == true136switch editor.variableID137case EDIT_VAR_PROPVAL // property value138checkResult = object.propertyValue139break140141case 0 // width142checkResult = object.propertyValue143checkResult >>= 4144checkResult &= 0xF145break146147case 1 // height148checkResult = object.propertyValue149checkResult &= 0xF150break151152end switch153else154switch editor.variableID155case EDIT_VAR_PROPVAL // property value156object.propertyValue = editor.variableValue157break158159case 0 // width160temp0 = editor.variableValue161temp0 &= 0xF162temp0 <<= 4163164object.propertyValue &= 0x0F165object.propertyValue |= temp0166break167168case 1 // height169temp0 = editor.variableValue170temp0 &= 0xF171172object.propertyValue &= 0xF0173object.propertyValue |= temp0174break175176end switch177end if178end event179180181event RSDKDraw182temp0 = object.xpos183temp1 = object.ypos184185temp2 = object.propertyValue186temp4 = temp2187temp4 &= 0xF0188temp4 <<= 15189temp2 >>= 4190temp2++191temp6 = temp2192193temp3 = object.propertyValue194temp3 &= 0x0F195temp5 = temp3196temp5 <<= 19197temp3++198199temp0 -= temp4200temp4 = temp0201temp1 -= temp5202while temp3 > 0203while temp2 > 0204DrawSpriteXY(0, temp0, temp1)205temp0 += 0x100000206temp2--207loop208temp2 = temp6209temp0 = temp4210temp1 += 0x100000211temp3--212loop213end event214215216event RSDKLoad217LoadSpriteSheet("Global/Display.gif")218SpriteFrame(-8, -7, 16, 14, 1, 176)219220AddEditorVariable("width")221AddEditorVariable("height")222223SetVariableAlias(ALIAS_VAR_VAL0, "timeAttackOnly")224end event225226227