Skip to content

Commit

Permalink
More build updates. Added build info to game.
Browse files Browse the repository at this point in the history
essial committed Nov 2, 2019
1 parent 33db9b1 commit fc8191c
Showing 11 changed files with 78 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions Common/BuildInfo.go
Original file line number Diff line number Diff line change
@@ -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,
}
}
Binary file added OpenDiablo2.exe
Binary file not shown.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Binary file added ResourceHacker.exe
Binary file not shown.
9 changes: 9 additions & 0 deletions ResourceHacker.ini
Original file line number Diff line number Diff line change
@@ -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=
18 changes: 18 additions & 0 deletions Scenes/MainMenu.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Language": "ENG",
"FullScreen": false,
"FullScreen": true,
"Scale": 1,
"TicksPerSecond": -1,
"RunInBackground": true,
Binary file added d2logo.ico
Binary file not shown.
Binary file added d2logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
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)
ebiten.SetFullscreen(d2Engine.Settings.FullScreen)
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)
}
}

0 comments on commit fc8191c

Please sign in to comment.