export const RECORD_TICK_MODULO = 6 ; export const NUM_SCHEDULE_TICKS = 196608 ; export const NUM_TICKS_PER_DAY = 65535 ; export const NUM_SCHEDULE_RECORD_TICKS = NUM_SCHEDULE_TICKS / RECORD_TICK_MODULO ; export const NUM_RECORD_TICKS_PER_DAY = NUM_TICKS_PER_DAY / RECORD_TICK_MODULO ; export function get_scaled_time ( time ) { return Math . round ( time / RECORD_TICK_MODULO ) ; } export function get_scaled_time_floor ( time ) { return Math . floor ( time / RECORD_TICK_MODULO ) ; } export function get_scaled_time_ceil ( time ) { return Math . ceil ( time / RECORD_TICK_MODULO ) ; } export function get_linear_time ( time , day ) { time += ( NUM_TICKS_PER_DAY * day ) - 16384 ; return time ; } export function get_schedule_data_index_at_time ( time , day ) { let schedule_tick = 0 ; if ( day == 0 ) time -= 16384 ; else time += ( NUM_TICKS_PER_DAY * day ) - 16384 ; schedule_tick = get_scaled_time_floor ( time ) ; console . log ( "time of " + time . toString ( ) + " is schedule index of " + schedule_tick . toString ( ) ) ; return schedule_tick ; } export class PlayerScheduleData { pos : Buffer ; rot : Buffer ; anim : Buffer ; scene : number ; alive : boolean ; constructor ( ) { this . pos = Buffer . alloc ( 12 ) ; this . rot = Buffer . alloc ( 6 ) ; this . anim = Buffer . alloc ( 86 ) ; this . scene = 111 ; this . alive = false ; } } export class PlayerSchedule { schedule_data : PlayerScheduleData [ ] ; constructor ( ) { this . schedule_data = new Array < PlayerScheduleData > ( NUM_SCHEDULE_RECORD_TICKS ) ; for ( let index = 0 ; index < NUM_SCHEDULE_RECORD_TICKS ; index ++ ) { this . schedule_data [ index ] = new PlayerScheduleData ( ) ; } } } export default PlayerSchedule ;