; start of routine
02067830 B5F8 push {r3-r7,r14}
02067832 B082 add sp,-#0x8
02067834 9000 str r0,[sp]
02067836 9101 str r1,[sp,#0x4]
02067838 1C17 mov r7,r2 ; need to know what this is
0206783A F7C6F8DD bl #0x202D9F8
0206783E 0081 lsl r1,r0,#0x2
02067840 480F ldr r0,=#0x20FE4B8
02067842 5846 ldr r6,[r0,r1] ; location at SAVE
02067844 9801 ldr r0,[sp,#0x4]
; depending on where we are in the loop
; we want to set r4 to our mod value so
; we can get a route number from the rng
; r5 is?
; r0 will iterate 0-2, so this will run three times
02067846 2801 cmp r0,#0x1
02067848 D802 bhi two ;#0x2067850
: one_or_zero
0206784A 2410 mov r4,#0x10
0206784C 2500 mov r5,#0x0
0206784E E001 b roll_rng ;#0x2067854
: two
02067850 2419 mov r4,#0x19
02067852 2510 mov r5,#0x10
; if r0 == 0 || r0 == 1
; r4 = 16
; r5 - 0
l if r0 == 2
; r4 = 25
; r5 = 16
; done getting our mod value
: roll_rng
02067854 F7B8FA76 bl :lcrng ; CALL THE RNG
02067858 1C21 mov r1,r4
0206785A F08BE89E blx :division ;#0x20F2998
0206785E 1868 add r0,r5,r1
; for the first two the result in r0:
; 0 - 16
; for the last the result in r0 (lati):
; 16 - 40
02067860 0600 lsl r0,r0,#0x18
02067862 0E02 lsr r2,r0,#0x18 ; move our value into r2
02067864 4806 ldr r0,=#0x20FE4B8 ; load the mem location of lookup table
02067866 0091 lsl r1,r2,#0x2 ; load into r1 the value of r2 << 2
; (*4. 32 bit indexing here for the array)
; get the contents of the lookup table at offset r1 into r3
02067868 5843 ldr r3,[r0,r1]
0206786A 42BB cmp r3,r7
0206786C D0F2 beq roll_rng ;#0x2067854
0206786E 42B3 cmp r3,r6
02067870 D0F0 beq roll_rng ;#0x2067854
02067872 9800 ldr r0,[sp]
02067874 9901 ldr r1,[sp,#0x4]
02067876 F000F84D bl #0x2067914
0206787A B002 add sp,#0x8
0206787C BDF8 pop {r3-r7,r15}