MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / load

Method load

src/SB/Game/zDiscoFloor.cpp:622–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622void z_disco_floor::load(z_disco_floor_asset& asset)
623{
624 xBaseInit(this, &asset);
625
626 baseType = eBaseTypeDiscoFloor;
627 this->asset = &asset;
628 eventFunc = event_handler;
629
630 if (linkCount != 0)
631 {
632 link = (xLinkAsset*)(&asset + 1);
633 }
634
635 char* data = (char*)(&asset.flags);
636
637 prefix[0] = data + asset.prefix_offset.off;
638 prefix[1] = data + asset.prefix_offset.transition;
639 prefix[2] = data + asset.prefix_offset.on;
640
641 state_masks = (U8**)xMemAllocSize(asset.states_size * sizeof(U8*));
642
643 size_t* state_offsets = (size_t*)(data + asset.states_offset);
644
645 for (size_t i = 0; i < asset.states_size; i++)
646 {
647 state_masks[i] = (U8*)(data + state_offsets[i]);
648 }
649
650 active_state_mask = (U8*)xMemAllocSize(state_byte_size(asset.state_mask_size));
651 next_state_mask = (U8*)xMemAllocSize(state_byte_size(asset.state_mask_size));
652
653 if (asset.interval.transition < 0.0f)
654 {
655 asset.interval.transition = 0.25f;
656 }
657
658 if (asset.interval.state < 0.0f)
659 {
660 asset.interval.state = 1.0f;
661 }
662
663 flag.enabled = (asset.flags & 0x2) && (tiles_size != 0);
664
665 sound_delay = 0.0f;
666
667 curr_note = 5.0f * -xurand() - 5.0f;
668}
669
670namespace
671{

Callers 1

initMethod · 0.45

Calls 3

xBaseInitFunction · 0.85
state_byte_sizeFunction · 0.85
xurandFunction · 0.85

Tested by

no test coverage detected