Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

align all campaign features #4775

Closed
wzdev-ci opened this issue Apr 19, 2018 · 11 comments
Closed

align all campaign features #4775

wzdev-ci opened this issue Apr 19, 2018 · 11 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by Forgon


Features should be aligned, which means that their x and y coordinates are positioned at a corner or the center of a tile. Otherwise, warnings are printed (see './src/feature.cpp:208'). For example, starting campaign mission Alpha 1 lead to the following 5 warnings:

warning |21:00:00: [buildFeature:208] Feature not aligned. position (5422,4658), size (1,1) (**Further warnings of this type are suppressed.)
warning |21:00:00: [buildFeature:208] Feature not aligned. position (5068,4689), size (1,1) (**Further warnings of this type are suppressed.)
warning |21:00:00: [buildFeature:208] Feature not aligned. position (5323,4676), size (1,1) (**Further warnings of this type are suppressed.)
warning |21:00:00: [buildFeature:208] Feature not aligned. position (1908,1923), size (1,1) (**Further warnings of this type are suppressed.)
warning |21:00:00: [buildFeature:208] Feature not aligned. position (5474,6205), size (1,1) (**Further warnings of this type are suppressed.)

These features are now aligned, as are all other campaign features. This slightly changes the appearance of a few campaign maps (compare [raw-attachment:alpha1_feature_alignment_old.png] with [raw-attachment:alpha1_feature_alignment_new.png]).

The positions of campaign features are stored in binary files named "feat.bjo", of which the following were modified:

  • ./data/base/wrf/cam1/cam1a/feat.bjo
  • ./data/base/wrf/cam1/sub1-3/feat.bjo
  • ./data/base/wrf/cam2/cam2b/feat.bjo
  • ./data/base/wrf/cam2/cam2c/feat.bjo
  • ./data/base/wrf/cam2/sub2-1/feat.bjo
  • ./data/base/wrf/cam2/sub2-2/feat.bjo
  • ./data/base/wrf/cam2/sub2-5/feat.bjo
  • ./data/base/wrf/cam2/sub2-6/feat.bjo
  • ./data/base/wrf/cam2/sub2-7/feat.bjo
  • ./data/base/wrf/cam2/sub2-8/feat.bjo
  • ./data/base/wrf/cam2/sub2-d/feat.bjo
  • ./data/base/wrf/cam3/sub3-3/feat.bjo

To correct feature positions in these files, I wrote an AWK script, which is attached.

The format of 'feat.bjo' files is documented in './src/game.cpp'. The bulk of its content is defined by the data structures OBJECT_SAVE_V19 or OBJECT_SAVE_V20 (see './src/game.cpp:224'). Their field "inFire" is of type "int32_t", but read as unsigned value in './tools/map/mapload.cpp:235' and './tools/map/mapload.cpp:369'. Should this be fixed?

I also noticed two other oddities, which may require further investigation:

  • file './data/base/wrf/cam3/sub3-x/feat.bjo' is of version 2, which is unsupported (the minimum supported version is 8). Edit: I have created ticket removed unused campaign mission sub3-x #4776, since the mission the file belongs to appears to be unused.
  • many of the early campaign missions contain garbage in the name fields of their 'feat.bjo' files: Following the null character which terminates the feature names, parts of other feature names are printed in their remaining bytes. My guess is that this was caused by faulty software.

Issue migrated from trac:4775 at 2022-04-16 13:05:24 -0700

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file feature_alignment.patch (6.8 KiB)

patch file created with git format-patch

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file alpha1_feature_alignment_old.png (520.5 KiB)

unaligned features of Alpha 1 before applying this patch
alpha1_feature_alignment_old.png

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file alpha1_feature_alignment_new.png (531.8 KiB)

aligned features of Alpha 1 after applying this patch
alpha1_feature_alignment_new.png

@wzdev-ci
Copy link
Contributor Author

Forgon uploaded file align_features (5.2 KiB)

AWK script that aligns features of all files named 'feat.bjo' inside the current working directory

@wzdev-ci
Copy link
Contributor Author

Berserk Cyborg commented


Sub3-x is most likely the remains of a nonexistent mission and can be removed. It might have been an early version of 3-b judging by the placement of Project droids and walls.

@wzdev-ci
Copy link
Contributor Author

Forgon edited the issue description

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Apr 19, 2018

Forgon commented


Replying to Warzone2100/old-trac-import#4775 (comment:1):

Sub3-x is most likely the remains of a nonexistent mission and can be removed. It might have been an early version of 3-b judging by the placement of Project droids and walls.

Thank you for investigating this.
I have created ticket #4776, which proposes to remove all files for that mission.

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed owner from `` to Forgon2100 <forgon2100@gmail.com>

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

Forgon2100 <forgon2100@...> committed [185]


In Warzone2100/warzone2100@185b9be:

#CommitTicketReference repository="" revision="185b9beb2132ebcb6e52851de33883a05cff34ee"
fixes #4775: all campaign features are now aligned

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant