194 lines
11 KiB
Plaintext
194 lines
11 KiB
Plaintext
import { LinkInventoryChecks } from @zelda1:link;
|
|
import { GameInventoryChecks } from @zelda1:game;
|
|
import { Gfx } from @sdk:gfx;
|
|
import { Color } from @core:color;
|
|
import { InventoryScreen } from @zelda1:screens/inventory;
|
|
import { Stage } from @zelda1:stage;
|
|
import { Link } from @zelda1:link;
|
|
import { InventoryGraphics } from @zelda1:screens/inventory;
|
|
declare global test_extra: int=0;
|
|
declare global test_batch: int=0;
|
|
declare global test_count: int=0;
|
|
declare global test_failed: int=0;
|
|
declare global test_results: array<int> = new array<int>(2048);
|
|
declare service InventoryChecks {
|
|
fn check(value: bool) -> void { test_results[test_count]=if value { 1 } else { 0 }; test_count+=1; if !value { test_failed+=1; } }
|
|
fn selection_case(values: array<int>, start: int, direction: int, expected: int) -> void { let s=new BSelection(values,start,0); s.search(direction,start); InventoryChecks.check(s.selected==expected); }
|
|
// ORACLE_BATCHES
|
|
fn batch_138() -> void {}
|
|
fn batch_139() -> void {}
|
|
fn extra() -> int {
|
|
Inventory.reset(); Stage.reset(); Link.start_game();
|
|
inventory_slots[7]=2; inventory_slots[15]=1; Inventory.ensure_selection();
|
|
if selection.selected!=7 { return 1; }
|
|
let damage=Inventory.damage_life(300); Link.use_b(true);
|
|
let heal_active=Link.healing(); let potion_count=Inventory.read_slot(7);
|
|
if !heal_active { return 20+potion_count; } if potion_count!=1 { return 30+potion_count; }
|
|
for tick: int from 0 until 200 { if Link.healing() { Link.heal_frame(); } }
|
|
let still_healing=Link.healing(); let full=Inventory.full_hearts(); if still_healing || !full { return 3; }
|
|
Link.use_b(true); for tick: int from 0 until 200 { if Link.healing() { Link.heal_frame(); } }
|
|
Inventory.ensure_selection(); if selection.selected!=15 { return 40+selection.selected; } let remaining_potions=Inventory.read_slot(7); if remaining_potions!=0 { return 60+remaining_potions; }
|
|
inventory_slots[1]=3; inventory_slots[29]=1; selection.selected=0; selection.previous=0;
|
|
Inventory.select_direction(1); if selection.selected!=1 { return 5; }
|
|
Inventory.select_direction(1); if selection.selected!=1 { return 6; }
|
|
Inventory.select_direction(0); Inventory.select_direction(1); if selection.selected!=15 { return 7; }
|
|
Inventory.select_direction(0); Inventory.select_direction(1); if selection.selected!=0 { return 8; }
|
|
inventory_slots[30]=1; let displayed=Inventory.selected_display_slot(); if displayed!=30 { return 9; }
|
|
return 0;
|
|
}
|
|
fn frame() -> void {
|
|
if test_batch==0 { InventoryChecks.batch_0(); }
|
|
if test_batch==1 { InventoryChecks.batch_1(); }
|
|
if test_batch==2 { InventoryChecks.batch_2(); }
|
|
if test_batch==3 { InventoryChecks.batch_3(); }
|
|
if test_batch==4 { InventoryChecks.batch_4(); }
|
|
if test_batch==5 { InventoryChecks.batch_5(); }
|
|
if test_batch==6 { InventoryChecks.batch_6(); }
|
|
if test_batch==7 { InventoryChecks.batch_7(); }
|
|
if test_batch==8 { InventoryChecks.batch_8(); }
|
|
if test_batch==9 { InventoryChecks.batch_9(); }
|
|
if test_batch==10 { InventoryChecks.batch_10(); }
|
|
if test_batch==11 { InventoryChecks.batch_11(); }
|
|
if test_batch==12 { InventoryChecks.batch_12(); }
|
|
if test_batch==13 { InventoryChecks.batch_13(); }
|
|
if test_batch==14 { InventoryChecks.batch_14(); }
|
|
if test_batch==15 { InventoryChecks.batch_15(); }
|
|
if test_batch==16 { InventoryChecks.batch_16(); }
|
|
if test_batch==17 { InventoryChecks.batch_17(); }
|
|
if test_batch==18 { InventoryChecks.batch_18(); }
|
|
if test_batch==19 { InventoryChecks.batch_19(); }
|
|
if test_batch==20 { InventoryChecks.batch_20(); }
|
|
if test_batch==21 { InventoryChecks.batch_21(); }
|
|
if test_batch==22 { InventoryChecks.batch_22(); }
|
|
if test_batch==23 { InventoryChecks.batch_23(); }
|
|
if test_batch==24 { InventoryChecks.batch_24(); }
|
|
if test_batch==25 { InventoryChecks.batch_25(); }
|
|
if test_batch==26 { InventoryChecks.batch_26(); }
|
|
if test_batch==27 { InventoryChecks.batch_27(); }
|
|
if test_batch==28 { InventoryChecks.batch_28(); }
|
|
if test_batch==29 { InventoryChecks.batch_29(); }
|
|
if test_batch==30 { InventoryChecks.batch_30(); }
|
|
if test_batch==31 { InventoryChecks.batch_31(); }
|
|
if test_batch==32 { InventoryChecks.batch_32(); }
|
|
if test_batch==33 { InventoryChecks.batch_33(); }
|
|
if test_batch==34 { InventoryChecks.batch_34(); }
|
|
if test_batch==35 { InventoryChecks.batch_35(); }
|
|
if test_batch==36 { InventoryChecks.batch_36(); }
|
|
if test_batch==37 { InventoryChecks.batch_37(); }
|
|
if test_batch==38 { InventoryChecks.batch_38(); }
|
|
if test_batch==39 { InventoryChecks.batch_39(); }
|
|
if test_batch==40 { InventoryChecks.batch_40(); }
|
|
if test_batch==41 { InventoryChecks.batch_41(); }
|
|
if test_batch==42 { InventoryChecks.batch_42(); }
|
|
if test_batch==43 { InventoryChecks.batch_43(); }
|
|
if test_batch==44 { InventoryChecks.batch_44(); }
|
|
if test_batch==45 { InventoryChecks.batch_45(); }
|
|
if test_batch==46 { InventoryChecks.batch_46(); }
|
|
if test_batch==47 { InventoryChecks.batch_47(); }
|
|
if test_batch==48 { InventoryChecks.batch_48(); }
|
|
if test_batch==49 { InventoryChecks.batch_49(); }
|
|
if test_batch==50 { InventoryChecks.batch_50(); }
|
|
if test_batch==51 { InventoryChecks.batch_51(); }
|
|
if test_batch==52 { InventoryChecks.batch_52(); }
|
|
if test_batch==53 { InventoryChecks.batch_53(); }
|
|
if test_batch==54 { InventoryChecks.batch_54(); }
|
|
if test_batch==55 { InventoryChecks.batch_55(); }
|
|
if test_batch==56 { InventoryChecks.batch_56(); }
|
|
if test_batch==57 { InventoryChecks.batch_57(); }
|
|
if test_batch==58 { InventoryChecks.batch_58(); }
|
|
if test_batch==59 { InventoryChecks.batch_59(); }
|
|
if test_batch==60 { InventoryChecks.batch_60(); }
|
|
if test_batch==61 { InventoryChecks.batch_61(); }
|
|
if test_batch==62 { InventoryChecks.batch_62(); }
|
|
if test_batch==63 { InventoryChecks.batch_63(); }
|
|
if test_batch==64 { InventoryChecks.batch_64(); }
|
|
if test_batch==65 { InventoryChecks.batch_65(); }
|
|
if test_batch==66 { InventoryChecks.batch_66(); }
|
|
if test_batch==67 { InventoryChecks.batch_67(); }
|
|
if test_batch==68 { InventoryChecks.batch_68(); }
|
|
if test_batch==69 { InventoryChecks.batch_69(); }
|
|
if test_batch==70 { InventoryChecks.batch_70(); }
|
|
if test_batch==71 { InventoryChecks.batch_71(); }
|
|
if test_batch==72 { InventoryChecks.batch_72(); }
|
|
if test_batch==73 { InventoryChecks.batch_73(); }
|
|
if test_batch==74 { InventoryChecks.batch_74(); }
|
|
if test_batch==75 { InventoryChecks.batch_75(); }
|
|
if test_batch==76 { InventoryChecks.batch_76(); }
|
|
if test_batch==77 { InventoryChecks.batch_77(); }
|
|
if test_batch==78 { InventoryChecks.batch_78(); }
|
|
if test_batch==79 { InventoryChecks.batch_79(); }
|
|
if test_batch==80 { InventoryChecks.batch_80(); }
|
|
if test_batch==81 { InventoryChecks.batch_81(); }
|
|
if test_batch==82 { InventoryChecks.batch_82(); }
|
|
if test_batch==83 { InventoryChecks.batch_83(); }
|
|
if test_batch==84 { InventoryChecks.batch_84(); }
|
|
if test_batch==85 { InventoryChecks.batch_85(); }
|
|
if test_batch==86 { InventoryChecks.batch_86(); }
|
|
if test_batch==87 { InventoryChecks.batch_87(); }
|
|
if test_batch==88 { InventoryChecks.batch_88(); }
|
|
if test_batch==89 { InventoryChecks.batch_89(); }
|
|
if test_batch==90 { InventoryChecks.batch_90(); }
|
|
if test_batch==91 { InventoryChecks.batch_91(); }
|
|
if test_batch==92 { InventoryChecks.batch_92(); }
|
|
if test_batch==93 { InventoryChecks.batch_93(); }
|
|
if test_batch==94 { InventoryChecks.batch_94(); }
|
|
if test_batch==95 { InventoryChecks.batch_95(); }
|
|
if test_batch==96 { InventoryChecks.batch_96(); }
|
|
if test_batch==97 { InventoryChecks.batch_97(); }
|
|
if test_batch==98 { InventoryChecks.batch_98(); }
|
|
if test_batch==99 { InventoryChecks.batch_99(); }
|
|
if test_batch==100 { InventoryChecks.batch_100(); }
|
|
if test_batch==101 { InventoryChecks.batch_101(); }
|
|
if test_batch==102 { InventoryChecks.batch_102(); }
|
|
if test_batch==103 { InventoryChecks.batch_103(); }
|
|
if test_batch==104 { InventoryChecks.batch_104(); }
|
|
if test_batch==105 { InventoryChecks.batch_105(); }
|
|
if test_batch==106 { InventoryChecks.batch_106(); }
|
|
if test_batch==107 { InventoryChecks.batch_107(); }
|
|
if test_batch==108 { InventoryChecks.batch_108(); }
|
|
if test_batch==109 { InventoryChecks.batch_109(); }
|
|
if test_batch==110 { InventoryChecks.batch_110(); }
|
|
if test_batch==111 { InventoryChecks.batch_111(); }
|
|
if test_batch==112 { InventoryChecks.batch_112(); }
|
|
if test_batch==113 { InventoryChecks.batch_113(); }
|
|
if test_batch==114 { InventoryChecks.batch_114(); }
|
|
if test_batch==115 { InventoryChecks.batch_115(); }
|
|
if test_batch==116 { InventoryChecks.batch_116(); }
|
|
if test_batch==117 { InventoryChecks.batch_117(); }
|
|
if test_batch==118 { InventoryChecks.batch_118(); }
|
|
if test_batch==119 { InventoryChecks.batch_119(); }
|
|
if test_batch==120 { InventoryChecks.batch_120(); }
|
|
if test_batch==121 { InventoryChecks.batch_121(); }
|
|
if test_batch==122 { InventoryChecks.batch_122(); }
|
|
if test_batch==123 { InventoryChecks.batch_123(); }
|
|
if test_batch==124 { InventoryChecks.batch_124(); }
|
|
if test_batch==125 { InventoryChecks.batch_125(); }
|
|
if test_batch==126 { InventoryChecks.batch_126(); }
|
|
if test_batch==127 { InventoryChecks.batch_127(); }
|
|
if test_batch==128 { InventoryChecks.batch_128(); }
|
|
if test_batch==129 { InventoryChecks.batch_129(); }
|
|
if test_batch==130 { InventoryChecks.batch_130(); }
|
|
if test_batch==131 { InventoryChecks.batch_131(); }
|
|
if test_batch==132 { InventoryChecks.batch_132(); }
|
|
if test_batch==133 { InventoryChecks.batch_133(); }
|
|
if test_batch==134 { InventoryChecks.batch_134(); }
|
|
if test_batch==135 { InventoryChecks.batch_135(); }
|
|
if test_batch==136 { InventoryChecks.batch_136(); }
|
|
if test_batch==137 { InventoryChecks.batch_137(); }
|
|
if test_batch==138 { InventoryChecks.batch_138(); }
|
|
if test_batch==139 { InventoryChecks.batch_139(); }
|
|
if test_batch==140 { let assertion_14=LinkInventoryChecks.run(); InventoryChecks.check(assertion_14); }
|
|
if test_batch==141 { let assertion_15=GameInventoryChecks.run(); InventoryChecks.check(assertion_15); }
|
|
if test_batch==142 { let extra_result=InventoryChecks.extra(); test_extra=extra_result; InventoryChecks.check(extra_result==0); }
|
|
if test_batch<143 { test_batch+=1; }
|
|
Gfx.clear(Color.rgb(0,0,0)); Gfx.fill_rect(470,260,3,3,Color.rgb(test_extra as long,0,0));
|
|
for i: int from 0 until test_count { let v=test_results[i] else 0; Gfx.fill_rect(i%160*3,i/160*3,2,2,if v==1 { Color.rgb(0,255,0) } else { Color.rgb(255,0,0) }); }
|
|
Gfx.fill_rect(477,267,3,3,if test_batch<143 { Color.rgb(0,0,255) } else if test_failed==0 { Color.rgb(0,255,0) } else { Color.rgb(255,0,0) });
|
|
}
|
|
fn visual() -> void {
|
|
Inventory.reset(); for i: int from 0 until 40 { inventory_slots[i]=1; } inventory_slots[24]=34; inventory_slots[25]=255; inventory_slots[26]=255; inventory_slots[37]=8;
|
|
Stage.reset(); Link.start_game(); InventoryScreen.reset(); InventoryScreen.open(); for i: int from 0 until 65 { let c=InventoryScreen.advance(false,0); }
|
|
}
|
|
fn draw() -> void { InventoryScreen.draw(); }
|
|
}
|