Skip to content

Commit

Permalink
chore: identify a few more ScriptActionType
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkAtra committed Sep 27, 2024
1 parent ba468b9 commit 0182176
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ enum class ScriptActionType(
AUDIO_OVERRIDE_VOLUME_TYPE(224u),
AUDIO_RESTORE_VOLUME_TYPE(225u),
AUDIO_RESTORE_VOLUME_ALL_TYPE(226u),
UNKNOWN_227(227u),
UNUSED_PLACEHOLDER_227(227u),
UNKNOWN_228(228u),
UNKNOWN_229(229u),
UNKNOWN_230(230u),
Expand Down Expand Up @@ -349,7 +349,7 @@ enum class ScriptActionType(
UNKNOWN_340(340u),
CAMERA_BLOOM_EFFECT_BEGIN(341u),
CAMERA_BLOOM_EFFECT_END(342u),
UNKNOWN_343(343u),
UNUSED_PLACEHOLDER_343(343u),
UNKNOWN_344(344u),
UNKNOWN_345(345u),
UNKNOWN_346(346u),
Expand Down Expand Up @@ -388,7 +388,7 @@ enum class ScriptActionType(
UNKNOWN_379(379u),
UNKNOWN_380(380u),
NAMED_BASE_UNPACK(381u),
UNKNOWN_382(382u),
UNUSED_PLACEHOLDER_382(382u),
BUILD_BASE_BUILDING(383u),
BUILD_BASE_BUILDING_IN_SLOT(384u),
BUILD_BASE_BUILDING_PER_TACTICAL_MARKER(385u),
Expand Down Expand Up @@ -486,7 +486,7 @@ enum class ScriptActionType(
MUSIC_SCRIPT_PUSH_TRACK_FINITE_TIMES(477u),
MUSIC_SCRIPT_PUSH_TRACK_FINITE_TIMES_AND_NOTIFY(478u),
UNKNOWN_479(479u),
UNKNOWN_480(480u),
UNUSED_PLACEHOLDER_480(480u),
UNKNOWN_481(481u),
UNKNOWN_482(482u),
UNKNOWN_483(483u),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import de.darkatra.bfme2.Vector3
import de.darkatra.bfme2.map.camera.LookAtCameraAnimation
import de.darkatra.bfme2.map.globallighting.TimeOfDay
import de.darkatra.bfme2.map.`object`.RoadType
import de.darkatra.bfme2.map.scripting.ScriptActionType
import de.darkatra.bfme2.map.scripting.ScriptConditionType
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -137,9 +138,17 @@ internal class MapFileReaderTest {
val testScripts = map.playerScriptsList.scriptLists.first().scriptFolders.first().scripts

// the first script in the test folder contains multiple actions - check if all of them are correctly mapped to an enum value
// TODO: take all actions from the first script, sorts them and write them to a new script in the script folder (once)
val firstScript = testScripts.first()
// placeholder actions do not have an internalName - skip these in the assertions
val placeholders = setOf(
ScriptActionType.UNUSED_PLACEHOLDER_227,
ScriptActionType.UNUSED_PLACEHOLDER_343,
ScriptActionType.UNUSED_PLACEHOLDER_382,
ScriptActionType.UNUSED_PLACEHOLDER_480
)
firstScript.actions.forEach { action ->
if (action.type.name != action.internalName.name) {
if (action.type.name != action.internalName.name && !placeholders.contains(action.type)) {
println("ScriptActionType ${action.type.id}u in Script ${firstScript.name}: ${action.internalName.name}")
}
}
Expand All @@ -155,12 +164,16 @@ internal class MapFileReaderTest {
}

// FIXME: enable assertions once all ScriptActionTypes are identified
// testScripts.forEach { script ->
// val action = script.actions.first()
// assertThat(script.name)
// .isEqualTo(action.type.name)
// .isEqualTo(action.internalName.name)
// }
//testScripts.forEach { script ->
// val action = script.actions.first()
// if (placeholders.contains(action.type)) {
// assertThat(action.internalName.name).isEqualTo("")
// } else {
// assertThat(script.name)
// .isEqualTo(action.type.name)
// .isEqualTo(action.internalName.name)
// }
//}
}

@Test
Expand Down
Binary file modified map/src/test/resources/maps/bfme2-rotwk/all scripts.map
Binary file not shown.

0 comments on commit 0182176

Please sign in to comment.