From ecf74f9721e5067be648353d9f6d0a07a7360f0e Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Fri, 26 Jul 2024 20:06:40 +0100 Subject: [PATCH 01/24] Separate stage asset management --- Makefile.psx.mk | 36 +++++++------ tools/sotn-assets/main.go | 103 ++++++++++++++++++++----------------- tools/sotn-assets/utils.go | 10 ++++ 3 files changed, 86 insertions(+), 63 deletions(-) diff --git a/Makefile.psx.mk b/Makefile.psx.mk index fc6751ffaa..95a798048c 100644 --- a/Makefile.psx.mk +++ b/Makefile.psx.mk @@ -80,25 +80,27 @@ $(BUILD_DIR)/$(SRC_DIR)/main/psxsdk/libgpu/sys.c.o: $(SRC_DIR)/main/psxsdk/libgp $(CPP) $(CPP_FLAGS) -lang-c $< | $(SOTNSTR) | $(ICONV) | $(CC) $(CC_FLAGS) $(PSXCC_FLAGS) | $(MASPSX_21) | $(AS) $(AS_FLAGS) -o $@ extract_assets: $(SOTNASSETS) - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/CEN/CEN.BIN -o assets/st/cen - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/DRE/DRE.BIN -o assets/st/dre - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/NO3/NO3.BIN -o assets/st/no3 - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/NP3/NP3.BIN -o assets/st/np3 - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/NZ0/NZ0.BIN -o assets/st/nz0 - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/ST0/ST0.BIN -o assets/st/st0 - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/WRP/WRP.BIN -o assets/st/wrp - $(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/RWRP/RWRP.BIN -o assets/st/rwrp + cd tools/sotn-assets; $(GO) install + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/CEN/CEN.BIN -o assets/st/cen + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/DRE/DRE.BIN -o assets/st/dre + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/NO3/NO3.BIN -o assets/st/no3 + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/NP3/NP3.BIN -o assets/st/np3 + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/NZ0/NZ0.BIN -o assets/st/nz0 + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/ST0/ST0.BIN -o assets/st/st0 + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/WRP/WRP.BIN -o assets/st/wrp + $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/RWRP/RWRP.BIN -o assets/st/rwrp extract_assets_hd: $(SOTNASSETS) - $(SOTNASSETS) extract -stage_ovl disks/pspeu/PSP_GAME/USRDIR/res/ps/hdbin/wrp.bin -o assets/st/wrp + cd tools/sotn-assets; $(GO) install + $(SOTNASSETS) stage extract -stage_ovl disks/pspeu/PSP_GAME/USRDIR/res/ps/hdbin/wrp.bin -o assets/st/wrp build_assets: $(SOTNASSETS) - $(SOTNASSETS) build_all -i assets/st/cen -o src/st/cen/ - $(SOTNASSETS) build_all -i assets/st/dre -o src/st/dre/ - $(SOTNASSETS) build_all -i assets/st/no3 -o src/st/no3/ - $(SOTNASSETS) build_all -i assets/st/np3 -o src/st/np3/ - $(SOTNASSETS) build_all -i assets/st/nz0 -o src/st/nz0/ - $(SOTNASSETS) build_all -i assets/st/st0 -o src/st/st0/ - $(SOTNASSETS) build_all -i assets/st/wrp -o src/st/wrp/ - $(SOTNASSETS) build_all -i assets/st/rwrp -o src/st/rwrp/ + $(SOTNASSETS) stage build_all -i assets/st/cen -o src/st/cen/ + $(SOTNASSETS) stage build_all -i assets/st/dre -o src/st/dre/ + $(SOTNASSETS) stage build_all -i assets/st/no3 -o src/st/no3/ + $(SOTNASSETS) stage build_all -i assets/st/np3 -o src/st/np3/ + $(SOTNASSETS) stage build_all -i assets/st/nz0 -o src/st/nz0/ + $(SOTNASSETS) stage build_all -i assets/st/st0 -o src/st/st0/ + $(SOTNASSETS) stage build_all -i assets/st/wrp -o src/st/wrp/ + $(SOTNASSETS) stage build_all -i assets/st/rwrp -o src/st/rwrp/ $(BUILD_DIR)/assets/dra/memcard_%.png.o: assets/dra/memcard_%.png mkdir -p $(dir $@) diff --git a/tools/sotn-assets/main.go b/tools/sotn-assets/main.go index 2b71d66203..bacf0d2f7f 100644 --- a/tools/sotn-assets/main.go +++ b/tools/sotn-assets/main.go @@ -288,92 +288,103 @@ func testStuff() { } } -func main() { - if len(os.Args) < 2 { - fmt.Println("expected 'info', 'extract', 'build' or 'build_all' subcommands") - os.Exit(1) - } - - switch os.Args[1] { - case "info": - extractCmd := flag.NewFlagSet("info", flag.ExitOnError) +func handlerStage(args []string) error { + commands := map[string]func(args []string) error{} + commands["info"] = func(args []string) error { var stageOvl string + extractCmd := flag.NewFlagSet("info", flag.ExitOnError) extractCmd.StringVar(&stageOvl, "stage_ovl", "", "The overlay file to process") - extractCmd.Parse(os.Args[2:]) - if err := info(stageOvl); err != nil { - panic(err) - } - - case "extract": - extractCmd := flag.NewFlagSet("extract", flag.ExitOnError) + extractCmd.Parse(args) + return info(stageOvl) + } + commands["extract"] = func(args []string) error { var stageOvl string var assetDir string + extractCmd := flag.NewFlagSet("extract", flag.ExitOnError) extractCmd.StringVar(&stageOvl, "stage_ovl", "", "The overlay file to process") extractCmd.StringVar(&assetDir, "o", "", "Where to extract the asset files") + extractCmd.Parse(args) - extractCmd.Parse(os.Args[2:]) if stageOvl == "" || assetDir == "" { - fmt.Println("stage_ovl and asset_dir are required for extract") + fmt.Fprintln(os.Stderr, "stage_ovl and asset_dir are required for extract") extractCmd.PrintDefaults() os.Exit(1) } - if err := extract(stageOvl, assetDir); err != nil { - panic(err) - } - - case "build": - buildCmd := flag.NewFlagSet("build", flag.ExitOnError) + return extract(stageOvl, assetDir) + } + commands["build"] = func(args []string) error { var file string var kind string var outputDir string + buildCmd := flag.NewFlagSet("build", flag.ExitOnError) buildCmd.StringVar(&file, "file", "", "File to process") buildCmd.StringVar(&kind, "kind", "", "Kind of the file to process") buildCmd.StringVar(&outputDir, "o", "", "Where to store the processed source files") - - buildCmd.Parse(os.Args[2:]) + buildCmd.Parse(args) if file == "" || kind == "" || outputDir == "" { - fmt.Println("file, kind, and output_dir are required for build") + fmt.Fprintln(os.Stderr, "file, kind, and output_dir are required for build") buildCmd.PrintDefaults() os.Exit(1) } - var err error switch kind { case "rooms": - err = buildRooms(file, outputDir) + return buildRooms(file, outputDir) case "layers": - err = buildLayers(path.Base(file), file, outputDir) + return buildLayers(path.Base(file), file, outputDir) case "sprites": - err = buildSprites(file, outputDir) - default: - fmt.Println("unknown kind, valid values are 'room', 'layer', 'sprites'") - } - if err != nil { - panic(err) + return buildSprites(file, outputDir) } - - case "build_all": + return fmt.Errorf("unknown kind, valid values are 'room', 'layer', 'sprites'") + } + commands["build_all"] = func(args []string) error { buildCmd := flag.NewFlagSet("build_all", flag.ExitOnError) var inputDir string var outputDir string buildCmd.StringVar(&inputDir, "i", "", "Folder where all the assets are located") buildCmd.StringVar(&outputDir, "o", "", "Where to store the processed source files") - - buildCmd.Parse(os.Args[2:]) + buildCmd.Parse(args) if inputDir == "" || outputDir == "" { - fmt.Println("input_dir and output_dir are required for build") + fmt.Fprintln(os.Stderr, "input_dir and output_dir are required for build") buildCmd.PrintDefaults() os.Exit(1) } + return buildAll(inputDir, outputDir) + } - if err := buildAll(inputDir, outputDir); err != nil { - panic(err) + if len(args) > 0 { + command := args[0] + if f, found := commands[command]; found { + return f(args[1:]) } + fmt.Fprintf(os.Stderr, "unknown subcommand %q. Valid subcommands are %s\n", command, joinMapKeys(commands, ", ")) + } else { + fmt.Fprintf(os.Stderr, "Need a subcommand. Valid subcommands are %s\n", joinMapKeys(commands, ", ")) + } + os.Exit(1) + return nil +} - default: - fmt.Println("expected 'info', 'extract', 'build' or 'build_all' subcommands") - os.Exit(1) +func main() { + commands := map[string]func(args []string) error{ + "stage": handlerStage, + } + + args := os.Args[1:] + if len(args) > 0 { + command := args[0] + if f, found := commands[command]; found { + if err := f(args[1:]); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + return + } + fmt.Fprintf(os.Stderr, "unknown command %q. Valid commands are %s\n", command, joinMapKeys(commands, ", ")) + } else { + fmt.Fprintf(os.Stderr, "Need a command. Valid commands are %s\n", joinMapKeys(commands, ", ")) } + os.Exit(1) } diff --git a/tools/sotn-assets/utils.go b/tools/sotn-assets/utils.go index 8267412ed2..df6d58c117 100644 --- a/tools/sotn-assets/utils.go +++ b/tools/sotn-assets/utils.go @@ -1,5 +1,15 @@ package main +import "strings" + +func joinMapKeys[T any](m map[string]T, sep string) string { + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + return strings.Join(keys, sep) +} + func minBy[T any](slice []T, getter func(T) int) (max int) { if len(slice) == 0 { return max From 71e9747df8e1f9d48a510099e486c5d9d93dd6fe Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 28 Jul 2024 18:39:17 +0100 Subject: [PATCH 02/24] Move psx offsets into its own package --- tools/sotn-assets/data_range.go | 7 +-- tools/sotn-assets/graphics.go | 25 +++++----- tools/sotn-assets/layer.go | 27 +++++----- tools/sotn-assets/layout.go | 17 ++++--- tools/sotn-assets/main.go | 39 +++++++-------- tools/sotn-assets/paths.go | 29 ++++++----- tools/sotn-assets/psx/offsets.go | 66 +++++++++++++++++++++++++ tools/sotn-assets/psx_offsets.go | 84 -------------------------------- tools/sotn-assets/room.go | 7 +-- tools/sotn-assets/sprites.go | 37 +++++++------- tools/sotn-assets/tile_def.go | 21 ++++---- tools/sotn-assets/tile_map.go | 9 ++-- tools/sotn-assets/utils.go | 27 +++++++++- 13 files changed, 207 insertions(+), 188 deletions(-) create mode 100644 tools/sotn-assets/psx/offsets.go delete mode 100644 tools/sotn-assets/psx_offsets.go diff --git a/tools/sotn-assets/data_range.go b/tools/sotn-assets/data_range.go index 6b8315d972..6e387815cb 100644 --- a/tools/sotn-assets/data_range.go +++ b/tools/sotn-assets/data_range.go @@ -2,12 +2,13 @@ package main import ( "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "sort" ) type dataRange struct { - begin PsxOffset - end PsxOffset + begin psx.Addr + end psx.Addr } func (r dataRange) Format(f fmt.State, c rune) { @@ -15,7 +16,7 @@ func (r dataRange) Format(f fmt.State, c rune) { } func (r dataRange) empty() bool { - return r.begin == RamNull && r.end == RamNull + return r.begin == psx.RamNull && r.end == psx.RamNull } func mergeDataRanges(ranges []dataRange) dataRange { diff --git a/tools/sotn-assets/graphics.go b/tools/sotn-assets/graphics.go index 333ff06661..574cb2c3f1 100644 --- a/tools/sotn-assets/graphics.go +++ b/tools/sotn-assets/graphics.go @@ -2,6 +2,7 @@ package main import ( "encoding/binary" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" ) @@ -20,7 +21,7 @@ type gfxEntry struct { Y uint16 Width uint16 Height uint16 - Data PsxOffset + Data psx.Addr } type gfxBlock struct { @@ -34,15 +35,15 @@ type gfx struct { indices []int } -func readGraphics(file *os.File, off PsxOffset) (gfx, dataRange, error) { - if err := off.moveFile(file); err != nil { +func readGraphics(file *os.File, off psx.Addr) (gfx, dataRange, error) { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return gfx{}, dataRange{}, err } // all the offsets are before the array, so it is easy to find where the offsets array ends - blockOffsets := []PsxOffset{} + blockOffsets := []psx.Addr{} for { - var offBank PsxOffset + var offBank psx.Addr if err := binary.Read(file, binary.LittleEndian, &offBank); err != nil { return gfx{}, dataRange{}, err } @@ -53,15 +54,15 @@ func readGraphics(file *os.File, off PsxOffset) (gfx, dataRange, error) { } // the order of each gfxBlock must be preserved - pool := map[PsxOffset]int{} - pool[RamNull] = -1 + pool := map[psx.Addr]int{} + pool[psx.RamNull] = -1 blocks := []gfxBlock{} ranges := []dataRange{} for _, blockOffset := range sortUniqueOffsets(blockOffsets) { - if blockOffset == RamNull { // exception for ST0 + if blockOffset == psx.RamNull { // exception for ST0 continue } - if err := blockOffset.moveFile(file); err != nil { + if err := blockOffset.MoveFile(file, psx.RamStageBegin); err != nil { return gfx{}, dataRange{}, err } var block gfxBlock @@ -77,7 +78,7 @@ func readGraphics(file *os.File, off PsxOffset) (gfx, dataRange, error) { blocks = append(blocks, block) ranges = append(ranges, dataRange{ begin: blockOffset, - end: blockOffset.sum(4), + end: blockOffset.Sum(4), }) continue } @@ -96,7 +97,7 @@ func readGraphics(file *os.File, off PsxOffset) (gfx, dataRange, error) { blocks = append(blocks, block) ranges = append(ranges, dataRange{ begin: blockOffset, - end: blockOffset.sum(4 + len(block.entries)*12 + 4), + end: blockOffset.Sum(4 + len(block.entries)*12 + 4), }) } @@ -107,6 +108,6 @@ func readGraphics(file *os.File, off PsxOffset) (gfx, dataRange, error) { return g, mergeDataRanges(append(ranges, dataRange{ begin: off, - end: off.sum(len(blockOffsets) * 4), + end: off.Sum(len(blockOffsets) * 4), })), nil } diff --git a/tools/sotn-assets/layer.go b/tools/sotn-assets/layer.go index d17976b35a..8fa828c04a 100644 --- a/tools/sotn-assets/layer.go +++ b/tools/sotn-assets/layer.go @@ -3,13 +3,14 @@ package main import ( "encoding/binary" "encoding/json" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" "slices" ) type layer struct { - Data PsxOffset - Tiledef PsxOffset + Data psx.Addr + Tiledef psx.Addr PackedInfo uint32 ZPriority uint16 UnkE uint8 @@ -76,44 +77,44 @@ func (r roomLayers) MarshalJSON() ([]byte, error) { return json.Marshal(m) } -func readLayers(file *os.File, off PsxOffset) ([]roomLayers, dataRange, error) { +func readLayers(file *os.File, off psx.Addr) ([]roomLayers, dataRange, error) { if off == 0 { return nil, dataRange{}, nil } - if err := off.moveFile(file); err != nil { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return nil, dataRange{}, err } // when the data starts to no longer makes sense, we can assume we reached the end of the array - layerOffsets := []PsxOffset{} - layersOff := make([]PsxOffset, 2) + layerOffsets := []psx.Addr{} + layersOff := make([]psx.Addr, 2) for { if err := binary.Read(file, binary.LittleEndian, layersOff); err != nil { return nil, dataRange{}, err } - if layersOff[0] <= RamStageBegin || layersOff[0] >= off || - layersOff[1] <= RamStageBegin || layersOff[1] >= off { + if layersOff[0] <= psx.RamStageBegin || layersOff[0] >= off || + layersOff[1] <= psx.RamStageBegin || layersOff[1] >= off { break } layerOffsets = append(layerOffsets, layersOff...) } // Creates a map of layers, so we can re-use them when a layer is used by multiple rooms - pool := map[PsxOffset]*layer{} - pool[PsxOffset(0)] = nil + pool := map[psx.Addr]*layer{} + pool[psx.Addr(0)] = nil for _, layerOffset := range layerOffsets { if _, exists := pool[layerOffset]; exists { continue } - if err := layerOffset.moveFile(file); err != nil { + if err := layerOffset.MoveFile(file, psx.RamStageBegin); err != nil { return nil, dataRange{}, err } var l layer if err := binary.Read(file, binary.LittleEndian, &l); err != nil { return nil, dataRange{}, err } - if l.Data != RamNull || l.Tiledef != RamNull || l.PackedInfo != 0 { + if l.Data != psx.RamNull || l.Tiledef != psx.RamNull || l.PackedInfo != 0 { pool[layerOffset] = &l } else { pool[layerOffset] = nil @@ -129,6 +130,6 @@ func readLayers(file *os.File, off PsxOffset) ([]roomLayers, dataRange, error) { } return roomsLayers, dataRange{ begin: slices.Min(layerOffsets), - end: off.sum(count * 8), + end: off.Sum(count * 8), }, nil } diff --git a/tools/sotn-assets/layout.go b/tools/sotn-assets/layout.go index 31902cd1dd..225d33d3b3 100644 --- a/tools/sotn-assets/layout.go +++ b/tools/sotn-assets/layout.go @@ -3,6 +3,7 @@ package main import ( "encoding/binary" "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "io" "os" ) @@ -73,24 +74,24 @@ func hydrateYOrderFields(x layouts, y layouts) error { return nil } -func readEntityLayout(file *os.File, off PsxOffset, count int, isX bool) (layouts, []dataRange, error) { - if err := off.moveFile(file); err != nil { +func readEntityLayout(file *os.File, off psx.Addr, count int, isX bool) (layouts, []dataRange, error) { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return layouts{}, nil, err } // there are two copies of the layout, one ordered by X and the other one ordered by Y // we will only read the first one, which is ordered by Y - blockOffsets := make([]PsxOffset, count) + blockOffsets := make([]psx.Addr, count) if err := binary.Read(file, binary.LittleEndian, blockOffsets); err != nil { return layouts{}, nil, err } // the order of each layout entry must be preserved - pool := map[PsxOffset]int{} + pool := map[psx.Addr]int{} blocks := [][]layoutEntry{} xRanges := []dataRange{} for _, blockOffset := range sortUniqueOffsets(blockOffsets) { - if err := blockOffset.moveFile(file); err != nil { + if err := blockOffset.MoveFile(file, psx.RamStageBegin); err != nil { return layouts{}, nil, err } entries := []layoutEntry{} @@ -116,18 +117,18 @@ func readEntityLayout(file *os.File, off PsxOffset, count int, isX bool) (layout blocks = append(blocks, entries) xRanges = append(xRanges, dataRange{ begin: blockOffset, - end: blockOffset.sum(len(entries) * 10), + end: blockOffset.Sum(len(entries) * 10), }) } // the very last entry needs to be aligned by 4 - xRanges[len(xRanges)-1].end = xRanges[len(xRanges)-1].end.align4() + xRanges[len(xRanges)-1].end = xRanges[len(xRanges)-1].end.Align4() l := layouts{Entities: blocks} for _, blockOffset := range blockOffsets { l.Indices = append(l.Indices, pool[blockOffset]) } - endOfArray := off.sum(count * 4) + endOfArray := off.Sum(count * 4) if isX { // we want to do the same thing with the vertically aligned layout yLayouts, yRanges, err := readEntityLayout(file, endOfArray, count, false) if err != nil { diff --git a/tools/sotn-assets/main.go b/tools/sotn-assets/main.go index bacf0d2f7f..6cbca09f08 100644 --- a/tools/sotn-assets/main.go +++ b/tools/sotn-assets/main.go @@ -5,6 +5,7 @@ import ( "encoding/json" "flag" "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" "path" ) @@ -22,23 +23,23 @@ type ovl struct { graphics dataContainer[gfx] layouts dataContainer[layouts] layoutsExtraRange dataRange - tileMaps dataContainer[map[PsxOffset][]byte] - tileDefs dataContainer[map[PsxOffset]tileDef] + tileMaps dataContainer[map[psx.Addr][]byte] + tileDefs dataContainer[map[psx.Addr]tileDef] } func getOvlAssets(fileName string) (ovl, error) { type stageHeader struct { - FnUpdate PsxOffset - FnHitDetection PsxOffset - FnUpdateRoomPos PsxOffset - FnInitRoomEntities PsxOffset - Rooms PsxOffset // ✅ - Sprites PsxOffset // ✅ - Cluts PsxOffset // 🫥 - Layouts PsxOffset // ✅ - Layers PsxOffset // ✅ - Graphics PsxOffset // 🫥 WIP - FnUpdateStageEntities PsxOffset + FnUpdate psx.Addr + FnHitDetection psx.Addr + FnUpdateRoomPos psx.Addr + FnInitRoomEntities psx.Addr + Rooms psx.Addr // ✅ + Sprites psx.Addr // ✅ + Cluts psx.Addr // 🫥 + Layouts psx.Addr // ✅ + Layers psx.Addr // ✅ + Graphics psx.Addr // 🫥 WIP + FnUpdateStageEntities psx.Addr } file, err := os.Open(fileName) @@ -74,7 +75,7 @@ func getOvlAssets(fileName string) (ovl, error) { // check for unused tile defs (CEN has one) for tileMapsRange.end < tileDefsRange.begin { - offset := tileDefsRange.begin.sum(-0x10) + offset := tileDefsRange.begin.Sum(-0x10) unusedTileDef, unusedTileDefRange, err := readTiledef(file, offset) if err != nil { return ovl{}, fmt.Errorf("there is a gap between tileMaps and tileDefs: %w", err) @@ -94,7 +95,7 @@ func getOvlAssets(fileName string) (ovl, error) { } layoutOff := header.Layouts - if layoutOff == RamNull { + if layoutOff == psx.RamNull { // some overlays have this field nulled, we have to find the offset ourselves // it should be usually be right after header.Graphics layoutOff = graphicsRange.end // ⚠️ assumption @@ -125,8 +126,8 @@ func getOvlAssets(fileName string) (ovl, error) { graphics: dataContainer[gfx]{dataRange: graphicsRange, content: graphics}, layouts: dataContainer[layouts]{dataRange: layoutsRange[1], content: entityLayouts}, layoutsExtraRange: layoutsRange[0], - tileMaps: dataContainer[map[PsxOffset][]byte]{dataRange: tileMapsRange, content: tileMaps}, - tileDefs: dataContainer[map[PsxOffset]tileDef]{dataRange: tileDefsRange, content: tileDefs}, + tileMaps: dataContainer[map[psx.Addr][]byte]{dataRange: tileMapsRange, content: tileMaps}, + tileDefs: dataContainer[map[psx.Addr]tileDef]{dataRange: tileDefsRange, content: tileDefs}, }, nil } @@ -246,7 +247,7 @@ func info(fileName string) error { fmt.Println(" - [0x0, .data, header]") for i := 0; i < len(entries); i++ { e := entries[i] - s := fmt.Sprintf(" - [0x%X, .data, %s]", e.dataRange.begin.real(), e.name) + s := fmt.Sprintf(" - [0x%X, .data, %s]", e.dataRange.begin.Real(psx.RamStageBegin), e.name) if e.comment != "" { s = fmt.Sprintf("%s # %s", s, e.comment) } @@ -254,7 +255,7 @@ func info(fileName string) error { // if there is a gap between the current entry and the next one, mark it as unrecognized data if i == len(entries)-1 || e.dataRange.end != entries[i+1].dataRange.begin { - fmt.Printf(" - [0x%X, data]\n", e.dataRange.end.real()) + fmt.Printf(" - [0x%X, data]\n", e.dataRange.end.Real(psx.RamStageBegin)) } } return nil diff --git a/tools/sotn-assets/paths.go b/tools/sotn-assets/paths.go index 04f0c178db..41f77a5f4f 100644 --- a/tools/sotn-assets/paths.go +++ b/tools/sotn-assets/paths.go @@ -1,27 +1,30 @@ package main -import "fmt" +import ( + "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" +) -func getTilemapFileName(off PsxOffset) string { - return fmt.Sprintf("tilemap_%05X.bin", off.real()) +func getTilemapFileName(off psx.Addr) string { + return fmt.Sprintf("tilemap_%05X.bin", off.Real(psx.RamStageBegin)) } -func getTiledefFileName(off PsxOffset) string { - return fmt.Sprintf("tiledef_%05X.json", off.real()) +func getTiledefFileName(off psx.Addr) string { + return fmt.Sprintf("tiledef_%05X.json", off.Real(psx.RamStageBegin)) } -func getTiledefIndicesFileName(off PsxOffset) string { - return fmt.Sprintf("tiledef_%05X_tiles.bin", off.real()) +func getTiledefIndicesFileName(off psx.Addr) string { + return fmt.Sprintf("tiledef_%05X_tiles.bin", off.Real(psx.RamStageBegin)) } -func getTiledefPagesFileName(off PsxOffset) string { - return fmt.Sprintf("tiledef_%05X_pages.bin", off.real()) +func getTiledefPagesFileName(off psx.Addr) string { + return fmt.Sprintf("tiledef_%05X_pages.bin", off.Real(psx.RamStageBegin)) } -func getTiledefClutsFileName(off PsxOffset) string { - return fmt.Sprintf("tiledef_%05X_cluts.bin", off.real()) +func getTiledefClutsFileName(off psx.Addr) string { + return fmt.Sprintf("tiledef_%05X_cluts.bin", off.Real(psx.RamStageBegin)) } -func getTiledefCollisionsFileName(off PsxOffset) string { - return fmt.Sprintf("tiledef_%05X_cols.bin", off.real()) +func getTiledefCollisionsFileName(off psx.Addr) string { + return fmt.Sprintf("tiledef_%05X_cols.bin", off.Real(psx.RamStageBegin)) } diff --git a/tools/sotn-assets/psx/offsets.go b/tools/sotn-assets/psx/offsets.go new file mode 100644 index 0000000000..1ecba08752 --- /dev/null +++ b/tools/sotn-assets/psx/offsets.go @@ -0,0 +1,66 @@ +package psx + +import ( + "encoding/binary" + "fmt" + "os" +) + +type Addr uint32 + +const ( + RamNull = Addr(0) + RamGameBegin = Addr(0x800A0000) + RamStageBegin = Addr(0x80180000) + RamStageEnd = Addr(0x801C0000) + RamGameEnd = Addr(0x801F8000) +) + +func (off Addr) Format(f fmt.State, c rune) { + f.Write([]byte(fmt.Sprintf("0x%08X", uint32(off)))) +} + +func (off Addr) Real(begin Addr) int { + return int(off - begin) +} + +func (off Addr) Align4() Addr { + if (off & 3) != 0 { + return (off | 3) + 1 + } + return off +} + +func (off Addr) Sum(x int) Addr { + return Addr(uint32(off) + uint32(x)) +} + +func (off Addr) DistanceTo(x Addr) int { + return int(x - off) +} + +func (off Addr) InRange(begin Addr, end Addr) bool { + return off >= begin && off < end +} + +func (off Addr) MoveFile(file *os.File, begin Addr) error { + info, err := file.Stat() + if err != nil { + return fmt.Errorf("could not stat file: %w", err) + } + + end := begin.Sum(int(info.Size())) + if !off.InRange(begin, end) { + err := fmt.Errorf("offset %s is outside the boundaries [%s, %s]", off, begin, end) + panic(err) + return err + } + + fileOffset := int64(off - begin) + file.Seek(fileOffset, 0) + return nil +} + +func GetAddr(data []byte) Addr { + return Addr(binary.LittleEndian.Uint32(data)) +} diff --git a/tools/sotn-assets/psx_offsets.go b/tools/sotn-assets/psx_offsets.go deleted file mode 100644 index 52d6ef3af2..0000000000 --- a/tools/sotn-assets/psx_offsets.go +++ /dev/null @@ -1,84 +0,0 @@ -package main - -import ( - "fmt" - "os" - "slices" -) - -type PsxOffset uint32 - -const ( - RamNull = PsxOffset(0) - RamStageBegin = PsxOffset(0x80180000) - RamStageEnd = PsxOffset(0x801C0000) -) - -func (off PsxOffset) Format(f fmt.State, c rune) { - f.Write([]byte(fmt.Sprintf("0x%08X", uint32(off)))) -} - -func (off PsxOffset) real() int { - return int(off - RamStageBegin) -} - -func (off PsxOffset) align4() PsxOffset { - if (off & 3) != 0 { - return (off | 3) + 1 - } - return off -} - -func (off PsxOffset) sum(x int) PsxOffset { - return PsxOffset(uint32(off) + uint32(x)) -} - -func (off PsxOffset) distanceTo(x PsxOffset) int { - return int(x - off) -} - -func (off PsxOffset) valid() bool { - return off >= RamStageBegin && off < RamStageEnd -} - -func (off PsxOffset) moveFile(file *os.File) error { - if !off.valid() { - err := fmt.Errorf("offset %08X is outside the stage boundaries", off) - panic(err) - return err - } - - stats, err := file.Stat() - if err != nil { - return err - } - - fileOffset := int64(off - RamStageBegin) - if fileOffset >= stats.Size() { - return fmt.Errorf("offset %08X is outside the file boundaries", off) - } - - file.Seek(fileOffset, 0) - return nil -} - -func sortUniqueOffsets(slice []PsxOffset) []PsxOffset { - unique := map[PsxOffset]struct{}{} - for _, v := range slice { - unique[v] = struct{}{} - } - newSlice := make([]PsxOffset, 0, len(unique)) - for offset := range unique { - newSlice = append(newSlice, offset) - } - - slices.SortFunc(newSlice, func(a, b PsxOffset) int { - if a < b { - return -1 - } else if a > b { - return 1 - } - return 0 - }) - return newSlice -} diff --git a/tools/sotn-assets/room.go b/tools/sotn-assets/room.go index e8b6ed6ee3..75dc593dc6 100644 --- a/tools/sotn-assets/room.go +++ b/tools/sotn-assets/room.go @@ -2,6 +2,7 @@ package main import ( "encoding/binary" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" ) @@ -20,11 +21,11 @@ func (r room) isTerminator() bool { return r.Left == 0x40 } -func readRooms(file *os.File, off PsxOffset) ([]room, dataRange, error) { +func readRooms(file *os.File, off psx.Addr) ([]room, dataRange, error) { if off == 0 { return nil, dataRange{}, nil } - if err := off.moveFile(file); err != nil { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return nil, dataRange{}, err } @@ -41,6 +42,6 @@ func readRooms(file *os.File, off PsxOffset) ([]room, dataRange, error) { } return rooms, dataRange{ begin: off, - end: off.sum(len(rooms)*8 + 4), + end: off.Sum(len(rooms)*8 + 4), }, nil } diff --git a/tools/sotn-assets/sprites.go b/tools/sotn-assets/sprites.go index feac648033..9487142835 100644 --- a/tools/sotn-assets/sprites.go +++ b/tools/sotn-assets/sprites.go @@ -3,6 +3,7 @@ package main import ( "encoding/binary" "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" "sort" ) @@ -26,8 +27,8 @@ type spriteDefs struct { Indices []int `json:"indices"` } -func readSprites(file *os.File, off PsxOffset) ([]sprite, dataRange, error) { - if err := off.moveFile(file); err != nil { +func readSprites(file *os.File, off psx.Addr) ([]sprite, dataRange, error) { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return nil, dataRange{}, fmt.Errorf("invalid sprites: %w", err) } @@ -43,32 +44,32 @@ func readSprites(file *os.File, off PsxOffset) ([]sprite, dataRange, error) { return sprites, dataRange{ begin: off, - end: off.sum(4 + 0x16*int(count)).align4(), + end: off.Sum(4 + 0x16*int(count)).Align4(), }, nil } -func readSpriteBank(file *os.File, off PsxOffset) ([]*[]sprite, dataRange, error) { - if err := off.moveFile(file); err != nil { +func readSpriteBank(file *os.File, off psx.Addr) ([]*[]sprite, dataRange, error) { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return nil, dataRange{}, fmt.Errorf("invalid sprite Indices: %w", err) } // the end of the sprite array is the beginning of the earliest sprite offset - earliestSpriteOff := RamStageEnd + earliestSpriteOff := psx.RamStageEnd currentOff := off - spriteOffsets := make([]PsxOffset, 0) + spriteOffsets := make([]psx.Addr, 0) for { if currentOff == earliestSpriteOff { break } currentOff += 4 - var spriteOffset PsxOffset + var spriteOffset psx.Addr if err := binary.Read(file, binary.LittleEndian, &spriteOffset); err != nil { return nil, dataRange{}, err } spriteOffsets = append(spriteOffsets, spriteOffset) - if spriteOffset != RamNull { - if !spriteOffset.valid() { + if spriteOffset != psx.RamNull { + if !spriteOffset.InRange(psx.RamStageBegin, psx.RamStageEnd) { err := fmt.Errorf("sprite offset %s is not valid", spriteOffset) return nil, dataRange{}, err } @@ -83,7 +84,7 @@ func readSpriteBank(file *os.File, off PsxOffset) ([]*[]sprite, dataRange, error spriteBank := make([]*[]sprite, len(spriteOffsets)) spriteRanges := []dataRange{} for i, offset := range spriteOffsets { - if offset == RamNull { + if offset == psx.RamNull { spriteBank[i] = nil continue } @@ -98,21 +99,21 @@ func readSpriteBank(file *os.File, off PsxOffset) ([]*[]sprite, dataRange, error return spriteBank, mergeDataRanges(append(spriteRanges, headerRange)), nil } -func readSpritesBanks(file *os.File, off PsxOffset) (spriteDefs, dataRange, error) { - if err := off.moveFile(file); err != nil { +func readSpritesBanks(file *os.File, off psx.Addr) (spriteDefs, dataRange, error) { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return spriteDefs{}, dataRange{}, err } - offBanks := make([]PsxOffset, 24) + offBanks := make([]psx.Addr, 24) if err := binary.Read(file, binary.LittleEndian, offBanks); err != nil { return spriteDefs{}, dataRange{}, err } // the order sprites are stored must be preserved - pool := map[PsxOffset][]*[]sprite{} + pool := map[psx.Addr][]*[]sprite{} spriteRanges := []dataRange{} for _, offset := range offBanks { - if offset == RamNull { + if offset == psx.RamNull { continue } if _, found := pool[offset]; found { @@ -128,7 +129,7 @@ func readSpritesBanks(file *os.File, off PsxOffset) (spriteDefs, dataRange, erro // the indices do not guarantee sprites to be stored in a linear order // we must sort the offsets to preserve the order sprites are stored - sortedOffsets := make([]PsxOffset, 0, len(pool)) + sortedOffsets := make([]psx.Addr, 0, len(pool)) for offset := range pool { sortedOffsets = append(sortedOffsets, offset) } @@ -137,7 +138,7 @@ func readSpritesBanks(file *os.File, off PsxOffset) (spriteDefs, dataRange, erro // create a list of indices to replace the original pointers indices := make([]int, len(offBanks)) for i, offset := range offBanks { - if offset == RamNull { + if offset == psx.RamNull { indices[i] = -1 } for j, sortedOffset := range sortedOffsets { diff --git a/tools/sotn-assets/tile_def.go b/tools/sotn-assets/tile_def.go index 03c5bc4007..bfeac20e59 100644 --- a/tools/sotn-assets/tile_def.go +++ b/tools/sotn-assets/tile_def.go @@ -3,6 +3,7 @@ package main import ( "encoding/binary" "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" ) @@ -20,12 +21,12 @@ type tileDefPaths struct { Collisions string `json:"collisions"` } -func readTiledef(file *os.File, off PsxOffset) (tileDef, dataRange, error) { - if err := off.moveFile(file); err != nil { +func readTiledef(file *os.File, off psx.Addr) (tileDef, dataRange, error) { + if err := off.MoveFile(file, psx.RamStageBegin); err != nil { return tileDef{}, dataRange{}, err } - offsets := make([]PsxOffset, 4) + offsets := make([]psx.Addr, 4) if err := binary.Read(file, binary.LittleEndian, offsets); err != nil { return tileDef{}, dataRange{}, err } @@ -37,28 +38,28 @@ func readTiledef(file *os.File, off PsxOffset) (tileDef, dataRange, error) { cols: make([]byte, off-offsets[3]), } - if err := offsets[0].moveFile(file); err != nil { + if err := offsets[0].MoveFile(file, psx.RamStageBegin); err != nil { return tileDef{}, dataRange{}, err } if _, err := file.Read(td.tiles); err != nil { return tileDef{}, dataRange{}, err } - if err := offsets[1].moveFile(file); err != nil { + if err := offsets[1].MoveFile(file, psx.RamStageBegin); err != nil { return tileDef{}, dataRange{}, err } if _, err := file.Read(td.pages); err != nil { return tileDef{}, dataRange{}, err } - if err := offsets[2].moveFile(file); err != nil { + if err := offsets[2].MoveFile(file, psx.RamStageBegin); err != nil { return tileDef{}, dataRange{}, err } if _, err := file.Read(td.cluts); err != nil { return tileDef{}, dataRange{}, err } - if err := offsets[3].moveFile(file); err != nil { + if err := offsets[3].MoveFile(file, psx.RamStageBegin); err != nil { return tileDef{}, dataRange{}, err } if _, err := file.Read(td.cols); err != nil { @@ -67,13 +68,13 @@ func readTiledef(file *os.File, off PsxOffset) (tileDef, dataRange, error) { return td, dataRange{ begin: offsets[0], - end: off.sum(0x10), + end: off.Sum(0x10), }, nil } -func readAllTiledefs(file *os.File, roomLayers []roomLayers) (map[PsxOffset]tileDef, dataRange, error) { +func readAllTiledefs(file *os.File, roomLayers []roomLayers) (map[psx.Addr]tileDef, dataRange, error) { ranges := []dataRange{} - processed := map[PsxOffset]tileDef{} + processed := map[psx.Addr]tileDef{} for _, rl := range roomLayers { if rl.fg != nil { if _, found := processed[rl.fg.Tiledef]; !found { diff --git a/tools/sotn-assets/tile_map.go b/tools/sotn-assets/tile_map.go index 7a88d93038..7789512625 100644 --- a/tools/sotn-assets/tile_map.go +++ b/tools/sotn-assets/tile_map.go @@ -2,11 +2,12 @@ package main import ( "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "os" ) func readTilemap(file *os.File, layer *layer) ([]byte, dataRange, error) { - if err := layer.Data.moveFile(file); err != nil { + if err := layer.Data.MoveFile(file, psx.RamStageBegin); err != nil { return nil, dataRange{}, err } data := make([]byte, layer.tilemapFileSize()) @@ -15,13 +16,13 @@ func readTilemap(file *os.File, layer *layer) ([]byte, dataRange, error) { } return data, dataRange{ begin: layer.Data, - end: layer.Data.sum(len(data)), + end: layer.Data.Sum(len(data)), }, nil } -func readAllTileMaps(file *os.File, roomLayers []roomLayers) (map[PsxOffset][]byte, dataRange, error) { +func readAllTileMaps(file *os.File, roomLayers []roomLayers) (map[psx.Addr][]byte, dataRange, error) { ranges := []dataRange{} - processed := map[PsxOffset][]byte{} + processed := map[psx.Addr][]byte{} for _, rl := range roomLayers { if rl.fg != nil { if _, found := processed[rl.fg.Data]; !found { diff --git a/tools/sotn-assets/utils.go b/tools/sotn-assets/utils.go index df6d58c117..8c8e12f6e5 100644 --- a/tools/sotn-assets/utils.go +++ b/tools/sotn-assets/utils.go @@ -1,6 +1,10 @@ package main -import "strings" +import ( + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" + "slices" + "strings" +) func joinMapKeys[T any](m map[string]T, sep string) string { keys := make([]string, 0, len(m)) @@ -44,3 +48,24 @@ func btoi(b bool) int { } return 0 } + +func sortUniqueOffsets(slice []psx.Addr) []psx.Addr { + unique := map[psx.Addr]struct{}{} + for _, v := range slice { + unique[v] = struct{}{} + } + newSlice := make([]psx.Addr, 0, len(unique)) + for offset := range unique { + newSlice = append(newSlice, offset) + } + + slices.SortFunc(newSlice, func(a, b psx.Addr) int { + if a < b { + return -1 + } else if a > b { + return 1 + } + return 0 + }) + return newSlice +} From ef7e85f5e029a9b560cf67b82a7808ce14b9ae7c Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 28 Jul 2024 18:41:37 +0100 Subject: [PATCH 03/24] Extract animset as JSON --- config/assets.us.weapon.yaml | 359 +++++++++++++++++++++++++++ go.work.sum | 1 + tools/sotn-assets/animset/animset.go | 85 +++++++ tools/sotn-assets/asset_config.go | 160 ++++++++++++ tools/sotn-assets/go.mod | 5 +- tools/sotn-assets/go.sum | 3 + tools/sotn-assets/main.go | 11 +- 7 files changed, 622 insertions(+), 2 deletions(-) create mode 100644 config/assets.us.weapon.yaml create mode 100644 go.work.sum create mode 100644 tools/sotn-assets/animset/animset.go create mode 100644 tools/sotn-assets/asset_config.go diff --git a/config/assets.us.weapon.yaml b/config/assets.us.weapon.yaml new file mode 100644 index 0000000000..7a321c709c --- /dev/null +++ b/config/assets.us.weapon.yaml @@ -0,0 +1,359 @@ +files: + - target: disks/us/BIN/WEAPON0.BIN + asset_path: assets/weapon + src_path: src/weapon + segments: + - start: 0x04000 + vram: 0x8017A000 + assets: + - [0x04040, animset, w_000_1] + - [0x04A44, animset, w_000_2] + - [0x04A44, skip] + - start: 0x0B000 + vram: 0x8017A000 + assets: + - [0x0B040, animset, w_001_1] + - [0x0BA44, animset, w_001_2] + - [0x0BA44, skip] + - start: 0x12000 + vram: 0x8017A000 + assets: + - [0x12040, animset, w_002_1] + - [0x12884, animset, w_002_2] + - [0x12884, skip] + - start: 0x19000 + vram: 0x8017A000 + assets: + - [0x19040, animset, w_003_1] + - [0x19884, animset, w_003_2] + - [0x19884, skip] + - start: 0x20000 + vram: 0x8017A000 + assets: + - [0x20040, animset, w_004_1] + - [0x20EAC, animset, w_004_2] + - [0x20EAC, skip] + - start: 0x27000 + vram: 0x8017A000 + assets: + - [0x27040, animset, w_005_1] + - [0x27EAC, animset, w_005_2] + - [0x27EAC, skip] + - start: 0x2E000 + vram: 0x8017A000 + assets: + - [0x2E040, animset, w_006_1] + - [0x2E884, animset, w_006_2] + - [0x2E884, skip] + - start: 0x35000 + vram: 0x8017A000 + assets: + - [0x35040, animset, w_007_1] + - [0x35884, animset, w_007_2] + - [0x35884, skip] + - start: 0x3C000 + vram: 0x8017A000 + assets: + - [0x3C040, animset, w_008_1] + - [0x3C804, animset, w_008_2] + - [0x3C804, skip] + - start: 0x43000 + vram: 0x8017A000 + assets: + - [0x43040, animset, w_009_1] + - [0x43804, animset, w_009_2] + - [0x43804, skip] + - start: 0x4A000 + vram: 0x8017A000 + assets: + - [0x4A040, animset, w_010_1] + - [0x4A8EC, animset, w_010_2] + - [0x4A8EC, skip] + - start: 0x51000 + vram: 0x8017A000 + assets: + - [0x51040, animset, w_011_1] + - [0x51958, animset, w_011_2] + - [0x51958, skip] + - start: 0x58000 + vram: 0x8017A000 + assets: + - [0x58040, animset, w_012_1] + - [0x582B0, animset, w_012_2] + - [0x582B0, skip] + - start: 0x5F000 + vram: 0x8017A000 + assets: + - [0x5F040, animset, w_013_1] + - [0x5F2B0, animset, w_013_2] + - [0x5F2B0, skip] + - start: 0x66000 + vram: 0x8017A000 + assets: + - [0x66040, animset, w_014_1] + - [0x662B0, animset, w_014_2] + - [0x662B0, skip] + - start: 0x6D000 + vram: 0x8017A000 + assets: + - [0x6D040, animset, w_015_1] + - [0x6D2B0, animset, w_015_2] + - [0x6D478, skip] + - start: 0x74000 + vram: 0x8017A000 + assets: + - [0x74040, animset, w_016_1] + - [0x742B0, animset, w_016_2] + - [0x742B0, skip] + - start: 0x7B000 + vram: 0x8017A000 + assets: + - [0x7B040, animset, w_017_1] + - [0x7B040, animset, w_017_2] + - [0x7B040, skip] + - start: 0x82000 + vram: 0x8017A000 + assets: + - [0x82040, animset, w_018_1] + - [0x82488, animset, w_018_2] + - [0x82488, skip] + - start: 0x89000 + vram: 0x8017A000 + assets: + - [0x89040, animset, w_019_1] + - [0x8930C, animset, w_019_2] + - [0x8930C, skip] + - start: 0x90000 + vram: 0x8017A000 + assets: + - [0x90040, animset, w_020_1] + - [0x90630, animset, w_020_2] + - [0x90630, skip] + - start: 0x97000 + vram: 0x8017A000 + assets: + - [0x97040, animset, w_021_1] + - [0x97564, animset, w_021_2] + - [0x97564, skip] + - start: 0x9E000 + vram: 0x8017A000 + assets: + - [0x9E040, animset, w_022_1] + - [0x9E540, animset, w_022_2] + - [0x9E540, skip] + - start: 0xA5000 + vram: 0x8017A000 + assets: + - [0xA5040, animset, w_023_1] + - [0xA58A4, animset, w_023_2] + - [0xA58A4, skip] + - start: 0xAC000 + vram: 0x8017A000 + assets: + - [0xAC040, animset, w_024_1] + - [0xAC804, animset, w_024_2] + - [0xAC804, skip] + - start: 0xB3000 + vram: 0x8017A000 + assets: + - [0xB3040, animset, w_025_1] + - [0xB3804, animset, w_025_2] + - [0xB3804, skip] + - start: 0xBA000 + vram: 0x8017A000 + assets: + - [0xBA040, animset, w_026_1] + - [0xBA804, animset, w_026_2] + - [0xBA804, skip] + - start: 0xC1000 + vram: 0x8017A000 + assets: + - [0xC1040, animset, w_027_1] + - [0xC1A18, animset, w_027_2] + - [0xC1A18, skip] + - start: 0xC8000 + vram: 0x8017A000 + assets: + - [0xC8040, animset, w_028_1] + - [0xC8804, animset, w_028_2] + - [0xC8804, skip] + - start: 0xCF000 + vram: 0x8017A000 + assets: + - [0xCF040, animset, w_029_1] + - [0xCF884, animset, w_029_2] + - [0xCF884, skip] + - start: 0xD6000 + vram: 0x8017A000 + assets: + - [0xD6040, animset, w_030_1] + - [0xD6040, animset, w_030_2] + - [0xD6040, skip] + - start: 0xDD000 + vram: 0x8017A000 + assets: + - [0xDD040, animset, w_031_1] + - [0xDD704, animset, w_031_2] + - [0xDD704, skip] + - start: 0xE4000 + vram: 0x8017A000 + assets: + - [0xE4040, animset, w_032_1] + - [0xE4704, animset, w_032_2] + - [0xE4704, skip] + - start: 0xEB000 + vram: 0x8017A000 + assets: + - [0xEB040, animset, w_033_1] + - [0xEBA9C, animset, w_033_2] + - [0xEBA9C, skip] + - start: 0xF2000 + vram: 0x8017A000 + assets: + - [0xF2040, animset, w_034_1] + - [0xF2784, animset, w_034_2] + - [0xF2784, skip] + - start: 0xF9000 + vram: 0x8017A000 + assets: + - [0xF9040, animset, w_035_1] + - [0xF9404, animset, w_035_2] + - [0xF9404, skip] + - start: 0x100000 + vram: 0x8017A000 + assets: + - [0x100040, animset, w_036_1] + - [0x100404, animset, w_036_2] + - [0x100404, skip] + - start: 0x107000 + vram: 0x8017A000 + assets: + - [0x107040, animset, w_037_1] + - [0x107504, animset, w_037_2] + - [0x107504, skip] + - start: 0x10E000 + vram: 0x8017A000 + assets: + - [0x10E040, animset, w_038_1] + - [0x10EC08, animset, w_038_2] + - [0x10EC08, skip] + - start: 0x115000 + vram: 0x8017A000 + assets: + - [0x115040, animset, w_039_1] + - [0x115C08, animset, w_039_2] + - [0x115C08, skip] + - start: 0x11C000 + vram: 0x8017A000 + assets: + - [0x11C040, animset, w_040_1] + - [0x11C504, animset, w_040_2] + - [0x11C504, skip] + - start: 0x123000 + vram: 0x8017A000 + assets: + - [0x123040, animset, w_041_1] + - [0x123284, animset, w_041_2] + - [0x123284, skip] + - start: 0x12A000 + vram: 0x8017A000 + assets: + - [0x12A040, animset, w_042_1] + - [0x12A3E4, animset, w_042_2] + - [0x12A3E4, skip] + - start: 0x131000 + vram: 0x8017A000 + assets: + - [0x131040, animset, w_043_1] + - [0x131A44, animset, w_043_2] + - [0x131A44, skip] + - start: 0x138000 + vram: 0x8017A000 + assets: + - [0x138040, animset, w_044_1] + - [0x138040, animset, w_044_2] + - [0x138040, skip] + - start: 0x13F000 + vram: 0x8017A000 + assets: + - [0x13F040, animset, w_045_1] + - [0x13F330, animset, w_045_2] + - [0x13F330, skip] + - start: 0x146000 + vram: 0x8017A000 + assets: + - [0x146040, animset, w_046_1] + - [0x1462B0, animset, w_046_2] + - [0x1462B0, skip] + - start: 0x14D000 + vram: 0x8017A000 + assets: + - [0x14D040, animset, w_047_1] + - [0x14D0D4, animset, w_047_2] + - [0x14D228, skip] + - start: 0x154000 + vram: 0x8017A000 + assets: + - [0x154040, animset, w_048_1] + - [0x154A44, animset, w_048_2] + - [0x154A44, skip] + - start: 0x15B000 + vram: 0x8017A000 + assets: + - [0x15B040, animset, w_049_1] + - [0x15BA44, animset, w_049_2] + - [0x15BC00, skip] + - start: 0x162000 + vram: 0x8017A000 + assets: + - [0x162040, animset, w_050_1] + - [0x162A44, animset, w_050_2] + - [0x162A44, skip] + - start: 0x169000 + vram: 0x8017A000 + assets: + - [0x169040, animset, w_051_1] + - [0x169950, animset, w_051_2] + - [0x169950, skip] + - start: 0x170000 + vram: 0x8017A000 + assets: + - [0x170040, animset, w_052_1] + - [0x170808, animset, w_052_2] + - [0x170808, skip] + - start: 0x177000 + vram: 0x8017A000 + assets: + - [0x177040, animset, w_053_1] + - [0x177A44, animset, w_053_2] + - [0x177A44, skip] + - start: 0x17E000 + vram: 0x8017A000 + assets: + - [0x17E040, animset, w_054_1] + - [0x17EA44, animset, w_054_2] + - [0x17EA44, skip] + - start: 0x185000 + vram: 0x8017A000 + assets: + - [0x185040, animset, w_055_1] + - [0x185A44, animset, w_055_2] + - [0x185A44, skip] + - start: 0x18C000 + vram: 0x8017A000 + assets: + - [0x18C040, animset, w_056_1] + - [0x18CA44, animset, w_056_2] + - [0x18CA44, skip] + - start: 0x193000 + vram: 0x8017A000 + assets: + - [0x193040, animset, w_057_1] + - [0x193A44, animset, w_057_2] + - [0x193A44, skip] + - start: 0x19A000 + vram: 0x8017A000 + assets: + - [0x19A040, animset, w_058_1] + - [0x19A808, animset, w_058_2] + - [0x19A808, skip] diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 0000000000..5ab138f8a4 --- /dev/null +++ b/go.work.sum @@ -0,0 +1 @@ +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/tools/sotn-assets/animset/animset.go b/tools/sotn-assets/animset/animset.go new file mode 100644 index 0000000000..128ad6cfbd --- /dev/null +++ b/tools/sotn-assets/animset/animset.go @@ -0,0 +1,85 @@ +package animset + +import ( + "encoding/binary" + "encoding/json" + "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" + "os" + "path/filepath" +) + +type AnimFrame struct { + Flags int16 `json:"flags"` + Offsetx int16 `json:"offsetx"` + Offsety int16 `json:"offsety"` + Width int16 `json:"width"` + Height int16 `json:"height"` + Clut int16 `json:"clut"` + Tileset int16 `json:"tileset"` + Left int16 `json:"left"` + Top int16 `json:"top"` + Right int16 `json:"right"` + Bottom int16 `json:"bottom"` +} + +func parseAnimFrame(data []byte) AnimFrame { + return AnimFrame{ + Flags: int16(binary.LittleEndian.Uint16(data[0:])), + Offsetx: int16(binary.LittleEndian.Uint16(data[2:])), + Offsety: int16(binary.LittleEndian.Uint16(data[4:])), + Width: int16(binary.LittleEndian.Uint16(data[6:])), + Height: int16(binary.LittleEndian.Uint16(data[8:])), + Clut: int16(binary.LittleEndian.Uint16(data[10:])), + Tileset: int16(binary.LittleEndian.Uint16(data[12:])), + Left: int16(binary.LittleEndian.Uint16(data[14:])), + Top: int16(binary.LittleEndian.Uint16(data[16:])), + Right: int16(binary.LittleEndian.Uint16(data[18:])), + Bottom: int16(binary.LittleEndian.Uint16(data[20:])), + } +} + +func parse(baseAddr psx.Addr, data []byte, start, end int) []*[]AnimFrame { + var offsets []psx.Addr + endAddr := baseAddr.Sum(end) + for i := start; i < end; i += 4 { + addr := psx.GetAddr(data[i:]) + if addr != psx.RamNull && !addr.InRange(baseAddr, endAddr) { + break + } + offsets = append(offsets, addr) + } + + set := make([]*[]AnimFrame, 0) + for _, addr := range offsets { + if addr == psx.RamNull { + set = append(set, nil) + continue + } + var frames []AnimFrame + cur := data[addr-baseAddr:] + nFrames := int(binary.LittleEndian.Uint16(cur)) + cur = cur[2:] + for i := 0; i < nFrames; i++ { + frames = append(frames, parseAnimFrame(cur)) + cur = cur[22:] + } + set = append(set, &frames) + } + return set +} + +func Extract(path string, addr psx.Addr, data []byte, start, end int) error { + set := parse(addr, data, start, end) + content, err := json.MarshalIndent(set, "", " ") + if err != nil { + return err + } + + dir := filepath.Dir(path) + if err := os.MkdirAll(dir, 0755); err != nil { + fmt.Printf("failed to create directory %s: %v\n", dir, err) + return err + } + return os.WriteFile(path, content, 0644) +} diff --git a/tools/sotn-assets/asset_config.go b/tools/sotn-assets/asset_config.go new file mode 100644 index 0000000000..62e7a8e2b5 --- /dev/null +++ b/tools/sotn-assets/asset_config.go @@ -0,0 +1,160 @@ +package main + +import ( + "fmt" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/animset" + "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" + "golang.org/x/sync/errgroup" + "gopkg.in/yaml.v2" + "os" + "path" + "strconv" +) + +type assetSegmentEntry struct { + Start int `yaml:"start"` + Vram psx.Addr `yaml:"vram"` + Assets [][]string `yaml:"assets"` +} + +type assetFileEntry struct { + Target string `yaml:"target"` + AssetDir string `yaml:"asset_path"` + Segments []assetSegmentEntry `yaml:"segments"` +} + +type assetConfig struct { + Files []assetFileEntry `yaml:"files"` +} + +type assetEntry struct { + data []byte + start int + end int + outDir string + name string + args []string + ramBase psx.Addr +} + +var handlers = map[string]func(assetEntry) error{ + "animset": func(e assetEntry) error { + outPath := path.Join(e.outDir, fmt.Sprintf("%s.animset_test.json", e.name)) + return animset.Extract(outPath, e.ramBase, e.data, e.start, e.end) + }, +} + +func parseArgs(entry []string) (offset int64, kind string, args []string, err error) { + if len(entry) < 2 { + err = fmt.Errorf("asset %v is malformed", entry) + return + } + offsetRaw := entry[0] + if len(offsetRaw) >= 2 && offsetRaw[0] == '0' && offsetRaw[1] == 'x' { + offset, err = strconv.ParseInt(offsetRaw[2:], 16, 32) + } else { + offset, err = strconv.ParseInt(offsetRaw, 10, 32) + } + if err != nil { + err = fmt.Errorf("offset %q in asset %v is malformed", offset, entry) + return + } + kind = entry[1] + args = entry[2:] + return +} + +func readConfig(path string) (*assetConfig, error) { + yamlFile, err := os.ReadFile(path) + if err != nil { + return nil, fmt.Errorf("Error reading YAML file: %v", err) + } + var data assetConfig + if err = yaml.Unmarshal(yamlFile, &data); err != nil { + return nil, fmt.Errorf("Error unmarshalling YAML file: %v", err) + } + return &data, nil +} + +func enqueueExtractAssetEntry( + eg errgroup.Group, + handler func(assetEntry) error, + assetDir string, + name string, + data []byte, + start int, + end int, + args []string, + ramBase psx.Addr) { + eg.Go(func() error { + if err := handler(assetEntry{ + data: data, + start: start, + end: end, + outDir: assetDir, + ramBase: ramBase, + name: name, + args: args, + }); err != nil { + return fmt.Errorf("unable to extract asset %q: %v", name, err) + } + return nil + }) +} + +func extractAssetFile(file assetFileEntry) error { + var eg errgroup.Group + data, err := os.ReadFile(file.Target) + if err != nil { + return err + } + for _, segment := range file.Segments { + if len(segment.Assets) == 0 { + continue + } + off, kind, args, err := parseArgs(segment.Assets[0]) + if err != nil { + return err + } + for i := 1; i < len(segment.Assets); i++ { + off2, kind2, args2, err2 := parseArgs(segment.Assets[i]) + if err2 != nil { + return err2 + } + size := int(off2 - off) + if size < 0 { + return fmt.Errorf("offset 0x%X should be smaller than 0x%X, asset %v", off, off2, segment.Assets[i-1]) + } + if kind == "skip" { + continue + } + if handler, found := handlers[kind]; found { + name := strconv.FormatUint(uint64(off), 16) + if len(args) > 0 { + name = args[0] + args = args[1:] + } + start := int(off) - segment.Start + end := start + size + enqueueExtractAssetEntry(eg, handler, file.AssetDir, name, data[segment.Start:], start, end, args, segment.Vram) + } + off = off2 + kind = kind2 + args = args2 + } + } + return eg.Wait() +} + +func extractFromConfig(c *assetConfig) error { + var eg errgroup.Group + for _, file := range c.Files { + if len(file.Segments) == 0 { + continue + } + eg.Go(func() error { + return extractAssetFile(file) + }) + } + return eg.Wait() +} diff --git a/tools/sotn-assets/go.mod b/tools/sotn-assets/go.mod index 6a9427b61d..d74893216f 100644 --- a/tools/sotn-assets/go.mod +++ b/tools/sotn-assets/go.mod @@ -2,4 +2,7 @@ module github.com/xeeynamo/sotn-decomp/tools/sotn-assets go 1.21 -require golang.org/x/sync v0.7.0 // indirect +require ( + golang.org/x/sync v0.7.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +) diff --git a/tools/sotn-assets/go.sum b/tools/sotn-assets/go.sum index e8ef4a360a..1515bf1c90 100644 --- a/tools/sotn-assets/go.sum +++ b/tools/sotn-assets/go.sum @@ -1,2 +1,5 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/tools/sotn-assets/main.go b/tools/sotn-assets/main.go index 6cbca09f08..cbf40516b5 100644 --- a/tools/sotn-assets/main.go +++ b/tools/sotn-assets/main.go @@ -368,9 +368,18 @@ func handlerStage(args []string) error { return nil } +func handlerConfig(args []string) error { + c, err := readConfig(args[0]) + if err != nil { + return err + } + return extractFromConfig(c) +} + func main() { commands := map[string]func(args []string) error{ - "stage": handlerStage, + "stage": handlerStage, + "config": handlerConfig, } args := os.Args[1:] From acad97900d3d8ff14583c4927079a58f3ba63396 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 09:48:05 +0100 Subject: [PATCH 04/24] Add support to build frameset --- config/assets.us.weapon.yaml | 236 +++++++++++++-------------- src/weapon/.gitignore | 2 + tools/sotn-assets/animset/animset.go | 85 ---------- tools/sotn-assets/asset_config.go | 131 ++++++++++++--- tools/sotn-assets/build.go | 17 ++ tools/sotn-assets/main.go | 35 +++- tools/sotn-assets/psx/offsets.go | 19 ++- tools/sotn-assets/sprites.go | 54 +++--- 8 files changed, 318 insertions(+), 261 deletions(-) create mode 100644 src/weapon/.gitignore delete mode 100644 tools/sotn-assets/animset/animset.go diff --git a/config/assets.us.weapon.yaml b/config/assets.us.weapon.yaml index 7a321c709c..de63f26a5c 100644 --- a/config/assets.us.weapon.yaml +++ b/config/assets.us.weapon.yaml @@ -6,354 +6,354 @@ files: - start: 0x04000 vram: 0x8017A000 assets: - - [0x04040, animset, w_000_1] - - [0x04A44, animset, w_000_2] + - [0x04040, frameset, w_000_1] + - [0x04A44, frameset, w_000_2] - [0x04A44, skip] - start: 0x0B000 vram: 0x8017A000 assets: - - [0x0B040, animset, w_001_1] - - [0x0BA44, animset, w_001_2] + - [0x0B040, frameset, w_001_1] + - [0x0BA44, frameset, w_001_2] - [0x0BA44, skip] - start: 0x12000 vram: 0x8017A000 assets: - - [0x12040, animset, w_002_1] - - [0x12884, animset, w_002_2] + - [0x12040, frameset, w_002_1] + - [0x12884, frameset, w_002_2] - [0x12884, skip] - start: 0x19000 vram: 0x8017A000 assets: - - [0x19040, animset, w_003_1] - - [0x19884, animset, w_003_2] + - [0x19040, frameset, w_003_1] + - [0x19884, frameset, w_003_2] - [0x19884, skip] - start: 0x20000 vram: 0x8017A000 assets: - - [0x20040, animset, w_004_1] - - [0x20EAC, animset, w_004_2] + - [0x20040, frameset, w_004_1] + - [0x20EAC, frameset, w_004_2] - [0x20EAC, skip] - start: 0x27000 vram: 0x8017A000 assets: - - [0x27040, animset, w_005_1] - - [0x27EAC, animset, w_005_2] + - [0x27040, frameset, w_005_1] + - [0x27EAC, frameset, w_005_2] - [0x27EAC, skip] - start: 0x2E000 vram: 0x8017A000 assets: - - [0x2E040, animset, w_006_1] - - [0x2E884, animset, w_006_2] + - [0x2E040, frameset, w_006_1] + - [0x2E884, frameset, w_006_2] - [0x2E884, skip] - start: 0x35000 vram: 0x8017A000 assets: - - [0x35040, animset, w_007_1] - - [0x35884, animset, w_007_2] + - [0x35040, frameset, w_007_1] + - [0x35884, frameset, w_007_2] - [0x35884, skip] - start: 0x3C000 vram: 0x8017A000 assets: - - [0x3C040, animset, w_008_1] - - [0x3C804, animset, w_008_2] + - [0x3C040, frameset, w_008_1] + - [0x3C804, frameset, w_008_2] - [0x3C804, skip] - start: 0x43000 vram: 0x8017A000 assets: - - [0x43040, animset, w_009_1] - - [0x43804, animset, w_009_2] + - [0x43040, frameset, w_009_1] + - [0x43804, frameset, w_009_2] - [0x43804, skip] - start: 0x4A000 vram: 0x8017A000 assets: - - [0x4A040, animset, w_010_1] - - [0x4A8EC, animset, w_010_2] + - [0x4A040, frameset, w_010_1] + - [0x4A8EC, frameset, w_010_2] - [0x4A8EC, skip] - start: 0x51000 vram: 0x8017A000 assets: - - [0x51040, animset, w_011_1] - - [0x51958, animset, w_011_2] + - [0x51040, frameset, w_011_1] + - [0x51958, frameset, w_011_2] - [0x51958, skip] - start: 0x58000 vram: 0x8017A000 assets: - - [0x58040, animset, w_012_1] - - [0x582B0, animset, w_012_2] + - [0x58040, frameset, w_012_1] + - [0x582B0, frameset, w_012_2] - [0x582B0, skip] - start: 0x5F000 vram: 0x8017A000 assets: - - [0x5F040, animset, w_013_1] - - [0x5F2B0, animset, w_013_2] + - [0x5F040, frameset, w_013_1] + - [0x5F2B0, frameset, w_013_2] - [0x5F2B0, skip] - start: 0x66000 vram: 0x8017A000 assets: - - [0x66040, animset, w_014_1] - - [0x662B0, animset, w_014_2] + - [0x66040, frameset, w_014_1] + - [0x662B0, frameset, w_014_2] - [0x662B0, skip] - start: 0x6D000 vram: 0x8017A000 assets: - - [0x6D040, animset, w_015_1] - - [0x6D2B0, animset, w_015_2] + - [0x6D040, frameset, w_015_1] + - [0x6D2B0, frameset, w_015_2] - [0x6D478, skip] - start: 0x74000 vram: 0x8017A000 assets: - - [0x74040, animset, w_016_1] - - [0x742B0, animset, w_016_2] + - [0x74040, frameset, w_016_1] + - [0x742B0, frameset, w_016_2] - [0x742B0, skip] - start: 0x7B000 vram: 0x8017A000 assets: - - [0x7B040, animset, w_017_1] - - [0x7B040, animset, w_017_2] + - [0x7B040, frameset, w_017_1] + - [0x7B040, frameset, w_017_2] - [0x7B040, skip] - start: 0x82000 vram: 0x8017A000 assets: - - [0x82040, animset, w_018_1] - - [0x82488, animset, w_018_2] + - [0x82040, frameset, w_018_1] + - [0x82488, frameset, w_018_2] - [0x82488, skip] - start: 0x89000 vram: 0x8017A000 assets: - - [0x89040, animset, w_019_1] - - [0x8930C, animset, w_019_2] + - [0x89040, frameset, w_019_1] + - [0x8930C, frameset, w_019_2] - [0x8930C, skip] - start: 0x90000 vram: 0x8017A000 assets: - - [0x90040, animset, w_020_1] - - [0x90630, animset, w_020_2] + - [0x90040, frameset, w_020_1] + - [0x90630, frameset, w_020_2] - [0x90630, skip] - start: 0x97000 vram: 0x8017A000 assets: - - [0x97040, animset, w_021_1] - - [0x97564, animset, w_021_2] + - [0x97040, frameset, w_021_1] + - [0x97564, frameset, w_021_2] - [0x97564, skip] - start: 0x9E000 vram: 0x8017A000 assets: - - [0x9E040, animset, w_022_1] - - [0x9E540, animset, w_022_2] + - [0x9E040, frameset, w_022_1] + - [0x9E540, frameset, w_022_2] - [0x9E540, skip] - start: 0xA5000 vram: 0x8017A000 assets: - - [0xA5040, animset, w_023_1] - - [0xA58A4, animset, w_023_2] + - [0xA5040, frameset, w_023_1] + - [0xA58A4, frameset, w_023_2] - [0xA58A4, skip] - start: 0xAC000 vram: 0x8017A000 assets: - - [0xAC040, animset, w_024_1] - - [0xAC804, animset, w_024_2] + - [0xAC040, frameset, w_024_1] + - [0xAC804, frameset, w_024_2] - [0xAC804, skip] - start: 0xB3000 vram: 0x8017A000 assets: - - [0xB3040, animset, w_025_1] - - [0xB3804, animset, w_025_2] + - [0xB3040, frameset, w_025_1] + - [0xB3804, frameset, w_025_2] - [0xB3804, skip] - start: 0xBA000 vram: 0x8017A000 assets: - - [0xBA040, animset, w_026_1] - - [0xBA804, animset, w_026_2] + - [0xBA040, frameset, w_026_1] + - [0xBA804, frameset, w_026_2] - [0xBA804, skip] - start: 0xC1000 vram: 0x8017A000 assets: - - [0xC1040, animset, w_027_1] - - [0xC1A18, animset, w_027_2] + - [0xC1040, frameset, w_027_1] + - [0xC1A18, frameset, w_027_2] - [0xC1A18, skip] - start: 0xC8000 vram: 0x8017A000 assets: - - [0xC8040, animset, w_028_1] - - [0xC8804, animset, w_028_2] + - [0xC8040, frameset, w_028_1] + - [0xC8804, frameset, w_028_2] - [0xC8804, skip] - start: 0xCF000 vram: 0x8017A000 assets: - - [0xCF040, animset, w_029_1] - - [0xCF884, animset, w_029_2] + - [0xCF040, frameset, w_029_1] + - [0xCF884, frameset, w_029_2] - [0xCF884, skip] - start: 0xD6000 vram: 0x8017A000 assets: - - [0xD6040, animset, w_030_1] - - [0xD6040, animset, w_030_2] + - [0xD6040, frameset, w_030_1] + - [0xD6040, frameset, w_030_2] - [0xD6040, skip] - start: 0xDD000 vram: 0x8017A000 assets: - - [0xDD040, animset, w_031_1] - - [0xDD704, animset, w_031_2] + - [0xDD040, frameset, w_031_1] + - [0xDD704, frameset, w_031_2] - [0xDD704, skip] - start: 0xE4000 vram: 0x8017A000 assets: - - [0xE4040, animset, w_032_1] - - [0xE4704, animset, w_032_2] + - [0xE4040, frameset, w_032_1] + - [0xE4704, frameset, w_032_2] - [0xE4704, skip] - start: 0xEB000 vram: 0x8017A000 assets: - - [0xEB040, animset, w_033_1] - - [0xEBA9C, animset, w_033_2] + - [0xEB040, frameset, w_033_1] + - [0xEBA9C, frameset, w_033_2] - [0xEBA9C, skip] - start: 0xF2000 vram: 0x8017A000 assets: - - [0xF2040, animset, w_034_1] - - [0xF2784, animset, w_034_2] + - [0xF2040, frameset, w_034_1] + - [0xF2784, frameset, w_034_2] - [0xF2784, skip] - start: 0xF9000 vram: 0x8017A000 assets: - - [0xF9040, animset, w_035_1] - - [0xF9404, animset, w_035_2] + - [0xF9040, frameset, w_035_1] + - [0xF9404, frameset, w_035_2] - [0xF9404, skip] - start: 0x100000 vram: 0x8017A000 assets: - - [0x100040, animset, w_036_1] - - [0x100404, animset, w_036_2] + - [0x100040, frameset, w_036_1] + - [0x100404, frameset, w_036_2] - [0x100404, skip] - start: 0x107000 vram: 0x8017A000 assets: - - [0x107040, animset, w_037_1] - - [0x107504, animset, w_037_2] + - [0x107040, frameset, w_037_1] + - [0x107504, frameset, w_037_2] - [0x107504, skip] - start: 0x10E000 vram: 0x8017A000 assets: - - [0x10E040, animset, w_038_1] - - [0x10EC08, animset, w_038_2] + - [0x10E040, frameset, w_038_1] + - [0x10EC08, frameset, w_038_2] - [0x10EC08, skip] - start: 0x115000 vram: 0x8017A000 assets: - - [0x115040, animset, w_039_1] - - [0x115C08, animset, w_039_2] + - [0x115040, frameset, w_039_1] + - [0x115C08, frameset, w_039_2] - [0x115C08, skip] - start: 0x11C000 vram: 0x8017A000 assets: - - [0x11C040, animset, w_040_1] - - [0x11C504, animset, w_040_2] + - [0x11C040, frameset, w_040_1] + - [0x11C504, frameset, w_040_2] - [0x11C504, skip] - start: 0x123000 vram: 0x8017A000 assets: - - [0x123040, animset, w_041_1] - - [0x123284, animset, w_041_2] + - [0x123040, frameset, w_041_1] + - [0x123284, frameset, w_041_2] - [0x123284, skip] - start: 0x12A000 vram: 0x8017A000 assets: - - [0x12A040, animset, w_042_1] - - [0x12A3E4, animset, w_042_2] + - [0x12A040, frameset, w_042_1] + - [0x12A3E4, frameset, w_042_2] - [0x12A3E4, skip] - start: 0x131000 vram: 0x8017A000 assets: - - [0x131040, animset, w_043_1] - - [0x131A44, animset, w_043_2] + - [0x131040, frameset, w_043_1] + - [0x131A44, frameset, w_043_2] - [0x131A44, skip] - start: 0x138000 vram: 0x8017A000 assets: - - [0x138040, animset, w_044_1] - - [0x138040, animset, w_044_2] + - [0x138040, frameset, w_044_1] + - [0x138040, frameset, w_044_2] - [0x138040, skip] - start: 0x13F000 vram: 0x8017A000 assets: - - [0x13F040, animset, w_045_1] - - [0x13F330, animset, w_045_2] + - [0x13F040, frameset, w_045_1] + - [0x13F330, frameset, w_045_2] - [0x13F330, skip] - start: 0x146000 vram: 0x8017A000 assets: - - [0x146040, animset, w_046_1] - - [0x1462B0, animset, w_046_2] + - [0x146040, frameset, w_046_1] + - [0x1462B0, frameset, w_046_2] - [0x1462B0, skip] - start: 0x14D000 vram: 0x8017A000 assets: - - [0x14D040, animset, w_047_1] - - [0x14D0D4, animset, w_047_2] + - [0x14D040, frameset, w_047_1] + - [0x14D0D4, frameset, w_047_2] - [0x14D228, skip] - start: 0x154000 vram: 0x8017A000 assets: - - [0x154040, animset, w_048_1] - - [0x154A44, animset, w_048_2] + - [0x154040, frameset, w_048_1] + - [0x154A44, frameset, w_048_2] - [0x154A44, skip] - start: 0x15B000 vram: 0x8017A000 assets: - - [0x15B040, animset, w_049_1] - - [0x15BA44, animset, w_049_2] + - [0x15B040, frameset, w_049_1] + - [0x15BA44, frameset, w_049_2] - [0x15BC00, skip] - start: 0x162000 vram: 0x8017A000 assets: - - [0x162040, animset, w_050_1] - - [0x162A44, animset, w_050_2] + - [0x162040, frameset, w_050_1] + - [0x162A44, frameset, w_050_2] - [0x162A44, skip] - start: 0x169000 vram: 0x8017A000 assets: - - [0x169040, animset, w_051_1] - - [0x169950, animset, w_051_2] + - [0x169040, frameset, w_051_1] + - [0x169950, frameset, w_051_2] - [0x169950, skip] - start: 0x170000 vram: 0x8017A000 assets: - - [0x170040, animset, w_052_1] - - [0x170808, animset, w_052_2] + - [0x170040, frameset, w_052_1] + - [0x170808, frameset, w_052_2] - [0x170808, skip] - start: 0x177000 vram: 0x8017A000 assets: - - [0x177040, animset, w_053_1] - - [0x177A44, animset, w_053_2] + - [0x177040, frameset, w_053_1] + - [0x177A44, frameset, w_053_2] - [0x177A44, skip] - start: 0x17E000 vram: 0x8017A000 assets: - - [0x17E040, animset, w_054_1] - - [0x17EA44, animset, w_054_2] + - [0x17E040, frameset, w_054_1] + - [0x17EA44, frameset, w_054_2] - [0x17EA44, skip] - start: 0x185000 vram: 0x8017A000 assets: - - [0x185040, animset, w_055_1] - - [0x185A44, animset, w_055_2] + - [0x185040, frameset, w_055_1] + - [0x185A44, frameset, w_055_2] - [0x185A44, skip] - start: 0x18C000 vram: 0x8017A000 assets: - - [0x18C040, animset, w_056_1] - - [0x18CA44, animset, w_056_2] + - [0x18C040, frameset, w_056_1] + - [0x18CA44, frameset, w_056_2] - [0x18CA44, skip] - start: 0x193000 vram: 0x8017A000 assets: - - [0x193040, animset, w_057_1] - - [0x193A44, animset, w_057_2] + - [0x193040, frameset, w_057_1] + - [0x193A44, frameset, w_057_2] - [0x193A44, skip] - start: 0x19A000 vram: 0x8017A000 assets: - - [0x19A040, animset, w_058_1] - - [0x19A808, animset, w_058_2] + - [0x19A040, frameset, w_058_1] + - [0x19A808, frameset, w_058_2] - [0x19A808, skip] diff --git a/src/weapon/.gitignore b/src/weapon/.gitignore new file mode 100644 index 0000000000..d8807cc2d2 --- /dev/null +++ b/src/weapon/.gitignore @@ -0,0 +1,2 @@ +w_*_1.h +w_*_2.h diff --git a/tools/sotn-assets/animset/animset.go b/tools/sotn-assets/animset/animset.go deleted file mode 100644 index 128ad6cfbd..0000000000 --- a/tools/sotn-assets/animset/animset.go +++ /dev/null @@ -1,85 +0,0 @@ -package animset - -import ( - "encoding/binary" - "encoding/json" - "fmt" - "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" - "os" - "path/filepath" -) - -type AnimFrame struct { - Flags int16 `json:"flags"` - Offsetx int16 `json:"offsetx"` - Offsety int16 `json:"offsety"` - Width int16 `json:"width"` - Height int16 `json:"height"` - Clut int16 `json:"clut"` - Tileset int16 `json:"tileset"` - Left int16 `json:"left"` - Top int16 `json:"top"` - Right int16 `json:"right"` - Bottom int16 `json:"bottom"` -} - -func parseAnimFrame(data []byte) AnimFrame { - return AnimFrame{ - Flags: int16(binary.LittleEndian.Uint16(data[0:])), - Offsetx: int16(binary.LittleEndian.Uint16(data[2:])), - Offsety: int16(binary.LittleEndian.Uint16(data[4:])), - Width: int16(binary.LittleEndian.Uint16(data[6:])), - Height: int16(binary.LittleEndian.Uint16(data[8:])), - Clut: int16(binary.LittleEndian.Uint16(data[10:])), - Tileset: int16(binary.LittleEndian.Uint16(data[12:])), - Left: int16(binary.LittleEndian.Uint16(data[14:])), - Top: int16(binary.LittleEndian.Uint16(data[16:])), - Right: int16(binary.LittleEndian.Uint16(data[18:])), - Bottom: int16(binary.LittleEndian.Uint16(data[20:])), - } -} - -func parse(baseAddr psx.Addr, data []byte, start, end int) []*[]AnimFrame { - var offsets []psx.Addr - endAddr := baseAddr.Sum(end) - for i := start; i < end; i += 4 { - addr := psx.GetAddr(data[i:]) - if addr != psx.RamNull && !addr.InRange(baseAddr, endAddr) { - break - } - offsets = append(offsets, addr) - } - - set := make([]*[]AnimFrame, 0) - for _, addr := range offsets { - if addr == psx.RamNull { - set = append(set, nil) - continue - } - var frames []AnimFrame - cur := data[addr-baseAddr:] - nFrames := int(binary.LittleEndian.Uint16(cur)) - cur = cur[2:] - for i := 0; i < nFrames; i++ { - frames = append(frames, parseAnimFrame(cur)) - cur = cur[22:] - } - set = append(set, &frames) - } - return set -} - -func Extract(path string, addr psx.Addr, data []byte, start, end int) error { - set := parse(addr, data, start, end) - content, err := json.MarshalIndent(set, "", " ") - if err != nil { - return err - } - - dir := filepath.Dir(path) - if err := os.MkdirAll(dir, 0755); err != nil { - fmt.Printf("failed to create directory %s: %v\n", dir, err) - return err - } - return os.WriteFile(path, content, 0644) -} diff --git a/tools/sotn-assets/asset_config.go b/tools/sotn-assets/asset_config.go index 62e7a8e2b5..ea8ffa17ce 100644 --- a/tools/sotn-assets/asset_config.go +++ b/tools/sotn-assets/asset_config.go @@ -1,13 +1,15 @@ package main import ( + "bytes" + "encoding/json" "fmt" - "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/animset" "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" "golang.org/x/sync/errgroup" "gopkg.in/yaml.v2" "os" "path" + "path/filepath" "strconv" ) @@ -18,9 +20,10 @@ type assetSegmentEntry struct { } type assetFileEntry struct { - Target string `yaml:"target"` - AssetDir string `yaml:"asset_path"` - Segments []assetSegmentEntry `yaml:"segments"` + Target string `yaml:"target"` + AssetDir string `yaml:"asset_path"` + SourceDir string `yaml:"src_path"` + Segments []assetSegmentEntry `yaml:"segments"` } type assetConfig struct { @@ -28,19 +31,54 @@ type assetConfig struct { } type assetEntry struct { - data []byte - start int - end int - outDir string - name string - args []string - ramBase psx.Addr + data []byte + start int + end int + assetDir string + name string + args []string + ramBase psx.Addr } -var handlers = map[string]func(assetEntry) error{ - "animset": func(e assetEntry) error { - outPath := path.Join(e.outDir, fmt.Sprintf("%s.animset_test.json", e.name)) - return animset.Extract(outPath, e.ramBase, e.data, e.start, e.end) +type assetBuildEntry struct { + assetDir string + srcDir string + name string +} + +var extractHandlers = map[string]func(assetEntry) error{ + "frameset": func(e assetEntry) error { + var set []*[]sprite + var err error + if e.start != e.end { + r := bytes.NewReader(e.data) + set, _, err = readFrameSet(r, e.ramBase, e.ramBase.Sum(e.start)) + if err != nil { + return err + } + } else { + set = make([]*[]sprite, 0) + } + content, err := json.MarshalIndent(set, "", " ") + if err != nil { + return err + } + + outPath := path.Join(e.assetDir, fmt.Sprintf("%s.frameset.json", e.name)) + dir := filepath.Dir(outPath) + if err := os.MkdirAll(dir, 0755); err != nil { + fmt.Printf("failed to create directory %s: %v\n", dir, err) + return err + } + return os.WriteFile(outPath, content, 0644) + }, +} + +var buildHandlers = map[string]func(assetBuildEntry) error{ + "frameset": func(e assetBuildEntry) error { + inFileName := path.Join(e.assetDir, fmt.Sprintf("%s.frameset.json", e.name)) + outFileName := path.Join(e.srcDir, fmt.Sprintf("%s.h", e.name)) + return buildFrameSet(inFileName, outFileName, e.name) }, } @@ -88,18 +126,19 @@ func enqueueExtractAssetEntry( ramBase psx.Addr) { eg.Go(func() error { if err := handler(assetEntry{ - data: data, - start: start, - end: end, - outDir: assetDir, - ramBase: ramBase, - name: name, - args: args, + data: data, + start: start, + end: end, + assetDir: assetDir, + ramBase: ramBase, + name: name, + args: args, }); err != nil { return fmt.Errorf("unable to extract asset %q: %v", name, err) } return nil }) + eg.Wait() } func extractAssetFile(file assetFileEntry) error { @@ -128,7 +167,7 @@ func extractAssetFile(file assetFileEntry) error { if kind == "skip" { continue } - if handler, found := handlers[kind]; found { + if handler, found := extractHandlers[kind]; found { name := strconv.FormatUint(uint64(off), 16) if len(args) > 0 { name = args[0] @@ -158,3 +197,49 @@ func extractFromConfig(c *assetConfig) error { } return eg.Wait() } + +func buildAssetFile(file assetFileEntry) error { + for _, segment := range file.Segments { + if len(segment.Assets) == 0 { + continue + } + for _, asset := range segment.Assets { + off, kind, args, err := parseArgs(asset) + if err != nil { + return err + } + if kind == "skip" { + continue + } + if handler, found := buildHandlers[kind]; found { + name := strconv.FormatUint(uint64(off), 16) + if len(args) > 0 { + name = args[0] + args = args[1:] + } + err := handler(assetBuildEntry{ + assetDir: file.AssetDir, + srcDir: file.SourceDir, + name: name, + }) + if err != nil { + return err + } + } + } + } + return nil +} + +func buildFromConfig(c *assetConfig) error { + var eg errgroup.Group + for _, file := range c.Files { + if len(file.Segments) == 0 { + continue + } + eg.Go(func() error { + return buildAssetFile(file) + }) + } + return eg.Wait() +} diff --git a/tools/sotn-assets/build.go b/tools/sotn-assets/build.go index c16d120f86..c77f28e9c8 100644 --- a/tools/sotn-assets/build.go +++ b/tools/sotn-assets/build.go @@ -329,6 +329,23 @@ func buildSpriteGroup(sb *strings.Builder, sprites []*[]sprite, mainSymbol strin } } +func buildFrameSet(inputFileName, outputFileName, prefix string) error { + data, err := os.ReadFile(inputFileName) + if err != nil { + return fmt.Errorf("unable to open %q: %v", inputFileName, err) + } + + var sprites []*[]sprite + if err := json.Unmarshal(data, &sprites); err != nil { + return fmt.Errorf("unable to parse %q: %v", inputFileName, err) + } + sb := strings.Builder{} + sb.WriteString("// clang-format off\n") + r := rand.New(rand.NewSource(int64(len(data)))) + buildSpriteGroup(&sb, sprites, prefix, r) + return os.WriteFile(outputFileName, []byte(sb.String()), 0644) +} + func buildSprites(fileName string, outputDir string) error { ovlName := path.Base(outputDir) data, err := os.ReadFile(fileName) diff --git a/tools/sotn-assets/main.go b/tools/sotn-assets/main.go index cbf40516b5..096cc3856a 100644 --- a/tools/sotn-assets/main.go +++ b/tools/sotn-assets/main.go @@ -84,7 +84,7 @@ func getOvlAssets(fileName string) (ovl, error) { tileDefsRange = mergeDataRanges([]dataRange{tileDefsRange, unusedTileDefRange}) } - sprites, spritesRange, err := readSpritesBanks(file, header.Sprites) + sprites, spritesRange, err := readSpritesBanks(file, psx.RamStageBegin, header.Sprites) if err != nil { return ovl{}, fmt.Errorf("unable to gather all sprites: %w", err) } @@ -368,7 +368,7 @@ func handlerStage(args []string) error { return nil } -func handlerConfig(args []string) error { +func handlerConfigExtract(args []string) error { c, err := readConfig(args[0]) if err != nil { return err @@ -376,6 +376,37 @@ func handlerConfig(args []string) error { return extractFromConfig(c) } +func handlerConfigBuild(args []string) error { + c, err := readConfig(args[0]) + if err != nil { + return err + } + return buildFromConfig(c) +} + +func handlerConfig(args []string) error { + commands := map[string]func(args []string) error{ + "extract": handlerConfigExtract, + "build": handlerConfigBuild, + } + + if len(args) > 0 { + command := args[0] + if f, found := commands[command]; found { + if err := f(args[1:]); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + return nil + } + fmt.Fprintf(os.Stderr, "unknown subcommand %q. Valid subcommand are %s\n", command, joinMapKeys(commands, ", ")) + } else { + fmt.Fprintf(os.Stderr, "Need a subcommand. Valid subcommand are %s\n", joinMapKeys(commands, ", ")) + } + os.Exit(1) + return nil +} + func main() { commands := map[string]func(args []string) error{ "stage": handlerStage, diff --git a/tools/sotn-assets/psx/offsets.go b/tools/sotn-assets/psx/offsets.go index 1ecba08752..760d1e63be 100644 --- a/tools/sotn-assets/psx/offsets.go +++ b/tools/sotn-assets/psx/offsets.go @@ -3,7 +3,7 @@ package psx import ( "encoding/binary" "fmt" - "os" + "io" ) type Addr uint32 @@ -43,13 +43,8 @@ func (off Addr) InRange(begin Addr, end Addr) bool { return off >= begin && off < end } -func (off Addr) MoveFile(file *os.File, begin Addr) error { - info, err := file.Stat() - if err != nil { - return fmt.Errorf("could not stat file: %w", err) - } - - end := begin.Sum(int(info.Size())) +func (off Addr) MoveFile(r io.ReadSeeker, begin Addr) error { + end := RamGameEnd if !off.InRange(begin, end) { err := fmt.Errorf("offset %s is outside the boundaries [%s, %s]", off, begin, end) panic(err) @@ -57,10 +52,16 @@ func (off Addr) MoveFile(file *os.File, begin Addr) error { } fileOffset := int64(off - begin) - file.Seek(fileOffset, 0) + r.Seek(fileOffset, 0) return nil } func GetAddr(data []byte) Addr { return Addr(binary.LittleEndian.Uint32(data)) } + +func ReadAddr(r io.Reader) Addr { + b := make([]byte, 4) + _, _ = r.Read(b) + return GetAddr(b) +} diff --git a/tools/sotn-assets/sprites.go b/tools/sotn-assets/sprites.go index 9487142835..c9b9a19774 100644 --- a/tools/sotn-assets/sprites.go +++ b/tools/sotn-assets/sprites.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "fmt" "github.com/xeeynamo/sotn-decomp/tools/sotn-assets/psx" - "os" + "io" "sort" ) @@ -27,35 +27,35 @@ type spriteDefs struct { Indices []int `json:"indices"` } -func readSprites(file *os.File, off psx.Addr) ([]sprite, dataRange, error) { - if err := off.MoveFile(file, psx.RamStageBegin); err != nil { +func readSprites(r io.ReadSeeker, baseAddr, addr psx.Addr) ([]sprite, dataRange, error) { + if err := addr.MoveFile(r, baseAddr); err != nil { return nil, dataRange{}, fmt.Errorf("invalid sprites: %w", err) } var count uint16 - if err := binary.Read(file, binary.LittleEndian, &count); err != nil { + if err := binary.Read(r, binary.LittleEndian, &count); err != nil { return nil, dataRange{}, err } sprites := make([]sprite, count) - if err := binary.Read(file, binary.LittleEndian, sprites); err != nil { + if err := binary.Read(r, binary.LittleEndian, sprites); err != nil { return nil, dataRange{}, err } return sprites, dataRange{ - begin: off, - end: off.Sum(4 + 0x16*int(count)).Align4(), + begin: addr, + end: addr.Sum(4 + 0x16*int(count)).Align4(), }, nil } -func readSpriteBank(file *os.File, off psx.Addr) ([]*[]sprite, dataRange, error) { - if err := off.MoveFile(file, psx.RamStageBegin); err != nil { +func readFrameSet(r io.ReadSeeker, baseAddr, addr psx.Addr) ([]*[]sprite, dataRange, error) { + if err := addr.MoveFile(r, baseAddr); err != nil { return nil, dataRange{}, fmt.Errorf("invalid sprite Indices: %w", err) } // the end of the sprite array is the beginning of the earliest sprite offset earliestSpriteOff := psx.RamStageEnd - currentOff := off + currentOff := addr spriteOffsets := make([]psx.Addr, 0) for { if currentOff == earliestSpriteOff { @@ -64,12 +64,12 @@ func readSpriteBank(file *os.File, off psx.Addr) ([]*[]sprite, dataRange, error) currentOff += 4 var spriteOffset psx.Addr - if err := binary.Read(file, binary.LittleEndian, &spriteOffset); err != nil { + if err := binary.Read(r, binary.LittleEndian, &spriteOffset); err != nil { return nil, dataRange{}, err } spriteOffsets = append(spriteOffsets, spriteOffset) if spriteOffset != psx.RamNull { - if !spriteOffset.InRange(psx.RamStageBegin, psx.RamStageEnd) { + if !spriteOffset.InRange(baseAddr, psx.RamGameEnd) { err := fmt.Errorf("sprite offset %s is not valid", spriteOffset) return nil, dataRange{}, err } @@ -77,7 +77,7 @@ func readSpriteBank(file *os.File, off psx.Addr) ([]*[]sprite, dataRange, error) } } headerRange := dataRange{ - begin: off, + begin: addr, end: earliestSpriteOff, } @@ -88,7 +88,7 @@ func readSpriteBank(file *os.File, off psx.Addr) ([]*[]sprite, dataRange, error) spriteBank[i] = nil continue } - sprites, ranges, err := readSprites(file, offset) + sprites, ranges, err := readSprites(r, baseAddr, offset) if err != nil { return nil, dataRange{}, fmt.Errorf("unable to read sprites: %w", err) } @@ -99,31 +99,37 @@ func readSpriteBank(file *os.File, off psx.Addr) ([]*[]sprite, dataRange, error) return spriteBank, mergeDataRanges(append(spriteRanges, headerRange)), nil } -func readSpritesBanks(file *os.File, off psx.Addr) (spriteDefs, dataRange, error) { - if err := off.MoveFile(file, psx.RamStageBegin); err != nil { +func readSpritesBanks(r io.ReadSeeker, baseAddr, addr psx.Addr) (spriteDefs, dataRange, error) { + if err := addr.MoveFile(r, baseAddr); err != nil { return spriteDefs{}, dataRange{}, err } - offBanks := make([]psx.Addr, 24) - if err := binary.Read(file, binary.LittleEndian, offBanks); err != nil { - return spriteDefs{}, dataRange{}, err + // start with a capacity of 24 as that's the length for all the stage overlays + offBanks := make([]psx.Addr, 0, 24) + for { + addr := psx.ReadAddr(r) + if addr != psx.RamNull && !addr.InRange(baseAddr, psx.RamGameEnd) { + break + } + offBanks = append(offBanks, addr) } + r.Seek(-4, io.SeekCurrent) // the order sprites are stored must be preserved pool := map[psx.Addr][]*[]sprite{} spriteRanges := []dataRange{} - for _, offset := range offBanks { - if offset == psx.RamNull { + for _, spriteAddr := range offBanks { + if spriteAddr == psx.RamNull { continue } - if _, found := pool[offset]; found { + if _, found := pool[spriteAddr]; found { continue } - bank, bankRange, err := readSpriteBank(file, offset) + bank, bankRange, err := readFrameSet(r, baseAddr, spriteAddr) if err != nil { return spriteDefs{}, dataRange{}, fmt.Errorf("unable to read sprite Indices: %w", err) } - pool[offset] = bank + pool[spriteAddr] = bank spriteRanges = append(spriteRanges, bankRange) } From a616582089ae8e983ac18c982b14b506d9411ad3 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 10:00:13 +0100 Subject: [PATCH 05/24] Integrate asset manager with weapon overlay --- Makefile | 4 ++-- Makefile.psx.mk | 2 ++ src/weapon/header.c | 11 ----------- src/weapon/shared.h | 9 +++++++++ src/weapon/w_000.c | 4 ++++ src/weapon/w_001.c | 4 ++++ src/weapon/w_002.c | 4 ++++ src/weapon/w_003.c | 4 ++++ src/weapon/w_004.c | 4 ++++ src/weapon/w_005.c | 4 ++++ src/weapon/w_006.c | 4 ++++ src/weapon/w_007.c | 4 ++++ src/weapon/w_008.c | 4 ++++ src/weapon/w_009.c | 4 ++++ src/weapon/w_010.c | 4 ++++ src/weapon/w_011.c | 4 ++++ src/weapon/w_012.c | 4 ++++ src/weapon/w_013.c | 4 ++++ src/weapon/w_014.c | 4 ++++ src/weapon/w_015.c | 4 ++++ src/weapon/w_016.c | 4 ++++ src/weapon/w_017.c | 4 ++++ src/weapon/w_018.c | 4 ++++ src/weapon/w_019.c | 4 ++++ src/weapon/w_020.c | 4 ++++ src/weapon/w_021.c | 4 ++++ src/weapon/w_022.c | 4 ++++ src/weapon/w_023.c | 4 ++++ src/weapon/w_024.c | 4 ++++ src/weapon/w_025.c | 4 ++++ src/weapon/w_026.c | 4 ++++ src/weapon/w_027.c | 4 ++++ src/weapon/w_028.c | 4 ++++ src/weapon/w_029.c | 4 ++++ src/weapon/w_030.c | 4 ++++ src/weapon/w_031.c | 4 ++++ src/weapon/w_032.c | 4 ++++ src/weapon/w_033.c | 4 ++++ src/weapon/w_034.c | 4 ++++ src/weapon/w_035.c | 4 ++++ src/weapon/w_036.c | 4 ++++ src/weapon/w_037.c | 4 ++++ src/weapon/w_038.c | 4 ++++ src/weapon/w_039.c | 4 ++++ src/weapon/w_040.c | 4 ++++ src/weapon/w_041.c | 4 ++++ src/weapon/w_042.c | 4 ++++ src/weapon/w_043.c | 4 ++++ src/weapon/w_044.c | 4 ++++ src/weapon/w_045.c | 4 ++++ src/weapon/w_046.c | 4 ++++ src/weapon/w_047.c | 4 ++++ src/weapon/w_048.c | 4 ++++ src/weapon/w_049.c | 4 ++++ src/weapon/w_050.c | 4 ++++ src/weapon/w_051.c | 4 ++++ src/weapon/w_052.c | 4 ++++ src/weapon/w_053.c | 4 ++++ src/weapon/w_054.c | 4 ++++ src/weapon/w_055.c | 4 ++++ src/weapon/w_056.c | 4 ++++ src/weapon/w_057.c | 4 ++++ src/weapon/w_058.c | 4 ++++ 63 files changed, 249 insertions(+), 13 deletions(-) delete mode 100644 src/weapon/header.c diff --git a/Makefile b/Makefile index d4d668d92a..c6842c2648 100644 --- a/Makefile +++ b/Makefile @@ -328,7 +328,7 @@ $(ASM_DIR)/weapon/data/w_%.data.s: # create a fake empty file if all the data ha touch $@ $(ASM_DIR)/weapon/data/w_%.sbss.s: # create a fake empty file if all the bss section has been imported touch $@ -$(BUILD_DIR)/weapon/w0_%.elf: $(BUILD_DIR)/$(SRC_DIR)/weapon/header.c.o $(BUILD_DIR)/$(ASSETS_DIR)/weapon/w_%_1.animset.o $(BUILD_DIR)/$(ASSETS_DIR)/weapon/w_%_2.animset.o $(BUILD_DIR)/$(SRC_DIR)/weapon/w_%.c.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.data.s.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.sbss.s.o +$(BUILD_DIR)/weapon/w0_%.elf: $(BUILD_DIR)/$(SRC_DIR)/weapon/w_%.c.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.data.s.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.sbss.s.o $(LD) $(LD_FLAGS) --no-check-sections -o $@ \ -Map $(BUILD_DIR)/weapon/w0_$*.map \ -T weapon0.ld \ @@ -336,7 +336,7 @@ $(BUILD_DIR)/weapon/w0_%.elf: $(BUILD_DIR)/$(SRC_DIR)/weapon/header.c.o $(BUILD_ -T $(CONFIG_DIR)/undefined_syms_auto.$(VERSION).weapon.txt \ -T $(CONFIG_DIR)/undefined_funcs_auto.$(VERSION).weapon.txt \ $^ -$(BUILD_DIR)/weapon/w1_%.elf: $(BUILD_DIR)/$(SRC_DIR)/weapon/header.c.o $(BUILD_DIR)/$(ASSETS_DIR)/weapon/w_%_1.animset.o $(BUILD_DIR)/$(ASSETS_DIR)/weapon/w_%_2.animset.o $(BUILD_DIR)/$(SRC_DIR)/weapon/w_%.c.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.data.s.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.sbss.s.o +$(BUILD_DIR)/weapon/w1_%.elf: $(BUILD_DIR)/$(SRC_DIR)/weapon/w_%.c.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.data.s.o $(BUILD_DIR)/$(ASM_DIR)/weapon/data/w_%.sbss.s.o $(LD) $(LD_FLAGS) --no-check-sections -o $@ \ -Map $(BUILD_DIR)/weapon/w1_$*.map \ -T weapon1.ld \ diff --git a/Makefile.psx.mk b/Makefile.psx.mk index 95a798048c..c5f92c5f2e 100644 --- a/Makefile.psx.mk +++ b/Makefile.psx.mk @@ -89,6 +89,7 @@ extract_assets: $(SOTNASSETS) $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/ST0/ST0.BIN -o assets/st/st0 $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/WRP/WRP.BIN -o assets/st/wrp $(SOTNASSETS) stage extract -stage_ovl disks/$(VERSION)/ST/RWRP/RWRP.BIN -o assets/st/rwrp + $(SOTNASSETS) config extract config/assets.us.weapon.yaml extract_assets_hd: $(SOTNASSETS) cd tools/sotn-assets; $(GO) install $(SOTNASSETS) stage extract -stage_ovl disks/pspeu/PSP_GAME/USRDIR/res/ps/hdbin/wrp.bin -o assets/st/wrp @@ -101,6 +102,7 @@ build_assets: $(SOTNASSETS) $(SOTNASSETS) stage build_all -i assets/st/st0 -o src/st/st0/ $(SOTNASSETS) stage build_all -i assets/st/wrp -o src/st/wrp/ $(SOTNASSETS) stage build_all -i assets/st/rwrp -o src/st/rwrp/ + $(SOTNASSETS) config build config/assets.us.weapon.yaml $(BUILD_DIR)/assets/dra/memcard_%.png.o: assets/dra/memcard_%.png mkdir -p $(dir $@) diff --git a/src/weapon/header.c b/src/weapon/header.c deleted file mode 100644 index 95310efdfe..0000000000 --- a/src/weapon/header.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "weapon_private.h" - -Weapon g_Weapon = { - EntityWeaponAttack, func_ptr_80170004, func_ptr_80170008, - func_ptr_8017000C, func_ptr_80170010, func_ptr_80170014, - GetWeaponId, LoadWeaponPalette, EntityWeaponShieldSpell, - func_ptr_80170024, func_ptr_80170028, WeaponUnused2C, - WeaponUnused30, WeaponUnused34, WeaponUnused38, - WeaponUnused3C, -}; diff --git a/src/weapon/shared.h b/src/weapon/shared.h index 0e6b7589f9..fc161bb146 100644 --- a/src/weapon/shared.h +++ b/src/weapon/shared.h @@ -143,3 +143,12 @@ void SetWeaponProperties(Entity* self, s32 kind) { self->attack = 0xFF; } } + +Weapon g_Weapon = { + EntityWeaponAttack, func_ptr_80170004, func_ptr_80170008, + func_ptr_8017000C, func_ptr_80170010, func_ptr_80170014, + GetWeaponId, LoadWeaponPalette, EntityWeaponShieldSpell, + func_ptr_80170024, func_ptr_80170028, WeaponUnused2C, + WeaponUnused30, WeaponUnused34, WeaponUnused38, + WeaponUnused3C, +}; diff --git a/src/weapon/w_000.c b/src/weapon/w_000.c index d1da85ddf4..70718ba413 100644 --- a/src/weapon/w_000.c +++ b/src/weapon/w_000.c @@ -6,6 +6,10 @@ #include "weapon_private.h" #include "shared.h" +#include "w_000_1.h" +#include "w_000_2.h" +#define g_Animset w_000_1 +#define g_Animset2 w_000_2 u16 g_Clut0[] = { 0x0000, 0x8000, 0xA821, 0x9DC0, 0xA821, 0xA821, 0xA821, 0xA821, // 0 diff --git a/src/weapon/w_001.c b/src/weapon/w_001.c index 83384d1f27..c217fd8c8e 100644 --- a/src/weapon/w_001.c +++ b/src/weapon/w_001.c @@ -3,6 +3,10 @@ // Unknown#187, Unknown#188 #include "weapon_private.h" #include "shared.h" +#include "w_001_1.h" +#include "w_001_2.h" +#define g_Animset w_001_1 +#define g_Animset2 w_001_2 INCLUDE_ASM("weapon/nonmatchings/w_001", EntityWeaponAttack); diff --git a/src/weapon/w_002.c b/src/weapon/w_002.c index 7b4c0c3d9f..3736af570e 100644 --- a/src/weapon/w_002.c +++ b/src/weapon/w_002.c @@ -2,6 +2,10 @@ // Mace #include "weapon_private.h" #include "shared.h" +#include "w_002_1.h" +#include "w_002_2.h" +#define g_Animset w_002_1 +#define g_Animset2 w_002_2 extern WeaponAnimation D_12000_8017ABC4[]; diff --git a/src/weapon/w_003.c b/src/weapon/w_003.c index 4f7fa32e0a..47412eb9cb 100644 --- a/src/weapon/w_003.c +++ b/src/weapon/w_003.c @@ -2,6 +2,10 @@ // Morningstar #include "weapon_private.h" #include "shared.h" +#include "w_003_1.h" +#include "w_003_2.h" +#define g_Animset w_003_1 +#define g_Animset2 w_003_2 extern WeaponAnimation D_19000_8017AC28[]; diff --git a/src/weapon/w_004.c b/src/weapon/w_004.c index b0db422899..e558fe3036 100644 --- a/src/weapon/w_004.c +++ b/src/weapon/w_004.c @@ -2,6 +2,10 @@ // Holy rod, Unknown#170 #include "weapon_private.h" #include "shared.h" +#include "w_004_1.h" +#include "w_004_2.h" +#define g_Animset w_004_1 +#define g_Animset2 w_004_2 extern WeaponAnimation D_20000_8017B2F4[]; // g_SoundEvents diff --git a/src/weapon/w_005.c b/src/weapon/w_005.c index 8df8e5ffa9..e6df13e297 100644 --- a/src/weapon/w_005.c +++ b/src/weapon/w_005.c @@ -2,6 +2,10 @@ // Star flail, Unknown#171 #include "weapon_private.h" #include "shared.h" +#include "w_005_1.h" +#include "w_005_2.h" +#define g_Animset w_005_1 +#define g_Animset2 w_005_2 INCLUDE_ASM("weapon/nonmatchings/w_005", EntityWeaponAttack); diff --git a/src/weapon/w_006.c b/src/weapon/w_006.c index d1ebb0244f..170552d217 100644 --- a/src/weapon/w_006.c +++ b/src/weapon/w_006.c @@ -2,6 +2,10 @@ // Moon rod, Unknown#172 #include "weapon_private.h" #include "shared.h" +#include "w_006_1.h" +#include "w_006_2.h" +#define g_Animset w_006_1 +#define g_Animset2 w_006_2 extern WeaponAnimation D_2E000_8017ABC4[]; void EntityWeaponAttack(Entity* self) { diff --git a/src/weapon/w_007.c b/src/weapon/w_007.c index eec7615f86..4082aab97c 100644 --- a/src/weapon/w_007.c +++ b/src/weapon/w_007.c @@ -2,6 +2,10 @@ // Shield rod, Unknown#173 #include "weapon_private.h" #include "shared.h" +#include "w_007_1.h" +#include "w_007_2.h" +#define g_Animset w_007_1 +#define g_Animset2 w_007_2 INCLUDE_ASM("weapon/nonmatchings/w_007", EntityWeaponAttack); diff --git a/src/weapon/w_008.c b/src/weapon/w_008.c index 7c4e8ef67c..10c2fc62ba 100644 --- a/src/weapon/w_008.c +++ b/src/weapon/w_008.c @@ -2,6 +2,10 @@ // Leather shield, Unknown#203 #include "weapon_private.h" #include "shared.h" +#include "w_008_1.h" +#include "w_008_2.h" +#define g_Animset w_008_1 +#define g_Animset2 w_008_2 extern SpriteParts D_3C000_8017A040[]; extern s8 D_3C000_8017A9F8; diff --git a/src/weapon/w_009.c b/src/weapon/w_009.c index 6c549b7f96..32c126d18b 100644 --- a/src/weapon/w_009.c +++ b/src/weapon/w_009.c @@ -2,6 +2,10 @@ // Knight shield, Unknown#204 #include "weapon_private.h" #include "shared.h" +#include "w_009_1.h" +#include "w_009_2.h" +#define g_Animset w_009_1 +#define g_Animset2 w_009_2 extern SpriteParts D_43000_8017A040[]; extern s8 D_43000_8017A9F8; diff --git a/src/weapon/w_010.c b/src/weapon/w_010.c index f1366e646f..ce13124ad1 100644 --- a/src/weapon/w_010.c +++ b/src/weapon/w_010.c @@ -2,6 +2,10 @@ // Iron shield, Unknown#205 #include "weapon_private.h" #include "shared.h" +#include "w_010_1.h" +#include "w_010_2.h" +#define g_Animset w_010_1 +#define g_Animset2 w_010_2 #include "items.h" extern SpriteParts D_4A000_8017A040[]; diff --git a/src/weapon/w_011.c b/src/weapon/w_011.c index 39a1984f4d..cc8a728da0 100644 --- a/src/weapon/w_011.c +++ b/src/weapon/w_011.c @@ -2,6 +2,10 @@ // AxeLord shield, Unknown#206 #include "weapon_private.h" #include "shared.h" +#include "w_011_1.h" +#include "w_011_2.h" +#define g_Animset w_011_1 +#define g_Animset2 w_011_2 extern SpriteParts D_51000_8017A040[]; extern s8 D_51000_8017AB4C; diff --git a/src/weapon/w_012.c b/src/weapon/w_012.c index 7135f33ba5..a83c6439dc 100644 --- a/src/weapon/w_012.c +++ b/src/weapon/w_012.c @@ -2,6 +2,10 @@ // Chakram, Vorpal blade, Crissaegrim #include "weapon_private.h" #include "shared.h" +#include "w_012_1.h" +#include "w_012_2.h" +#define g_Animset w_012_1 +#define g_Animset2 w_012_2 INCLUDE_ASM("weapon/nonmatchings/w_012", EntityWeaponAttack); diff --git a/src/weapon/w_013.c b/src/weapon/w_013.c index 3b4229bd36..b6ce132b7a 100644 --- a/src/weapon/w_013.c +++ b/src/weapon/w_013.c @@ -8,6 +8,10 @@ #include "weapon_private.h" #include "shared.h" +#include "w_013_1.h" +#include "w_013_2.h" +#define g_Animset w_013_1 +#define g_Animset2 w_013_2 extern SpriteParts D_5F000_8017A040[]; extern u8 D_5F000_8017A5B0[6][8]; diff --git a/src/weapon/w_014.c b/src/weapon/w_014.c index b3a19f00ed..2189ebbf63 100644 --- a/src/weapon/w_014.c +++ b/src/weapon/w_014.c @@ -2,6 +2,10 @@ // Runesword #include "weapon_private.h" #include "shared.h" +#include "w_014_1.h" +#include "w_014_2.h" +#define g_Animset w_014_1 +#define g_Animset2 w_014_2 INCLUDE_ASM("weapon/nonmatchings/w_014", EntityWeaponAttack); diff --git a/src/weapon/w_015.c b/src/weapon/w_015.c index 8ade67073f..a71ba02885 100644 --- a/src/weapon/w_015.c +++ b/src/weapon/w_015.c @@ -2,6 +2,10 @@ // Shuriken, Cross shuriken, Buffalo star, Flame star, TNT #include "weapon_private.h" #include "shared.h" +#include "w_015_1.h" +#include "w_015_2.h" +#define g_Animset w_015_1 +#define g_Animset2 w_015_2 INCLUDE_ASM("weapon/nonmatchings/w_015", EntityWeaponAttack); diff --git a/src/weapon/w_016.c b/src/weapon/w_016.c index c99477a87c..5fe5fa7de0 100644 --- a/src/weapon/w_016.c +++ b/src/weapon/w_016.c @@ -2,6 +2,10 @@ // Bwaka knife, Boomerang, Javelin, Fire boomerang, Iron ball #include "weapon_private.h" #include "shared.h" +#include "w_016_1.h" +#include "w_016_2.h" +#define g_Animset w_016_1 +#define g_Animset2 w_016_2 // Weapon 16 extern SpriteParts D_74000_8017A040[]; diff --git a/src/weapon/w_017.c b/src/weapon/w_017.c index 5ede98a6b2..3e69969023 100644 --- a/src/weapon/w_017.c +++ b/src/weapon/w_017.c @@ -2,6 +2,10 @@ // Pentagram, Bat Pentagram #include "weapon_private.h" #include "shared.h" +#include "w_017_1.h" +#include "w_017_2.h" +#define g_Animset w_017_1 +#define g_Animset2 w_017_2 INCLUDE_ASM("weapon/nonmatchings/w_017", EntityWeaponAttack); diff --git a/src/weapon/w_018.c b/src/weapon/w_018.c index 5a22e29738..c122e27ec6 100644 --- a/src/weapon/w_018.c +++ b/src/weapon/w_018.c @@ -2,6 +2,10 @@ // Power of Sire #include "weapon_private.h" #include "shared.h" +#include "w_018_1.h" +#include "w_018_2.h" +#define g_Animset w_018_1 +#define g_Animset2 w_018_2 extern const char D_82000_8017A73C[]; // "\no\n" extern s32 D_82000_8017B1B4; // g_DebugWaitInfoTimer diff --git a/src/weapon/w_019.c b/src/weapon/w_019.c index 4d48bb94ea..d45f794399 100644 --- a/src/weapon/w_019.c +++ b/src/weapon/w_019.c @@ -2,6 +2,10 @@ // Neutron bomb #include "weapon_private.h" #include "shared.h" +#include "w_019_1.h" +#include "w_019_2.h" +#define g_Animset w_019_1 +#define g_Animset2 w_019_2 INCLUDE_ASM("weapon/nonmatchings/w_019", EntityWeaponAttack); diff --git a/src/weapon/w_020.c b/src/weapon/w_020.c index 43ec1cf9d7..72a88afe6c 100644 --- a/src/weapon/w_020.c +++ b/src/weapon/w_020.c @@ -2,6 +2,10 @@ // Karma Coin #include "weapon_private.h" #include "shared.h" +#include "w_020_1.h" +#include "w_020_2.h" +#define g_Animset w_020_1 +#define g_Animset2 w_020_2 #include "sfx.h" extern SpriteParts D_90000_8017A040[]; diff --git a/src/weapon/w_021.c b/src/weapon/w_021.c index a8a849f716..0c93ea26de 100644 --- a/src/weapon/w_021.c +++ b/src/weapon/w_021.c @@ -7,6 +7,10 @@ // Chinese bun, Dim Sum set, Pot roast, Sirloin, Turkey, Meal ticket #include "weapon_private.h" #include "shared.h" +#include "w_021_1.h" +#include "w_021_2.h" +#define g_Animset w_021_1 +#define g_Animset2 w_021_2 extern SpriteParts D_97000_8017A040[]; diff --git a/src/weapon/w_022.c b/src/weapon/w_022.c index 2be29c25cb..952135240e 100644 --- a/src/weapon/w_022.c +++ b/src/weapon/w_022.c @@ -2,6 +2,10 @@ // Magic Missile #include "weapon_private.h" #include "shared.h" +#include "w_022_1.h" +#include "w_022_2.h" +#define g_Animset w_022_1 +#define g_Animset2 w_022_2 extern AnimationFrame D_9E000_8017A760[]; extern AnimationFrame D_9E000_8017A800[]; diff --git a/src/weapon/w_023.c b/src/weapon/w_023.c index ba7e523fec..08a1b53174 100644 --- a/src/weapon/w_023.c +++ b/src/weapon/w_023.c @@ -2,6 +2,10 @@ // Herald shield, Unknown#207 #include "weapon_private.h" #include "shared.h" +#include "w_023_1.h" +#include "w_023_2.h" +#define g_Animset w_023_1 +#define g_Animset2 w_023_2 extern SpriteParts D_A5000_8017A040[]; extern s8 D_A5000_8017AAD8; diff --git a/src/weapon/w_024.c b/src/weapon/w_024.c index 316c371c10..9f94e48ec1 100644 --- a/src/weapon/w_024.c +++ b/src/weapon/w_024.c @@ -2,6 +2,10 @@ // Dark shield, Unknown#208 #include "weapon_private.h" #include "shared.h" +#include "w_024_1.h" +#include "w_024_2.h" +#define g_Animset w_024_1 +#define g_Animset2 w_024_2 extern SpriteParts D_AC000_8017A040[]; extern s8 D_AC000_8017ABD8; diff --git a/src/weapon/w_025.c b/src/weapon/w_025.c index fd3d036e7b..0e13ad3b33 100644 --- a/src/weapon/w_025.c +++ b/src/weapon/w_025.c @@ -2,6 +2,10 @@ // Goddess shield, Unknown#209 #include "weapon_private.h" #include "shared.h" +#include "w_025_1.h" +#include "w_025_2.h" +#define g_Animset w_025_1 +#define g_Animset2 w_025_2 extern SpriteParts D_B3000_8017A040[]; extern s8 D_B3000_8017AA18; diff --git a/src/weapon/w_026.c b/src/weapon/w_026.c index 36ddc17835..3d27f8bfaa 100644 --- a/src/weapon/w_026.c +++ b/src/weapon/w_026.c @@ -2,6 +2,10 @@ // Shaman shield, Unknown#210 #include "weapon_private.h" #include "shared.h" +#include "w_026_1.h" +#include "w_026_2.h" +#define g_Animset w_026_1 +#define g_Animset2 w_026_2 extern SpriteParts D_BA000_8017A040[]; extern s8 D_BA000_8017AA18; diff --git a/src/weapon/w_027.c b/src/weapon/w_027.c index 76d10af31f..adf8f118fc 100644 --- a/src/weapon/w_027.c +++ b/src/weapon/w_027.c @@ -2,6 +2,10 @@ // Medusa shield, Unknown#211 #include "weapon_private.h" #include "shared.h" +#include "w_027_1.h" +#include "w_027_2.h" +#define g_Animset w_027_1 +#define g_Animset2 w_027_2 extern SpriteParts D_C1000_8017A040[]; extern s8 D_C1000_8017AC0C[]; diff --git a/src/weapon/w_028.c b/src/weapon/w_028.c index 3618f4c28e..29e71570d3 100644 --- a/src/weapon/w_028.c +++ b/src/weapon/w_028.c @@ -2,6 +2,10 @@ // Skull shield, Unknown#212 #include "weapon_private.h" #include "shared.h" +#include "w_028_1.h" +#include "w_028_2.h" +#define g_Animset w_028_1 +#define g_Animset2 w_028_2 extern SpriteParts D_C8000_8017A040[]; extern s8 D_C8000_8017AA98[]; diff --git a/src/weapon/w_029.c b/src/weapon/w_029.c index 380cd994f7..f332a5c742 100644 --- a/src/weapon/w_029.c +++ b/src/weapon/w_029.c @@ -2,6 +2,10 @@ // Fire shield, Unknown#213 #include "weapon_private.h" #include "shared.h" +#include "w_029_1.h" +#include "w_029_2.h" +#define g_Animset w_029_1 +#define g_Animset2 w_029_2 #include "items.h" extern s32 D_CF000_8017AC78; diff --git a/src/weapon/w_030.c b/src/weapon/w_030.c index aceadbfa1e..ae92b5306c 100644 --- a/src/weapon/w_030.c +++ b/src/weapon/w_030.c @@ -2,6 +2,10 @@ // Sword of Dawn, Unknown#177 #include "weapon_private.h" #include "shared.h" +#include "w_030_1.h" +#include "w_030_2.h" +#define g_Animset w_030_1 +#define g_Animset2 w_030_2 extern WeaponAnimation D_D6000_8017A5E4[]; diff --git a/src/weapon/w_031.c b/src/weapon/w_031.c index 0c4a0916f0..dbab2152c1 100644 --- a/src/weapon/w_031.c +++ b/src/weapon/w_031.c @@ -2,6 +2,10 @@ // Basilard, Unknown#174 #include "weapon_private.h" #include "shared.h" +#include "w_031_1.h" +#include "w_031_2.h" +#define g_Animset w_031_1 +#define g_Animset2 w_031_2 INCLUDE_ASM("weapon/nonmatchings/w_031", EntityWeaponAttack); diff --git a/src/weapon/w_032.c b/src/weapon/w_032.c index b2e3a93dd1..5b3c2c8668 100644 --- a/src/weapon/w_032.c +++ b/src/weapon/w_032.c @@ -2,6 +2,10 @@ // Combat knife, Unknown#175 #include "weapon_private.h" #include "shared.h" +#include "w_032_1.h" +#include "w_032_2.h" +#define g_Animset w_032_1 +#define g_Animset2 w_032_2 INCLUDE_ASM("weapon/nonmatchings/w_032", EntityWeaponAttack); diff --git a/src/weapon/w_033.c b/src/weapon/w_033.c index 4293220f87..032ffdd4fa 100644 --- a/src/weapon/w_033.c +++ b/src/weapon/w_033.c @@ -2,6 +2,10 @@ // Nunchaku #include "weapon_private.h" #include "shared.h" +#include "w_033_1.h" +#include "w_033_2.h" +#define g_Animset w_033_1 +#define g_Animset2 w_033_2 INCLUDE_ASM("weapon/nonmatchings/w_033", EntityWeaponAttack); diff --git a/src/weapon/w_034.c b/src/weapon/w_034.c index 84b57312bc..aa6930a4a3 100644 --- a/src/weapon/w_034.c +++ b/src/weapon/w_034.c @@ -2,6 +2,10 @@ // Shotel, Unknown#176 #include "weapon_private.h" #include "shared.h" +#include "w_034_1.h" +#include "w_034_2.h" +#define g_Animset w_034_1 +#define g_Animset2 w_034_2 extern WeaponAnimation D_F2000_8017A934[]; diff --git a/src/weapon/w_035.c b/src/weapon/w_035.c index 7f557244d4..51cb379224 100644 --- a/src/weapon/w_035.c +++ b/src/weapon/w_035.c @@ -2,6 +2,10 @@ // Red Rust #include "weapon_private.h" #include "shared.h" +#include "w_035_1.h" +#include "w_035_2.h" +#define g_Animset w_035_1 +#define g_Animset2 w_035_2 extern WeaponAnimation D_F9000_8017A530[]; diff --git a/src/weapon/w_036.c b/src/weapon/w_036.c index 51972f140a..6728d8ac09 100644 --- a/src/weapon/w_036.c +++ b/src/weapon/w_036.c @@ -2,6 +2,10 @@ // Takemitsu #include "weapon_private.h" #include "shared.h" +#include "w_036_1.h" +#include "w_036_2.h" +#define g_Animset w_036_1 +#define g_Animset2 w_036_2 extern WeaponAnimation D_100000_8017A540[]; diff --git a/src/weapon/w_037.c b/src/weapon/w_037.c index 275a69733e..2061d3aba0 100644 --- a/src/weapon/w_037.c +++ b/src/weapon/w_037.c @@ -2,6 +2,10 @@ // Short sword, Jewel sword, Stone sword, Unknown#198 #include "weapon_private.h" #include "shared.h" +#include "w_037_1.h" +#include "w_037_2.h" +#define g_Animset w_037_1 +#define g_Animset2 w_037_2 extern WeaponAnimation D_107000_8017A6A4[]; extern s32 D_107000_8017BBE4; diff --git a/src/weapon/w_038.c b/src/weapon/w_038.c index d01e90f3df..a6c241d404 100644 --- a/src/weapon/w_038.c +++ b/src/weapon/w_038.c @@ -2,6 +2,10 @@ // Rapier, Unknown#191 #include "weapon_private.h" #include "shared.h" +#include "w_038_1.h" +#include "w_038_2.h" +#define g_Animset w_038_1 +#define g_Animset2 w_038_2 extern WeaponAnimation D_10E000_8017ADC0[2]; diff --git a/src/weapon/w_039.c b/src/weapon/w_039.c index fac6509971..751008e30a 100644 --- a/src/weapon/w_039.c +++ b/src/weapon/w_039.c @@ -2,6 +2,10 @@ // Were Bane, Unknown#190 #include "weapon_private.h" #include "shared.h" +#include "w_039_1.h" +#include "w_039_2.h" +#define g_Animset w_039_1 +#define g_Animset2 w_039_2 extern WeaponAnimation D_115000_8017ADC0[2]; diff --git a/src/weapon/w_040.c b/src/weapon/w_040.c index 3e1a9769de..51d3de4835 100644 --- a/src/weapon/w_040.c +++ b/src/weapon/w_040.c @@ -2,6 +2,10 @@ // Monster vial 1 #include "weapon_private.h" #include "shared.h" +#include "w_040_1.h" +#include "w_040_2.h" +#define g_Animset w_040_1 +#define g_Animset2 w_040_2 extern AnimationFrame D_11C000_8017A724[]; extern AnimationFrame D_11C000_8017A748[]; diff --git a/src/weapon/w_041.c b/src/weapon/w_041.c index e21e025d50..7fb31f9664 100644 --- a/src/weapon/w_041.c +++ b/src/weapon/w_041.c @@ -2,6 +2,10 @@ // Monster vial 2 #include "weapon_private.h" #include "shared.h" +#include "w_041_1.h" +#include "w_041_2.h" +#define g_Animset w_041_1 +#define g_Animset2 w_041_2 extern AnimationFrame D_123000_8017A4A4[]; extern FrameProperty D_123000_8017A50C[]; diff --git a/src/weapon/w_042.c b/src/weapon/w_042.c index f22c3037ab..2111a300ff 100644 --- a/src/weapon/w_042.c +++ b/src/weapon/w_042.c @@ -2,6 +2,10 @@ // Monster vial 3 #include "weapon_private.h" #include "shared.h" +#include "w_042_1.h" +#include "w_042_2.h" +#define g_Animset w_042_1 +#define g_Animset2 w_042_2 // data extern AnimationFrame D_12A000_8017A604[]; diff --git a/src/weapon/w_043.c b/src/weapon/w_043.c index 7ec85098b4..e6a55d57aa 100644 --- a/src/weapon/w_043.c +++ b/src/weapon/w_043.c @@ -2,6 +2,10 @@ // Alucard sword, Sword Familiar, Alucart sword, Unknown#197 #include "weapon_private.h" #include "shared.h" +#include "w_043_1.h" +#include "w_043_2.h" +#define g_Animset w_043_1 +#define g_Animset2 w_043_2 extern SpriteParts D_131000_8017A040[]; extern AnimationFrame D_131000_8017AF40[]; diff --git a/src/weapon/w_044.c b/src/weapon/w_044.c index b2a4107912..97f378029f 100644 --- a/src/weapon/w_044.c +++ b/src/weapon/w_044.c @@ -2,6 +2,10 @@ // Heart Refresh #include "weapon_private.h" #include "shared.h" +#include "w_044_1.h" +#include "w_044_2.h" +#define g_Animset w_044_1 +#define g_Animset2 w_044_2 INCLUDE_ASM("weapon/nonmatchings/w_044", EntityWeaponAttack); diff --git a/src/weapon/w_045.c b/src/weapon/w_045.c index 848d7cf58c..1d89d3eefd 100644 --- a/src/weapon/w_045.c +++ b/src/weapon/w_045.c @@ -2,6 +2,10 @@ // Unknown#216 #include "weapon_private.h" #include "shared.h" +#include "w_045_1.h" +#include "w_045_2.h" +#define g_Animset w_045_1 +#define g_Animset2 w_045_2 extern SpriteParts D_13F000_8017A040[]; extern s32 D_13F000_8017B3B8; diff --git a/src/weapon/w_046.c b/src/weapon/w_046.c index 8236e91498..b21c32647a 100644 --- a/src/weapon/w_046.c +++ b/src/weapon/w_046.c @@ -2,6 +2,10 @@ // Holbein dagger, Blue knuckles #include "weapon_private.h" #include "shared.h" +#include "w_046_1.h" +#include "w_046_2.h" +#define g_Animset w_046_1 +#define g_Animset2 w_046_2 INCLUDE_ASM("weapon/nonmatchings/w_046", EntityWeaponAttack); diff --git a/src/weapon/w_047.c b/src/weapon/w_047.c index 4fbc65b342..407969849d 100644 --- a/src/weapon/w_047.c +++ b/src/weapon/w_047.c @@ -2,6 +2,10 @@ // Dynamite #include "weapon_private.h" #include "shared.h" +#include "w_047_1.h" +#include "w_047_2.h" +#define g_Animset w_047_1 +#define g_Animset2 w_047_2 INCLUDE_ASM("weapon/nonmatchings/w_047", EntityWeaponAttack); diff --git a/src/weapon/w_048.c b/src/weapon/w_048.c index 9c1c9653ab..142fe154b8 100644 --- a/src/weapon/w_048.c +++ b/src/weapon/w_048.c @@ -2,6 +2,10 @@ // Thunderbrand, Unknown#178 #include "weapon_private.h" #include "shared.h" +#include "w_048_1.h" +#include "w_048_2.h" +#define g_Animset w_048_1 +#define g_Animset2 w_048_2 INCLUDE_ASM("weapon/nonmatchings/w_048", EntityWeaponAttack); diff --git a/src/weapon/w_049.c b/src/weapon/w_049.c index 35a0127470..b2447504d1 100644 --- a/src/weapon/w_049.c +++ b/src/weapon/w_049.c @@ -2,6 +2,10 @@ // Firebrand, Marsil, Unknown#179, Unknown#180 #include "weapon_private.h" #include "shared.h" +#include "w_049_1.h" +#include "w_049_2.h" +#define g_Animset w_049_1 +#define g_Animset2 w_049_2 INCLUDE_ASM("weapon/nonmatchings/w_049", EntityWeaponAttack); diff --git a/src/weapon/w_050.c b/src/weapon/w_050.c index d60ba2e3a3..4017c62315 100644 --- a/src/weapon/w_050.c +++ b/src/weapon/w_050.c @@ -2,6 +2,10 @@ // Icebrand, Unknown#181, Unknown#199, Unknown#200, Unknown#201 #include "weapon_private.h" #include "shared.h" +#include "w_050_1.h" +#include "w_050_2.h" +#define g_Animset w_050_1 +#define g_Animset2 w_050_2 INCLUDE_ASM("weapon/nonmatchings/w_050", EntityWeaponAttack); diff --git a/src/weapon/w_051.c b/src/weapon/w_051.c index 3bf34d7082..7ffe96c0bf 100644 --- a/src/weapon/w_051.c +++ b/src/weapon/w_051.c @@ -3,6 +3,10 @@ // Unknown#182, Unknown#183, Unknown#184, Unknown#185 #include "weapon_private.h" #include "shared.h" +#include "w_051_1.h" +#include "w_051_2.h" +#define g_Animset w_051_1 +#define g_Animset2 w_051_2 #include "sfx.h" u16 D_169000_8017A950[] = { diff --git a/src/weapon/w_052.c b/src/weapon/w_052.c index 7e2e4d716d..b8a6a8f055 100644 --- a/src/weapon/w_052.c +++ b/src/weapon/w_052.c @@ -2,6 +2,10 @@ // Alucard shield, Unknown#214 #include "weapon_private.h" #include "shared.h" +#include "w_052_1.h" +#include "w_052_2.h" +#define g_Animset w_052_1 +#define g_Animset2 w_052_2 extern SpriteParts D_170000_8017A040[]; extern s8 D_170000_8017AB3C[]; diff --git a/src/weapon/w_053.c b/src/weapon/w_053.c index 91f9b45cd8..55f1634382 100644 --- a/src/weapon/w_053.c +++ b/src/weapon/w_053.c @@ -3,6 +3,10 @@ // Unknown#193, Unknown#194 #include "weapon_private.h" #include "shared.h" +#include "w_053_1.h" +#include "w_053_2.h" +#define g_Animset w_053_1 +#define g_Animset2 w_053_2 INCLUDE_ASM("weapon/nonmatchings/w_053", EntityWeaponAttack); diff --git a/src/weapon/w_054.c b/src/weapon/w_054.c index 43ce8cccf3..49cc12aab3 100644 --- a/src/weapon/w_054.c +++ b/src/weapon/w_054.c @@ -2,6 +2,10 @@ // Gurthang, Unknown#195 #include "weapon_private.h" #include "shared.h" +#include "w_054_1.h" +#include "w_054_2.h" +#define g_Animset w_054_1 +#define g_Animset2 w_054_2 INCLUDE_ASM("weapon/nonmatchings/w_054", EntityWeaponAttack); diff --git a/src/weapon/w_055.c b/src/weapon/w_055.c index 6571a8fbd0..4c01c6540e 100644 --- a/src/weapon/w_055.c +++ b/src/weapon/w_055.c @@ -2,6 +2,10 @@ // Holy sword, Unknown#196 #include "weapon_private.h" #include "shared.h" +#include "w_055_1.h" +#include "w_055_2.h" +#define g_Animset w_055_1 +#define g_Animset2 w_055_2 INCLUDE_ASM("weapon/nonmatchings/w_055", EntityWeaponAttack); diff --git a/src/weapon/w_056.c b/src/weapon/w_056.c index 0bb38f6dcc..070c579c30 100644 --- a/src/weapon/w_056.c +++ b/src/weapon/w_056.c @@ -2,6 +2,10 @@ // Muramasa #include "weapon_private.h" #include "shared.h" +#include "w_056_1.h" +#include "w_056_2.h" +#define g_Animset w_056_1 +#define g_Animset2 w_056_2 INCLUDE_ASM("weapon/nonmatchings/w_056", EntityWeaponAttack); diff --git a/src/weapon/w_057.c b/src/weapon/w_057.c index 7597368c61..b86fa78f86 100644 --- a/src/weapon/w_057.c +++ b/src/weapon/w_057.c @@ -2,6 +2,10 @@ // Mablung Sword #include "weapon_private.h" #include "shared.h" +#include "w_057_1.h" +#include "w_057_2.h" +#define g_Animset w_057_1 +#define g_Animset2 w_057_2 extern WeaponAnimation D_193000_8017B06C[]; diff --git a/src/weapon/w_058.c b/src/weapon/w_058.c index 775b6640ac..074cf2b0f3 100644 --- a/src/weapon/w_058.c +++ b/src/weapon/w_058.c @@ -2,6 +2,10 @@ // Alucart shield, Unknown#215 #include "weapon_private.h" #include "shared.h" +#include "w_058_1.h" +#include "w_058_2.h" +#define g_Animset w_058_1 +#define g_Animset2 w_058_2 extern SpriteParts D_19A000_8017A040[]; extern s8 D_19A000_8017AB3C; From 568219b9c378860eefd7d9afd58dabb44c46c35b Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 10:12:57 +0100 Subject: [PATCH 06/24] Statically link w_000 --- src/pc/weapon_pc.c | 797 +----------------------------------- src/weapon/shared.h | 4 +- src/weapon/w_000.c | 30 +- src/weapon/weapon_private.h | 32 +- 4 files changed, 49 insertions(+), 814 deletions(-) diff --git a/src/pc/weapon_pc.c b/src/pc/weapon_pc.c index 6a89614f4a..660356842f 100644 --- a/src/pc/weapon_pc.c +++ b/src/pc/weapon_pc.c @@ -47,786 +47,21 @@ Weapon D_8017D000 = { func_ptr_80170028Dummy, }; -void w_000_EntityWeaponAttack(Entity* self); -s32 w_000_func_ptr_80170004(Entity* self); -void w_000_func_ptr_80170008(Entity* self); -void w_000_func_ptr_8017000C(Entity* self); -s32 w_000_func_ptr_80170010(Entity* self); -s32 w_000_func_ptr_80170014(Entity* self); -int w_000_GetWeaponId(void); -void w_000_LoadWeaponPalette(s32 clutIndex); -void w_000_EntityWeaponShieldSpell(Entity* self); -void w_000_func_ptr_80170024(Entity* self); -void w_000_func_ptr_80170028(Entity* self); - -Weapon g_Weapons[] = { - { - w_000_EntityWeaponAttack, - w_000_func_ptr_80170004, - w_000_func_ptr_80170008, - w_000_func_ptr_8017000C, - w_000_func_ptr_80170010, - w_000_func_ptr_80170014, - w_000_GetWeaponId, - w_000_LoadWeaponPalette, - w_000_EntityWeaponShieldSpell, - w_000_func_ptr_80170024, - w_000_func_ptr_80170028, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }, - { - EntityWeaponAttackDummy, - func_ptr_80170004Dummy, - func_ptr_80170008Dummy, - func_ptr_8017000CDummy, - func_ptr_80170010Dummy, - func_ptr_80170014Dummy, - GetWeaponIdDummy, - LoadWeaponPaletteDummy, - EntityWeaponShieldSpellDummy, - func_ptr_80170024Dummy, - func_ptr_80170028Dummy, - }}; +extern Weapon w_000_header; +Weapon* g_Weapons[] = { + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &w_000_header, &w_000_header, &w_000_header, +}; SpriteParts* g_Animset[1]; @@ -863,7 +98,7 @@ int readSubsetToBuf(char* filename, char* dest, size_t start, size_t size) { } void HandleWeapon0Prg(int fileId) { - memcpy(&D_8017A000, &g_Weapons[fileId], sizeof(Weapon)); + memcpy(&D_8017A000, g_Weapons[fileId], sizeof(Weapon)); // todo animsets } diff --git a/src/weapon/shared.h b/src/weapon/shared.h index fc161bb146..9411fe3614 100644 --- a/src/weapon/shared.h +++ b/src/weapon/shared.h @@ -2,7 +2,7 @@ #include "../destroy_entity.h" -void OVL_EXPORT(LoadWeaponPalette)(s32 clutIndex) { +static void LoadWeaponPalette(s32 clutIndex) { RECT dstRect; u16* src; u16* dst; @@ -144,7 +144,7 @@ void SetWeaponProperties(Entity* self, s32 kind) { } } -Weapon g_Weapon = { +Weapon OVL_EXPORT(header) = { EntityWeaponAttack, func_ptr_80170004, func_ptr_80170008, func_ptr_8017000C, func_ptr_80170010, func_ptr_80170014, GetWeaponId, LoadWeaponPalette, EntityWeaponShieldSpell, diff --git a/src/weapon/w_000.c b/src/weapon/w_000.c index 70718ba413..4d5028ecc8 100644 --- a/src/weapon/w_000.c +++ b/src/weapon/w_000.c @@ -192,7 +192,7 @@ u16* g_WeaponCluts[] = { s32 g_HandId = HAND_ID; -void OVL_EXPORT(EntityWeaponAttack)(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s32 mask; s16 subType; @@ -245,30 +245,30 @@ void OVL_EXPORT(EntityWeaponAttack)(Entity* self) { self->rotPivotY = PLAYER.rotPivotY; } -s32 OVL_EXPORT(func_ptr_80170004)(Entity* self) {} +static s32 func_ptr_80170004(Entity* self) {} -void OVL_EXPORT(func_ptr_80170008)(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void OVL_EXPORT(func_ptr_8017000C)(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 OVL_EXPORT(func_ptr_80170010)(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 OVL_EXPORT(func_ptr_80170014)(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int OVL_EXPORT(GetWeaponId)(void) { return 0; } +static int GetWeaponId(void) { return 0; } -void OVL_EXPORT(EntityWeaponShieldSpell)(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void OVL_EXPORT(func_ptr_80170024)(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void OVL_EXPORT(func_ptr_80170028)(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/weapon_private.h b/src/weapon/weapon_private.h index 0b67c7c79c..8ffbadc311 100644 --- a/src/weapon/weapon_private.h +++ b/src/weapon/weapon_private.h @@ -24,22 +24,22 @@ #endif // exported -void EntityWeaponAttack(Entity* self); -void LoadWeaponPalette(s32 clutIndex); -s32 func_ptr_80170004(Entity* self); -void func_ptr_80170008(Entity* self); -void func_ptr_8017000C(Entity* self); -s32 func_ptr_80170010(Entity* self); -s32 func_ptr_80170014(Entity* self); -int GetWeaponId(void); -void EntityWeaponShieldSpell(Entity* self); -void func_ptr_80170024(Entity* self); -void func_ptr_80170028(Entity* self); -void WeaponUnused2C(void); -void WeaponUnused30(void); -void WeaponUnused34(void); -void WeaponUnused38(void); -void WeaponUnused3C(void); +static void EntityWeaponAttack(Entity* self); +static void LoadWeaponPalette(s32 clutIndex); +static s32 func_ptr_80170004(Entity* self); +static void func_ptr_80170008(Entity* self); +static void func_ptr_8017000C(Entity* self); +static s32 func_ptr_80170010(Entity* self); +static s32 func_ptr_80170014(Entity* self); +static int GetWeaponId(void); +static void EntityWeaponShieldSpell(Entity* self); +static void func_ptr_80170024(Entity* self); +static void func_ptr_80170028(Entity* self); +static void WeaponUnused2C(void); +static void WeaponUnused30(void); +static void WeaponUnused34(void); +static void WeaponUnused38(void); +static void WeaponUnused3C(void); // internals extern SpriteParts* g_Animset[]; From 9ee18e99d901eba2c2ae6bf5a66743b7ac6c2842 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 10:18:42 +0100 Subject: [PATCH 07/24] Ignore Splat animset --- tools/splat_ext/animset.py | 148 +------------------------------------ 1 file changed, 3 insertions(+), 145 deletions(-) diff --git a/tools/splat_ext/animset.py b/tools/splat_ext/animset.py index aa2b04f3cc..8823e26638 100755 --- a/tools/splat_ext/animset.py +++ b/tools/splat_ext/animset.py @@ -1,8 +1,5 @@ #!/usr/bin/python3 -import argparse -import json -import io import os import sys from typing import Optional @@ -12,102 +9,6 @@ sys.path.append(f"{os.getcwd()}/tools/splat_ext") from splat.util import options from splat.segtypes.n64.segment import N64Segment -import utils - - -item_size = 0x16 # sizeof(SpritePart) - - -def parse_spriteparts(data: bytearray) -> list: - count = utils.to_s16(data[0:]) - items = [] - data = data[2:] - for i in range(0, count): - items.append( - { - "flags": utils.to_s16(data[0:]), - "offsetx": utils.to_s16(data[2:]), - "offsety": utils.to_s16(data[4:]), - "width": utils.to_s16(data[6:]), - "height": utils.to_s16(data[8:]), - "clut": utils.to_s16(data[10:]), - "tileset": utils.to_s16(data[12:]), - "left": utils.to_s16(data[14:]), - "top": utils.to_s16(data[16:]), - "right": utils.to_s16(data[18:]), - "bottom": utils.to_s16(data[20:]), - } - ) - data = data[item_size:] - return items - - -def parse_animset(start_ptr, data: bytearray) -> list: - end_ptr = start_ptr + len(data) - assumed_list_end = len(data) - spriteparts_offsets = [] - for i in range(0, len(data), 4): - if i >= assumed_list_end: - break - ptr = utils.to_u32(data[i:]) - if ptr != 0: - if ptr < start_ptr or ptr >= end_ptr: - utils.log_fatal( - f"spriteparts list pointer 0x{ptr:X} is out of bounds (start:{start_ptr:X}, end:{end_ptr:X})" - ) - offset = ptr - start_ptr - assumed_list_end = min(assumed_list_end, offset) - spriteparts_offsets.append(offset) - else: - spriteparts_offsets.append(0) - - animset = [] - for offset in spriteparts_offsets: - if offset != 0: - animset.append(parse_spriteparts(data[offset:])) - else: - animset.append(None) - return animset - - -def write_animset_list_as_asm(writer: io.BufferedWriter, name: str, content: str): - animset = json.loads(content) - - writer.write(".section .data\n") - writer.write(f".global {name}\n") - writer.write(f"{name}:\n") - - for i, spriteparts in enumerate(animset): - if spriteparts != None: - writer.write(f".word {name}_{i}\n") - else: - writer.write(".word 0\n") - - for i, spriteparts in enumerate(animset): - if spriteparts == None: - continue - n_parts = len(spriteparts) - writer.write(f".global {name}_{i}\n") - writer.write(f"{name}_{i}:\n") - writer.write(f".half {n_parts}\n") - for i, part in enumerate(spriteparts): - writer.write(f"# part {i}\n") - writer.write(f".half {part['flags']}\n") - writer.write(f".half {part['offsetx']}\n") - writer.write(f".half {part['offsety']}\n") - writer.write(f".half {part['width']}\n") - writer.write(f".half {part['height']}\n") - writer.write(f".half {part['clut']}\n") - writer.write(f".half {part['tileset']}\n") - writer.write(f".half {part['left']}\n") - writer.write(f".half {part['top']}\n") - writer.write(f".half {part['right']}\n") - writer.write(f".half {part['bottom']}\n") - # now align by 4 - if (n_parts % 2) == 1: - writer.write(f".word 0 # terminator\n") - else: - writer.write(f".half 0 # terminator\n") class PSXSegAnimset(N64Segment): @@ -121,52 +22,9 @@ def src_path(self) -> Optional[Path]: return options.opts.asset_path / self.dir / f"{self.name}.animset.json" def split(self, rom_bytes): - path = self.src_path() - path.parent.mkdir(parents=True, exist_ok=True) - - data = parse_animset( - self.vram_start, - rom_bytes[self.rom_start : self.rom_end], - ) - with open(path, "w") as f: - f.write(json.dumps(data, indent=4)) - - -def get_file_name(full_path): - file_name = os.path.basename(full_path) - exts = os.path.splitext(file_name) - if len(exts) > 1 and len(exts[1]) > 0: - return get_file_name(exts[0]) - return exts[0] + return if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="De/serialize a list of animation sets" - ) - subparsers = parser.add_subparsers(dest="command") - - gen_asm_parser = subparsers.add_parser( - "gen-asm", - description="Generate assembly code from an already parsed JSON", - ) - gen_asm_parser.add_argument( - "input", - help="The animset parsed in JSON to convert", - ) - gen_asm_parser.add_argument( - "output", - help="Generates the correspondent assembly code", - ) - gen_asm_parser.add_argument( - "-s", "--symbol", required=False, type=str, help="Assign a custom symbol name" - ) - - args = parser.parse_args() - if args.command == "gen-asm": - symbol_name = args.symbol - if symbol_name is None: - symbol_name = get_file_name(args.input) - with open(args.input, "r") as f_in: - with open(args.output, "w") as f_out: - write_animset_list_as_asm(f_out, symbol_name, f_in.read()) + print("dummy") + exit(1) From 206557c99d02b1869517490632acb27e67d706eb Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 10:24:31 +0100 Subject: [PATCH 08/24] Makefile clean-up --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index c6842c2648..b0a3f8d4c6 100644 --- a/Makefile +++ b/Makefile @@ -471,9 +471,6 @@ $(SOTNASSETS): $(GO) $(SOTNASSETS_SOURCES) $(BUILD_DIR)/$(ASSETS_DIR)/%.spritesheet.json.o: $(ASSETS_DIR)/%.spritesheet.json ./tools/splat_ext/spritesheet.py encode $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.s $(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.s -$(BUILD_DIR)/$(ASSETS_DIR)/%.animset.json.o: $(ASSETS_DIR)/%.animset.json - ./tools/splat_ext/animset.py gen-asm $< $(BUILD_DIR)/$(ASSETS_DIR)/$*.s - $(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/$*.s $(BUILD_DIR)/$(ASSETS_DIR)/dra/%.json.o: $(ASSETS_DIR)/dra/%.json ./tools/splat_ext/assets.py $< $(BUILD_DIR)/$(ASSETS_DIR)/dra/$*.s $(AS) $(AS_FLAGS) -o $(BUILD_DIR)/$(ASSETS_DIR)/dra/$*.o $(BUILD_DIR)/$(ASSETS_DIR)/dra/$*.s From ad0744355e1dada87c5c0f8ded92e448c352e6bd Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 10:40:12 +0100 Subject: [PATCH 09/24] Fix HD build --- Makefile.psx.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.psx.mk b/Makefile.psx.mk index c5f92c5f2e..dff9e6e6f8 100644 --- a/Makefile.psx.mk +++ b/Makefile.psx.mk @@ -20,7 +20,7 @@ extract_us: $(addprefix $(BUILD_DIR)/,$(addsuffix .ld,$(PSX_US_TARGETS))) make build_assets extract_hd: $(addprefix $(BUILD_DIR)/,$(addsuffix .ld,$(PSX_HD_TARGETS))) make extract_assets_hd - make build_assets + make build_assets_hd extract_disk_us: extract_disk_psxus extract_disk_hd: extract_disk_pspeu @@ -102,7 +102,9 @@ build_assets: $(SOTNASSETS) $(SOTNASSETS) stage build_all -i assets/st/st0 -o src/st/st0/ $(SOTNASSETS) stage build_all -i assets/st/wrp -o src/st/wrp/ $(SOTNASSETS) stage build_all -i assets/st/rwrp -o src/st/rwrp/ - $(SOTNASSETS) config build config/assets.us.weapon.yaml + $(SOTNASSETS) config build config/assets.$(VERSION).weapon.yaml +build_assets_hd: $(SOTNASSETS) + $(SOTNASSETS) stage build_all -i assets/st/wrp -o src/st/wrp/ $(BUILD_DIR)/assets/dra/memcard_%.png.o: assets/dra/memcard_%.png mkdir -p $(dir $@) From 7ea6258919efbbdf4639216d1d284345d652c788 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 10:44:46 +0100 Subject: [PATCH 10/24] Parallel asset build --- tools/sotn-assets/asset_config.go | 32 +++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/tools/sotn-assets/asset_config.go b/tools/sotn-assets/asset_config.go index ea8ffa17ce..673e9ae855 100644 --- a/tools/sotn-assets/asset_config.go +++ b/tools/sotn-assets/asset_config.go @@ -138,7 +138,6 @@ func enqueueExtractAssetEntry( } return nil }) - eg.Wait() } func extractAssetFile(file assetFileEntry) error { @@ -185,6 +184,25 @@ func extractAssetFile(file assetFileEntry) error { return eg.Wait() } +func enqueueBuildAssetEntry( + eg errgroup.Group, + handler func(assetBuildEntry) error, + assetDir, + sourceDir, + name string) { + eg.Go(func() error { + err := handler(assetBuildEntry{ + assetDir: assetDir, + srcDir: sourceDir, + name: name, + }) + if err != nil { + return fmt.Errorf("unable to build asset %q: %v", name, err) + } + return nil + }) +} + func extractFromConfig(c *assetConfig) error { var eg errgroup.Group for _, file := range c.Files { @@ -199,6 +217,7 @@ func extractFromConfig(c *assetConfig) error { } func buildAssetFile(file assetFileEntry) error { + var eg errgroup.Group for _, segment := range file.Segments { if len(segment.Assets) == 0 { continue @@ -217,18 +236,11 @@ func buildAssetFile(file assetFileEntry) error { name = args[0] args = args[1:] } - err := handler(assetBuildEntry{ - assetDir: file.AssetDir, - srcDir: file.SourceDir, - name: name, - }) - if err != nil { - return err - } + enqueueBuildAssetEntry(eg, handler, file.AssetDir, file.SourceDir, name) } } } - return nil + return eg.Wait() } func buildFromConfig(c *assetConfig) error { From 9c6d7aaac7021387a26dc470fcc792a66e7df993 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 11:08:25 +0100 Subject: [PATCH 11/24] MT fixes --- Makefile | 1 + tools/sotn-assets/asset_config.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b0a3f8d4c6..091c78056b 100644 --- a/Makefile +++ b/Makefile @@ -130,6 +130,7 @@ clean: git clean -fdx assets/ git clean -fdx asm/$(VERSION)/ git clean -fdx build/$(VERSION)/ + git clean -fdx $(SRC_DIR)/weapon git clean -fdx config/ git clean -fdx function_calls/ git clean -fdx sotn_calltree.txt diff --git a/tools/sotn-assets/asset_config.go b/tools/sotn-assets/asset_config.go index 673e9ae855..5cd382331d 100644 --- a/tools/sotn-assets/asset_config.go +++ b/tools/sotn-assets/asset_config.go @@ -115,7 +115,7 @@ func readConfig(path string) (*assetConfig, error) { } func enqueueExtractAssetEntry( - eg errgroup.Group, + eg *errgroup.Group, handler func(assetEntry) error, assetDir string, name string, @@ -174,7 +174,7 @@ func extractAssetFile(file assetFileEntry) error { } start := int(off) - segment.Start end := start + size - enqueueExtractAssetEntry(eg, handler, file.AssetDir, name, data[segment.Start:], start, end, args, segment.Vram) + enqueueExtractAssetEntry(&eg, handler, file.AssetDir, name, data[segment.Start:], start, end, args, segment.Vram) } off = off2 kind = kind2 @@ -185,7 +185,7 @@ func extractAssetFile(file assetFileEntry) error { } func enqueueBuildAssetEntry( - eg errgroup.Group, + eg *errgroup.Group, handler func(assetBuildEntry) error, assetDir, sourceDir, @@ -236,7 +236,7 @@ func buildAssetFile(file assetFileEntry) error { name = args[0] args = args[1:] } - enqueueBuildAssetEntry(eg, handler, file.AssetDir, file.SourceDir, name) + enqueueBuildAssetEntry(&eg, handler, file.AssetDir, file.SourceDir, name) } } } From be5a2fe3e32f47b803ac8a982e1bae4117469ed6 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 11:16:51 +0100 Subject: [PATCH 12/24] Mark all weapon symbols as static --- src/weapon/shared.h | 10 +++++----- src/weapon/w_000.c | 46 ++++++++++++++++++++++----------------------- src/weapon/w_001.c | 26 ++++++++++++------------- src/weapon/w_002.c | 28 +++++++++++++-------------- src/weapon/w_003.c | 28 +++++++++++++-------------- src/weapon/w_004.c | 28 +++++++++++++-------------- src/weapon/w_005.c | 26 ++++++++++++------------- src/weapon/w_006.c | 26 ++++++++++++------------- src/weapon/w_007.c | 26 ++++++++++++------------- src/weapon/w_008.c | 26 ++++++++++++------------- src/weapon/w_009.c | 26 ++++++++++++------------- src/weapon/w_010.c | 28 +++++++++++++-------------- src/weapon/w_011.c | 24 +++++++++++------------ src/weapon/w_012.c | 26 ++++++++++++------------- src/weapon/w_013.c | 28 +++++++++++++-------------- src/weapon/w_014.c | 26 ++++++++++++------------- src/weapon/w_015.c | 22 +++++++++++----------- src/weapon/w_016.c | 24 +++++++++++------------ src/weapon/w_017.c | 26 ++++++++++++------------- src/weapon/w_018.c | 30 ++++++++++++++--------------- src/weapon/w_019.c | 26 ++++++++++++------------- src/weapon/w_020.c | 28 +++++++++++++-------------- src/weapon/w_021.c | 28 +++++++++++++-------------- src/weapon/w_022.c | 26 ++++++++++++------------- src/weapon/w_023.c | 28 +++++++++++++-------------- src/weapon/w_024.c | 28 +++++++++++++-------------- src/weapon/w_025.c | 28 +++++++++++++-------------- src/weapon/w_026.c | 28 +++++++++++++-------------- src/weapon/w_027.c | 32 +++++++++++++++---------------- src/weapon/w_028.c | 28 +++++++++++++-------------- src/weapon/w_029.c | 28 +++++++++++++-------------- src/weapon/w_030.c | 22 +++++++++++----------- src/weapon/w_031.c | 26 ++++++++++++------------- src/weapon/w_032.c | 26 ++++++++++++------------- src/weapon/w_033.c | 26 ++++++++++++------------- src/weapon/w_034.c | 28 +++++++++++++-------------- src/weapon/w_035.c | 28 +++++++++++++-------------- src/weapon/w_036.c | 28 +++++++++++++-------------- src/weapon/w_037.c | 28 +++++++++++++-------------- src/weapon/w_038.c | 28 +++++++++++++-------------- src/weapon/w_039.c | 28 +++++++++++++-------------- src/weapon/w_040.c | 28 +++++++++++++-------------- src/weapon/w_041.c | 26 ++++++++++++------------- src/weapon/w_042.c | 32 +++++++++++++++---------------- src/weapon/w_043.c | 26 ++++++++++++------------- src/weapon/w_044.c | 26 ++++++++++++------------- src/weapon/w_045.c | 26 ++++++++++++------------- src/weapon/w_046.c | 26 ++++++++++++------------- src/weapon/w_047.c | 26 ++++++++++++------------- src/weapon/w_048.c | 24 +++++++++++------------ src/weapon/w_049.c | 20 ++++++++++---------- src/weapon/w_050.c | 20 ++++++++++---------- src/weapon/w_051.c | 28 +++++++++++++-------------- src/weapon/w_052.c | 28 +++++++++++++-------------- src/weapon/w_053.c | 22 +++++++++++----------- src/weapon/w_054.c | 26 ++++++++++++------------- src/weapon/w_055.c | 26 ++++++++++++------------- src/weapon/w_056.c | 26 ++++++++++++------------- src/weapon/w_057.c | 26 ++++++++++++------------- src/weapon/w_058.c | 26 ++++++++++++------------- 60 files changed, 797 insertions(+), 797 deletions(-) diff --git a/src/weapon/shared.h b/src/weapon/shared.h index 9411fe3614..36085cd281 100644 --- a/src/weapon/shared.h +++ b/src/weapon/shared.h @@ -42,7 +42,7 @@ static void LoadWeaponPalette(s32 clutIndex) { LoadImage(&dstRect, &D_8006EDCC); } -void SetSpriteBank1(SpriteParts* animset) { +static void SetSpriteBank1(SpriteParts* animset) { SpritePart** spriteBankDst = g_api.o.spriteBanks; spriteBankDst += 0x10; @@ -52,7 +52,7 @@ void SetSpriteBank1(SpriteParts* animset) { *spriteBankDst = animset; } -void SetSpriteBank2(SpriteParts* animset) { +static void SetSpriteBank2(SpriteParts* animset) { SpritePart** spriteBankDst = g_api.o.spriteBanks; spriteBankDst += 0x11; @@ -63,7 +63,7 @@ void SetSpriteBank2(SpriteParts* animset) { } #if !defined(W_029) && !defined(W_030) && !defined(W_044) && !defined(W_051) -void SetWeaponAnimation(u8 anim) { +static void SetWeaponAnimation(u8 anim) { g_CurrentEntity->ext.weapon.anim = anim; g_CurrentEntity->animFrameDuration = 0; g_CurrentEntity->animFrameIdx = 0; @@ -108,7 +108,7 @@ static void SetSpeedX(s32 speed) { #endif #if !defined(W_030) && !defined(W_051) -void DestroyEntityWeapon(bool arg0) { +static void DestroyEntityWeapon(bool arg0) { if (arg0 == false) { DestroyEntity(&g_Entities[E_WEAPON]); } @@ -119,7 +119,7 @@ void DestroyEntityWeapon(bool arg0) { } #endif -void SetWeaponProperties(Entity* self, s32 kind) { +static void SetWeaponProperties(Entity* self, s32 kind) { Equipment equip; g_api.GetEquipProperties(g_HandId, &equip, self->ext.weapon.equipId); diff --git a/src/weapon/w_000.c b/src/weapon/w_000.c index 9d5003bd23..91f5a65bbc 100644 --- a/src/weapon/w_000.c +++ b/src/weapon/w_000.c @@ -12,7 +12,7 @@ #define g_Animset2 w_000_2 #include "sfx.h" -u16 g_Clut0[] = { +static u16 g_Clut0[] = { 0x0000, 0x8000, 0xA821, 0x9DC0, 0xA821, 0xA821, 0xA821, 0xA821, // 0 0x843F, 0xB0E4, 0x9CA4, 0x0000, 0x0000, 0x0000, 0xD294, 0xF2F3, 0x0000, 0x8000, 0x0000, 0x0000, 0x0000, 0xED8C, 0xED8C, 0xED8C, // 1 @@ -29,7 +29,7 @@ u16 g_Clut0[] = { 0x843F, 0xB9C0, 0x801F, 0x0000, 0x0000, 0x0000, 0xD294, 0xEA90, }; -u16 g_Clut1[] = { +static u16 g_Clut1[] = { 0x0000, 0x8007, 0xAD6B, 0xAD6B, 0xAD6B, 0xAD6B, 0xAD6B, 0xAD6B, // 0 0x843F, 0xB148, 0xA928, 0x0000, 0x0000, 0x0000, 0xD294, 0xF39C, 0x0000, 0x8007, 0x0000, 0x0000, 0x0000, 0xE717, 0xE717, 0xE717, // 1 @@ -46,7 +46,7 @@ u16 g_Clut1[] = { 0x843F, 0xB9C0, 0x801F, 0x0000, 0x0000, 0x0000, 0xD294, 0xEB5A, }; -u16 g_Clut2[] = { +static u16 g_Clut2[] = { 0x0000, 0x8000, 0x800F, 0x800F, 0x800F, 0x800F, 0x800F, 0x800F, // 0 0x83E0, 0x800F, 0x8CB4, 0x0000, 0x0000, 0x0000, 0xD294, 0xCF1C, 0x0000, 0x8000, 0x0000, 0x0000, 0x0000, 0xA818, 0xB0B8, 0xAC38, // 1 @@ -63,7 +63,7 @@ u16 g_Clut2[] = { 0x83E0, 0xB9C0, 0x801F, 0x0000, 0x0000, 0x0000, 0xD294, 0x9E1C, }; -u16 g_Clut3[] = { +static u16 g_Clut3[] = { 0x0000, 0x8000, 0x8900, 0x8900, 0x8900, 0x8900, 0x8902, 0x8904, // 0 0x843F, 0x9541, 0x95E1, 0x0000, 0x0000, 0x0000, 0xD294, 0xF2D1, 0x0000, 0x8000, 0x0000, 0x0000, 0x0000, 0xA208, 0xA208, 0xA208, // 1 @@ -80,7 +80,7 @@ u16 g_Clut3[] = { 0x843F, 0xB9C0, 0x801F, 0x0000, 0x0000, 0x0000, 0xD294, 0xB792, }; -u16 g_Clut4[] = { +static u16 g_Clut4[] = { 0x0000, 0x8000, 0x817F, 0x81B6, 0x81DF, 0x827F, 0xA2FE, 0xD77F, // 0 0x843F, 0x819E, 0x9A1F, 0x0000, 0x0000, 0x0000, 0xD294, 0xF39C, 0x0000, 0x8000, 0x0000, 0x0000, 0x0000, 0xB77D, 0xB77D, 0xB77D, // 1 @@ -97,69 +97,69 @@ u16 g_Clut4[] = { 0x843F, 0xB9C0, 0x801F, 0x0000, 0x0000, 0x0000, 0xD294, 0xF39C, }; -u8 g_Anim0Frame0[] = { +static u8 g_Anim0Frame0[] = { 0x01, 0x02, 0x02, 0x04, 0x03, 0x04, 0x04, 0x04, 0x05, 0x04, 0x06, 0x06, 0x07, 0x06, 0x08, 0x06, 0x09, 0x06, 0x0A, 0x08, 0x0B, 0x08, 0x0C, 0x08, 0x0D, 0x08, 0xFF, 0xFF, }; -u8 g_Anim0Frame1[] = { +static u8 g_Anim0Frame1[] = { 0x0E, 0x0A, 0x0F, 0x0C, 0x10, 0x0C, 0x11, 0x0C, 0x12, 0x0C, 0x13, 0x0E, 0x14, 0x0E, 0x15, 0x0E, 0x16, 0x0E, 0x1F, 0x08, 0x20, 0x08, 0x21, 0x08, 0x22, 0x08, 0xFF, 0xFF, }; -u8 g_Anim0Frame2[] = { +static u8 g_Anim0Frame2[] = { 0x0E, 0x0A, 0x17, 0x10, 0x18, 0x12, 0x19, 0x10, 0x1A, 0x12, 0x1B, 0x14, 0x1C, 0x14, 0x1D, 0x14, 0x1E, 0x14, 0x1F, 0x08, 0x20, 0x08, 0x21, 0x08, 0x22, 0x08, 0xFF, 0xFF}; -u8 g_Anim0Frame3[] = { +static u8 g_Anim0Frame3[] = { 0x23, 0x16, 0x24, 0x18, 0x25, 0x18, 0x26, 0x18, 0x27, 0x18, 0x28, 0x1A, 0x29, 0x1A, 0x2A, 0x1A, 0x2B, 0x1A, 0x2C, 0x08, 0xFF, 0xFF, 0x00, 0x00}; -u8 g_Anim0Frame4[] = { +static u8 g_Anim0Frame4[] = { 0x2D, 0x1C, 0x2E, 0x1E, 0x2F, 0x1E, 0x30, 0x1E, 0x31, 0x1E, 0x32, 0x20, 0x33, 0x20, 0x34, 0x20, 0x35, 0x20, 0x3E, 0x08, 0xFF, 0xFF, 0x00, 0x00}; -u8 g_Anim0Frame5[] = { +static u8 g_Anim0Frame5[] = { 0x2D, 0x1C, 0x36, 0x22, 0x37, 0x22, 0x38, 0x22, 0x39, 0x22, 0x3A, 0x24, 0x3B, 0x24, 0x3C, 0x24, 0x3D, 0x24, 0x3E, 0x08, 0xFF, 0xFF, 0x00, 0x00}; -u8 g_Anim1Frame0[] = { +static u8 g_Anim1Frame0[] = { 0x01, 0x02, 0x3F, 0x26, 0x40, 0x26, 0x41, 0x26, 0x06, 0x06, 0x07, 0x06, 0x08, 0x06, 0x09, 0x06, 0x0A, 0x08, 0x0B, 0x08, 0x0C, 0x08, 0x0D, 0x08, 0xFF, 0xFF, 0x00, 0x00, }; -u8 g_Anim1Frame1[] = { +static u8 g_Anim1Frame1[] = { 0x0E, 0x0A, 0x42, 0x28, 0x43, 0x28, 0x44, 0x28, 0x13, 0x0E, 0x14, 0x0E, 0x15, 0x0E, 0x16, 0x0E, 0x1F, 0x08, 0x20, 0x08, 0x21, 0x08, 0x22, 0x08, 0xFF, 0xFF, 0x00, 0x00, }; -u8 g_Anim1Frame2[] = { +static u8 g_Anim1Frame2[] = { 0x0E, 0x0A, 0x45, 0x2A, 0x46, 0x2A, 0x47, 0x2A, 0x1B, 0x14, 0x1C, 0x14, 0x1D, 0x14, 0x1E, 0x14, 0x1F, 0x08, 0x20, 0x08, 0x21, 0x08, 0x22, 0x08, 0xFF, 0xFF, 0x00, 0x00, }; -u8 g_Anim1Frame3[] = { +static u8 g_Anim1Frame3[] = { 0x23, 0x16, 0x48, 0x2C, 0x49, 0x2C, 0x4A, 0x2C, 0x28, 0x1A, 0x29, 0x1A, 0x2A, 0x1A, 0x2B, 0x1A, 0x2C, 0x08, 0xFF, 0xFF, }; -u8 g_Anim1Frame4[] = { +static u8 g_Anim1Frame4[] = { 0x2D, 0x1C, 0x4B, 0x2E, 0x4C, 0x2E, 0x4D, 0x2E, 0x32, 0x20, 0x33, 0x20, 0x34, 0x20, 0x35, 0x20, 0x3E, 0x08, 0xFF, 0xFF, }; -u8 g_Anim1Frame5[] = { +static u8 g_Anim1Frame5[] = { 0x2D, 0x1C, 0x4E, 0x30, 0x4F, 0x30, 0x50, 0x30, 0x3A, 0x24, 0x3B, 0x24, 0x3C, 0x24, 0x3D, 0x24, 0x3E, 0x08, 0xFF, 0xFF, }; -s8 g_Hitboxes[][4] = { +static s8 g_Hitboxes[][4] = { {0, 0, 0, 0}, {4, -23, 8, 5}, {30, -17, 35, 8}, {30, -14, 18, 4}, {-32, -31, 0, 0}, {-4, -6, 8, 5}, {22, 0, 35, 8}, {22, 3, 18, 4}, {29, 22, 13, 11}, {12, 7, 19, 12}, {14, 14, 18, 4}, {1, -25, 8, 5}, @@ -169,17 +169,17 @@ s8 g_Hitboxes[][4] = { {22, 3, 26, 10}, }; -u8* g_Anim0[] = { +static u8* g_Anim0[] = { g_Anim0Frame0, g_Anim0Frame0, g_Anim0Frame1, g_Anim0Frame2, g_Anim0Frame3, g_Anim0Frame4, g_Anim0Frame5, }; -u8* g_Anim1[] = { +static u8* g_Anim1[] = { g_Anim1Frame0, g_Anim1Frame0, g_Anim1Frame1, g_Anim1Frame2, g_Anim1Frame3, g_Anim1Frame4, g_Anim1Frame5, }; -WeaponAnimation g_SoundEvents[] = { +static WeaponAnimation g_SoundEvents[] = { {g_Anim1, g_Hitboxes, 0, SFX_WEAPON_SWISH_B, 0x41, 4}, {g_Anim0, g_Hitboxes, 0, SFX_WEAPON_SWISH_B, 0x41, 4}, {g_Anim0, g_Hitboxes, 0, SFX_WEAPON_SWISH_C, 0x41, 4}, @@ -187,11 +187,11 @@ WeaponAnimation g_SoundEvents[] = { {g_Anim0, g_Hitboxes, 0, SFX_WEAPON_SWISH_C, 0x41, 4}, }; -u16* g_WeaponCluts[] = { +static u16* g_WeaponCluts[] = { g_Clut1, g_Clut0, g_Clut2, g_Clut3, g_Clut4, }; -s32 g_HandId = HAND_ID; +static s32 g_HandId = HAND_ID; static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; diff --git a/src/weapon/w_001.c b/src/weapon/w_001.c index 35e452d794..bee58072ff 100644 --- a/src/weapon/w_001.c +++ b/src/weapon/w_001.c @@ -15,7 +15,7 @@ INCLUDE_ASM("weapon/nonmatchings/w_001", func_ptr_80170004); extern AnimationFrame D_B000_8017AFC8[]; -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { switch (self->step) { case 0: self->flags = FLAG_UNK_08000000 | FLAG_UNK_100000; @@ -61,26 +61,26 @@ void func_ptr_80170008(Entity* self) { } } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 1; } +static int GetWeaponId(void) { return 1; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_002.c b/src/weapon/w_002.c index 3736af570e..d7b8cf6033 100644 --- a/src/weapon/w_002.c +++ b/src/weapon/w_002.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_12000_8017ABC4[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -61,28 +61,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 2; } +static int GetWeaponId(void) { return 2; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_003.c b/src/weapon/w_003.c index 47412eb9cb..214c860715 100644 --- a/src/weapon/w_003.c +++ b/src/weapon/w_003.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_19000_8017AC28[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -63,28 +63,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 3; } +static int GetWeaponId(void) { return 3; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_004.c b/src/weapon/w_004.c index e558fe3036..75b3316d5a 100644 --- a/src/weapon/w_004.c +++ b/src/weapon/w_004.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_20000_8017B2F4[]; // g_SoundEvents -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s16 subType; @@ -63,28 +63,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 4; } +static int GetWeaponId(void) { return 4; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_005.c b/src/weapon/w_005.c index e6df13e297..3b1da95818 100644 --- a/src/weapon/w_005.c +++ b/src/weapon/w_005.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_005", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 5; } +static int GetWeaponId(void) { return 5; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_006.c b/src/weapon/w_006.c index 170552d217..589067e2a7 100644 --- a/src/weapon/w_006.c +++ b/src/weapon/w_006.c @@ -8,7 +8,7 @@ #define g_Animset2 w_006_2 extern WeaponAnimation D_2E000_8017ABC4[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -114,26 +114,26 @@ s32 func_2E000_8017B6A0(Primitive* prim, s32 x, s32 y) { INCLUDE_ASM("weapon/nonmatchings/w_006", func_ptr_80170008); -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 6; } +static int GetWeaponId(void) { return 6; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_007.c b/src/weapon/w_007.c index 12a3fba3cb..ab8c8cf429 100644 --- a/src/weapon/w_007.c +++ b/src/weapon/w_007.c @@ -61,7 +61,7 @@ s32 func_35000_8017B604(Primitive* prim, s32 x, s32 y) { return 0; } -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { Primitive* prim; s32 velocityX; s32 range; @@ -102,26 +102,26 @@ void func_ptr_80170008(Entity* self) { DestroyEntity(self); } } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 7; } +static int GetWeaponId(void) { return 7; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_008.c b/src/weapon/w_008.c index 10c2fc62ba..3bb0f8aafc 100644 --- a/src/weapon/w_008.c +++ b/src/weapon/w_008.c @@ -11,7 +11,7 @@ extern SpriteParts D_3C000_8017A040[]; extern s8 D_3C000_8017A9F8; extern AnimationFrame* D_3C000_8017AA40; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -147,28 +147,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 8; } +static int GetWeaponId(void) { return 8; } INCLUDE_ASM("weapon/nonmatchings/w_008", EntityWeaponShieldSpell); -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_009.c b/src/weapon/w_009.c index 32c126d18b..03e1289fb6 100644 --- a/src/weapon/w_009.c +++ b/src/weapon/w_009.c @@ -11,7 +11,7 @@ extern SpriteParts D_43000_8017A040[]; extern s8 D_43000_8017A9F8; extern AnimationFrame* D_43000_8017AA40; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -147,28 +147,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 9; } +static int GetWeaponId(void) { return 9; } INCLUDE_ASM("weapon/nonmatchings/w_009", EntityWeaponShieldSpell); -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_010.c b/src/weapon/w_010.c index ce13124ad1..3cc65a617a 100644 --- a/src/weapon/w_010.c +++ b/src/weapon/w_010.c @@ -14,7 +14,7 @@ extern AnimationFrame* D_4A000_8017AB68; extern s32 D_4A000_8017CC1C; // g_DebugWaitInfoTimer -void DebugShowWaitInfo(const char* msg) { +static void DebugShowWaitInfo(const char* msg) { g_CurrentBuffer = g_CurrentBuffer->next; FntPrint(msg); if (D_4A000_8017CC1C++ & 4) { @@ -27,14 +27,14 @@ void DebugShowWaitInfo(const char* msg) { FntFlush(-1); } -void DebugInputWait(const char* msg) { +static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); while (!PadRead(0)) DebugShowWaitInfo(msg); } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -206,28 +206,28 @@ s32 func_ptr_80170004(Entity* self) { } } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 10; } +static int GetWeaponId(void) { return 10; } INCLUDE_ASM("weapon/nonmatchings/w_010", EntityWeaponShieldSpell); INCLUDE_ASM("weapon/nonmatchings/w_010", func_ptr_80170024); -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_011.c b/src/weapon/w_011.c index cc8a728da0..461da7a6b4 100644 --- a/src/weapon/w_011.c +++ b/src/weapon/w_011.c @@ -11,7 +11,7 @@ extern SpriteParts D_51000_8017A040[]; extern s8 D_51000_8017AB4C; extern AnimationFrame* D_51000_8017AB94; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -147,28 +147,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 11; } +static int GetWeaponId(void) { return 11; } INCLUDE_ASM("weapon/nonmatchings/w_011", EntityWeaponShieldSpell); INCLUDE_ASM("weapon/nonmatchings/w_011", func_ptr_80170024); -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_012.c b/src/weapon/w_012.c index a83c6439dc..42d9f73704 100644 --- a/src/weapon/w_012.c +++ b/src/weapon/w_012.c @@ -11,7 +11,7 @@ INCLUDE_ASM("weapon/nonmatchings/w_012", EntityWeaponAttack); INCLUDE_ASM("weapon/nonmatchings/w_012", func_ptr_80170004); -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { if (self->step == 0) { if (self->ext.weapon.parent->entityId == 0) { DestroyEntity(self); @@ -36,26 +36,26 @@ void func_ptr_80170008(Entity* self) { DestroyEntity(self); } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 12; } +static int GetWeaponId(void) { return 12; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_013.c b/src/weapon/w_013.c index e6612d8a98..18b2adc73c 100644 --- a/src/weapon/w_013.c +++ b/src/weapon/w_013.c @@ -66,7 +66,7 @@ s32 func_5F000_8017A9CC(Primitive* prim, s32 x, s32 y) { return 0; } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { Entity* unused; s16 var_s1; @@ -236,7 +236,7 @@ s32 func_ptr_80170004(Entity* self) { DestroyEntity(self); } -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { Entity* ents2; Primitive* prim; s16 angle; @@ -415,7 +415,7 @@ void func_ptr_80170008(Entity* self) { // Pay attention to unk80, unk8A, and childPalette. These all seem to be // special for Heaven Sword and we should probably have it as a special weapon. -void func_ptr_8017000C(Entity* self) { +static void func_ptr_8017000C(Entity* self) { s16 angle; if (self->ext.weapon.parent->entityId == 0) { @@ -477,24 +477,24 @@ void func_ptr_8017000C(Entity* self) { } } -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 13; } +static int GetWeaponId(void) { return 13; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_014.c b/src/weapon/w_014.c index 2189ebbf63..5092f5f055 100644 --- a/src/weapon/w_014.c +++ b/src/weapon/w_014.c @@ -59,28 +59,28 @@ s32 func_ptr_80170004(Entity* self) { self->posY.i.hi = baseY + self->ext.weapon.parent->posY.i.hi; } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 14; } +static int GetWeaponId(void) { return 14; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_015.c b/src/weapon/w_015.c index 580eb57c6d..5fe1f72299 100644 --- a/src/weapon/w_015.c +++ b/src/weapon/w_015.c @@ -36,7 +36,7 @@ s32 func_ptr_80170004(Entity* self) { extern AnimationFrame D_6D000_8017A6C0[]; extern s32 D_6D000_8017BFC8; -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { Entity* factory; if (self->step == 0) { @@ -81,7 +81,7 @@ INCLUDE_ASM("weapon/nonmatchings/w_015", func_ptr_80170010); extern SpriteParts D_6D000_8017A2B0[]; extern AnimationFrame D_6D000_8017A770[]; -s32 func_ptr_80170014(Entity* self) { +static s32 func_ptr_80170014(Entity* self) { s16 angle; if (self->step == 0) { @@ -126,20 +126,20 @@ s32 func_ptr_80170014(Entity* self) { self->velocityY += self->ext.weapon.accelerationY; } -int GetWeaponId(void) { return 15; } +static int GetWeaponId(void) { return 15; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_016.c b/src/weapon/w_016.c index b67e0eb764..192e07e246 100644 --- a/src/weapon/w_016.c +++ b/src/weapon/w_016.c @@ -11,7 +11,7 @@ // Weapon 16 extern SpriteParts D_74000_8017A040[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { FakePrim* fakePrim; s16 angle; u16 temp_a0; @@ -133,7 +133,7 @@ s32 func_ptr_80170004(Entity* self) { INCLUDE_ASM("weapon/nonmatchings/w_016", func_ptr_80170008); -void func_ptr_8017000C(Entity* self) { +static void func_ptr_8017000C(Entity* self) { s16 temp_a0; switch (self->step) { @@ -187,7 +187,7 @@ INCLUDE_ASM("weapon/nonmatchings/w_016", func_ptr_80170010); // Tracing function calls in emulator indicates that this function manages // the physics for the Iron Ball item. -s32 func_ptr_80170014(Entity* self) { +static s32 func_ptr_80170014(Entity* self) { Collider collider; s16 collX; s16 collY; @@ -379,20 +379,20 @@ s32 func_ptr_80170014(Entity* self) { } } -int GetWeaponId(void) { return 16; } +static int GetWeaponId(void) { return 16; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_017.c b/src/weapon/w_017.c index 3e69969023..49f84d9ac9 100644 --- a/src/weapon/w_017.c +++ b/src/weapon/w_017.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_017", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 17; } +static int GetWeaponId(void) { return 17; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_018.c b/src/weapon/w_018.c index c122e27ec6..b13d5da430 100644 --- a/src/weapon/w_018.c +++ b/src/weapon/w_018.c @@ -10,7 +10,7 @@ extern const char D_82000_8017A73C[]; // "\no\n" extern s32 D_82000_8017B1B4; // g_DebugWaitInfoTimer -void DebugShowWaitInfo(const char* msg) { +static void DebugShowWaitInfo(const char* msg) { g_CurrentBuffer = g_CurrentBuffer->next; FntPrint(msg); if (D_82000_8017B1B4++ & 4) { @@ -23,7 +23,7 @@ void DebugShowWaitInfo(const char* msg) { FntFlush(-1); } -void DebugInputWait(const char* msg) { +static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); while (!PadRead(0)) @@ -34,28 +34,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_018", EntityWeaponAttack); INCLUDE_ASM("weapon/nonmatchings/w_018", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 18; } +static int GetWeaponId(void) { return 18; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_019.c b/src/weapon/w_019.c index d45f794399..e7f0cb76dd 100644 --- a/src/weapon/w_019.c +++ b/src/weapon/w_019.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_019", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 19; } +static int GetWeaponId(void) { return 19; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_020.c b/src/weapon/w_020.c index 72a88afe6c..a6fad74fbf 100644 --- a/src/weapon/w_020.c +++ b/src/weapon/w_020.c @@ -23,7 +23,7 @@ extern s32 D_90000_8017AADC[]; extern s32 D_90000_8017AB44[]; extern s32 D_90000_8017C238; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { Collider sp10; Entity* child; Primitive* prim; @@ -427,7 +427,7 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { if (self->ext.weapon.parent->entityId == 0) { DestroyEntity(self); return; @@ -465,26 +465,26 @@ void func_ptr_80170008(Entity* self) { self->posY.val += self->velocityY; } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 20; } +static int GetWeaponId(void) { return 20; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_021.c b/src/weapon/w_021.c index 0c93ea26de..36262f90e8 100644 --- a/src/weapon/w_021.c +++ b/src/weapon/w_021.c @@ -213,7 +213,7 @@ s32 func_97000_8017AF2C(Entity* self, s32 arg1) { return 1; } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { Collider sp10; s16 xShift; s16 yShift; @@ -528,28 +528,28 @@ s32 func_ptr_80170004(Entity* self) { } } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 21; } +static int GetWeaponId(void) { return 21; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_022.c b/src/weapon/w_022.c index 952135240e..3df2fd6d23 100644 --- a/src/weapon/w_022.c +++ b/src/weapon/w_022.c @@ -52,28 +52,28 @@ s32 func_ptr_80170004(Entity* self) { } } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 22; } +static int GetWeaponId(void) { return 22; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_023.c b/src/weapon/w_023.c index 9756e48d5d..32f04bdf80 100644 --- a/src/weapon/w_023.c +++ b/src/weapon/w_023.c @@ -18,7 +18,7 @@ extern s32 D_A5000_8017AC50[]; extern SVECTOR* D_A5000_8017AC90[]; extern VECTOR D_A5000_8017ACD8; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -166,17 +166,17 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 23; } +static int GetWeaponId(void) { return 23; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { s16 back; s16 front; s16 top; @@ -453,7 +453,7 @@ void EntityWeaponShieldSpell(Entity* self) { } } -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { s32 unused1; s32 unusedFlag; SVECTOR rotation_axis; @@ -586,7 +586,7 @@ void func_ptr_80170024(Entity* self) { extern AnimationFrame D_A5000_8017AB58[]; -void func_ptr_80170028(Entity* self) { +static void func_ptr_80170028(Entity* self) { switch (self->step) { case 0: @@ -635,12 +635,12 @@ void func_ptr_80170028(Entity* self) { break; } } -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_024.c b/src/weapon/w_024.c index 3bc137a18a..92b46b0ae0 100644 --- a/src/weapon/w_024.c +++ b/src/weapon/w_024.c @@ -14,7 +14,7 @@ extern AnimationFrame* D_AC000_8017AC20; extern s16* D_AC000_8017ACF8[]; extern s32 D_AC000_8017AD08[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -175,17 +175,17 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 24; } +static int GetWeaponId(void) { return 24; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { Entity* unusedEnt; Primitive* prim; Primitive* prevPrim; @@ -527,7 +527,7 @@ void EntityWeaponShieldSpell(Entity* self) { } // Appears to be the entity for the rising rocks as part of the Shield Rod spell -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { Primitive* prim; s16 selfX; s16 selfY; @@ -632,14 +632,14 @@ void func_ptr_80170024(Entity* self) { } } -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_025.c b/src/weapon/w_025.c index 0e13ad3b33..f5c7819f06 100644 --- a/src/weapon/w_025.c +++ b/src/weapon/w_025.c @@ -21,7 +21,7 @@ void func_B3000_8017AF14(const char* fmt, u_long end) { } } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -157,17 +157,17 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 25; } +static int GetWeaponId(void) { return 25; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { Entity* unusedEnt; Primitive* prim; Primitive* prevPrim; @@ -476,7 +476,7 @@ void EntityWeaponShieldSpell(Entity* self) { } // Probably the dancing clouds of fog that appear with the shield spell? -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { Primitive* prim; s16 angle; s16 xSize; @@ -604,14 +604,14 @@ void func_ptr_80170024(Entity* self) { prim->y3 = yVar - (((rsin(angle) >> 4) * ySize) >> 8); } -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_026.c b/src/weapon/w_026.c index 3d27f8bfaa..fc5f94099b 100644 --- a/src/weapon/w_026.c +++ b/src/weapon/w_026.c @@ -17,7 +17,7 @@ extern u8 D_BA000_8017AADC[]; extern s32 D_BA000_8017CC3C; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -153,15 +153,15 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 26; } +static int GetWeaponId(void) { return 26; } void func_BA000_8017B37C(void) { RECT rect; @@ -191,7 +191,7 @@ void func_BA000_8017B37C(void) { LoadImage(&rect, &g_Clut[0x1100]); } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { s16 back; s16 front; s16 top; @@ -494,7 +494,7 @@ const SVECTOR D_BA000_8017AB94 = {56, 28, 0}; // When casting the Shaman Shield spell with the Shield Rod, an animation plays // where several stars rotate in 3D around Alucard. This handles that rotation. -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { SVECTOR rotation_axis; VECTOR transfer_vector; MATRIX m; @@ -689,14 +689,14 @@ void func_ptr_80170024(Entity* self) { } } -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_027.c b/src/weapon/w_027.c index adf8f118fc..2d7ad81a87 100644 --- a/src/weapon/w_027.c +++ b/src/weapon/w_027.c @@ -14,7 +14,7 @@ extern AnimationFrame D_C1000_8017AC8C[]; extern AnimationFrame D_C1000_8017ACB4[]; extern s32 D_C1000_8017C6EC; // g_DebugWaitInfoTimer -void DebugShowWaitInfo(const char* msg) { +static void DebugShowWaitInfo(const char* msg) { g_CurrentBuffer = g_CurrentBuffer->next; FntPrint(msg); if (D_C1000_8017C6EC++ & 4) { @@ -27,7 +27,7 @@ void DebugShowWaitInfo(const char* msg) { FntFlush(-1); } -void DebugInputWait(const char* msg) { +static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); while (!PadRead(0)) @@ -35,7 +35,7 @@ void DebugInputWait(const char* msg) { } // Duplicate of Weapon 28! -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim = 0; bool crouchCheck = false; s32 attackButton; @@ -169,17 +169,17 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 27; } +static int GetWeaponId(void) { return 27; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { Primitive* prim; s16 selfPosX; s16 selfPosY; @@ -318,7 +318,7 @@ void EntityWeaponShieldSpell(Entity* self) { return; } -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { Primitive* prim; Primitive* basePrim; s16 angle; @@ -550,7 +550,7 @@ void func_ptr_80170024(Entity* self) { } } -void func_ptr_80170028(Entity* self) { +static void func_ptr_80170028(Entity* self) { Entity* parent = self->ext.generic.unk8C.entityPtr; if (parent->entityId == 0) { DestroyEntity(self); @@ -576,12 +576,12 @@ void func_ptr_80170028(Entity* self) { } } -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_028.c b/src/weapon/w_028.c index ea4a461545..c2e0ed53f6 100644 --- a/src/weapon/w_028.c +++ b/src/weapon/w_028.c @@ -13,7 +13,7 @@ extern s8 D_C8000_8017AA98[]; extern s32 D_C8000_8017AAE0[]; extern s32 D_C8000_8017AB1C[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim = 0; bool crouchCheck = false; s32 attackButton; @@ -147,15 +147,15 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 28; } +static int GetWeaponId(void) { return 28; } extern s16 D_C8000_8017AB18; extern s16 D_C8000_8017AB1A; @@ -188,7 +188,7 @@ void func_C8000_8017B3D4(void) { LoadImage(&rect, &g_Clut[0x1100]); } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { s32 i; s16 left; s16 right; @@ -512,7 +512,7 @@ void EntityWeaponShieldSpell(Entity* self) { func_C8000_8017B3D4(); } -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { Primitive* prim; s32 xShift; s16 selfPosX; @@ -656,14 +656,14 @@ void func_ptr_80170024(Entity* self) { return; } -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_029.c b/src/weapon/w_029.c index f332a5c742..5c4bec6d6b 100644 --- a/src/weapon/w_029.c +++ b/src/weapon/w_029.c @@ -30,7 +30,7 @@ typedef struct { } FireShieldDragon; extern FireShieldDragon D_CF000_8017C9A0[][20]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim; s32 handButton; s32 unkAC_offset; @@ -195,17 +195,17 @@ s32 func_ptr_80170004(Entity* self) { self->ext.weapon.unk80 + D_CF000_8017AD04[g_GameTimer / 2 % 5]; } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 29; } +static int GetWeaponId(void) { return 29; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { Primitive* prim; s32 var_v0; u16 selfX; @@ -353,7 +353,7 @@ void EntityWeaponShieldSpell(Entity* self) { return; } -void func_ptr_80170024(Entity* self) { +static void func_ptr_80170024(Entity* self) { // All these variables are kind of guessing names, behavior of this // function is a little unclear. Primitive* firstPrim; @@ -563,7 +563,7 @@ void func_ptr_80170024(Entity* self) { g_api.CreateEntFactoryFromEntity(self, ((g_HandId + 1) << 14) + 100, 0); } -void func_ptr_80170028(Entity* self) { +static void func_ptr_80170028(Entity* self) { if (self->ext.weapon.parent->entityId == 0) { DestroyEntity(self); return; @@ -582,12 +582,12 @@ void func_ptr_80170028(Entity* self) { } } -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_030.c b/src/weapon/w_030.c index ae92b5306c..babd8810cd 100644 --- a/src/weapon/w_030.c +++ b/src/weapon/w_030.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_D6000_8017A5E4[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; WeaponAnimation* anim2; s8 animIndex; @@ -68,22 +68,22 @@ INCLUDE_ASM("weapon/nonmatchings/w_030", func_ptr_8017000C); INCLUDE_ASM("weapon/nonmatchings/w_030", func_ptr_80170010); -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 30; } +static int GetWeaponId(void) { return 30; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_031.c b/src/weapon/w_031.c index dbab2152c1..afb7f546b0 100644 --- a/src/weapon/w_031.c +++ b/src/weapon/w_031.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_031", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 31; } +static int GetWeaponId(void) { return 31; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_032.c b/src/weapon/w_032.c index 5b3c2c8668..9a69e9416b 100644 --- a/src/weapon/w_032.c +++ b/src/weapon/w_032.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_032", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 32; } +static int GetWeaponId(void) { return 32; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_033.c b/src/weapon/w_033.c index 032ffdd4fa..ae2b05cbd3 100644 --- a/src/weapon/w_033.c +++ b/src/weapon/w_033.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_033", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 33; } +static int GetWeaponId(void) { return 33; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_034.c b/src/weapon/w_034.c index aa6930a4a3..2ebf36cb54 100644 --- a/src/weapon/w_034.c +++ b/src/weapon/w_034.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_F2000_8017A934[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -62,28 +62,28 @@ void EntityWeaponAttack(Entity* self) { INCLUDE_ASM("weapon/nonmatchings/w_034", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 34; } +static int GetWeaponId(void) { return 34; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_035.c b/src/weapon/w_035.c index 51cb379224..54bf45cc2e 100644 --- a/src/weapon/w_035.c +++ b/src/weapon/w_035.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_F9000_8017A530[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -63,28 +63,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 35; } +static int GetWeaponId(void) { return 35; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_036.c b/src/weapon/w_036.c index 6728d8ac09..9128336c7c 100644 --- a/src/weapon/w_036.c +++ b/src/weapon/w_036.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_100000_8017A540[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -62,28 +62,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 36; } +static int GetWeaponId(void) { return 36; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_037.c b/src/weapon/w_037.c index 2061d3aba0..eb0a0ba330 100644 --- a/src/weapon/w_037.c +++ b/src/weapon/w_037.c @@ -10,7 +10,7 @@ extern WeaponAnimation D_107000_8017A6A4[]; extern s32 D_107000_8017BBE4; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -325,7 +325,7 @@ s32 func_ptr_80170004(Entity* self) { extern AnimationFrame D_107000_8017A798[]; -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { Collider collider; s16 distX; s16 distY; @@ -407,26 +407,26 @@ void func_ptr_80170008(Entity* self) { } } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 37; } +static int GetWeaponId(void) { return 37; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_038.c b/src/weapon/w_038.c index a6c241d404..f85e63d97b 100644 --- a/src/weapon/w_038.c +++ b/src/weapon/w_038.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_10E000_8017ADC0[2]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -70,28 +70,28 @@ void EntityWeaponAttack(Entity* self) { INCLUDE_ASM("weapon/nonmatchings/w_038", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 38; } +static int GetWeaponId(void) { return 38; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_039.c b/src/weapon/w_039.c index 751008e30a..e1914d64e6 100644 --- a/src/weapon/w_039.c +++ b/src/weapon/w_039.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_115000_8017ADC0[2]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -70,28 +70,28 @@ void EntityWeaponAttack(Entity* self) { INCLUDE_ASM("weapon/nonmatchings/w_039", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 39; } +static int GetWeaponId(void) { return 39; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_040.c b/src/weapon/w_040.c index af2054e4cf..c075a5e399 100644 --- a/src/weapon/w_040.c +++ b/src/weapon/w_040.c @@ -33,7 +33,7 @@ void func_11C000_8017AC14(void) { LoadImage(&rect, D_8006EDCC); } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { Collider col; s32 var_a2; s16 xMod; @@ -184,7 +184,7 @@ s32 func_ptr_80170004(Entity* self) { func_11C000_8017AC14(); } -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { s32 var_a1; if (self->step == 0) { @@ -221,7 +221,7 @@ void func_ptr_80170008(Entity* self) { g_api.UpdateAnim(D_11C000_8017A844, NULL); } -void func_ptr_8017000C(Entity* self) { +static void func_ptr_8017000C(Entity* self) { if (self->step == 0) { self->animSet = self->ext.weapon.parent->animSet; self->unk5A = self->ext.weapon.parent->unk5A; @@ -237,24 +237,24 @@ void func_ptr_8017000C(Entity* self) { } } -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 40; } +static int GetWeaponId(void) { return 40; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_041.c b/src/weapon/w_041.c index 7fb31f9664..03c9dc61b2 100644 --- a/src/weapon/w_041.c +++ b/src/weapon/w_041.c @@ -202,28 +202,28 @@ s32 func_ptr_80170004(Entity* self) { func_123000_8017A914(); } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 41; } +static int GetWeaponId(void) { return 41; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_042.c b/src/weapon/w_042.c index 36c81da373..0e23de662d 100644 --- a/src/weapon/w_042.c +++ b/src/weapon/w_042.c @@ -26,7 +26,7 @@ extern s32 D_12A000_8017B5F0; extern const char D_12A000_8017A760[]; // "\no\n" extern s32 D_12A000_8017B5EC; // g_DebugWaitInfoTimer -void DebugShowWaitInfo(const char* msg) { +static void DebugShowWaitInfo(const char* msg) { g_CurrentBuffer = g_CurrentBuffer->next; FntPrint(msg); if (D_12A000_8017B5EC++ & 4) { @@ -39,7 +39,7 @@ void DebugShowWaitInfo(const char* msg) { FntFlush(-1); } -void DebugInputWait(const char* msg) { +static void DebugInputWait(const char* msg) { while (PadRead(0)) DebugShowWaitInfo(msg); while (!PadRead(0)) @@ -61,7 +61,7 @@ void func_12A000_8017AC08(void) { LoadImage(&rect, D_8006EDCC); } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { Collider col; s32 var_a2; s16 xMod; @@ -218,7 +218,7 @@ s32 func_ptr_80170004(Entity* self) { func_12A000_8017AC08(); } -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { s16 unk; s32 modX; @@ -280,7 +280,7 @@ void func_ptr_80170008(Entity* self) { g_api.UpdateAnim(D_12A000_8017A6DC, NULL); } -void func_ptr_8017000C(Entity* self) { +static void func_ptr_8017000C(Entity* self) { if (self->step == 0) { self->animSet = self->ext.weapon.parent->animSet; self->unk5A = self->ext.weapon.parent->unk5A; @@ -296,24 +296,24 @@ void func_ptr_8017000C(Entity* self) { } } -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 42; } +static int GetWeaponId(void) { return 42; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_043.c b/src/weapon/w_043.c index e6a55d57aa..3a4a7e9397 100644 --- a/src/weapon/w_043.c +++ b/src/weapon/w_043.c @@ -14,7 +14,7 @@ INCLUDE_ASM("weapon/nonmatchings/w_043", EntityWeaponAttack); INCLUDE_ASM("weapon/nonmatchings/w_043", func_ptr_80170004); -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { if (self->step == 0) { self->unk4C = D_131000_8017AF40; SetSpriteBank1(D_131000_8017A040); @@ -56,26 +56,26 @@ void func_ptr_80170008(Entity* self) { self->rotPivotY = PLAYER.rotPivotY; } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 43; } +static int GetWeaponId(void) { return 43; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_044.c b/src/weapon/w_044.c index 97f378029f..868fa9530a 100644 --- a/src/weapon/w_044.c +++ b/src/weapon/w_044.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_044", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 44; } +static int GetWeaponId(void) { return 44; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_045.c b/src/weapon/w_045.c index 1d89d3eefd..67c9077c6e 100644 --- a/src/weapon/w_045.c +++ b/src/weapon/w_045.c @@ -41,7 +41,7 @@ int func_13F000_8017A718() { return 0; } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { SetSpriteBank1(D_13F000_8017A040); if (g_HandId != 0) { g_CurrentEntity->animSet = ANIMSET_OVL(0x12); @@ -71,7 +71,7 @@ void EntityWeaponAttack(Entity* self) { INCLUDE_ASM("weapon/nonmatchings/w_045", func_ptr_80170004); -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { SetSpriteBank1(D_13F000_8017A040); if (g_HandId != 0) { g_CurrentEntity->animSet = ANIMSET_OVL(0x12); @@ -131,7 +131,7 @@ void func_ptr_80170008(Entity* self) { INCLUDE_ASM("weapon/nonmatchings/w_045", func_ptr_8017000C); -s32 func_ptr_80170010(Entity* self) { +static s32 func_ptr_80170010(Entity* self) { D_13F000_8017B3BC += 0x80; SetSpriteBank1(D_13F000_8017A040); if (g_HandId != 0) { @@ -213,22 +213,22 @@ s32 func_ptr_80170010(Entity* self) { } } -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 45; } +static int GetWeaponId(void) { return 45; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_046.c b/src/weapon/w_046.c index b21c32647a..0ecc4c9e82 100644 --- a/src/weapon/w_046.c +++ b/src/weapon/w_046.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_046", EntityWeaponAttack); INCLUDE_ASM("weapon/nonmatchings/w_046", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 46; } +static int GetWeaponId(void) { return 46; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_047.c b/src/weapon/w_047.c index 407969849d..660a1c4ec5 100644 --- a/src/weapon/w_047.c +++ b/src/weapon/w_047.c @@ -51,28 +51,28 @@ s32 func_ptr_80170004(Entity* self) { } } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 47; } +static int GetWeaponId(void) { return 47; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_048.c b/src/weapon/w_048.c index 142fe154b8..1f9974f4fc 100644 --- a/src/weapon/w_048.c +++ b/src/weapon/w_048.c @@ -42,26 +42,26 @@ INCLUDE_ASM("weapon/nonmatchings/w_048", func_ptr_80170004); INCLUDE_ASM("weapon/nonmatchings/w_048", func_ptr_80170008); -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 48; } +static int GetWeaponId(void) { return 48; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_049.c b/src/weapon/w_049.c index b2447504d1..e142cdc5b6 100644 --- a/src/weapon/w_049.c +++ b/src/weapon/w_049.c @@ -49,7 +49,7 @@ INCLUDE_ASM("weapon/nonmatchings/w_049", func_ptr_80170010); extern SpriteParts D_15B000_8017AA44[]; extern AnimationFrame D_15B000_8017B10C[]; -s32 func_ptr_80170014(Entity* self) { +static s32 func_ptr_80170014(Entity* self) { switch (self->step) { case 0: SetSpriteBank2(D_15B000_8017AA44); @@ -84,20 +84,20 @@ s32 func_ptr_80170014(Entity* self) { } } -int GetWeaponId(void) { return 49; } +static int GetWeaponId(void) { return 49; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_050.c b/src/weapon/w_050.c index 4017c62315..bb098ca327 100644 --- a/src/weapon/w_050.c +++ b/src/weapon/w_050.c @@ -123,22 +123,22 @@ INCLUDE_ASM("weapon/nonmatchings/w_050", func_ptr_8017000C); INCLUDE_ASM("weapon/nonmatchings/w_050", func_ptr_80170010); -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 50; } +static int GetWeaponId(void) { return 50; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_051.c b/src/weapon/w_051.c index ff5e205610..0b69aa7641 100644 --- a/src/weapon/w_051.c +++ b/src/weapon/w_051.c @@ -294,7 +294,7 @@ void func_169000_8017B1DC(s32 arg0) { LoadImage(&rect, (u_long*)D_8006EDCC); } -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s16 subType; @@ -424,7 +424,7 @@ s32 func_ptr_80170004(Entity* self) { } } -void func_ptr_80170008(Entity* self) { +static void func_ptr_80170008(Entity* self) { AnimProperties* anim; Primitive* prim; s16 rot; @@ -561,26 +561,26 @@ void func_ptr_80170008(Entity* self) { prim->y3 = y - (((rsin(rot) >> 4) * t) >> 9); } -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 51; } +static int GetWeaponId(void) { return 51; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_052.c b/src/weapon/w_052.c index 595dde4ccf..404a298e41 100644 --- a/src/weapon/w_052.c +++ b/src/weapon/w_052.c @@ -22,7 +22,7 @@ extern s16 D_170000_8017CBA0[]; extern s16 D_170000_8017CBB8[]; extern f32 D_170000_8017CBD0[11][4]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim; s32 anim2; s32 attackButton; @@ -188,17 +188,17 @@ void EntityWeaponAttack(Entity* self) { } } -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 52; } +static int GetWeaponId(void) { return 52; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { Primitive* prim; s16 angle; s16 selfX; @@ -680,16 +680,16 @@ s32 func_ptr_80170004(Entity* self) { } } -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_053.c b/src/weapon/w_053.c index 55f1634382..45ea3cbf11 100644 --- a/src/weapon/w_053.c +++ b/src/weapon/w_053.c @@ -16,24 +16,24 @@ INCLUDE_ASM("weapon/nonmatchings/w_053", func_ptr_80170008); INCLUDE_ASM("weapon/nonmatchings/w_053", func_ptr_8017000C); -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 53; } +static int GetWeaponId(void) { return 53; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_054.c b/src/weapon/w_054.c index 49cc12aab3..fcdf389c8b 100644 --- a/src/weapon/w_054.c +++ b/src/weapon/w_054.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_054", EntityWeaponAttack); s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 54; } +static int GetWeaponId(void) { return 54; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_055.c b/src/weapon/w_055.c index 4c01c6540e..74a2cc3dd0 100644 --- a/src/weapon/w_055.c +++ b/src/weapon/w_055.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_055", EntityWeaponAttack); INCLUDE_ASM("weapon/nonmatchings/w_055", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 55; } +static int GetWeaponId(void) { return 55; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_056.c b/src/weapon/w_056.c index 070c579c30..2435d555da 100644 --- a/src/weapon/w_056.c +++ b/src/weapon/w_056.c @@ -11,28 +11,28 @@ INCLUDE_ASM("weapon/nonmatchings/w_056", EntityWeaponAttack); INCLUDE_ASM("weapon/nonmatchings/w_056", func_ptr_80170004); -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} -int GetWeaponId(void) { return 56; } +static int GetWeaponId(void) { return 56; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_057.c b/src/weapon/w_057.c index b86fa78f86..2bd91d6ccd 100644 --- a/src/weapon/w_057.c +++ b/src/weapon/w_057.c @@ -9,7 +9,7 @@ extern WeaponAnimation D_193000_8017B06C[]; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s8 animIndex; @@ -63,28 +63,28 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} s32 GetWeaponId(void) { return 0; } -void EntityWeaponShieldSpell(Entity* self) {} +static void EntityWeaponShieldSpell(Entity* self) {} -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} diff --git a/src/weapon/w_058.c b/src/weapon/w_058.c index 074cf2b0f3..494abf4fe7 100644 --- a/src/weapon/w_058.c +++ b/src/weapon/w_058.c @@ -12,7 +12,7 @@ extern s8 D_19A000_8017AB3C; extern AnimationFrame* D_19A000_8017AB84; extern s32 D_19A000_8017BB40; -void EntityWeaponAttack(Entity* self) { +static void EntityWeaponAttack(Entity* self) { s32 anim1; s32 anim2; s32 attackButton; @@ -150,17 +150,17 @@ void EntityWeaponAttack(Entity* self) { s32 func_ptr_80170004(Entity* self) {} -void func_ptr_80170008(Entity* self) {} +static void func_ptr_80170008(Entity* self) {} -void func_ptr_8017000C(Entity* self) {} +static void func_ptr_8017000C(Entity* self) {} -s32 func_ptr_80170010(Entity* self) {} +static s32 func_ptr_80170010(Entity* self) {} -s32 func_ptr_80170014(Entity* self) {} +static s32 func_ptr_80170014(Entity* self) {} s32 GetWeaponId(void) { return 52; } -void EntityWeaponShieldSpell(Entity* self) { +static void EntityWeaponShieldSpell(Entity* self) { Primitive* prim; s16 primRight; s16 primLeft; @@ -348,16 +348,16 @@ void EntityWeaponShieldSpell(Entity* self) { } } -void func_ptr_80170024(Entity* self) {} +static void func_ptr_80170024(Entity* self) {} -void func_ptr_80170028(Entity* self) {} +static void func_ptr_80170028(Entity* self) {} -void WeaponUnused2C(void) {} +static void WeaponUnused2C(void) {} -void WeaponUnused30(void) {} +static void WeaponUnused30(void) {} -void WeaponUnused34(void) {} +static void WeaponUnused34(void) {} -void WeaponUnused38(void) {} +static void WeaponUnused38(void) {} -void WeaponUnused3C(void) {} +static void WeaponUnused3C(void) {} From 36a0e2cad75bac16bedf80b618f2e51112f3e9a7 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 11:26:43 +0100 Subject: [PATCH 13/24] Re-organize common weapon declarations order --- src/weapon/shared.h | 9 --------- src/weapon/w_000.c | 3 ++- src/weapon/w_001.c | 2 ++ src/weapon/w_002.c | 2 ++ src/weapon/w_003.c | 2 ++ src/weapon/w_004.c | 2 ++ src/weapon/w_005.c | 2 ++ src/weapon/w_006.c | 2 ++ src/weapon/w_007.c | 2 ++ src/weapon/w_008.c | 2 ++ src/weapon/w_009.c | 2 ++ src/weapon/w_010.c | 2 ++ src/weapon/w_011.c | 2 ++ src/weapon/w_012.c | 2 ++ src/weapon/w_013.c | 2 ++ src/weapon/w_014.c | 2 ++ src/weapon/w_015.c | 2 ++ src/weapon/w_016.c | 2 ++ src/weapon/w_017.c | 2 ++ src/weapon/w_018.c | 2 ++ src/weapon/w_019.c | 2 ++ src/weapon/w_020.c | 2 ++ src/weapon/w_021.c | 2 ++ src/weapon/w_022.c | 2 ++ src/weapon/w_023.c | 2 ++ src/weapon/w_024.c | 2 ++ src/weapon/w_025.c | 2 ++ src/weapon/w_026.c | 2 ++ src/weapon/w_027.c | 2 ++ src/weapon/w_028.c | 2 ++ src/weapon/w_029.c | 2 ++ src/weapon/w_030.c | 2 ++ src/weapon/w_031.c | 2 ++ src/weapon/w_032.c | 2 ++ src/weapon/w_033.c | 2 ++ src/weapon/w_034.c | 2 ++ src/weapon/w_035.c | 2 ++ src/weapon/w_036.c | 2 ++ src/weapon/w_037.c | 2 ++ src/weapon/w_038.c | 2 ++ src/weapon/w_039.c | 2 ++ src/weapon/w_040.c | 2 ++ src/weapon/w_041.c | 2 ++ src/weapon/w_042.c | 2 ++ src/weapon/w_043.c | 2 ++ src/weapon/w_044.c | 2 ++ src/weapon/w_045.c | 2 ++ src/weapon/w_046.c | 2 ++ src/weapon/w_047.c | 2 ++ src/weapon/w_048.c | 2 ++ src/weapon/w_049.c | 2 ++ src/weapon/w_050.c | 2 ++ src/weapon/w_051.c | 2 ++ src/weapon/w_052.c | 2 ++ src/weapon/w_053.c | 2 ++ src/weapon/w_054.c | 2 ++ src/weapon/w_055.c | 2 ++ src/weapon/w_056.c | 2 ++ src/weapon/w_057.c | 2 ++ src/weapon/w_058.c | 2 ++ src/weapon/weapon_private.h | 19 +++++++++++-------- 61 files changed, 129 insertions(+), 18 deletions(-) diff --git a/src/weapon/shared.h b/src/weapon/shared.h index 36085cd281..da54132d5d 100644 --- a/src/weapon/shared.h +++ b/src/weapon/shared.h @@ -143,12 +143,3 @@ static void SetWeaponProperties(Entity* self, s32 kind) { self->attack = 0xFF; } } - -Weapon OVL_EXPORT(header) = { - EntityWeaponAttack, func_ptr_80170004, func_ptr_80170008, - func_ptr_8017000C, func_ptr_80170010, func_ptr_80170014, - GetWeaponId, LoadWeaponPalette, EntityWeaponShieldSpell, - func_ptr_80170024, func_ptr_80170028, WeaponUnused2C, - WeaponUnused30, WeaponUnused34, WeaponUnused38, - WeaponUnused3C, -}; diff --git a/src/weapon/w_000.c b/src/weapon/w_000.c index 91f5a65bbc..5fd79f0658 100644 --- a/src/weapon/w_000.c +++ b/src/weapon/w_000.c @@ -5,7 +5,6 @@ // Mourneblade, Badelaire, Unknown#169 #include "weapon_private.h" -#include "shared.h" #include "w_000_1.h" #include "w_000_2.h" #define g_Animset w_000_1 @@ -193,6 +192,8 @@ static u16* g_WeaponCluts[] = { static s32 g_HandId = HAND_ID; +#include "shared.h" + static void EntityWeaponAttack(Entity* self) { WeaponAnimation* anim; s32 mask; diff --git a/src/weapon/w_001.c b/src/weapon/w_001.c index bee58072ff..85dc9b7485 100644 --- a/src/weapon/w_001.c +++ b/src/weapon/w_001.c @@ -2,6 +2,8 @@ // Knuckle duster, Jewel knuckles, Iron Fist, Fist of Tulkas, Unknown#186, // Unknown#187, Unknown#188 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_001_1.h" #include "w_001_2.h" diff --git a/src/weapon/w_002.c b/src/weapon/w_002.c index d7b8cf6033..491b18c80e 100644 --- a/src/weapon/w_002.c +++ b/src/weapon/w_002.c @@ -1,6 +1,8 @@ // Weapon ID #2. Used by weapons: // Mace #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_002_1.h" #include "w_002_2.h" diff --git a/src/weapon/w_003.c b/src/weapon/w_003.c index 214c860715..f2da263293 100644 --- a/src/weapon/w_003.c +++ b/src/weapon/w_003.c @@ -1,6 +1,8 @@ // Weapon ID #3. Used by weapons: // Morningstar #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_003_1.h" #include "w_003_2.h" diff --git a/src/weapon/w_004.c b/src/weapon/w_004.c index 75b3316d5a..3655eee443 100644 --- a/src/weapon/w_004.c +++ b/src/weapon/w_004.c @@ -1,6 +1,8 @@ // Weapon ID #4. Used by weapons: // Holy rod, Unknown#170 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_004_1.h" #include "w_004_2.h" diff --git a/src/weapon/w_005.c b/src/weapon/w_005.c index 3b1da95818..5198ec9ac0 100644 --- a/src/weapon/w_005.c +++ b/src/weapon/w_005.c @@ -1,6 +1,8 @@ // Weapon ID #5. Used by weapons: // Star flail, Unknown#171 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_005_1.h" #include "w_005_2.h" diff --git a/src/weapon/w_006.c b/src/weapon/w_006.c index 589067e2a7..b1a210494f 100644 --- a/src/weapon/w_006.c +++ b/src/weapon/w_006.c @@ -1,6 +1,8 @@ // Weapon ID #6. Used by weapons: // Moon rod, Unknown#172 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_006_1.h" #include "w_006_2.h" diff --git a/src/weapon/w_007.c b/src/weapon/w_007.c index ab8c8cf429..56273d8572 100644 --- a/src/weapon/w_007.c +++ b/src/weapon/w_007.c @@ -1,6 +1,8 @@ // Weapon ID #7. Used by weapons: // Shield rod, Unknown#173 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_007_1.h" #include "w_007_2.h" diff --git a/src/weapon/w_008.c b/src/weapon/w_008.c index 3bb0f8aafc..da6a2d210b 100644 --- a/src/weapon/w_008.c +++ b/src/weapon/w_008.c @@ -1,6 +1,8 @@ // Weapon ID #8. Used by weapons: // Leather shield, Unknown#203 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_008_1.h" #include "w_008_2.h" diff --git a/src/weapon/w_009.c b/src/weapon/w_009.c index 03e1289fb6..d765036839 100644 --- a/src/weapon/w_009.c +++ b/src/weapon/w_009.c @@ -1,6 +1,8 @@ // Weapon ID #9. Used by weapons: // Knight shield, Unknown#204 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_009_1.h" #include "w_009_2.h" diff --git a/src/weapon/w_010.c b/src/weapon/w_010.c index 3cc65a617a..b53497e892 100644 --- a/src/weapon/w_010.c +++ b/src/weapon/w_010.c @@ -1,6 +1,8 @@ // Weapon ID #10. Used by weapons: // Iron shield, Unknown#205 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_010_1.h" #include "w_010_2.h" diff --git a/src/weapon/w_011.c b/src/weapon/w_011.c index 461da7a6b4..bf6869ca19 100644 --- a/src/weapon/w_011.c +++ b/src/weapon/w_011.c @@ -1,6 +1,8 @@ // Weapon ID #11. Used by weapons: // AxeLord shield, Unknown#206 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_011_1.h" #include "w_011_2.h" diff --git a/src/weapon/w_012.c b/src/weapon/w_012.c index 42d9f73704..e96320ce9d 100644 --- a/src/weapon/w_012.c +++ b/src/weapon/w_012.c @@ -1,6 +1,8 @@ // Weapon ID #12. Used by weapons: // Chakram, Vorpal blade, Crissaegrim #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_012_1.h" #include "w_012_2.h" diff --git a/src/weapon/w_013.c b/src/weapon/w_013.c index 18b2adc73c..a15a5ddf60 100644 --- a/src/weapon/w_013.c +++ b/src/weapon/w_013.c @@ -7,6 +7,8 @@ // the entities. They interact weirdly and seem to not line up. #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_013_1.h" #include "w_013_2.h" diff --git a/src/weapon/w_014.c b/src/weapon/w_014.c index 5092f5f055..2343873529 100644 --- a/src/weapon/w_014.c +++ b/src/weapon/w_014.c @@ -1,6 +1,8 @@ // Weapon ID #14. Used by weapons: // Runesword #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_014_1.h" #include "w_014_2.h" diff --git a/src/weapon/w_015.c b/src/weapon/w_015.c index 5fe1f72299..ffa9e719e2 100644 --- a/src/weapon/w_015.c +++ b/src/weapon/w_015.c @@ -1,6 +1,8 @@ // Weapon ID #15. Used by weapons: // Shuriken, Cross shuriken, Buffalo star, Flame star, TNT #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_015_1.h" #include "w_015_2.h" diff --git a/src/weapon/w_016.c b/src/weapon/w_016.c index 192e07e246..fb9adf072d 100644 --- a/src/weapon/w_016.c +++ b/src/weapon/w_016.c @@ -1,6 +1,8 @@ // Weapon ID #16. Used by weapons: // Bwaka knife, Boomerang, Javelin, Fire boomerang, Iron ball #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_016_1.h" #include "w_016_2.h" diff --git a/src/weapon/w_017.c b/src/weapon/w_017.c index 49f84d9ac9..af13de1eb4 100644 --- a/src/weapon/w_017.c +++ b/src/weapon/w_017.c @@ -1,6 +1,8 @@ // Weapon ID #17. Used by weapons: // Pentagram, Bat Pentagram #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_017_1.h" #include "w_017_2.h" diff --git a/src/weapon/w_018.c b/src/weapon/w_018.c index b13d5da430..ddc5099c84 100644 --- a/src/weapon/w_018.c +++ b/src/weapon/w_018.c @@ -1,6 +1,8 @@ // Weapon ID #18. Used by weapons: // Power of Sire #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_018_1.h" #include "w_018_2.h" diff --git a/src/weapon/w_019.c b/src/weapon/w_019.c index e7f0cb76dd..df8790c058 100644 --- a/src/weapon/w_019.c +++ b/src/weapon/w_019.c @@ -1,6 +1,8 @@ // Weapon ID #19. Used by weapons: // Neutron bomb #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_019_1.h" #include "w_019_2.h" diff --git a/src/weapon/w_020.c b/src/weapon/w_020.c index a6fad74fbf..c2c17d4856 100644 --- a/src/weapon/w_020.c +++ b/src/weapon/w_020.c @@ -1,6 +1,8 @@ // Weapon ID #20. Used by weapons: // Karma Coin #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_020_1.h" #include "w_020_2.h" diff --git a/src/weapon/w_021.c b/src/weapon/w_021.c index 36262f90e8..445a4a6d0d 100644 --- a/src/weapon/w_021.c +++ b/src/weapon/w_021.c @@ -6,6 +6,8 @@ // tea, Green tea, Natou, Ramen, Miso soup, Sushi, Pork bun, Red bean bun, // Chinese bun, Dim Sum set, Pot roast, Sirloin, Turkey, Meal ticket #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_021_1.h" #include "w_021_2.h" diff --git a/src/weapon/w_022.c b/src/weapon/w_022.c index 3df2fd6d23..25040c7311 100644 --- a/src/weapon/w_022.c +++ b/src/weapon/w_022.c @@ -1,6 +1,8 @@ // Weapon ID #22. Used by weapons: // Magic Missile #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_022_1.h" #include "w_022_2.h" diff --git a/src/weapon/w_023.c b/src/weapon/w_023.c index 32f04bdf80..b01608f543 100644 --- a/src/weapon/w_023.c +++ b/src/weapon/w_023.c @@ -1,6 +1,8 @@ // Weapon ID #23. Used by weapons: // Herald shield, Unknown#207 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_023_1.h" #include "w_023_2.h" diff --git a/src/weapon/w_024.c b/src/weapon/w_024.c index 92b46b0ae0..7b1afcd216 100644 --- a/src/weapon/w_024.c +++ b/src/weapon/w_024.c @@ -1,6 +1,8 @@ // Weapon ID #24. Used by weapons: // Dark shield, Unknown#208 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_024_1.h" #include "w_024_2.h" diff --git a/src/weapon/w_025.c b/src/weapon/w_025.c index f5c7819f06..79a02a237c 100644 --- a/src/weapon/w_025.c +++ b/src/weapon/w_025.c @@ -1,6 +1,8 @@ // Weapon ID #25. Used by weapons: // Goddess shield, Unknown#209 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_025_1.h" #include "w_025_2.h" diff --git a/src/weapon/w_026.c b/src/weapon/w_026.c index fc5f94099b..04ef04998f 100644 --- a/src/weapon/w_026.c +++ b/src/weapon/w_026.c @@ -1,6 +1,8 @@ // Weapon ID #26. Used by weapons: // Shaman shield, Unknown#210 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_026_1.h" #include "w_026_2.h" diff --git a/src/weapon/w_027.c b/src/weapon/w_027.c index 2d7ad81a87..78c75e61b7 100644 --- a/src/weapon/w_027.c +++ b/src/weapon/w_027.c @@ -1,6 +1,8 @@ // Weapon ID #27. Used by weapons: // Medusa shield, Unknown#211 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_027_1.h" #include "w_027_2.h" diff --git a/src/weapon/w_028.c b/src/weapon/w_028.c index c2e0ed53f6..96f9ef3e45 100644 --- a/src/weapon/w_028.c +++ b/src/weapon/w_028.c @@ -1,6 +1,8 @@ // Weapon ID #28. Used by weapons: // Skull shield, Unknown#212 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_028_1.h" #include "w_028_2.h" diff --git a/src/weapon/w_029.c b/src/weapon/w_029.c index 5c4bec6d6b..5f96af4f93 100644 --- a/src/weapon/w_029.c +++ b/src/weapon/w_029.c @@ -1,6 +1,8 @@ // Weapon ID #29. Used by weapons: // Fire shield, Unknown#213 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_029_1.h" #include "w_029_2.h" diff --git a/src/weapon/w_030.c b/src/weapon/w_030.c index babd8810cd..247d4a82f3 100644 --- a/src/weapon/w_030.c +++ b/src/weapon/w_030.c @@ -1,6 +1,8 @@ // Weapon ID #30. Used by weapons: // Sword of Dawn, Unknown#177 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_030_1.h" #include "w_030_2.h" diff --git a/src/weapon/w_031.c b/src/weapon/w_031.c index afb7f546b0..9f342dce97 100644 --- a/src/weapon/w_031.c +++ b/src/weapon/w_031.c @@ -1,6 +1,8 @@ // Weapon ID #31. Used by weapons: // Basilard, Unknown#174 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_031_1.h" #include "w_031_2.h" diff --git a/src/weapon/w_032.c b/src/weapon/w_032.c index 9a69e9416b..6c47cd8e81 100644 --- a/src/weapon/w_032.c +++ b/src/weapon/w_032.c @@ -1,6 +1,8 @@ // Weapon ID #32. Used by weapons: // Combat knife, Unknown#175 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_032_1.h" #include "w_032_2.h" diff --git a/src/weapon/w_033.c b/src/weapon/w_033.c index ae2b05cbd3..0ae0447a94 100644 --- a/src/weapon/w_033.c +++ b/src/weapon/w_033.c @@ -1,6 +1,8 @@ // Weapon ID #33. Used by weapons: // Nunchaku #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_033_1.h" #include "w_033_2.h" diff --git a/src/weapon/w_034.c b/src/weapon/w_034.c index 2ebf36cb54..e6d88f4ad0 100644 --- a/src/weapon/w_034.c +++ b/src/weapon/w_034.c @@ -1,6 +1,8 @@ // Weapon ID #34. Used by weapons: // Shotel, Unknown#176 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_034_1.h" #include "w_034_2.h" diff --git a/src/weapon/w_035.c b/src/weapon/w_035.c index 54bf45cc2e..8f36a5f897 100644 --- a/src/weapon/w_035.c +++ b/src/weapon/w_035.c @@ -1,6 +1,8 @@ // Weapon ID #35. Used by weapons: // Red Rust #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_035_1.h" #include "w_035_2.h" diff --git a/src/weapon/w_036.c b/src/weapon/w_036.c index 9128336c7c..afbbd35bdb 100644 --- a/src/weapon/w_036.c +++ b/src/weapon/w_036.c @@ -1,6 +1,8 @@ // Weapon ID #36. Used by weapons: // Takemitsu #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_036_1.h" #include "w_036_2.h" diff --git a/src/weapon/w_037.c b/src/weapon/w_037.c index eb0a0ba330..7016772c15 100644 --- a/src/weapon/w_037.c +++ b/src/weapon/w_037.c @@ -1,6 +1,8 @@ // Weapon ID #37. Used by weapons: // Short sword, Jewel sword, Stone sword, Unknown#198 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_037_1.h" #include "w_037_2.h" diff --git a/src/weapon/w_038.c b/src/weapon/w_038.c index f85e63d97b..4e73a12071 100644 --- a/src/weapon/w_038.c +++ b/src/weapon/w_038.c @@ -1,6 +1,8 @@ // Weapon ID #38. Used by weapons: // Rapier, Unknown#191 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_038_1.h" #include "w_038_2.h" diff --git a/src/weapon/w_039.c b/src/weapon/w_039.c index e1914d64e6..3422bc4741 100644 --- a/src/weapon/w_039.c +++ b/src/weapon/w_039.c @@ -1,6 +1,8 @@ // Weapon ID #39. Used by weapons: // Were Bane, Unknown#190 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_039_1.h" #include "w_039_2.h" diff --git a/src/weapon/w_040.c b/src/weapon/w_040.c index c075a5e399..8cb2fd47c3 100644 --- a/src/weapon/w_040.c +++ b/src/weapon/w_040.c @@ -1,6 +1,8 @@ // Weapon ID #40. Used by weapons: // Monster vial 1 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_040_1.h" #include "w_040_2.h" diff --git a/src/weapon/w_041.c b/src/weapon/w_041.c index 03c9dc61b2..0aba391702 100644 --- a/src/weapon/w_041.c +++ b/src/weapon/w_041.c @@ -1,6 +1,8 @@ // Weapon ID #41. Used by weapons: // Monster vial 2 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_041_1.h" #include "w_041_2.h" diff --git a/src/weapon/w_042.c b/src/weapon/w_042.c index 0e23de662d..324bdf9c82 100644 --- a/src/weapon/w_042.c +++ b/src/weapon/w_042.c @@ -1,6 +1,8 @@ // Weapon ID #42. Used by weapons: // Monster vial 3 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_042_1.h" #include "w_042_2.h" diff --git a/src/weapon/w_043.c b/src/weapon/w_043.c index 3a4a7e9397..4bc308770e 100644 --- a/src/weapon/w_043.c +++ b/src/weapon/w_043.c @@ -1,6 +1,8 @@ // Weapon ID #43. Used by weapons: // Alucard sword, Sword Familiar, Alucart sword, Unknown#197 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_043_1.h" #include "w_043_2.h" diff --git a/src/weapon/w_044.c b/src/weapon/w_044.c index 868fa9530a..f12ad758e7 100644 --- a/src/weapon/w_044.c +++ b/src/weapon/w_044.c @@ -1,6 +1,8 @@ // Weapon ID #44. Used by weapons: // Heart Refresh #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_044_1.h" #include "w_044_2.h" diff --git a/src/weapon/w_045.c b/src/weapon/w_045.c index 67c9077c6e..08399043ee 100644 --- a/src/weapon/w_045.c +++ b/src/weapon/w_045.c @@ -1,6 +1,8 @@ // Weapon ID #45. Used by weapons: // Unknown#216 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_045_1.h" #include "w_045_2.h" diff --git a/src/weapon/w_046.c b/src/weapon/w_046.c index 0ecc4c9e82..455448d6a8 100644 --- a/src/weapon/w_046.c +++ b/src/weapon/w_046.c @@ -1,6 +1,8 @@ // Weapon ID #46. Used by weapons: // Holbein dagger, Blue knuckles #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_046_1.h" #include "w_046_2.h" diff --git a/src/weapon/w_047.c b/src/weapon/w_047.c index 660a1c4ec5..61062b758e 100644 --- a/src/weapon/w_047.c +++ b/src/weapon/w_047.c @@ -1,6 +1,8 @@ // Weapon ID #47. Used by weapons: // Dynamite #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_047_1.h" #include "w_047_2.h" diff --git a/src/weapon/w_048.c b/src/weapon/w_048.c index 1f9974f4fc..24ad35004e 100644 --- a/src/weapon/w_048.c +++ b/src/weapon/w_048.c @@ -1,6 +1,8 @@ // Weapon ID #48. Used by weapons: // Thunderbrand, Unknown#178 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_048_1.h" #include "w_048_2.h" diff --git a/src/weapon/w_049.c b/src/weapon/w_049.c index e142cdc5b6..a580ce1725 100644 --- a/src/weapon/w_049.c +++ b/src/weapon/w_049.c @@ -1,6 +1,8 @@ // Weapon ID #49. Used by weapons: // Firebrand, Marsil, Unknown#179, Unknown#180 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_049_1.h" #include "w_049_2.h" diff --git a/src/weapon/w_050.c b/src/weapon/w_050.c index bb098ca327..57c08ead06 100644 --- a/src/weapon/w_050.c +++ b/src/weapon/w_050.c @@ -1,6 +1,8 @@ // Weapon ID #50. Used by weapons: // Icebrand, Unknown#181, Unknown#199, Unknown#200, Unknown#201 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_050_1.h" #include "w_050_2.h" diff --git a/src/weapon/w_051.c b/src/weapon/w_051.c index 0b69aa7641..313621f270 100644 --- a/src/weapon/w_051.c +++ b/src/weapon/w_051.c @@ -2,6 +2,8 @@ // Estoc, Claymore, Flamberge, Zwei hander, Obsidian sword, Great Sword, // Unknown#182, Unknown#183, Unknown#184, Unknown#185 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_051_1.h" #include "w_051_2.h" diff --git a/src/weapon/w_052.c b/src/weapon/w_052.c index 404a298e41..90de04e352 100644 --- a/src/weapon/w_052.c +++ b/src/weapon/w_052.c @@ -1,6 +1,8 @@ // Weapon ID #52. Used by weapons: // Alucard shield, Unknown#214 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_052_1.h" #include "w_052_2.h" diff --git a/src/weapon/w_053.c b/src/weapon/w_053.c index 45ea3cbf11..7ee9dfb841 100644 --- a/src/weapon/w_053.c +++ b/src/weapon/w_053.c @@ -2,6 +2,8 @@ // Katana, Osafune katana, Masamune, Yasutsuna, Unknown#189, Unknown#192, // Unknown#193, Unknown#194 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_053_1.h" #include "w_053_2.h" diff --git a/src/weapon/w_054.c b/src/weapon/w_054.c index fcdf389c8b..e308a54e36 100644 --- a/src/weapon/w_054.c +++ b/src/weapon/w_054.c @@ -1,6 +1,8 @@ // Weapon ID #54. Used by weapons: // Gurthang, Unknown#195 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_054_1.h" #include "w_054_2.h" diff --git a/src/weapon/w_055.c b/src/weapon/w_055.c index 74a2cc3dd0..10ee975411 100644 --- a/src/weapon/w_055.c +++ b/src/weapon/w_055.c @@ -1,6 +1,8 @@ // Weapon ID #55. Used by weapons: // Holy sword, Unknown#196 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_055_1.h" #include "w_055_2.h" diff --git a/src/weapon/w_056.c b/src/weapon/w_056.c index 2435d555da..ec5dd43e6d 100644 --- a/src/weapon/w_056.c +++ b/src/weapon/w_056.c @@ -1,6 +1,8 @@ // Weapon ID #56. Used by weapons: // Muramasa #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_056_1.h" #include "w_056_2.h" diff --git a/src/weapon/w_057.c b/src/weapon/w_057.c index 2bd91d6ccd..3203909998 100644 --- a/src/weapon/w_057.c +++ b/src/weapon/w_057.c @@ -1,6 +1,8 @@ // Weapon ID #57. Used by weapons: // Mablung Sword #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_057_1.h" #include "w_057_2.h" diff --git a/src/weapon/w_058.c b/src/weapon/w_058.c index 494abf4fe7..a31607398b 100644 --- a/src/weapon/w_058.c +++ b/src/weapon/w_058.c @@ -1,6 +1,8 @@ // Weapon ID #58. Used by weapons: // Alucart shield, Unknown#215 #include "weapon_private.h" +extern u16* g_WeaponCluts[]; +extern s32 g_HandId; #include "shared.h" #include "w_058_1.h" #include "w_058_2.h" diff --git a/src/weapon/weapon_private.h b/src/weapon/weapon_private.h index 8ffbadc311..fcd20969fe 100644 --- a/src/weapon/weapon_private.h +++ b/src/weapon/weapon_private.h @@ -41,17 +41,20 @@ static void WeaponUnused34(void); static void WeaponUnused38(void); static void WeaponUnused3C(void); -// internals -extern SpriteParts* g_Animset[]; -extern SpriteParts* g_Animset2[]; -extern u16* g_WeaponCluts[]; -extern s32 g_HandId; - void DestroyEntity(Entity* entity); -void SetSpriteBank1(SpriteParts* animset); -void SetSpriteBank2(SpriteParts* animset); +static void SetSpriteBank1(SpriteParts* animset); +static void SetSpriteBank2(SpriteParts* animset); static void DecelerateX(s32 amount); static void DecelerateY(s32 amount); static void SetSpeedX(s32 speed); +Weapon OVL_EXPORT(header) = { + EntityWeaponAttack, func_ptr_80170004, func_ptr_80170008, + func_ptr_8017000C, func_ptr_80170010, func_ptr_80170014, + GetWeaponId, LoadWeaponPalette, EntityWeaponShieldSpell, + func_ptr_80170024, func_ptr_80170028, WeaponUnused2C, + WeaponUnused30, WeaponUnused34, WeaponUnused38, + WeaponUnused3C, +}; + #endif From a31d932e500ecd552ac5ece97677c5818277c52e Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 12:06:33 +0100 Subject: [PATCH 14/24] Use dummy headers whenever is needed --- src/pc/weapon_pc.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/pc/weapon_pc.c b/src/pc/weapon_pc.c index 660356842f..29a5cd3703 100644 --- a/src/pc/weapon_pc.c +++ b/src/pc/weapon_pc.c @@ -46,21 +46,34 @@ Weapon D_8017D000 = { func_ptr_80170024Dummy, func_ptr_80170028Dummy, }; +static Weapon dummy_header = { + EntityWeaponAttackDummy, + func_ptr_80170004Dummy, + func_ptr_80170008Dummy, + func_ptr_8017000CDummy, + func_ptr_80170010Dummy, + func_ptr_80170014Dummy, + GetWeaponIdDummy, + LoadWeaponPaletteDummy, + EntityWeaponShieldSpellDummy, + func_ptr_80170024Dummy, + func_ptr_80170028Dummy, +}; extern Weapon w_000_header; Weapon* g_Weapons[] = { - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, &w_000_header, - &w_000_header, &w_000_header, &w_000_header, &w_000_header, + &w_000_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, &dummy_header, + &dummy_header, &dummy_header, &dummy_header, &dummy_header, }; SpriteParts* g_Animset[1]; From 95fd2367320e9ade36e604c6594cb488c863f8b9 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 19:25:00 +0100 Subject: [PATCH 15/24] Circumnavigate MSVC opitmization on w_000 --- src/weapon/w_000.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/weapon/w_000.c b/src/weapon/w_000.c index 5fd79f0658..9764d3518c 100644 --- a/src/weapon/w_000.c +++ b/src/weapon/w_000.c @@ -4,6 +4,8 @@ // Hador, Luminus, Harper, Gram, Mormegil, Terminus Est, Dark Blade, // Mourneblade, Badelaire, Unknown#169 +#pragma optimize("", off) // TODO circumnavigate an optimization bug with MSVC + #include "weapon_private.h" #include "w_000_1.h" #include "w_000_2.h" From c6c09cb576c049e62348dd7742020ce128a86fbc Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 19:38:07 +0100 Subject: [PATCH 16/24] try to fix msvc build --- CMakeLists.txt | 15 +++++++++++++++ src/weapon/w_000.c | 2 -- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c1cd90a84..e66226ce9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,21 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type") endif() +# TODO circumnavigate an optimization bug with MSVC +if (MSVC) + set(CMAKE_CXX_FLAGS "/Od") + set(CMAKE_C_FLAGS "/Od") + set(CMAKE_CXX_FLAGS_DEBUG "/Od") + set(CMAKE_C_FLAGS_DEBUG "/Od") + set(CMAKE_CXX_FLAGS_RELEASE "/Od") + set(CMAKE_C_FLAGS_RELEASE "/Od") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Od") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Od") + set(CMAKE_CXX_FLAGS_MINSIZEREL "/Od") + set(CMAKE_C_FLAGS_MINSIZEREL "/Od") +endif() + + find_package(SDL2 REQUIRED) set(SOURCE_FILES_PC diff --git a/src/weapon/w_000.c b/src/weapon/w_000.c index 9764d3518c..5fd79f0658 100644 --- a/src/weapon/w_000.c +++ b/src/weapon/w_000.c @@ -4,8 +4,6 @@ // Hador, Luminus, Harper, Gram, Mormegil, Terminus Est, Dark Blade, // Mourneblade, Badelaire, Unknown#169 -#pragma optimize("", off) // TODO circumnavigate an optimization bug with MSVC - #include "weapon_private.h" #include "w_000_1.h" #include "w_000_2.h" From f611b8caf9230ec014f280f8563e6e4655bf74a2 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 19:43:40 +0100 Subject: [PATCH 17/24] Downgrade agent to win2019 --- .github/workflows/picci.yaml | 2 +- CMakeLists.txt | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/picci.yaml b/.github/workflows/picci.yaml index c182009e3e..8b372cf9b1 100644 --- a/.github/workflows/picci.yaml +++ b/.github/workflows/picci.yaml @@ -102,7 +102,7 @@ jobs: cmake --build ${{github.workspace}}/pc --config Release build-windows: - runs-on: windows-latest + runs-on: windows-2019 needs: extract-assets steps: - name: Install requirements diff --git a/CMakeLists.txt b/CMakeLists.txt index e66226ce9c..04d6e3461b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,20 +26,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type") endif() -# TODO circumnavigate an optimization bug with MSVC -if (MSVC) - set(CMAKE_CXX_FLAGS "/Od") - set(CMAKE_C_FLAGS "/Od") - set(CMAKE_CXX_FLAGS_DEBUG "/Od") - set(CMAKE_C_FLAGS_DEBUG "/Od") - set(CMAKE_CXX_FLAGS_RELEASE "/Od") - set(CMAKE_C_FLAGS_RELEASE "/Od") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Od") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Od") - set(CMAKE_CXX_FLAGS_MINSIZEREL "/Od") - set(CMAKE_C_FLAGS_MINSIZEREL "/Od") -endif() - find_package(SDL2 REQUIRED) From d7f6ad060f65cdbc320844986dc6a9b154d867f3 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 19:51:51 +0100 Subject: [PATCH 18/24] Revert "Downgrade agent to win2019" This reverts commit f611b8caf9230ec014f280f8563e6e4655bf74a2. --- .github/workflows/picci.yaml | 2 +- CMakeLists.txt | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/picci.yaml b/.github/workflows/picci.yaml index 8b372cf9b1..c182009e3e 100644 --- a/.github/workflows/picci.yaml +++ b/.github/workflows/picci.yaml @@ -102,7 +102,7 @@ jobs: cmake --build ${{github.workspace}}/pc --config Release build-windows: - runs-on: windows-2019 + runs-on: windows-latest needs: extract-assets steps: - name: Install requirements diff --git a/CMakeLists.txt b/CMakeLists.txt index 04d6e3461b..e66226ce9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,20 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type") endif() +# TODO circumnavigate an optimization bug with MSVC +if (MSVC) + set(CMAKE_CXX_FLAGS "/Od") + set(CMAKE_C_FLAGS "/Od") + set(CMAKE_CXX_FLAGS_DEBUG "/Od") + set(CMAKE_C_FLAGS_DEBUG "/Od") + set(CMAKE_CXX_FLAGS_RELEASE "/Od") + set(CMAKE_C_FLAGS_RELEASE "/Od") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Od") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Od") + set(CMAKE_CXX_FLAGS_MINSIZEREL "/Od") + set(CMAKE_C_FLAGS_MINSIZEREL "/Od") +endif() + find_package(SDL2 REQUIRED) From dc0f2faa3a306d02737e00c0f37ece01c37087f4 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Thu, 8 Aug 2024 23:19:56 +0100 Subject: [PATCH 19/24] merge fixes --- src/weapon/w_004.c | 1 + src/weapon/w_011.c | 1 + src/weapon/w_037.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/weapon/w_004.c b/src/weapon/w_004.c index 31e5420d47..7270dd91fc 100644 --- a/src/weapon/w_004.c +++ b/src/weapon/w_004.c @@ -3,6 +3,7 @@ #include "weapon_private.h" extern u16* g_WeaponCluts[]; extern s32 g_HandId; +#include "shared.h" #include "w_004_1.h" #include "w_004_2.h" #define g_Animset w_004_1 diff --git a/src/weapon/w_011.c b/src/weapon/w_011.c index 09c83a8be5..11fdb680d1 100644 --- a/src/weapon/w_011.c +++ b/src/weapon/w_011.c @@ -3,6 +3,7 @@ #include "weapon_private.h" extern u16* g_WeaponCluts[]; extern s32 g_HandId; +#include "shared.h" #include "w_011_1.h" #include "w_011_2.h" #define g_Animset w_011_1 diff --git a/src/weapon/w_037.c b/src/weapon/w_037.c index 26bbf32f78..eadf6b9815 100644 --- a/src/weapon/w_037.c +++ b/src/weapon/w_037.c @@ -3,6 +3,7 @@ #include "weapon_private.h" extern u16* g_WeaponCluts[]; extern s32 g_HandId; +#include "shared.h" #include "w_037_1.h" #include "w_037_2.h" #define g_Animset w_037_1 From 4d7fbb8bcb85d72eb71b9723cad25c72cf86a46e Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Fri, 9 Aug 2024 00:12:28 +0100 Subject: [PATCH 20/24] MSVC fix attempt --- tools/sotn-assets/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sotn-assets/build.go b/tools/sotn-assets/build.go index c77f28e9c8..c72513b03f 100644 --- a/tools/sotn-assets/build.go +++ b/tools/sotn-assets/build.go @@ -253,7 +253,7 @@ func buildLayers(inputDir string, fileName string, outputDir string) error { } sb.WriteString("static MyLayer layers[] = {\n") - sb.WriteString(" {},\n") + sb.WriteString(" { NULL, NULL, 0, 0, 0, 0 },\n") for _, l := range layers[1:] { sb.WriteString(fmt.Sprintf(" { %s, %s, 0x%08X, 0x%02X, %d, %d },\n", makeSymbolFromFileName(l["data"].(string)), From 51422c81d130d4ecd84e082e7fe1413d790314a4 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Fri, 9 Aug 2024 00:18:41 +0100 Subject: [PATCH 21/24] Remove unnecessary changes --- CMakeLists.txt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b1ef3aeeb..33e5eacfab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,21 +26,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type") endif() -# TODO circumnavigate an optimization bug with MSVC -if (MSVC) - set(CMAKE_CXX_FLAGS "/Od") - set(CMAKE_C_FLAGS "/Od") - set(CMAKE_CXX_FLAGS_DEBUG "/Od") - set(CMAKE_C_FLAGS_DEBUG "/Od") - set(CMAKE_CXX_FLAGS_RELEASE "/Od") - set(CMAKE_C_FLAGS_RELEASE "/Od") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Od") - set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Od") - set(CMAKE_CXX_FLAGS_MINSIZEREL "/Od") - set(CMAKE_C_FLAGS_MINSIZEREL "/Od") -endif() - - find_package(SDL2 REQUIRED) set(SOURCE_FILES_PC From eeec44a5d984717a920ab23eef801dee4f23b429 Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Sun, 4 Aug 2024 19:43:40 +0100 Subject: [PATCH 22/24] Downgrade agent to win2019 --- .github/workflows/picci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/picci.yaml b/.github/workflows/picci.yaml index c182009e3e..8b372cf9b1 100644 --- a/.github/workflows/picci.yaml +++ b/.github/workflows/picci.yaml @@ -102,7 +102,7 @@ jobs: cmake --build ${{github.workspace}}/pc --config Release build-windows: - runs-on: windows-latest + runs-on: windows-2019 needs: extract-assets steps: - name: Install requirements From 1910f2c6a9f519f6b9f9984e760c23a97a1b25ed Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Fri, 9 Aug 2024 00:45:14 +0100 Subject: [PATCH 23/24] Do not build empty sprite groups --- tools/sotn-assets/build.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/sotn-assets/build.go b/tools/sotn-assets/build.go index c72513b03f..4a33f76e82 100644 --- a/tools/sotn-assets/build.go +++ b/tools/sotn-assets/build.go @@ -342,7 +342,9 @@ func buildFrameSet(inputFileName, outputFileName, prefix string) error { sb := strings.Builder{} sb.WriteString("// clang-format off\n") r := rand.New(rand.NewSource(int64(len(data)))) - buildSpriteGroup(&sb, sprites, prefix, r) + if len(sprites) > 0 { + buildSpriteGroup(&sb, sprites, prefix, r) + } return os.WriteFile(outputFileName, []byte(sb.String()), 0644) } From 1b042c4bf2be7bfd1fe44b94819b39479bd2da7b Mon Sep 17 00:00:00 2001 From: Luciano Ciccariello Date: Fri, 9 Aug 2024 00:51:21 +0100 Subject: [PATCH 24/24] Revert "Downgrade agent to win2019" This reverts commit f611b8caf9230ec014f280f8563e6e4655bf74a2. --- .github/workflows/picci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/picci.yaml b/.github/workflows/picci.yaml index 8b372cf9b1..c182009e3e 100644 --- a/.github/workflows/picci.yaml +++ b/.github/workflows/picci.yaml @@ -102,7 +102,7 @@ jobs: cmake --build ${{github.workspace}}/pc --config Release build-windows: - runs-on: windows-2019 + runs-on: windows-latest needs: extract-assets steps: - name: Install requirements