mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
Moved files around to allow running from root path
This commit is contained in:
parent
8bfcc220cb
commit
ec4949bc1b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
**/*__debug_bin
|
**/*__debug_bin
|
||||||
.vscode/*.*
|
.vscode/**/*
|
||||||
**/Client.exe
|
**/Client.exe
|
||||||
**/Client
|
**/Client
|
||||||
|
.idea/**/*
|
||||||
|
.vs/**/*
|
@ -1,4 +1,4 @@
|
|||||||
package OpenDiablo2
|
package Common
|
||||||
|
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package OpenDiablo2
|
package Core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -37,7 +37,7 @@ type Engine struct {
|
|||||||
Settings EngineConfig // Engine configuration settings from json file
|
Settings EngineConfig // Engine configuration settings from json file
|
||||||
Files map[string]string // Map that defines which files are in which MPQs
|
Files map[string]string // Map that defines which files are in which MPQs
|
||||||
Palettes map[Palettes.Palette]Common.Palette // Color palettes
|
Palettes map[Palettes.Palette]Common.Palette // Color palettes
|
||||||
SoundEntries map[string]SoundEntry // Sound configurations
|
SoundEntries map[string]Sound.SoundEntry // Sound configurations
|
||||||
LoadingSprite *Common.Sprite // The sprite shown when loading stuff
|
LoadingSprite *Common.Sprite // The sprite shown when loading stuff
|
||||||
loadingProgress float64 // LoadingProcess is a range between 0.0 and 1.0. If set, loading screen displays.
|
loadingProgress float64 // LoadingProcess is a range between 0.0 and 1.0. If set, loading screen displays.
|
||||||
stepLoadingSize float64 // The size for each loading step
|
stepLoadingSize float64 // The size for each loading step
|
||||||
@ -148,13 +148,13 @@ func (v *Engine) loadPalettes() {
|
|||||||
|
|
||||||
func (v *Engine) loadSoundEntries() {
|
func (v *Engine) loadSoundEntries() {
|
||||||
log.Println("loading sound configurations")
|
log.Println("loading sound configurations")
|
||||||
v.SoundEntries = make(map[string]SoundEntry)
|
v.SoundEntries = make(map[string]Sound.SoundEntry)
|
||||||
soundData := strings.Split(string(v.LoadFile(ResourcePaths.SoundSettings)), "\r\n")[1:]
|
soundData := strings.Split(string(v.LoadFile(ResourcePaths.SoundSettings)), "\r\n")[1:]
|
||||||
for _, line := range soundData {
|
for _, line := range soundData {
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
soundEntry := CreateSoundEntry(line)
|
soundEntry := Sound.CreateSoundEntry(line)
|
||||||
v.SoundEntries[soundEntry.Handle] = soundEntry
|
v.SoundEntries[soundEntry.Handle] = soundEntry
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ On windows this folder will most likely be in `C:\\users\\(you)\\go\\src\\github
|
|||||||
|
|
||||||
In the root folder, run `go get -d` to pull down all dependencies.
|
In the root folder, run `go get -d` to pull down all dependencies.
|
||||||
|
|
||||||
To run the project, run `go run ./cmd/Client` from the root folder.
|
To run the project, run `go run .` from the root folder.
|
||||||
|
|
||||||
You can also open the root folder in VSCode. Make sure you have the `ms-vscode.go` plugin installed.
|
You can also open the root folder in VSCode. Make sure you have the `ms-vscode.go` plugin installed.
|
||||||
|
|
||||||
|
68
Sound/SoundEntry.go
Normal file
68
Sound/SoundEntry.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package Sound
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/essial/OpenDiablo2/Common"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SoundEntry represents a sound entry
|
||||||
|
type SoundEntry struct {
|
||||||
|
Handle string
|
||||||
|
Index int
|
||||||
|
FileName string
|
||||||
|
Volume byte
|
||||||
|
GroupSize uint8
|
||||||
|
Loop bool
|
||||||
|
FadeIn uint8
|
||||||
|
FadeOut uint8
|
||||||
|
DeferInst uint8
|
||||||
|
StopInst uint8
|
||||||
|
Duration uint8
|
||||||
|
Compound int8
|
||||||
|
Reverb bool
|
||||||
|
Falloff uint8
|
||||||
|
Cache uint8
|
||||||
|
AsyncOnly bool
|
||||||
|
Priority uint8
|
||||||
|
Stream uint8
|
||||||
|
Stereo uint8
|
||||||
|
Tracking uint8
|
||||||
|
Solo uint8
|
||||||
|
MusicVol uint8
|
||||||
|
Block1 int
|
||||||
|
Block2 int
|
||||||
|
Block3 int
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSoundEntry creates a sound entry based on a sound row on sounds.txt
|
||||||
|
func CreateSoundEntry(soundLine string) SoundEntry {
|
||||||
|
props := strings.Split(soundLine, "\t")
|
||||||
|
result := SoundEntry{
|
||||||
|
Handle: props[0],
|
||||||
|
Index: Common.StringToInt(props[1]),
|
||||||
|
FileName: props[2],
|
||||||
|
Volume: Common.StringToUint8(props[3]),
|
||||||
|
GroupSize: Common.StringToUint8(props[4]),
|
||||||
|
Loop: Common.StringToUint8(props[5]) == 1,
|
||||||
|
FadeIn: Common.StringToUint8(props[6]),
|
||||||
|
FadeOut: Common.StringToUint8(props[7]),
|
||||||
|
DeferInst: Common.StringToUint8(props[8]),
|
||||||
|
StopInst: Common.StringToUint8(props[9]),
|
||||||
|
Duration: Common.StringToUint8(props[10]),
|
||||||
|
Compound: Common.StringToInt8(props[11]),
|
||||||
|
Reverb: Common.StringToUint8(props[12]) == 1,
|
||||||
|
Falloff: Common.StringToUint8(props[13]),
|
||||||
|
Cache: Common.StringToUint8(props[14]),
|
||||||
|
AsyncOnly: Common.StringToUint8(props[15]) == 1,
|
||||||
|
Priority: Common.StringToUint8(props[16]),
|
||||||
|
Stream: Common.StringToUint8(props[17]),
|
||||||
|
Stereo: Common.StringToUint8(props[18]),
|
||||||
|
Tracking: Common.StringToUint8(props[19]),
|
||||||
|
Solo: Common.StringToUint8(props[20]),
|
||||||
|
MusicVol: Common.StringToUint8(props[21]),
|
||||||
|
Block1: Common.StringToInt(props[22]),
|
||||||
|
Block2: Common.StringToInt(props[23]),
|
||||||
|
Block3: Common.StringToInt(props[24]),
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
@ -1,67 +0,0 @@
|
|||||||
package OpenDiablo2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SoundEntry represents a sound entry
|
|
||||||
type SoundEntry struct {
|
|
||||||
Handle string
|
|
||||||
Index int
|
|
||||||
FileName string
|
|
||||||
Volume byte
|
|
||||||
GroupSize uint8
|
|
||||||
Loop bool
|
|
||||||
FadeIn uint8
|
|
||||||
FadeOut uint8
|
|
||||||
DeferInst uint8
|
|
||||||
StopInst uint8
|
|
||||||
Duration uint8
|
|
||||||
Compound int8
|
|
||||||
Reverb bool
|
|
||||||
Falloff uint8
|
|
||||||
Cache uint8
|
|
||||||
AsyncOnly bool
|
|
||||||
Priority uint8
|
|
||||||
Stream uint8
|
|
||||||
Stereo uint8
|
|
||||||
Tracking uint8
|
|
||||||
Solo uint8
|
|
||||||
MusicVol uint8
|
|
||||||
Block1 int
|
|
||||||
Block2 int
|
|
||||||
Block3 int
|
|
||||||
}
|
|
||||||
|
|
||||||
// CreateSoundEntry creates a sound entry based on a sound row on sounds.txt
|
|
||||||
func CreateSoundEntry(soundLine string) SoundEntry {
|
|
||||||
props := strings.Split(soundLine, "\t")
|
|
||||||
result := SoundEntry{
|
|
||||||
Handle: props[0],
|
|
||||||
Index: StringToInt(props[1]),
|
|
||||||
FileName: props[2],
|
|
||||||
Volume: StringToUint8(props[3]),
|
|
||||||
GroupSize: StringToUint8(props[4]),
|
|
||||||
Loop: StringToUint8(props[5]) == 1,
|
|
||||||
FadeIn: StringToUint8(props[6]),
|
|
||||||
FadeOut: StringToUint8(props[7]),
|
|
||||||
DeferInst: StringToUint8(props[8]),
|
|
||||||
StopInst: StringToUint8(props[9]),
|
|
||||||
Duration: StringToUint8(props[10]),
|
|
||||||
Compound: StringToInt8(props[11]),
|
|
||||||
Reverb: StringToUint8(props[12]) == 1,
|
|
||||||
Falloff: StringToUint8(props[13]),
|
|
||||||
Cache: StringToUint8(props[14]),
|
|
||||||
AsyncOnly: StringToUint8(props[15]) == 1,
|
|
||||||
Priority: StringToUint8(props[16]),
|
|
||||||
Stream: StringToUint8(props[17]),
|
|
||||||
Stereo: StringToUint8(props[18]),
|
|
||||||
Tracking: StringToUint8(props[19]),
|
|
||||||
Solo: StringToUint8(props[20]),
|
|
||||||
MusicVol: StringToUint8(props[21]),
|
|
||||||
Block1: StringToInt(props[22]),
|
|
||||||
Block2: StringToInt(props[23]),
|
|
||||||
Block3: StringToInt(props[24]),
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
@ -1,19 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/essial/OpenDiablo2/Core"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/essial/OpenDiablo2"
|
|
||||||
"github.com/essial/OpenDiablo2/MPQ"
|
"github.com/essial/OpenDiablo2/MPQ"
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
)
|
)
|
||||||
|
|
||||||
var d2Engine *OpenDiablo2.Engine
|
var d2Engine *Core.Engine
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.Println("OpenDiablo2 - Open source Diablo 2 engine")
|
log.Println("OpenDiablo2 - Open source Diablo 2 engine")
|
||||||
MPQ.InitializeCryptoBuffer()
|
MPQ.InitializeCryptoBuffer()
|
||||||
d2Engine = OpenDiablo2.CreateEngine()
|
d2Engine = Core.CreateEngine()
|
||||||
ebiten.SetCursorVisible(false)
|
ebiten.SetCursorVisible(false)
|
||||||
ebiten.SetFullscreen(d2Engine.Settings.FullScreen)
|
ebiten.SetFullscreen(d2Engine.Settings.FullScreen)
|
||||||
ebiten.SetRunnableInBackground(d2Engine.Settings.RunInBackground)
|
ebiten.SetRunnableInBackground(d2Engine.Settings.RunInBackground)
|
Loading…
x
Reference in New Issue
Block a user