More build updates. Added build info to game.

This commit is contained in:
Tim Sarbin 2019-11-02 16:15:16 -04:00
parent 33db9b1a7b
commit fc8191c812
11 changed files with 78 additions and 4 deletions

View File

@ -17,8 +17,10 @@ script:
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install 7zip.portable ; fi
- mkdir -p ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME
- go get
- go build .
- go build -ldflags "-X main.GitCommit=$TRAVIS_COMMIT -X main.GitBranch=$TRAVIS_TAG"
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then ResourceHacker -open OpenDiablo2.exe -save OpenDiablo2.exe -action addskip -res d2logo.ico -mask ICONGROUP,MAIN, ; fi
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then cp ./OpenDiablo2.exe ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME ; else cp ./OpenDiablo2 ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME; fi
- cp ./d2logo.png ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME
- cp ./config.json ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then 7z a -r opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME.zip ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME ; else tar -cvzf opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz ./opendiablo2-$TRAVIS_TAG-$TRAVIS_OS_NAME ; fi
git:

15
Common/BuildInfo.go Normal file
View File

@ -0,0 +1,15 @@
package Common
type BuildInfoRecord struct {
Branch string
Commit string
}
var BuildInfo BuildInfoRecord
func SetBuildInfo(branch, commit string) {
BuildInfo = BuildInfoRecord{
Branch: branch,
Commit: commit,
}
}

BIN
OpenDiablo2.exe Normal file

Binary file not shown.

View File

@ -3,7 +3,7 @@
[Join us on Discord!](https://discord.gg/pRy8tdc)\
[Development Live stream](https://www.twitch.tv/essial/)
![Main Menu](docs/MainMenuSS.png)
![Logo](d2logo.png)
## About this project
@ -58,3 +58,17 @@ then clicking on `Edit in settings.json`. Just paste that section where appropri
The engine is configured via the `config.json` file. By default, the configuration assumes that you have installed Diablo 2 and the
expansion via the official Blizzard Diablo2 installers using the default file paths. If you are not on Windows, or have installed
the game in a different location, the base path may have to be adjusted.
## Screenshots
![Main Menu](docs/MainMenuSS.png)
![Select Hero](docs/SelectHeroSS.png)
## Additional Credits
- Diablo2 Logo
- Jose Pardilla (th3-prophetman)
- DT1 File Specifications
- Paul SIRAMY (http://paul.siramy.free.fr/_divers/dt1_doc/)
- Other Specifications and general info
- Various users on [Phrozen Keep](https://d2mods.info/home.php)

BIN
ResourceHacker.exe Normal file

Binary file not shown.

9
ResourceHacker.ini Normal file
View File

@ -0,0 +1,9 @@
[MRU List]
MRU1=C:\Users\lunat\go\src\github.com\essial\OpenDiablo2\OpenDiablo2.exe
MRU2=
MRU3=
MRU4=
MRU5=
MRU6=
MRU7=
MRU8=

View File

@ -38,6 +38,8 @@ type MainMenu struct {
copyrightLabel *UI.Label
copyrightLabel2 *UI.Label
openDiabloLabel *UI.Label
versionLabel *UI.Label
commitLabel *UI.Label
ShowTrademarkScreen bool
leftButtonHeld bool
@ -60,6 +62,20 @@ func CreateMainMenu(fileProvider Common.FileProvider, sceneProvider SceneProvide
func (v *MainMenu) Load() []func() {
v.soundManager.PlayBGM(ResourcePaths.BGMTitle)
return []func(){
func() {
v.versionLabel = UI.CreateLabel(v.fileProvider, ResourcePaths.FontFormal12, PaletteDefs.Static)
v.versionLabel.Alignment = UI.LabelAlignRight
v.versionLabel.SetText("OpenDiablo2 - " + Common.BuildInfo.Branch)
v.versionLabel.Color = color.RGBA{255, 255, 255, 255}
v.versionLabel.MoveTo(795, -10)
},
func() {
v.commitLabel = UI.CreateLabel(v.fileProvider, ResourcePaths.FontFormal10, PaletteDefs.Static)
v.commitLabel.Alignment = UI.LabelAlignLeft
v.commitLabel.SetText(Common.BuildInfo.Commit)
v.commitLabel.Color = color.RGBA{255, 255, 255, 255}
v.commitLabel.MoveTo(2, 2)
},
func() {
v.copyrightLabel = UI.CreateLabel(v.fileProvider, ResourcePaths.FontFormal12, PaletteDefs.Static)
v.copyrightLabel.Alignment = UI.LabelAlignCenter
@ -216,6 +232,8 @@ func (v *MainMenu) Render(screen *ebiten.Image) {
v.copyrightLabel2.Draw(screen)
} else {
v.openDiabloLabel.Draw(screen)
v.versionLabel.Draw(screen)
v.commitLabel.Draw(screen)
}
}

View File

@ -1,6 +1,6 @@
{
"Language": "ENG",
"FullScreen": false,
"FullScreen": true,
"Scale": 1,
"TicksPerSecond": -1,
"RunInBackground": true,

BIN
d2logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

BIN
d2logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

18
main.go
View File

@ -1,18 +1,34 @@
package main
import (
"image"
"log"
"github.com/hajimehoshi/ebiten/ebitenutil"
"github.com/essial/OpenDiablo2/Common"
"github.com/essial/OpenDiablo2/Core"
"github.com/essial/OpenDiablo2/MPQ"
"github.com/hajimehoshi/ebiten"
)
var GitBranch string
var GitCommit string
var d2Engine *Core.Engine
func main() {
if len(GitBranch) == 0 {
GitBranch = "Local Build"
GitCommit = ""
}
Common.SetBuildInfo(GitBranch, GitCommit)
log.SetFlags(log.Ldate | log.LUTC | log.Lmicroseconds | log.Llongfile)
log.Println("OpenDiablo2 - Open source Diablo 2 engine")
_, iconImage, err := ebitenutil.NewImageFromFile("d2logo.png", ebiten.FilterLinear)
if err == nil {
ebiten.SetWindowIcon([]image.Image{iconImage})
}
MPQ.InitializeCryptoBuffer()
d2Engine = Core.CreateEngine()
ebiten.SetCursorVisible(false)
@ -20,7 +36,7 @@ func main() {
ebiten.SetRunnableInBackground(d2Engine.Settings.RunInBackground)
ebiten.SetVsyncEnabled(d2Engine.Settings.VsyncEnabled)
ebiten.SetMaxTPS(d2Engine.Settings.TicksPerSecond)
if err := ebiten.Run(update, 800, 600, d2Engine.Settings.Scale, "OpenDiablo 2"); err != nil {
if err := ebiten.Run(update, 800, 600, d2Engine.Settings.Scale, "OpenDiablo 2 ("+GitBranch+")"); err != nil {
log.Fatal(err)
}
}