Adjustments following kind discussion with LunarJetman on IRC

This commit is contained in:
2020-03-22 17:19:26 +00:00
parent ba7c06e5fd
commit 3cb32b8962
9 changed files with 73 additions and 62 deletions

2
.gitignore vendored
View File

@@ -7,6 +7,6 @@
/view-minimap
/view-menu
/view-set
/wh40k
/ordoor
/investigation/Maps
/investigation/Obj

View File

@@ -2,7 +2,7 @@ srcfiles = Makefile go.mod $(shell find . -iname *.go)
GOBUILD ?= go build -tags ebitengl
all: loader palette-idx view-obj view-map view-menu view-minimap view-set wh40k
all: loader ordoor palette-idx view-obj view-map view-menu view-minimap view-set
loader: $(srcfiles)
$(GOBUILD) -o loader ./cmd/loader
@@ -25,10 +25,10 @@ view-minimap: $(srcfiles)
view-set: $(srcfiles)
$(GOBUILD) -o view-set ./cmd/view-set
wh40k: $(srcfiles)
$(GOBUILD) -o wh40k ./cmd/wh40k
ordoor: $(srcfiles)
$(GOBUILD) -o ordoor ./cmd/ordoor
clean:
rm -f loader view-obj view-map view-minimap view-set wh40k palette-idx
rm -f loader ordoor view-obj view-map view-minimap view-set palette-idx
.PHONY: all clean

View File

@@ -1,16 +1,27 @@
# Ordoor
Portmanteau of Order Door, a remake project for Warhammer 40,000: Chaos Gate,
the game from 1998.
Ordoor is an **unofficial** [game engine recreation](https://en.wikipedia.org/wiki/Game_engine_recreation)
of the classic game from 1998, [Warhammer 40,000: Chaos Gate](https://en.wikipedia.org/wiki/Warhammer_40,000:_Chaos_Gate)
**You must have a copy of the original game data to use this project**
**You must have a copy of the original game data to use this project**. GOG is
the current publisher of this game; [you can purchase it here](https://www.gog.com/game/warhammer_40000_chaos_gate).
No game yet, nothing even close. I'm in the very early stages of trying to
understand the various file formats. Until then, you can play WH40K: Chaos Gate
in a WinXP VM, disconnected from the internet. It doesn't need 3D rendering!
"Warhammer 40,000" is a trademark of Games Workshop, and the game data used by
Ordoor contains Games Workshop intellectual property. I am confident that this
project uses all those things in accordance with the
[Intellectual Property Policy](https://www.games-workshop.com/en-GB/Intellectual-Property-Policy)
and the license granted when purchasing a copy of the game in question. Do let
me know if you see or suspect any violation, and I'll address it immediately.
WH40K.exe is the existing game engine, and WH40K_TD.exe is the map editor.
Allows things to be saved as .MAP or as .SMF ("Super Macro File").
Ordoor is a portmanteau of Order Door, which is, of course, the opposite of a
Chaos Gate.
## Current status
Some of the original file formats are either partially or fully decoded. Maps,
menus, and most visual data can be rendered pixel-perfect. Sound can be played
(with a preprocessing step). Some UI tookit work is done. No game mechanics are
implemented yet.
## Building from source
@@ -66,12 +77,12 @@ Use the arrow keys to scroll around the map, the mouse wheel to zoom, and the
Dependency management uses `go mod`, so ensure you have at least Go 1.11.
There is the **start** of the menu / campaign flow in a `wh40k` binary:
There is the **start** of the menu / campaign flow in a `ordoor` binary:
```
$ cp config.toml.example config.toml
$ make wh40k
$ ./wh40k
$ make ordoor
$ ./ordoor
```
This plays the introductory videos so far, and nothing else.

View File

@@ -4,7 +4,7 @@ import (
"log"
"os"
"code.ur.gs/lupine/ordoor/internal/wh40k"
"code.ur.gs/lupine/ordoor/internal/ordoor"
)
func main() {
@@ -13,7 +13,7 @@ func main() {
configFile = os.Args[1]
}
if err := wh40k.Run(configFile); err != nil {
if err := ordoor.Run(configFile); err != nil {
log.Fatalf(err.Error())
}

View File

@@ -1,4 +1,4 @@
[wh40k]
[ordoor]
data_dir = "./orig"
video_player = [
"mpv",

View File

@@ -12,7 +12,7 @@ type WH40K struct {
}
type Config struct {
WH40K `toml:"wh40k"`
WH40K `toml:"ordoor"`
}
func Load(filename string) (*Config, error) {

View File

@@ -1,8 +1,8 @@
// package wh40k implements the full WH40K.EXE functionality, and is used from
// cmd/wh40k/main.go
// package ordoor implements the full WH40K.EXE functionality, and is used from
// cmd/ordoor/main.go
//
// Entrypoint is Run()
package wh40k
package ordoor
import (
"fmt"
@@ -10,7 +10,7 @@ import (
"code.ur.gs/lupine/ordoor/internal/config"
)
type WH40K struct {
type Ordoor struct {
Config *config.Config
}
@@ -20,12 +20,12 @@ func Run(configFile string) error {
return fmt.Errorf("Couldn't load config file: %v", err)
}
wh40k := &WH40K{
ordoor := &Ordoor{
Config: cfg,
}
wh40k.PlaySkippableVideo("LOGOS")
wh40k.PlaySkippableVideo("movie1")
ordoor.PlaySkippableVideo("LOGOS")
ordoor.PlaySkippableVideo("movie1")
// TODO: load main interface

35
internal/ordoor/videos.go Normal file
View File

@@ -0,0 +1,35 @@
package ordoor
import (
"log"
"os/exec"
)
func (o *Ordoor) PlayVideo(name string, skippable bool) {
filename := o.Config.DataFile("SMK/" + name + ".smk")
if len(o.Config.VideoPlayer) == 0 {
log.Printf("Video player not configured, skipping video %v", filename)
return
}
argc := o.Config.VideoPlayer[0]
argv := append(o.Config.VideoPlayer[1:])
if skippable {
argv = append(argv, "--input-conf=skippable.mpv.conf")
}
argv = append(argv, filename)
if err := exec.Command(argc, argv...).Run(); err != nil {
log.Printf("Error playing video %v: %v", filename, err)
}
}
func (o *Ordoor) PlayUnskippableVideo(name string) {
o.PlayVideo(name, false)
}
func (o *Ordoor) PlaySkippableVideo(name string) {
o.PlayVideo(name, true)
}

View File

@@ -1,35 +0,0 @@
package wh40k
import (
"log"
"os/exec"
)
func (w *WH40K) PlayVideo(name string, skippable bool) {
filename := w.Config.DataFile("SMK/" + name + ".smk")
if len(w.Config.VideoPlayer) == 0 {
log.Printf("Video player not configured, skipping video %v", filename)
return
}
argc := w.Config.VideoPlayer[0]
argv := append(w.Config.VideoPlayer[1:])
if skippable {
argv = append(argv, "--input-conf=skippable.mpv.conf")
}
argv = append(argv, filename)
if err := exec.Command(argc, argv...).Run(); err != nil {
log.Printf("Error playing video %v: %v", filename, err)
}
}
func (w *WH40K) PlayUnskippableVideo(name string) {
w.PlayVideo(name, false)
}
func (w *WH40K) PlaySkippableVideo(name string) {
w.PlayVideo(name, true)
}