Compare commits
79 Commits
alpha
...
ph3nom/mia
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80bad15904 | ||
|
|
4a453e3604 | ||
|
|
53261e57ed | ||
|
|
d79e4516a5 | ||
|
|
77530e641d | ||
|
|
ed540c8e00 | ||
|
|
428036968f | ||
|
|
30af702b47 | ||
|
|
75c8c88dce | ||
|
|
fea0c64122 | ||
|
|
08ddd4360a | ||
|
|
20b144df82 | ||
|
|
dd34e10ad4 | ||
|
|
d72b0d1894 | ||
|
|
bd7f7f1bd9 | ||
|
|
4ff8143d2e | ||
|
|
c457252551 | ||
|
|
3e474846a7 | ||
|
|
3d72c1765d | ||
|
|
2b5f567d77 | ||
|
|
fad0c7f1d7 | ||
|
|
7cf836e709 | ||
|
|
30ab9ab417 | ||
|
|
b38d4529dd | ||
|
|
f81bb9f7e4 | ||
|
|
49eef3c90c | ||
|
|
de14cc7f93 | ||
|
|
d5d9e99490 | ||
|
|
a4e929f549 | ||
|
|
55e4c6e9cd | ||
|
|
99be4f6404 | ||
|
|
adf8f39bda | ||
|
|
e6a5dbe809 | ||
|
|
018c289d9f | ||
|
|
a4dae3c8a6 | ||
|
|
f2bfb1916c | ||
|
|
4f84051b8c | ||
|
|
2a1092995a | ||
|
|
72a7f72bfe | ||
|
|
b1da5b5461 | ||
|
|
308adb0c64 | ||
|
|
4a6165b6ec | ||
|
|
7d77783492 | ||
|
|
09477b5c78 | ||
|
|
87bfbcab2d | ||
|
|
bdc27bf2fc | ||
|
|
1ee51d5136 | ||
|
|
725d60a9fb | ||
|
|
05e9e7452e | ||
|
|
51b21c02b9 | ||
|
|
86806215a5 | ||
|
|
a056fdecc7 | ||
|
|
b6d5c628b2 | ||
|
|
8c81349c69 | ||
|
|
282b639a4c | ||
|
|
69f9bbcf7b | ||
|
|
40f212e131 | ||
|
|
43c0e99ebf | ||
|
|
42647ddc6b | ||
|
|
b3ccf1f900 | ||
|
|
baf7612fcf | ||
|
|
33b9dd1c8a | ||
|
|
5786eeecb8 | ||
|
|
20864fdac6 | ||
|
|
1587d707a8 | ||
|
|
911b93bd0f | ||
|
|
e86fb27a48 | ||
|
|
2065c9a93f | ||
|
|
a2caa56275 | ||
|
|
fa65f637ad | ||
|
|
0a0a664428 | ||
|
|
5abd0641a4 | ||
|
|
ca866bdb2a | ||
|
|
bf0e36858e | ||
|
|
b90e8433da | ||
|
|
133110c15c | ||
|
|
6f71cfc458 | ||
|
|
02d0103b20 | ||
|
|
72da27ef0b |
8
.vscode/settings.json
vendored
@@ -140,6 +140,12 @@
|
||||
"svd": "cpp",
|
||||
"print": "cpp",
|
||||
"strstream": "cpp",
|
||||
"regex": "cpp"
|
||||
"regex": "cpp",
|
||||
"cassert": "cpp",
|
||||
"barrier": "cpp",
|
||||
"coroutine": "cpp",
|
||||
"future": "cpp",
|
||||
"latch": "cpp",
|
||||
"syncstream": "cpp"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ You will also need the following tools installed
|
||||
|
||||
### Cloning the dca3-game repo and downloading the prebuilt elf
|
||||
- Open dreamsdk shell
|
||||
- type `git clone https://gitlab.com/skmp/dca3-game.git` (and press enter)
|
||||
- type `git clone --branch alpha https://gitlab.com/skmp/dca3-game.git` (and press enter)
|
||||
- It should take a moment and successfully clone the repo
|
||||
- type `cd dca3-game/dreamcast` (and press enter)
|
||||
- type `explorer .` (and press enter).
|
||||
- A folder named dreamcast with some files should be open. Keep it on the side.
|
||||
- Download the artifacts from https://gitlab.com/skmp/dca3-game/-/jobs/8725216645
|
||||
- Download the Alpha Prebuilt Elf from https://gitlab.com/skmp/dca3-game/-/releases
|
||||
- Open artifacts.zip and extract dca3.elf to the folder that was kept open before.
|
||||
- Close the folder and dreamsdk shell
|
||||
|
||||
|
||||
@@ -12,19 +12,19 @@ IS_MAC := $(shell uname -s | grep -i "darwin" > /dev/null && echo "yes" || echo
|
||||
|
||||
MOD_NAME?=
|
||||
|
||||
GTA_DIR?=../../gta3
|
||||
GTA_MOD_DIR?=../../gta3_mod$(MOD_NAME)
|
||||
GTA_DIR?=../../miami
|
||||
GTA_MOD_DIR?=../../miami_mod$(MOD_NAME)
|
||||
GTA_MOD_IMG_DIR?=$(GTA_MOD_DIR)/img
|
||||
GTA_MOD_SFX_DIR?=$(GTA_MOD_DIR)/sfx
|
||||
GTA_MOD_LOOSE_DIR?=$(GTA_MOD_DIR)/loose
|
||||
|
||||
REPACK_DIR?=repack-data
|
||||
REPACK_GTA_DIR?=$(REPACK_DIR)/gta3
|
||||
REPACK_IMG_ORIG_DIR?=$(REPACK_DIR)/img-orig
|
||||
REPACK_IMG_DC_DIR?=$(REPACK_DIR)/img-dc
|
||||
REPACK_SFX_ORIG_DIR?=$(REPACK_DIR)/sfx-orig
|
||||
REPACK_SFX_DC_DIR?=$(REPACK_DIR)/sfx-dc
|
||||
REPACK_STREAM_DECODED_DIR?=$(REPACK_DIR)/stream-decoded
|
||||
REPACK_GTA_DIR?=$(REPACK_DIR)/miami
|
||||
REPACK_IMG_ORIG_DIR?=$(REPACK_DIR)/miami-img-orig
|
||||
REPACK_IMG_DC_DIR?=$(REPACK_DIR)/miami-img-dc
|
||||
REPACK_SFX_ORIG_DIR?=$(REPACK_DIR)/miami-sfx-orig
|
||||
REPACK_SFX_DC_DIR?=$(REPACK_DIR)/miami-sfx-dc
|
||||
REPACK_STREAM_DECODED_DIR?=$(REPACK_DIR)/miami-stream-decoded
|
||||
|
||||
LIBS :=
|
||||
TEXCONV_FLAGS :=
|
||||
@@ -45,7 +45,7 @@ all: $(TARGET)
|
||||
include common.mk
|
||||
|
||||
OBJS = $(RE3_OBJS) $(RW_OBJS) \
|
||||
../src/audio/sampman_dc.o \
|
||||
../miami/audio/sampman_dc.o \
|
||||
../src/prof/profiler.o
|
||||
|
||||
OBJS_TEXCONV = $(RW_OBJS:.o=.texconv.o)
|
||||
@@ -60,44 +60,54 @@ OBJS_TEXCONV += \
|
||||
../vendor/koshle/hlepvr_irq.texconv.o \
|
||||
../vendor/koshle/hlematrix3d.texconv.o \
|
||||
../vendor/librw/src/dc/vq.texconv.o \
|
||||
../src/fakerw/fake.texconv.o \
|
||||
../src/skel/crossplatform.texconv.o \
|
||||
../src/rw/TxdStore.texconv.o \
|
||||
../miami/fakerw/fake.texconv.o \
|
||||
../miami/skel/crossplatform.texconv.o \
|
||||
../miami/rw/TxdStore.texconv.o \
|
||||
../miami/rw/RwHelper.texconv.o \
|
||||
texconv.texconv.o \
|
||||
../vendor/TriStripper/src/connectivity_graph.texconv.o \
|
||||
../vendor/TriStripper/src/policy.texconv.o \
|
||||
../vendor/TriStripper/src/tri_stripper.texconv.o \
|
||||
../src/rw/VisibilityPlugins.texconv.o \
|
||||
../src/rw/NodeName.texconv.o \
|
||||
../src/animation/RpAnimBlend.texconv.o \
|
||||
../src/animation/Bones.texconv.o \
|
||||
../src/animation/AnimBlendAssociation.texconv.o \
|
||||
../src/animation/AnimBlendNode.texconv.o \
|
||||
../src/animation/AnimBlendClumpData.texconv.o \
|
||||
../src/rw/MemoryMgr.texconv.o \
|
||||
../src/math/Quaternion.texconv.o \
|
||||
../miami/rw/VisibilityPlugins.texconv.o \
|
||||
../miami/rw/NodeName.texconv.o \
|
||||
../miami/animation/RpAnimBlend.texconv.o \
|
||||
../miami/animation/Bones.texconv.o \
|
||||
../miami/animation/AnimBlendAssociation.texconv.o \
|
||||
../miami/animation/AnimBlendNode.texconv.o \
|
||||
../miami/animation/AnimBlendClumpData.texconv.o \
|
||||
../miami/rw/MemoryMgr.texconv.o \
|
||||
../miami/math/Quaternion.texconv.o \
|
||||
../vendor/librw/src/ps2-x/ps2.texconv.o \
|
||||
../vendor/librw/src/ps2-x/ps2device.texconv.o \
|
||||
../vendor/librw/src/ps2-x/ps2raster.texconv.o \
|
||||
../vendor/librw/src/ps2-x/ps2skin.texconv.o \
|
||||
../vendor/librw/src/d3d-x/d3d.texconv.o \
|
||||
../vendor/librw/src/d3d-x/d3d8.texconv.o \
|
||||
../vendor/librw/src/d3d-x/d3d8render.texconv.o \
|
||||
../vendor/librw/src/bmp.texconv.o \
|
||||
../vendor/librw/src/png.texconv.o \
|
||||
../vendor/librw/src/lodepng/lodepng.texconv.o
|
||||
|
||||
# Add compilation units to this list to explicity compile them with
|
||||
# -O3 optimizations, while the rest get the default (-Os) treatment
|
||||
# to conserve RAM.
|
||||
OBJS_O3 = \
|
||||
../vendor/librw/src/dc/rwdc.o \
|
||||
../src/core/World.o \
|
||||
../src/collision/Collision.o \
|
||||
../src/math/math.o \
|
||||
../src/math/Matrix.o \
|
||||
../src/math/Quaternion.o \
|
||||
../src/math/Rect.o \
|
||||
../src/math/Vector.o \
|
||||
../miami/core/World.o \
|
||||
../miami/collision/Collision.o \
|
||||
../miami/math/math.o \
|
||||
../miami/math/Matrix.o \
|
||||
../miami/math/Quaternion.o \
|
||||
../miami/math/Rect.o \
|
||||
../miami/math/Vector.o \
|
||||
../vendor/librw/src/base.o \
|
||||
../src/renderer/Shadows.o
|
||||
../miami/renderer/Shadows.o
|
||||
|
||||
OBJS_NO_FAST_MATH = \
|
||||
../src/core/Cam.o \
|
||||
../src/core/Camera.o
|
||||
../miami/core/Cam.o \
|
||||
../miami/core/Camera.o \
|
||||
../miami/vehicles/Bike.o \
|
||||
../miami/renderer/Particle.o
|
||||
|
||||
KOS_CPPFLAGS += -fbuiltin -ffast-math -ffp-contract=fast \
|
||||
-mfsrra -mfsca
|
||||
@@ -115,7 +125,7 @@ CXXFLAGS += $(if $(WITH_32MB),-O3,-Os) \
|
||||
$(if $(WITH_PROF),-DWITH_PROF=\"$(WITH_PROF)\") \
|
||||
-MMD -MP -ffunction-sections -fdata-sections -ffast-math \
|
||||
-fmerge-all-constants -fomit-frame-pointer -ml -std=gnu++20 \
|
||||
-fno-exceptions -fno-rtti -flto=auto -fipa-pta -Wno-write-strings \
|
||||
-fno-exceptions -fno-rtti -fipa-pta -Wno-write-strings \
|
||||
-Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion \
|
||||
-Wno-multichar -Wno-unused-value -Wno-char-subscripts -Wno-reorder \
|
||||
-Wno-unused-function -Wno-class-memaccess -fno-permissive \
|
||||
@@ -155,7 +165,7 @@ $(OBJS_NO_FAST_MATH): %.o: %.cpp
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
kos-c++ -o $(TARGET) $(OBJS) -Wl,--gc-sections -Wl,--as-needed -Wl,-Map,output.map \
|
||||
-flto=auto $(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1
|
||||
$(if $(WITH_IDE),-lkosfat) $(if $(WITH_SD),-lkosfat) -Wl,--build-id=sha1
|
||||
@echo && echo && echo "*** Build Completed Successfully ***" && echo && echo
|
||||
|
||||
run: $(TARGET)
|
||||
@@ -268,6 +278,9 @@ extract-sfx: extract-sfx.cpp
|
||||
pack-sfx: pack-sfx.cpp
|
||||
$(CXX) -std=c++17 -o $@ -Og $<
|
||||
|
||||
adf2mp3: adf2mp3.cpp
|
||||
$(CXX) -o $@ -O3 -g $<
|
||||
|
||||
aud2adpcm: aud2adpcm.c
|
||||
$(CC) -o $@ -O3 -g $< -I../vendor/minimp3
|
||||
|
||||
@@ -275,34 +288,31 @@ texconv: $(OBJS_TEXCONV) | pvrtex # You'll have to rebuild pvrtex manually if yo
|
||||
$(CXX) -o $@ $(OBJS_TEXCONV)
|
||||
|
||||
%.texconv.o: %.cpp
|
||||
$(CXX) -std=c++2a -c -O3 -g -MMD -MP -o $@ -I../vendor/koshle $(INCLUDE) -I../vendor/emu -I../vendor/crypto -I../vendor/TriStripper/include $(DEFINES) -DDC_TEXCONV -DDC_SIM -D_INC_WINDOWS $(TEXCONV_FLAGS) $<
|
||||
$(CXX) -std=c++2a -c -O0 -g -MMD -MP -o $@ -I../vendor/koshle -I../vendor/librw/src $(INCLUDE) -I../vendor/emu -I../vendor/crypto -I../vendor/TriStripper/include $(DEFINES) -DDC_TEXCONV -DDC_SIM $(TEXCONV_FLAGS) $<
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
#### Repacking ####
|
||||
|
||||
TXD_OPTS_fonts = 256 256
|
||||
TXD_OPTS_fronten1 = 512 512
|
||||
TXD_OPTS_fronten2 = 512 512
|
||||
# TXD_OPTS_generic = 512 512
|
||||
# TXD_OPTS_wheels = 512 512
|
||||
TXD_OPTS_hud = 128 128
|
||||
TXD_OPTS_menu = 512 512
|
||||
TXD_OPTS_INTRO = 512 512
|
||||
# TXD_OPTS_MISC = 512 512
|
||||
# TXD_OPTS_particle = 512 512
|
||||
TXD_OPTS_intro1 = 512 512
|
||||
TXD_OPTS_intro2 = 512 512
|
||||
TXD_OPTS_INTRO3 = 512 512
|
||||
TXD_OPTS_intro4 = 512 512
|
||||
TXD_OPTS_LOADSC0 = 512 512
|
||||
TXD_OPTS_LOADSC1 = 512 512
|
||||
TXD_OPTS_LOADSC10 = 512 512
|
||||
TXD_OPTS_LOADSC11 = 512 512
|
||||
TXD_OPTS_LOADSC12 = 512 512
|
||||
TXD_OPTS_LOADSC13 = 512 512
|
||||
TXD_OPTS_LOADSC14 = 512 512
|
||||
TXD_OPTS_LOADSC15 = 512 512
|
||||
TXD_OPTS_LOADSC16 = 512 512
|
||||
TXD_OPTS_LOADSC17 = 512 512
|
||||
TXD_OPTS_LOADSC18 = 512 512
|
||||
TXD_OPTS_LOADSC19 = 512 512
|
||||
TXD_OPTS_LOADSC2 = 512 512
|
||||
TXD_OPTS_LOADSC20 = 512 512
|
||||
TXD_OPTS_LOADSC21 = 512 512
|
||||
TXD_OPTS_LOADSC22 = 512 512
|
||||
TXD_OPTS_LOADSC23 = 512 512
|
||||
TXD_OPTS_LOADSC24 = 512 512
|
||||
TXD_OPTS_LOADSC25 = 512 512
|
||||
TXD_OPTS_LOADSC3 = 512 512
|
||||
TXD_OPTS_LOADSC4 = 512 512
|
||||
TXD_OPTS_LOADSC5 = 512 512
|
||||
@@ -310,12 +320,12 @@ TXD_OPTS_LOADSC6 = 512 512
|
||||
TXD_OPTS_LOADSC7 = 512 512
|
||||
TXD_OPTS_LOADSC8 = 512 512
|
||||
TXD_OPTS_LOADSC9 = 512 512
|
||||
TXD_OPTS_mainsc1 = 512 512
|
||||
TXD_OPTS_mainsc2 = 512 512
|
||||
TXD_OPTS_NEWS = 512 512
|
||||
TXD_OPTS_NEWS = 128 128
|
||||
TXD_OPTS_outro = 512 512
|
||||
TXD_OPTS_SPLASH1 = 512 512
|
||||
TXD_OPTS_SPLASH2 = 512 512
|
||||
TXD_OPTS_SPLASH3 = 512 512
|
||||
|
||||
DEFAULT_RES = 512
|
||||
|
||||
PVR_ENCODER ?= PVRTEX
|
||||
@@ -324,6 +334,7 @@ TEXTURE_DOWNSAMPLE_IMG ?= HALF
|
||||
|
||||
-include texlist.mk
|
||||
-include modlist.mk
|
||||
-include imgmisc.mk
|
||||
-include gta3files.mk
|
||||
-include sfxlist.mk
|
||||
-include sfxlooplist.mk
|
||||
@@ -332,24 +343,26 @@ TEXTURE_DOWNSAMPLE_IMG ?= HALF
|
||||
|
||||
IMG_TEXTURES_DC = $(addprefix $(REPACK_IMG_DC_DIR)/, $(IMG_TEXTURES))
|
||||
IMG_MODELS_DC = $(addprefix $(REPACK_IMG_DC_DIR)/, $(IMG_MODELS))
|
||||
IMG_MISC_DC = $(addprefix $(REPACK_IMG_DC_DIR)/, $(IMG_MISC))
|
||||
LOOSE_FILES_DC = $(addprefix $(REPACK_GTA_DIR)/, $(MISC_FILES))
|
||||
SFX_DC_DIR = $(REPACK_GTA_DIR)/sfx
|
||||
SFX_DC_RAW = $(SFX_DC_DIR)/sfx_all.raw
|
||||
SFX_DC_DSC = $(SFX_DC_DIR)/sfx_all.dsc
|
||||
STREAM_ADPCM_DC = $(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_WAV:.wav=.APM)) \
|
||||
$(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_MP3:.mp3=.APM))
|
||||
$(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_MP3:.mp3=.APM)) \
|
||||
$(addprefix $(REPACK_GTA_DIR)/stream/, $(STREAM_ADF:.adf=.APM))
|
||||
|
||||
IMG_TEXTURES_ORIG = $(addprefix $(REPACK_IMG_ORIG_DIR)/, $(IMG_TEXTURES))
|
||||
IMG_MODELS_ORIG = $(addprefix $(REPACK_IMG_ORIG_DIR)/, $(IMG_MODELS))
|
||||
IMG_MISC_ORIG = $(addprefix $(REPACK_IMG_ORIG_DIR)/, $(IMG_MISC))
|
||||
|
||||
SFX_ORIG = $(addprefix $(REPACK_SFX_ORIG_DIR)/, $(SFX_WAV))
|
||||
SFX_ORIG_LOOP = $(addprefix $(REPACK_SFX_ORIG_DIR)/, $(SFX_LOOP_WAV))
|
||||
SFX_REPACK_DC_WAV = $(addprefix $(REPACK_SFX_DC_DIR)/, $(SFX_WAV) $(SFX_LOOP_WAV))
|
||||
SFX_REPACK_DC = $(SFX_REPACK_DC_WAV:.wav=.pcm)
|
||||
STREAM_MP3_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_MP3:.mp3=.wav))
|
||||
STREAM_WAV_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_WAV))
|
||||
STREAM_ADF_DECODED = $(addprefix $(REPACK_STREAM_DECODED_DIR)/, $(STREAM_ADF:.adf=.mp3))
|
||||
|
||||
.PRECIOUS: $(SFX_ORIG) $(SFX_REPACK_DC) $(STREAM_MP3_DECODED) $(STREAM_WAV_DECODED)
|
||||
.PRECIOUS: $(SFX_ORIG) $(SFX_REPACK_DC) $(STREAM_ADF_DECODED)
|
||||
|
||||
$(REPACK_DIR)/repacked: $(REPACK_GTA_DIR)/models/gta3.img $(REPACK_GTA_DIR)/models/gta3.dir $(LOOSE_FILES_DC) $(STREAM_ADPCM_DC) $(SFX_DC_RAW) $(SFX_DC_DSC)
|
||||
mkdir -p $(@D)
|
||||
@@ -362,7 +375,8 @@ $(REPACK_DIR)/unpacked: imgtool $(GTA_DIR)/models/gta3.img $(GTA_DIR)/models/gta
|
||||
./imgtool unpack "$(GTA_DIR)/models/gta3" "$(REPACK_IMG_ORIG_DIR)"
|
||||
@touch $@
|
||||
|
||||
$(IMG_TEXTURES_ORIG) $(IMG_MODELS_ORIG): $(REPACK_DIR)/unpacked
|
||||
$(IMG_TEXTURES_ORIG) $(IMG_MODELS_ORIG) $(IMG_MISC_ORIG): $(REPACK_DIR)/unpacked
|
||||
@test -f $@
|
||||
@touch $@
|
||||
|
||||
# First try the mods img directory
|
||||
@@ -397,6 +411,22 @@ $(REPACK_IMG_DC_DIR)/%.TXD: $(REPACK_IMG_ORIG_DIR)/%.TXD texconv
|
||||
@mkdir -p $(@D)
|
||||
./texconv $< $@ $(DEFAULT_RES) $(DEFAULT_RES) -e $(PVR_ENCODER) -d $(TEXTURE_DOWNSAMPLE_IMG)
|
||||
|
||||
# First try the mods img directory
|
||||
$(REPACK_IMG_DC_DIR)/%.col: $(GTA_MOD_IMG_DIR)/%.col
|
||||
@mkdir -p $(@D)
|
||||
cp $< $@
|
||||
$(REPACK_IMG_DC_DIR)/%.ifp: $(GTA_MOD_IMG_DIR)/%.ifp
|
||||
@mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
||||
# if not, the extracted img directory
|
||||
$(REPACK_IMG_DC_DIR)/%.col: $(REPACK_IMG_ORIG_DIR)/%.col
|
||||
@mkdir -p $(@D)
|
||||
cp $< $@
|
||||
$(REPACK_IMG_DC_DIR)/%.ifp: $(REPACK_IMG_ORIG_DIR)/%.ifp
|
||||
@mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
||||
# first try the mods loose directory
|
||||
$(REPACK_GTA_DIR)/%.dff: $(GTA_MOD_LOOSE_DIR)/%.dff texconv
|
||||
@mkdir -p $(@D)
|
||||
@@ -430,7 +460,7 @@ $(REPACK_GTA_DIR)/%.TXD: $(GTA_DIR)/%.TXD texconv
|
||||
@mkdir -p $(@D)
|
||||
./texconv $< $@ $(TXD_OPTS_$(notdir $*)) -e $(PVR_ENCODER) -d $(TEXTURE_DOWNSAMPLE_TXD)
|
||||
|
||||
$(REPACK_DIR)/packed: $(IMG_TEXTURES_DC) $(IMG_MODELS_DC)
|
||||
$(REPACK_DIR)/packed: $(IMG_TEXTURES_DC) $(IMG_MODELS_DC) $(IMG_MISC_DC)
|
||||
mkdir -p $(@D)
|
||||
mkdir -p "$(REPACK_GTA_DIR)/models/gta3"
|
||||
./imgtool pack "$(REPACK_GTA_DIR)/models/gta3" "$(REPACK_IMG_DC_DIR)"
|
||||
@@ -440,16 +470,18 @@ $(REPACK_GTA_DIR)/models/gta3.img $(REPACK_GTA_DIR)/models/gta3.dir: $(REPACK_DI
|
||||
@touch $@
|
||||
|
||||
# sfx processing
|
||||
$(REPACK_DIR)/unpacked-sfx: extract-sfx $(GTA_DIR)/audio/sfx.SDT $(GTA_DIR)/audio/sfx.RAW
|
||||
$(REPACK_DIR)/unpacked-sfx: extract-sfx $(GTA_DIR)/Audio/sfx.SDT $(GTA_DIR)/Audio/sfx.RAW
|
||||
mkdir -p $(@D)
|
||||
mkdir -p "$(REPACK_SFX_ORIG_DIR)"
|
||||
./extract-sfx "$(GTA_DIR)/audio/sfx.SDT" "$(GTA_DIR)/audio/sfx.RAW" "$(REPACK_SFX_ORIG_DIR)"
|
||||
./extract-sfx "$(GTA_DIR)/Audio/sfx.SDT" "$(GTA_DIR)/Audio/sfx.RAW" "$(REPACK_SFX_ORIG_DIR)"
|
||||
@touch $@
|
||||
|
||||
$(SFX_ORIG): $(REPACK_DIR)/unpacked-sfx
|
||||
@test -f $@
|
||||
@touch $@
|
||||
|
||||
$(SFX_ORIG_LOOP): $(SFX_ORIG)
|
||||
@test -f $@
|
||||
@touch $@
|
||||
|
||||
# try first mods sfx directory
|
||||
@@ -465,23 +497,40 @@ $(REPACK_SFX_DC_DIR)/%.pcm: $(REPACK_SFX_ORIG_DIR)/%.wav aud2adpcm
|
||||
# stream processing
|
||||
|
||||
# first try the mods loose directory
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/audio/%.wav aud2adpcm
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/Audio/%.wav aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/audio/%.mp3 aud2adpcm
|
||||
$(REPACK_STREAM_DECODED_DIR)/%.mp3: $(GTA_MOD_LOOSE_DIR)/Audio/%.adf adf2mp3
|
||||
@mkdir -p $(@D)
|
||||
./adf2mp3 $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_MOD_LOOSE_DIR)/Audio/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(REPACK_STREAM_DECODED_DIR)/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
# then original folder
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_DIR)/audio/%.wav aud2adpcm
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_DIR)/Audio/%.wav aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_DIR)/audio/%.mp3 aud2adpcm
|
||||
$(REPACK_STREAM_DECODED_DIR)/%.mp3: $(GTA_DIR)/Audio/%.adf adf2mp3
|
||||
@mkdir -p $(@D)
|
||||
./adf2mp3 $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(GTA_DIR)/Audio/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
$(REPACK_GTA_DIR)/stream/%.APM: $(REPACK_STREAM_DECODED_DIR)/%.mp3 aud2adpcm
|
||||
@mkdir -p $(@D)
|
||||
./aud2adpcm $(AUDIO_STREAM_OPTION) $< $@
|
||||
|
||||
|
||||
# Note: This is last so it has least priority, files should be processed if possible
|
||||
$(REPACK_GTA_DIR)/%: $(GTA_DIR)/%
|
||||
@mkdir -p $(@D)
|
||||
@@ -489,7 +538,7 @@ $(REPACK_GTA_DIR)/%: $(GTA_DIR)/%
|
||||
|
||||
$(SFX_DC_RAW): pack-sfx $(SFX_REPACK_DC)
|
||||
mkdir -p $(@D)
|
||||
./pack-sfx "$(GTA_DIR)/audio/sfx.SDT" $(SFX_DC_RAW) $(SFX_DC_DSC) $(REPACK_SFX_DC_DIR)
|
||||
./pack-sfx "$(GTA_DIR)/Audio/sfx.SDT" $(SFX_DC_RAW) $(SFX_DC_DSC) $(REPACK_SFX_DC_DIR)
|
||||
|
||||
$(SFX_DC_DSC): $(SFX_DC_RAW)
|
||||
ls -l $@
|
||||
|
||||
50
dreamcast/adf2mp3.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Check for correct number of arguments.
|
||||
if (argc != 3) {
|
||||
std::cerr << "Usage: adf2mp3 <inputfile> <outputfile>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get file names from command line arguments.
|
||||
const char* inputFileName = argv[1];
|
||||
const char* outputFileName = argv[2];
|
||||
|
||||
// Open the input file in binary mode.
|
||||
std::ifstream inputFile(inputFileName, std::ios::binary);
|
||||
if (!inputFile) {
|
||||
std::cerr << "Error: Unable to open input file " << inputFileName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Open the output file in binary mode.
|
||||
std::ofstream outputFile(outputFileName, std::ios::binary);
|
||||
if (!outputFile) {
|
||||
std::cerr << "Error: Unable to open output file " << outputFileName << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Buffer to hold file data.
|
||||
const size_t bufferSize = 4096;
|
||||
char buffer[bufferSize];
|
||||
|
||||
// Process the file in chunks.
|
||||
while (inputFile.read(buffer, bufferSize) || inputFile.gcount() > 0) {
|
||||
// Get the number of bytes actually read.
|
||||
std::streamsize bytesRead = inputFile.gcount();
|
||||
// XOR each byte with 0x22.
|
||||
for (std::streamsize i = 0; i < bytesRead; ++i) {
|
||||
buffer[i] ^= 0x22;
|
||||
}
|
||||
// Write the modified buffer to the output file.
|
||||
outputFile.write(buffer, bytesRead);
|
||||
}
|
||||
|
||||
// Close files.
|
||||
inputFile.close();
|
||||
outputFile.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
dreamcast/assets/dc_ps2d.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
dreamcast/assets/dc_ps2f.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
dreamcast/assets/dc_xboxd.png
Normal file
|
After Width: | Height: | Size: 87 KiB |
BIN
dreamcast/assets/dc_xboxf.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
dreamcast/assets/ps4_d.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
dreamcast/assets/ps4_f.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
dreamcast/assets/xbox_d.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
dreamcast/assets/xbox_f.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
@@ -21,264 +21,279 @@ git-version.h: git-version.tmp
|
||||
|
||||
.PHONY: git-version.tmp
|
||||
|
||||
../src/skel/dc/dc.cpp: git-version.h
|
||||
../miami/skel/dc/dc.cpp: git-version.h
|
||||
|
||||
|
||||
|
||||
# List all of your C files here, but change the extension to ".o"
|
||||
# Include "romdisk.o" if you want a rom disk.
|
||||
RE3_OBJS = \
|
||||
../src/animation/AnimBlendAssocGroup.o \
|
||||
../src/animation/AnimBlendAssociation.o \
|
||||
../src/animation/AnimBlendClumpData.o \
|
||||
../src/animation/AnimBlendHierarchy.o \
|
||||
../src/animation/AnimBlendNode.o \
|
||||
../src/animation/AnimBlendSequence.o \
|
||||
../src/animation/AnimManager.o \
|
||||
../src/animation/Bones.o \
|
||||
../src/animation/CutsceneMgr.o \
|
||||
../src/animation/FrameUpdate.o \
|
||||
../src/animation/RpAnimBlend.o \
|
||||
../miami/animation/AnimBlendAssocGroup.o \
|
||||
../miami/animation/AnimBlendAssociation.o \
|
||||
../miami/animation/AnimBlendClumpData.o \
|
||||
../miami/animation/AnimBlendHierarchy.o \
|
||||
../miami/animation/AnimBlendNode.o \
|
||||
../miami/animation/AnimBlendSequence.o \
|
||||
../miami/animation/AnimManager.o \
|
||||
../miami/animation/Bones.o \
|
||||
../miami/animation/CutsceneMgr.o \
|
||||
../miami/animation/FrameUpdate.o \
|
||||
../miami/animation/RpAnimBlend.o \
|
||||
\
|
||||
../src/buildings/Building.o \
|
||||
../src/buildings/Treadable.o \
|
||||
../miami/buildings/Building.o \
|
||||
../miami/buildings/Treadable.o \
|
||||
\
|
||||
../src/collision/ColBox.o \
|
||||
../src/collision/ColLine.o \
|
||||
../src/collision/Collision.o \
|
||||
../src/collision/ColModel.o \
|
||||
../src/collision/ColPoint.o \
|
||||
../src/collision/ColSphere.o \
|
||||
../src/collision/ColTriangle.o \
|
||||
../src/collision/TempColModels.o \
|
||||
../src/collision/VuCollision.o \
|
||||
../miami/collision/ColBox.o \
|
||||
../miami/collision/ColLine.o \
|
||||
../miami/collision/Collision.o \
|
||||
../miami/collision/ColModel.o \
|
||||
../miami/collision/ColPoint.o \
|
||||
../miami/collision/ColSphere.o \
|
||||
../miami/collision/ColStore.o \
|
||||
../miami/collision/ColTriangle.o \
|
||||
../miami/collision/TempColModels.o \
|
||||
../miami/collision/VuCollision.o \
|
||||
\
|
||||
../src/control/AutoPilot.o \
|
||||
../src/control/Bridge.o \
|
||||
../src/control/CarAI.o \
|
||||
../src/control/CarCtrl.o \
|
||||
../src/control/Curves.o \
|
||||
../src/control/Darkel.o \
|
||||
../src/control/GameLogic.o \
|
||||
../src/control/Garages.o \
|
||||
../src/control/NameGrid.o \
|
||||
../src/control/OnscreenTimer.o \
|
||||
../src/control/PathFind.o \
|
||||
../src/control/Phones.o \
|
||||
../src/control/Pickups.o \
|
||||
../src/control/PowerPoints.o \
|
||||
../src/control/Record.o \
|
||||
../src/control/Remote.o \
|
||||
../src/control/Replay.o \
|
||||
../src/control/Restart.o \
|
||||
../src/control/RoadBlocks.o \
|
||||
../src/control/SceneEdit.o \
|
||||
../src/control/Script.o \
|
||||
../src/control/Script2.o \
|
||||
../src/control/Script3.o \
|
||||
../src/control/Script4.o \
|
||||
../src/control/Script5.o \
|
||||
../src/control/Script6.o \
|
||||
../src/control/ScriptDebug.o \
|
||||
../src/control/TrafficLights.o \
|
||||
../miami/control/AutoPilot.o \
|
||||
../miami/control/Bridge.o \
|
||||
../miami/control/CarAI.o \
|
||||
../miami/control/CarCtrl.o \
|
||||
../miami/control/Curves.o \
|
||||
../miami/control/Darkel.o \
|
||||
../miami/control/GameLogic.o \
|
||||
../miami/control/Garages.o \
|
||||
../miami/control/NameGrid.o \
|
||||
../miami/control/OnscreenTimer.o \
|
||||
../miami/control/PathFind.o \
|
||||
../miami/control/Phones.o \
|
||||
../miami/control/Pickups.o \
|
||||
../miami/control/PowerPoints.o \
|
||||
../miami/control/Record.o \
|
||||
../miami/control/Remote.o \
|
||||
../miami/control/Replay.o \
|
||||
../miami/control/Restart.o \
|
||||
../miami/control/RoadBlocks.o \
|
||||
../miami/control/SceneEdit.o \
|
||||
../miami/control/Script.o \
|
||||
../miami/control/Script2.o \
|
||||
../miami/control/Script3.o \
|
||||
../miami/control/Script4.o \
|
||||
../miami/control/Script5.o \
|
||||
../miami/control/Script6.o \
|
||||
../miami/control/Script7.o \
|
||||
../miami/control/Script8.o \
|
||||
../miami/control/SetPieces.o \
|
||||
../miami/control/ScriptDebug.o \
|
||||
../miami/control/TrafficLights.o \
|
||||
\
|
||||
../src/core/Accident.o \
|
||||
../src/core/Cam.o \
|
||||
../src/core/Camera.o \
|
||||
../src/core/CdStreamDC.o \
|
||||
../src/core/Clock.o \
|
||||
../src/core/ControllerConfig.o \
|
||||
../src/core/Debug.o \
|
||||
../src/core/Directory.o \
|
||||
../src/core/EventList.o \
|
||||
../src/core/FileLoader.o \
|
||||
../src/core/FileMgr.o \
|
||||
../src/core/Fire.o \
|
||||
../src/core/Frontend.o \
|
||||
../src/core/FrontEndControls.o \
|
||||
../src/core/Frontend_PS2.o \
|
||||
../src/core/Game.o \
|
||||
../src/core/IniFile.o \
|
||||
../src/core/Lists.o \
|
||||
../src/core/main.o \
|
||||
../src/core/MenuScreens.o \
|
||||
../src/core/MenuScreensCustom.o \
|
||||
../src/core/obrstr.o \
|
||||
../src/core/Pad.o \
|
||||
../src/core/Placeable.o \
|
||||
../src/core/PlayerInfo.o \
|
||||
../src/core/Pools.o \
|
||||
../src/core/Profile.o \
|
||||
../src/core/Radar.o \
|
||||
../src/core/Range2D.o \
|
||||
../src/core/Range3D.o \
|
||||
../src/core/re3.o \
|
||||
../src/core/References.o \
|
||||
../src/core/Stats.o \
|
||||
../src/core/Streaming.o \
|
||||
../src/core/SurfaceTable.o \
|
||||
../src/core/timebars.o \
|
||||
../src/core/Timer.o \
|
||||
../src/core/TimeStep.o \
|
||||
../src/core/User.o \
|
||||
../src/core/Wanted.o \
|
||||
../src/core/World.o \
|
||||
../src/core/ZoneCull.o \
|
||||
../src/core/Zones.o \
|
||||
../miami/core/Accident.o \
|
||||
../miami/core/Cam.o \
|
||||
../miami/core/Camera.o \
|
||||
../miami/core/CdStreamDC.o \
|
||||
../miami/core/Clock.o \
|
||||
../miami/core/ControllerConfig.o \
|
||||
../miami/core/Debug.o \
|
||||
../miami/core/Directory.o \
|
||||
../miami/core/EventList.o \
|
||||
../miami/core/FileLoader.o \
|
||||
../miami/core/FileMgr.o \
|
||||
../miami/core/Fire.o \
|
||||
../miami/core/Frontend.o \
|
||||
../miami/core/FrontEndControls.o \
|
||||
../miami/core/Frontend_PS2.o \
|
||||
../miami/core/Game.o \
|
||||
../miami/core/IniFile.o \
|
||||
../miami/core/Lists.o \
|
||||
../miami/core/main.o \
|
||||
../miami/core/MenuScreens.o \
|
||||
../miami/core/MenuScreensCustom.o \
|
||||
../miami/core/obrstr.o \
|
||||
../miami/core/Pad.o \
|
||||
../miami/core/Placeable.o \
|
||||
../miami/core/PlayerInfo.o \
|
||||
../miami/core/Pools.o \
|
||||
../miami/core/Profile.o \
|
||||
../miami/core/Radar.o \
|
||||
../miami/core/Range2D.o \
|
||||
../miami/core/Range3D.o \
|
||||
../miami/core/re3.o \
|
||||
../miami/core/References.o \
|
||||
../miami/core/Ropes.o \
|
||||
../miami/core/Stats.o \
|
||||
../miami/core/Streaming.o \
|
||||
../miami/core/SurfaceTable.o \
|
||||
../miami/core/timebars.o \
|
||||
../miami/core/Timer.o \
|
||||
../miami/core/TimeStep.o \
|
||||
../miami/core/User.o \
|
||||
../miami/core/Wanted.o \
|
||||
../miami/core/World.o \
|
||||
../miami/core/ZoneCull.o \
|
||||
../miami/core/Zones.o \
|
||||
\
|
||||
../src/entities/Dummy.o \
|
||||
../src/entities/Entity.o \
|
||||
../src/entities/Physical.o \
|
||||
../miami/entities/Dummy.o \
|
||||
../miami/entities/Entity.o \
|
||||
../miami/entities/Physical.o \
|
||||
\
|
||||
../src/fakerw/fake.o \
|
||||
../miami/fakerw/fake.o \
|
||||
\
|
||||
../src/math/math.o \
|
||||
../src/math/Matrix.o \
|
||||
../src/math/Quaternion.o \
|
||||
../src/math/Rect.o \
|
||||
../src/math/Vector.o \
|
||||
../miami/math/math.o \
|
||||
../miami/math/Matrix.o \
|
||||
../miami/math/Quaternion.o \
|
||||
../miami/math/Rect.o \
|
||||
../miami/math/Vector.o \
|
||||
\
|
||||
../src/modelinfo/BaseModelInfo.o \
|
||||
../src/modelinfo/ClumpModelInfo.o \
|
||||
../src/modelinfo/MloModelInfo.o \
|
||||
../src/modelinfo/ModelIndices.o \
|
||||
../src/modelinfo/ModelInfo.o \
|
||||
../src/modelinfo/PedModelInfo.o \
|
||||
../src/modelinfo/SimpleModelInfo.o \
|
||||
../src/modelinfo/TimeModelInfo.o \
|
||||
../src/modelinfo/VehicleModelInfo.o \
|
||||
../miami/modelinfo/BaseModelInfo.o \
|
||||
../miami/modelinfo/ClumpModelInfo.o \
|
||||
../miami/modelinfo/MloModelInfo.o \
|
||||
../miami/modelinfo/ModelIndices.o \
|
||||
../miami/modelinfo/ModelInfo.o \
|
||||
../miami/modelinfo/PedModelInfo.o \
|
||||
../miami/modelinfo/SimpleModelInfo.o \
|
||||
../miami/modelinfo/TimeModelInfo.o \
|
||||
../miami/modelinfo/VehicleModelInfo.o \
|
||||
../miami/modelinfo/WeaponModelInfo.o \
|
||||
\
|
||||
../src/objects/CutsceneHead.o \
|
||||
../src/objects/CutsceneObject.o \
|
||||
../src/objects/DummyObject.o \
|
||||
../src/objects/Object.o \
|
||||
../src/objects/ObjectData.o \
|
||||
../src/objects/ParticleObject.o \
|
||||
../src/objects/Projectile.o \
|
||||
../miami/objects/CutsceneObject.o \
|
||||
../miami/objects/DummyObject.o \
|
||||
../miami/objects/Object.o \
|
||||
../miami/objects/ObjectData.o \
|
||||
../miami/objects/ParticleObject.o \
|
||||
../miami/objects/Projectile.o \
|
||||
../miami/objects/Stinger.o \
|
||||
\
|
||||
../src/peds/CivilianPed.o \
|
||||
../src/peds/CopPed.o \
|
||||
../src/peds/EmergencyPed.o \
|
||||
../src/peds/Gangs.o \
|
||||
../src/peds/Ped.o \
|
||||
../src/peds/PedAI.o \
|
||||
../src/peds/PedChat.o \
|
||||
../src/peds/PedDebug.o \
|
||||
../src/peds/PedFight.o \
|
||||
../src/peds/PedIK.o \
|
||||
../src/peds/PedPlacement.o \
|
||||
../src/peds/PedRoutes.o \
|
||||
../src/peds/PedType.o \
|
||||
../src/peds/PlayerPed.o \
|
||||
../src/peds/Population.o \
|
||||
../miami/peds/CivilianPed.o \
|
||||
../miami/peds/CopPed.o \
|
||||
../miami/peds/EmergencyPed.o \
|
||||
../miami/peds/Gangs.o \
|
||||
../miami/peds/Ped.o \
|
||||
../miami/peds/PedAI.o \
|
||||
../miami/peds/PedChat.o \
|
||||
../miami/peds/PedDebug.o \
|
||||
../miami/peds/PedFight.o \
|
||||
../miami/peds/PedIK.o \
|
||||
../miami/peds/PedAttractor.o \
|
||||
../miami/peds/PedPlacement.o \
|
||||
../miami/peds/PedRoutes.o \
|
||||
../miami/peds/PedType.o \
|
||||
../miami/peds/PlayerPed.o \
|
||||
../miami/peds/Population.o \
|
||||
\
|
||||
../src/renderer/Antennas.o \
|
||||
../src/renderer/Clouds.o \
|
||||
../src/renderer/Console.o \
|
||||
../src/renderer/Coronas.o \
|
||||
../src/renderer/Credits.o \
|
||||
../src/renderer/Draw.o \
|
||||
../src/renderer/Fluff.o \
|
||||
../src/renderer/Font.o \
|
||||
../src/renderer/Glass.o \
|
||||
../src/renderer/Hud.o \
|
||||
../src/renderer/Instance.o \
|
||||
../src/renderer/Lines.o \
|
||||
../src/renderer/MBlur.o \
|
||||
../src/renderer/Particle.o \
|
||||
../src/renderer/ParticleMgr.o \
|
||||
../src/renderer/PlayerSkin.o \
|
||||
../src/renderer/PointLights.o \
|
||||
../src/renderer/RenderBuffer.o \
|
||||
../src/renderer/Renderer.o \
|
||||
../src/renderer/Rubbish.o \
|
||||
../src/renderer/Shadows.o \
|
||||
../src/renderer/Skidmarks.o \
|
||||
../src/renderer/SpecialFX.o \
|
||||
../src/renderer/Sprite.o \
|
||||
../src/renderer/Sprite2d.o \
|
||||
../src/renderer/TexList.o \
|
||||
../src/renderer/Timecycle.o \
|
||||
../src/renderer/WaterCannon.o \
|
||||
../src/renderer/WaterLevel.o \
|
||||
../src/renderer/Weather.o \
|
||||
../miami/renderer/Antennas.o \
|
||||
../miami/renderer/Clouds.o \
|
||||
../miami/renderer/Console.o \
|
||||
../miami/renderer/Coronas.o \
|
||||
../miami/renderer/Credits.o \
|
||||
../miami/renderer/CutsceneShadow.o \
|
||||
../miami/renderer/Draw.o \
|
||||
../miami/renderer/Fluff.o \
|
||||
../miami/renderer/Font.o \
|
||||
../miami/renderer/Glass.o \
|
||||
../miami/renderer/Hud.o \
|
||||
../miami/renderer/Instance.o \
|
||||
../miami/renderer/Lines.o \
|
||||
../miami/renderer/MBlur.o \
|
||||
../miami/renderer/Occlusion.o \
|
||||
../miami/renderer/Particle.o \
|
||||
../miami/renderer/ParticleMgr.o \
|
||||
../miami/renderer/PlayerSkin.o \
|
||||
../miami/renderer/PointLights.o \
|
||||
../miami/renderer/RenderBuffer.o \
|
||||
../miami/renderer/Renderer.o \
|
||||
../miami/renderer/Rubbish.o \
|
||||
../miami/renderer/Shadows.o \
|
||||
../miami/renderer/ShadowCamera.o \
|
||||
../miami/renderer/Skidmarks.o \
|
||||
../miami/renderer/SpecialFX.o \
|
||||
../miami/renderer/Sprite.o \
|
||||
../miami/renderer/Sprite2d.o \
|
||||
../miami/renderer/TexList.o \
|
||||
../miami/renderer/Timecycle.o \
|
||||
../miami/renderer/VarConsole.o \
|
||||
../miami/renderer/WaterCannon.o \
|
||||
../miami/renderer/WaterCreatures.o \
|
||||
../miami/renderer/WaterLevel.o \
|
||||
../miami/renderer/Weather.o \
|
||||
../miami/renderer/WindModifiers.o \
|
||||
\
|
||||
../src/rw/ClumpRead.o \
|
||||
../src/rw/Lights.o \
|
||||
../src/rw/MemoryHeap.o \
|
||||
../src/rw/MemoryMgr.o \
|
||||
../src/rw/NodeName.o \
|
||||
../src/rw/RwHelper.o \
|
||||
../src/rw/RwMatFX.o \
|
||||
../src/rw/RwPS2AlphaTest.o \
|
||||
../src/rw/TexRead.o \
|
||||
../src/rw/TexturePools.o \
|
||||
../src/rw/TxdStore.o \
|
||||
../src/rw/VisibilityPlugins.o \
|
||||
../miami/rw/ClumpRead.o \
|
||||
../miami/rw/Lights.o \
|
||||
../miami/rw/MemoryHeap.o \
|
||||
../miami/rw/MemoryMgr.o \
|
||||
../miami/rw/NodeName.o \
|
||||
../miami/rw/RwHelper.o \
|
||||
../miami/rw/RwMatFX.o \
|
||||
../miami/rw/RwPS2AlphaTest.o \
|
||||
../miami/rw/TexRead.o \
|
||||
../miami/rw/TexturePools.o \
|
||||
../miami/rw/TxdStore.o \
|
||||
../miami/rw/VisibilityPlugins.o \
|
||||
\
|
||||
../src/skel/crossplatform.o \
|
||||
../src/skel/events.o \
|
||||
../src/skel/skeleton.o \
|
||||
../src/skel/dc/dc.o \
|
||||
../miami/skel/crossplatform.o \
|
||||
../miami/skel/events.o \
|
||||
../miami/skel/skeleton.o \
|
||||
../miami/skel/dc/dc.o \
|
||||
\
|
||||
../src/text/Messages.o \
|
||||
../src/text/Pager.o \
|
||||
../src/text/Text.o \
|
||||
../miami/text/Messages.o \
|
||||
../miami/text/Pager.o \
|
||||
../miami/text/Text.o \
|
||||
\
|
||||
../src/vehicles/Automobile.o \
|
||||
../src/vehicles/Boat.o \
|
||||
../src/vehicles/CarGen.o \
|
||||
../src/vehicles/Cranes.o \
|
||||
../src/vehicles/DamageManager.o \
|
||||
../src/vehicles/Door.o \
|
||||
../src/vehicles/Floater.o \
|
||||
../src/vehicles/HandlingMgr.o \
|
||||
../src/vehicles/Heli.o \
|
||||
../src/vehicles/Plane.o \
|
||||
../src/vehicles/Train.o \
|
||||
../src/vehicles/Transmission.o \
|
||||
../src/vehicles/Vehicle.o \
|
||||
../miami/vehicles/Automobile.o \
|
||||
../miami/vehicles/Boat.o \
|
||||
../miami/vehicles/Bike.o \
|
||||
../miami/vehicles/CarGen.o \
|
||||
../miami/vehicles/Cranes.o \
|
||||
../miami/vehicles/DamageManager.o \
|
||||
../miami/vehicles/Door.o \
|
||||
../miami/vehicles/Floater.o \
|
||||
../miami/vehicles/HandlingMgr.o \
|
||||
../miami/vehicles/Heli.o \
|
||||
../miami/vehicles/Plane.o \
|
||||
../miami/vehicles/Train.o \
|
||||
../miami/vehicles/Transmission.o \
|
||||
../miami/vehicles/Vehicle.o \
|
||||
\
|
||||
../src/weapons/BulletInfo.o \
|
||||
../src/weapons/Explosion.o \
|
||||
../src/weapons/ProjectileInfo.o \
|
||||
../src/weapons/ShotInfo.o \
|
||||
../src/weapons/Weapon.o \
|
||||
../src/weapons/WeaponEffects.o \
|
||||
../src/weapons/WeaponInfo.o \
|
||||
../miami/weapons/BulletInfo.o \
|
||||
../miami/weapons/Explosion.o \
|
||||
../miami/weapons/ProjectileInfo.o \
|
||||
../miami/weapons/ShotInfo.o \
|
||||
../miami/weapons/Weapon.o \
|
||||
../miami/weapons/WeaponEffects.o \
|
||||
../miami/weapons/WeaponInfo.o \
|
||||
\
|
||||
../src/audio/AudioCollision.o \
|
||||
../src/audio/AudioLogic.o \
|
||||
../src/audio/AudioManager.o \
|
||||
../src/audio/AudioScriptObject.o \
|
||||
../src/audio/DMAudio.o \
|
||||
../src/audio/MusicManager.o \
|
||||
../src/audio/PolRadio.o \
|
||||
../src/audio/sampman_miles.o \
|
||||
../src/audio/sampman_oal.o \
|
||||
../miami/audio/AudioCollision.o \
|
||||
../miami/audio/AudioLogic.o \
|
||||
../miami/audio/AudioManager.o \
|
||||
../miami/audio/AudioScriptObject.o \
|
||||
../miami/audio/DMAudio.o \
|
||||
../miami/audio/MusicManager.o \
|
||||
../miami/audio/PolRadio.o \
|
||||
../miami/audio/sampman_miles.o \
|
||||
../miami/audio/sampman_oal.o \
|
||||
\
|
||||
../src/save/Date.o \
|
||||
../src/save/GenericGameStorage.o \
|
||||
../src/save/MemoryCard.o \
|
||||
../src/save/PCSave.o \
|
||||
../miami/save/Date.o \
|
||||
../miami/save/GenericGameStorage.o \
|
||||
../miami/save/MemoryCard.o \
|
||||
../miami/save/PCSave.o \
|
||||
\
|
||||
../src/extras/debugmenu.o \
|
||||
../src/extras/frontendoption.o \
|
||||
../src/extras/postfx.o \
|
||||
../src/extras/screendroplets.o \
|
||||
../miami/extras/debugmenu.o \
|
||||
../miami/extras/frontendoption.o \
|
||||
../miami/extras/postfx.o \
|
||||
../miami/extras/screendroplets.o \
|
||||
\
|
||||
../src/vmu/vmu.o \
|
||||
../vendor/miniLZO/minilzo.o \
|
||||
\
|
||||
../miami/vmu/vmu.o
|
||||
|
||||
# Excluded \
|
||||
../src/extras/custompipes.o \
|
||||
../src/extras/custompipes_d3d9.o \
|
||||
../src/extras/custompipes_gl.o \
|
||||
../src/core/CdStream.o \
|
||||
../src/core/CdStreamPosix.o \
|
||||
../src/extras \
|
||||
../src/extras/GitSHA1.cpp.in \
|
||||
../src/core/AnimViewer.o \
|
||||
../miami/extras/custompipes.o \
|
||||
../miami/extras/custompipes_d3d9.o \
|
||||
../miami/extras/custompipes_gl.o \
|
||||
../miami/core/CdStream.o \
|
||||
../miami/core/CdStreamPosix.o \
|
||||
../miami/extras \
|
||||
../miami/extras/GitSHA1.cpp.in \
|
||||
../miami/core/AnimViewer.o \
|
||||
|
||||
RW_OBJS = \
|
||||
../vendor/librw/src/anim.o \
|
||||
@@ -351,32 +366,32 @@ RW_OBJS = \
|
||||
../vendor/librw/src/ps2/ps2skin.o \
|
||||
|
||||
INCLUDE = \
|
||||
-I../src/animation \
|
||||
-I../src/audio \
|
||||
-I../src/buildings \
|
||||
-I../src/collision \
|
||||
-I../src/control \
|
||||
-I../src/core \
|
||||
-I../src/entities \
|
||||
-I../src/extras \
|
||||
-I../src/fakerw \
|
||||
-I../src/math \
|
||||
-I../src/modelinfo \
|
||||
-I../src/objects \
|
||||
-I../src/peds \
|
||||
-I../src/renderer \
|
||||
-I../src/rw \
|
||||
-I../src/save \
|
||||
-I../src/skel \
|
||||
-I../src/text \
|
||||
-I../src/vehicles \
|
||||
-I../src/weapons \
|
||||
-I../src/audio/eax \
|
||||
-I../src/audio/oal \
|
||||
-I../src/extras/shaders \
|
||||
-I../src/extras/shaders/obj \
|
||||
-I../src/skel/glfw \
|
||||
-I../src/skel/win \
|
||||
-I../miami/animation \
|
||||
-I../miami/audio \
|
||||
-I../miami/buildings \
|
||||
-I../miami/collision \
|
||||
-I../miami/control \
|
||||
-I../miami/core \
|
||||
-I../miami/entities \
|
||||
-I../miami/extras \
|
||||
-I../miami/fakerw \
|
||||
-I../miami/math \
|
||||
-I../miami/modelinfo \
|
||||
-I../miami/objects \
|
||||
-I../miami/peds \
|
||||
-I../miami/renderer \
|
||||
-I../miami/rw \
|
||||
-I../miami/save \
|
||||
-I../miami/skel \
|
||||
-I../miami/text \
|
||||
-I../miami/vehicles \
|
||||
-I../miami/weapons \
|
||||
-I../miami/audio/eax \
|
||||
-I../miami/audio/oal \
|
||||
-I../miami/extras/shaders \
|
||||
-I../miami/extras/shaders/obj \
|
||||
-I../miami/skel/glfw \
|
||||
-I../miami/skel/win \
|
||||
\
|
||||
-I../vendor/librw \
|
||||
\
|
||||
|
||||
@@ -1,178 +1,211 @@
|
||||
MISC_FILES = \
|
||||
anim/cuts.dir \
|
||||
\
|
||||
txd/LOADSC8.TXD \
|
||||
txd/LOADSC6.TXD \
|
||||
txd/outro.txd \
|
||||
txd/LOADSC2.TXD \
|
||||
txd/LOADSC5.TXD \
|
||||
txd/LOADSC3.TXD \
|
||||
txd/NEWS.TXD \
|
||||
txd/LOADSC11.TXD \
|
||||
txd/LOADSC12.TXD \
|
||||
txd/LOADSC10.TXD \
|
||||
txd/LOADSC1.TXD \
|
||||
txd/LOADSC9.TXD \
|
||||
txd/LOADSC7.TXD \
|
||||
txd/SPLASH2.TXD \
|
||||
txd/LOADSC13.TXD \
|
||||
txd/INTRO3.TXD \
|
||||
txd/SPLASH3.TXD \
|
||||
txd/SPLASH1.TXD \
|
||||
txd/intro2.txd \
|
||||
txd/intro1.txd \
|
||||
txd/LOADSC0.TXD \
|
||||
txd/LOADSC4.TXD \
|
||||
txd/intro4.txd \
|
||||
\
|
||||
models/fonts.txd \
|
||||
models/hud.txd \
|
||||
models/coll/weapons.col \
|
||||
models/coll/peds.col \
|
||||
models/coll/vehicles.col \
|
||||
models/coll/generic.col \
|
||||
models/MISC.TXD \
|
||||
models/generic.txd \
|
||||
models/gta3.dir \
|
||||
models/fronten2.txd \
|
||||
models/particle.txd \
|
||||
models/fronten1.txd \
|
||||
models/INTRO.TXD \
|
||||
models/generic/wheels.TXD \
|
||||
models/generic/wheels.DFF \
|
||||
models/generic/arrow.DFF \
|
||||
models/generic/player.bmp \
|
||||
models/generic/air_vlo.DFF \
|
||||
models/generic/zonecylb.DFF \
|
||||
models/gta3.img \
|
||||
\
|
||||
anim/cuts.img \
|
||||
anim/gta3.ini \
|
||||
anim/cuts.dir \
|
||||
anim/ped.ifp \
|
||||
data/animviewer.dat \
|
||||
data/carcols.dat \
|
||||
data/CULLZONE.DAT \
|
||||
data/default.dat \
|
||||
data/default.ide \
|
||||
data/fistfite.dat \
|
||||
data/gta3.dat \
|
||||
data/gta3.zon \
|
||||
data/handling.cfg \
|
||||
data/main.scm \
|
||||
data/map.zon \
|
||||
data/maps/comnbtm/comNbtm.col \
|
||||
data/maps/comnbtm/comnbtm.ide \
|
||||
data/maps/comnbtm/comNbtm.ipl \
|
||||
data/maps/comNbtm.ipl \
|
||||
data/maps/comntop/comNtop.col \
|
||||
data/maps/comntop/comntop.ide \
|
||||
data/maps/comntop/comNtop.ipl \
|
||||
data/maps/comNtop.ipl \
|
||||
data/maps/comroad/comroad.col \
|
||||
data/maps/comroad/comroad.ide \
|
||||
data/maps/comroad/comroad.ipl \
|
||||
data/maps/comse/comSE.col \
|
||||
data/maps/comse/comse.ide \
|
||||
data/maps/comse/comSE.ipl \
|
||||
data/maps/comSE.ipl \
|
||||
data/maps/comsw/comSW.col \
|
||||
data/maps/comsw/comsw.ide \
|
||||
data/maps/comsw/comSW.ipl \
|
||||
data/maps/comSW.ipl \
|
||||
data/maps/cull.ipl \
|
||||
data/maps/generic.ide \
|
||||
data/maps/gta3.IDE \
|
||||
data/maps/indroads/indroads.col \
|
||||
data/maps/indroads/indroads.ide \
|
||||
data/maps/indroads/indroads.ipl \
|
||||
data/maps/industne/industNE.col \
|
||||
data/maps/industne/industne.ide \
|
||||
data/maps/industne/industNE.ipl \
|
||||
data/maps/industNE.ipl \
|
||||
data/maps/industnw/industNW.col \
|
||||
data/maps/industnw/industnw.ide \
|
||||
data/maps/industnw/industNW.ipl \
|
||||
data/maps/industNW.ipl \
|
||||
data/maps/industse/industSE.col \
|
||||
data/maps/industse/industse.ide \
|
||||
data/maps/industse/industSE.ipl \
|
||||
data/maps/industSE.ipl \
|
||||
data/maps/industsw/industSW.col \
|
||||
data/maps/industsw/industsw.ide \
|
||||
data/maps/industsw/industSW.ipl \
|
||||
data/maps/industSW.ipl \
|
||||
data/maps/landne/landne.col \
|
||||
data/maps/landne/landne.ide \
|
||||
data/maps/landne/landne.ipl \
|
||||
data/maps/landsw/landsw.col \
|
||||
data/maps/landsw/landsw.ide \
|
||||
data/maps/landsw/landsw.ipl \
|
||||
data/maps/making/making.col \
|
||||
data/maps/making/making.ide \
|
||||
data/maps/making/making.ipl \
|
||||
data/maps/overview.ipl \
|
||||
data/maps/props.IPL \
|
||||
data/maps/subroads/subroads.col \
|
||||
data/maps/subroads/subroads.ide \
|
||||
data/maps/subroads/subroads.ipl \
|
||||
data/maps/suburbne.ipl \
|
||||
data/maps/suburbsw.ipl \
|
||||
data/maps/temppart/temppart.col \
|
||||
data/maps/temppart/temppart.ide \
|
||||
data/maps/temppart/temppart.ipl \
|
||||
data/object.dat \
|
||||
data/particle.cfg \
|
||||
data/paths/CHASE0.DAT \
|
||||
data/paths/CHASE1.DAT \
|
||||
data/paths/CHASE10.DAT \
|
||||
data/paths/CHASE11.DAT \
|
||||
data/paths/CHASE14.DAT \
|
||||
data/paths/CHASE16.DAT \
|
||||
data/paths/CHASE18.DAT \
|
||||
data/paths/CHASE19.DAT \
|
||||
data/paths/CHASE2.DAT \
|
||||
data/paths/CHASE3.DAT \
|
||||
data/paths/CHASE4.DAT \
|
||||
data/paths/CHASE5.DAT \
|
||||
data/paths/CHASE6.DAT \
|
||||
data/paths/CHASE7.DAT \
|
||||
data/paths/flight.dat \
|
||||
data/paths/flight2.dat \
|
||||
data/paths/flight3.dat \
|
||||
data/paths/flight4.dat \
|
||||
data/paths/tracks.dat \
|
||||
data/paths/tracks2.dat \
|
||||
data/ped.dat \
|
||||
data/pedgrp.dat \
|
||||
data/pedstats.dat \
|
||||
data/surface.dat \
|
||||
data/timecyc.dat \
|
||||
data/train.dat \
|
||||
data/train2.dat \
|
||||
data/water.dat \
|
||||
data/waterpro.dat \
|
||||
data/weapon.dat \
|
||||
gta3.ini \
|
||||
models/Coll/commer.col \
|
||||
models/Coll/generic.col \
|
||||
models/Coll/indust.col \
|
||||
models/Coll/peds.col \
|
||||
models/Coll/suburb.col \
|
||||
models/Coll/vehicles.col \
|
||||
models/Coll/weapons.col \
|
||||
models/Generic/air_vlo.DFF \
|
||||
models/Generic/arrow.DFF \
|
||||
models/Generic/loplyguy.dff \
|
||||
models/Generic/peds.dff \
|
||||
models/Generic/qsphere.DFF \
|
||||
models/Generic/sphere.DFF \
|
||||
models/Generic/weapons.dff \
|
||||
models/Generic/wheels.DFF \
|
||||
models/Generic/zonecyla.DFF \
|
||||
models/Generic/zonecylb.DFF \
|
||||
models/Generic/zonesphr.DFF \
|
||||
\
|
||||
Icons/app.ico \
|
||||
Icons/bin.ico \
|
||||
\
|
||||
skins/texture_guide.jpg \
|
||||
\
|
||||
movies/GTAtitles.mpg \
|
||||
movies/GTAtitlesGER.mpg \
|
||||
$(if $(wildcard $(GTA_DIR)/movies/LOGO.mpg), movies/LOGO.mpg, movies/Logo.mpg) \
|
||||
TEXT/american.gxt \
|
||||
TEXT/english.gxt \
|
||||
TEXT/french.gxt \
|
||||
movies/Logo.mpg \
|
||||
\
|
||||
TEXT/german.gxt \
|
||||
TEXT/italian.gxt \
|
||||
TEXT/spanish.gxt \
|
||||
TEXT/american.gxt \
|
||||
TEXT/french.gxt \
|
||||
\
|
||||
models/fonts.txd \
|
||||
models/frontend.txd \
|
||||
models/generic.txd \
|
||||
models/hud.txd \
|
||||
models/menu.txd \
|
||||
models/MISC.TXD \
|
||||
models/particle.txd \
|
||||
txd/LOADSC0.TXD \
|
||||
txd/LOADSC1.TXD \
|
||||
txd/LOADSC10.TXD \
|
||||
txd/LOADSC11.TXD \
|
||||
txd/LOADSC12.TXD \
|
||||
txd/LOADSC13.TXD \
|
||||
txd/LOADSC14.TXD \
|
||||
txd/LOADSC15.TXD \
|
||||
txd/LOADSC16.TXD \
|
||||
txd/LOADSC17.TXD \
|
||||
txd/LOADSC18.TXD \
|
||||
txd/LOADSC19.TXD \
|
||||
txd/LOADSC2.TXD \
|
||||
txd/LOADSC20.TXD \
|
||||
txd/LOADSC21.TXD \
|
||||
txd/LOADSC22.TXD \
|
||||
txd/LOADSC23.TXD \
|
||||
txd/LOADSC24.TXD \
|
||||
txd/LOADSC25.TXD \
|
||||
txd/LOADSC3.TXD \
|
||||
txd/LOADSC4.TXD \
|
||||
txd/LOADSC5.TXD \
|
||||
txd/LOADSC6.TXD \
|
||||
txd/LOADSC7.TXD \
|
||||
txd/LOADSC8.TXD \
|
||||
txd/LOADSC9.TXD \
|
||||
txd/mainsc1.txd \
|
||||
txd/mainsc2.txd \
|
||||
txd/NEWS.TXD \
|
||||
txd/SPLASH1.TXD \
|
||||
txd/SPLASH2.TXD \
|
||||
txd/SPLASH3.TXD \
|
||||
data/weapon.dat \
|
||||
data/train.dat \
|
||||
\
|
||||
audio/sfx.SDT
|
||||
data/maps/haiti/haiti.ide \
|
||||
data/maps/haiti/haiti.col \
|
||||
data/maps/haiti/haiti.ipl \
|
||||
data/maps/generic.ide \
|
||||
\
|
||||
data/maps/hotel/hotel.ipl \
|
||||
data/maps/hotel/hotel.ide \
|
||||
data/maps/hotel/hotel.col \
|
||||
\
|
||||
data/maps/islandsf/islandsf.ide \
|
||||
data/maps/islandsf/islandsf.ipl \
|
||||
data/maps/islandsf/islandsf.col \
|
||||
\
|
||||
data/maps/washintn/washintn.ipl \
|
||||
data/maps/washintn/washintn.ide \
|
||||
data/maps/washintn/washintn.col \
|
||||
data/maps/map6.dat \
|
||||
\
|
||||
data/maps/littleha/littleha.ipl \
|
||||
data/maps/littleha/littleha.ide \
|
||||
data/maps/littleha/littleha.col \
|
||||
\
|
||||
data/maps/mall/mall.ide \
|
||||
data/maps/mall/mall.col \
|
||||
data/maps/mall/mall.ipl \
|
||||
data/maps/map7.dat \
|
||||
\
|
||||
data/maps/bar/bar.ide \
|
||||
\
|
||||
data/maps/nbeach/nbeach.ipl \
|
||||
data/maps/nbeach/nbeach.ide \
|
||||
data/maps/nbeach/nbeach.col \
|
||||
\
|
||||
data/maps/golf/golf.ide \
|
||||
data/maps/golf/golf.col \
|
||||
data/maps/golf/golf.ipl \
|
||||
data/maps/map0.dat \
|
||||
\
|
||||
data/maps/bank/bank.col \
|
||||
data/maps/bank/bank.ide \
|
||||
data/maps/bank/bank.ipl \
|
||||
\
|
||||
data/maps/nbeachw/nbeachw.ide \
|
||||
data/maps/nbeachw/nbeachw.col \
|
||||
data/maps/nbeachw/nbeachw.ipl \
|
||||
data/maps/map4.dat \
|
||||
\
|
||||
data/maps/airport/airport.ipl \
|
||||
data/maps/airport/airport.ide \
|
||||
data/maps/airport/airport.col \
|
||||
data/maps/nbeachbt/nbeachbt.col \
|
||||
data/maps/nbeachbt/nbeachbt.ide \
|
||||
data/maps/nbeachbt/nbeachbt.ipl \
|
||||
data/maps/map5.dat \
|
||||
data/maps/lawyers/lawyers.ide \
|
||||
data/maps/lawyers/lawyers.col \
|
||||
data/maps/lawyers/lawyers.ipl \
|
||||
data/maps/haitiN/haitin.ipl \
|
||||
data/maps/haitiN/haitin.col \
|
||||
data/maps/haitiN/haitiN.ide \
|
||||
data/maps/downtown/downtown.col \
|
||||
data/maps/downtown/downtown.ipl \
|
||||
data/maps/downtown/downtown.ide \
|
||||
data/maps/stadint/stadint.col \
|
||||
data/maps/stadint/stadint.ide \
|
||||
data/maps/stadint/stadint.ipl \
|
||||
data/maps/club/club.ide \
|
||||
data/maps/club/CLUB.ipl \
|
||||
data/maps/club/CLUB.col \
|
||||
data/maps/yacht/yacht.ipl \
|
||||
data/maps/yacht/yacht.col \
|
||||
data/maps/yacht/yacht.ide \
|
||||
data/maps/cull.ipl \
|
||||
data/maps/map3.dat \
|
||||
data/maps/airportN/airportN.ipl \
|
||||
data/maps/airportN/airportN.col \
|
||||
data/maps/airportN/airportN.ide \
|
||||
data/maps/oceandrv/oceandrv.ipl \
|
||||
data/maps/oceandrv/oceandrv.ide \
|
||||
data/maps/oceandrv/oceandrv.col \
|
||||
data/maps/starisl/starisl.col \
|
||||
data/maps/starisl/starisl.ide \
|
||||
data/maps/starisl/starisl.ipl \
|
||||
data/maps/map1.dat \
|
||||
data/maps/oceandn/oceandN.ide \
|
||||
data/maps/oceandn/oceandN.col \
|
||||
data/maps/oceandn/oceandN.ipl \
|
||||
data/maps/washints/washints.ipl \
|
||||
data/maps/washints/washints.col \
|
||||
data/maps/washints/washints.ide \
|
||||
data/maps/mansion/mansion.col \
|
||||
data/maps/mansion/mansion.ipl \
|
||||
data/maps/mansion/mansion.ide \
|
||||
data/maps/downtows/downtows.ipl \
|
||||
data/maps/downtows/downtows.col \
|
||||
data/maps/downtows/downtows.ide \
|
||||
data/maps/bridge/bridge.col \
|
||||
data/maps/bridge/bridge.ide \
|
||||
data/maps/bridge/bridge.ipl \
|
||||
data/maps/docks/docks.col \
|
||||
data/maps/docks/docks.ide \
|
||||
data/maps/docks/docks.ipl \
|
||||
data/maps/concerth/concerth.ipl \
|
||||
data/maps/concerth/concerth.ide \
|
||||
data/maps/concerth/concerth.col \
|
||||
data/maps/paths.ipl \
|
||||
data/maps/cisland/cisland.ide \
|
||||
data/maps/cisland/cisland.ipl \
|
||||
data/maps/cisland/cisland.col \
|
||||
data/maps/stripclb/stripclb.ide \
|
||||
data/maps/stripclb/stripclb.ipl \
|
||||
data/maps/stripclb/stripclb.col \
|
||||
data/maps/map2.dat \
|
||||
data/pedstats.dat \
|
||||
data/gta_vc.dat \
|
||||
data/occlu.ipl \
|
||||
data/handling.cfg \
|
||||
data/timecyc.dat \
|
||||
data/paths/flight3.dat \
|
||||
data/paths/spath0.dat \
|
||||
data/paths/flight2.dat \
|
||||
data/paths/flight.dat \
|
||||
data/map.zon \
|
||||
data/water.dat \
|
||||
data/particle.cfg \
|
||||
data/navig.zon \
|
||||
data/default.dat \
|
||||
data/carcols.dat \
|
||||
data/fistfite.dat \
|
||||
data/train2.dat \
|
||||
data/info.zon \
|
||||
data/ped.dat \
|
||||
data/WATERPRO.DAT \
|
||||
data/main.sc \
|
||||
data/debug.sc \
|
||||
data/object.dat \
|
||||
data/animviewer.dat \
|
||||
data/Cullzoneempty.dat \
|
||||
data/surface.dat \
|
||||
data/main.scm \
|
||||
data/default.ide \
|
||||
data/pedgrp.dat \
|
||||
data/Cullzone.dat
|
||||
59
dreamcast/imgmisc.mk
Normal file
@@ -0,0 +1,59 @@
|
||||
IMG_MISC = \
|
||||
airport.col \
|
||||
airportN.col \
|
||||
bank.col \
|
||||
baseball.ifp \
|
||||
biked.ifp \
|
||||
bikeh.ifp \
|
||||
bikes.ifp \
|
||||
bikev.ifp \
|
||||
bridge.col \
|
||||
buddy.ifp \
|
||||
chainsaw.ifp \
|
||||
cisland.col \
|
||||
CLUB.col \
|
||||
coach.ifp \
|
||||
colt45.ifp \
|
||||
concerth.col \
|
||||
docks.col \
|
||||
downtown.col \
|
||||
downtows.col \
|
||||
flame.ifp \
|
||||
golf.col \
|
||||
grenade.ifp \
|
||||
haiti.col \
|
||||
haitin.col \
|
||||
hotel.col \
|
||||
islandsf.col \
|
||||
knife.ifp \
|
||||
lance.ifp \
|
||||
lawyers.col \
|
||||
littleha.col \
|
||||
m60.ifp \
|
||||
mall.col \
|
||||
mansion.col \
|
||||
medic.ifp \
|
||||
nbeachbt.col \
|
||||
nbeach.col \
|
||||
nbeachw.col \
|
||||
oceandN.col \
|
||||
oceandrv.col \
|
||||
playidles.ifp \
|
||||
python.ifp \
|
||||
rifle.ifp \
|
||||
riot.ifp \
|
||||
shotgun.ifp \
|
||||
skate.ifp \
|
||||
sniper.ifp \
|
||||
stadint.col \
|
||||
starisl.col \
|
||||
stripclb.col \
|
||||
strip.ifp \
|
||||
sunbathe.ifp \
|
||||
sword.ifp \
|
||||
tec.ifp \
|
||||
uzi.ifp \
|
||||
van.ifp \
|
||||
washintn.col \
|
||||
washints.col \
|
||||
yacht.col
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <filesystem>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
|
||||
// Sector size constant
|
||||
const size_t SECTOR_SIZE = 2048;
|
||||
@@ -27,6 +28,7 @@ std::vector<DirRecord> readDirFile(const std::string& dirFilePath) {
|
||||
DirRecord record;
|
||||
|
||||
while (dirFile.read(reinterpret_cast<char*>(&record), sizeof(DirRecord))) {
|
||||
assert(record.size != 0);
|
||||
records.push_back(record);
|
||||
}
|
||||
|
||||
|
||||
BIN
dreamcast/loader.elf
Executable file
7477
dreamcast/modlist.mk
@@ -1,71 +1,102 @@
|
||||
STREAM_ADF = \
|
||||
EMOTION.adf \
|
||||
ESPANT.adf \
|
||||
FEVER.adf \
|
||||
FLASH.adf \
|
||||
KCHAT.adf \
|
||||
VCPR.adf \
|
||||
VROCK.adf \
|
||||
WAVE.adf \
|
||||
WILD.adf
|
||||
|
||||
STREAM_MP3 = \
|
||||
BET.mp3 \
|
||||
END.mp3 \
|
||||
JB.mp3 \
|
||||
c1_tex.mp3 \
|
||||
d1_stog.mp3 \
|
||||
d2_kk.mp3 \
|
||||
d3_ado.mp3 \
|
||||
d4_gta.mp3 \
|
||||
d4_gta2.mp3 \
|
||||
d5_es.mp3 \
|
||||
d6_sts.mp3 \
|
||||
d7_mld.mp3 \
|
||||
el_ph1.mp3 \
|
||||
el_ph2.mp3 \
|
||||
el_ph3.mp3 \
|
||||
el_ph4.mp3 \
|
||||
hd_ph1.mp3 \
|
||||
hd_ph2.mp3 \
|
||||
hd_ph3.mp3 \
|
||||
hd_ph4.mp3 \
|
||||
hd_ph5.mp3 \
|
||||
j0_dm2.mp3 \
|
||||
j1_lfl.mp3 \
|
||||
j2_kcl.mp3 \
|
||||
j3_vh.mp3 \
|
||||
j4_eth.mp3 \
|
||||
j5_dst.mp3 \
|
||||
j6_tbj.mp3 \
|
||||
k1_kbo.mp3 \
|
||||
k2_gis.mp3 \
|
||||
k3_ds.mp3 \
|
||||
k4_shi.mp3 \
|
||||
k4_shi2.mp3 \
|
||||
k5_sd.mp3 \
|
||||
l1_lg.mp3 \
|
||||
l2_dsb.mp3 \
|
||||
l3_dm.mp3 \
|
||||
l4_pap.mp3 \
|
||||
l5_tfb.mp3 \
|
||||
mt_ph1.mp3 \
|
||||
mt_ph2.mp3 \
|
||||
mt_ph3.mp3 \
|
||||
mt_ph4.mp3 \
|
||||
r0_pdr2.mp3 \
|
||||
r1_sw.mp3 \
|
||||
r2_ap.mp3 \
|
||||
r3_ed.mp3 \
|
||||
r4_gf.mp3 \
|
||||
r5_pb.mp3 \
|
||||
r6_mm.mp3 \
|
||||
s0_mas.mp3 \
|
||||
s1_pf.mp3 \
|
||||
s2_ctg.mp3 \
|
||||
s2_ctg2.mp3 \
|
||||
s3_rtc.mp3 \
|
||||
s4_bdba.mp3 \
|
||||
s4_bdbb.mp3 \
|
||||
s4_bdbd.mp3 \
|
||||
s5_lrq.mp3 \
|
||||
s5_lrqb.mp3 \
|
||||
s5_lrqc.mp3 \
|
||||
t1_tol.mp3 \
|
||||
t2_tpu.mp3 \
|
||||
t3_mas.mp3 \
|
||||
t4_tat.mp3 \
|
||||
t5_bf.mp3 \
|
||||
yd_ph1.mp3 \
|
||||
yd_ph2.mp3 \
|
||||
yd_ph3.mp3 \
|
||||
yd_ph4.mp3
|
||||
cnt_1b.mp3 \
|
||||
int_b.mp3 \
|
||||
rok_1.mp3 \
|
||||
phil_2.mp3 \
|
||||
cok_2b.mp3 \
|
||||
Malibu.mp3 \
|
||||
bank_1.mp3 \
|
||||
Hwater.mp3 \
|
||||
bclosed.mp3 \
|
||||
resc_1a.mp3 \
|
||||
bank_3a.mp3 \
|
||||
bike_3.mp3 \
|
||||
tex_2.mp3 \
|
||||
col_2.mp3 \
|
||||
porn_3.mp3 \
|
||||
bike_1.mp3 \
|
||||
finale.mp3 \
|
||||
ass_2.mp3 \
|
||||
law_4.mp3 \
|
||||
car_1.mp3 \
|
||||
bank_2b.mp3 \
|
||||
tex_1.mp3 \
|
||||
cok_4b.mp3 \
|
||||
miscom.mp3 \
|
||||
bank_2a.mp3 \
|
||||
law_1b.mp3 \
|
||||
MallAmb.mp3 \
|
||||
bank_3b.mp3 \
|
||||
ass_1.mp3 \
|
||||
DirtRing.mp3 \
|
||||
col_5a.mp3 \
|
||||
tax_1.mp3 \
|
||||
cnt_1a.mp3 \
|
||||
bike_2.mp3 \
|
||||
int_a.mp3 \
|
||||
bud_1.mp3 \
|
||||
cok_2a.mp3 \
|
||||
City.mp3 \
|
||||
cap_1.mp3 \
|
||||
int_m.mp3 \
|
||||
cnt_2.mp3 \
|
||||
tex_3.mp3 \
|
||||
law_2c.mp3 \
|
||||
law_2b.mp3 \
|
||||
col_3a.mp3 \
|
||||
cok_4a2.mp3 \
|
||||
rok_2.mp3 \
|
||||
ice_1.mp3 \
|
||||
hat_1.mp3 \
|
||||
hat_2.mp3 \
|
||||
cub_4.mp3 \
|
||||
Glight.mp3 \
|
||||
Strip.mp3 \
|
||||
bud_3.mp3 \
|
||||
Hbeach.mp3 \
|
||||
bopen.mp3 \
|
||||
fin2.mp3 \
|
||||
cub_3.mp3 \
|
||||
cok_4a.mp3 \
|
||||
porn_2.mp3 \
|
||||
cub_1.mp3 \
|
||||
col_4a.mp3 \
|
||||
Hotel.mp3 \
|
||||
police.mp3 \
|
||||
law_2a.mp3 \
|
||||
Law4Riot.mp3 \
|
||||
cok_1.mp3 \
|
||||
col_5b.mp3 \
|
||||
Water.mp3 \
|
||||
HCity.mp3 \
|
||||
cok_3.mp3 \
|
||||
law_1a.mp3 \
|
||||
porn_1.mp3 \
|
||||
porn_4.mp3 \
|
||||
taxi.mp3 \
|
||||
cub_2.mp3 \
|
||||
law_3.mp3 \
|
||||
hat_3.mp3 \
|
||||
phil_1.mp3 \
|
||||
bank_4.mp3 \
|
||||
BeachAmb.mp3 \
|
||||
FIST.mp3 \
|
||||
bud_2.mp3 \
|
||||
ambsil.mp3 \
|
||||
int_d.mp3 \
|
||||
fin.mp3 \
|
||||
rok_3a.mp3 \
|
||||
drug_1.mp3 \
|
||||
stripa.mp3 \
|
||||
col_1.mp3
|
||||
7518
dreamcast/sfxlist.mk
@@ -1,23 +1,34 @@
|
||||
SFX_LOOP_WAV = \
|
||||
sfx_0_loop.wav \
|
||||
sfx_185_loop.wav \
|
||||
sfx_19_loop.wav \
|
||||
sfx_176_loop.wav \
|
||||
sfx_1_loop.wav \
|
||||
sfx_25_loop.wav \
|
||||
sfx_287_loop.wav \
|
||||
sfx_2_loop.wav \
|
||||
sfx_311_loop.wav \
|
||||
sfx_331_loop.wav \
|
||||
sfx_346_loop.wav \
|
||||
sfx_349_loop.wav \
|
||||
sfx_352_loop.wav \
|
||||
sfx_355_loop.wav \
|
||||
sfx_358_loop.wav \
|
||||
sfx_361_loop.wav \
|
||||
sfx_364_loop.wav \
|
||||
sfx_367_loop.wav \
|
||||
sfx_384_loop.wav \
|
||||
sfx_387_loop.wav \
|
||||
sfx_390_loop.wav \
|
||||
sfx_393_loop.wav \
|
||||
sfx_396_loop.wav \
|
||||
sfx_399_loop.wav \
|
||||
sfx_3_loop.wav \
|
||||
sfx_438_loop.wav \
|
||||
sfx_402_loop.wav \
|
||||
sfx_408_loop.wav \
|
||||
sfx_411_loop.wav \
|
||||
sfx_414_loop.wav \
|
||||
sfx_419_loop.wav \
|
||||
sfx_420_loop.wav \
|
||||
sfx_422_loop.wav \
|
||||
sfx_423_loop.wav \
|
||||
sfx_432_loop.wav \
|
||||
sfx_436_loop.wav \
|
||||
sfx_440_loop.wav \
|
||||
sfx_444_loop.wav \
|
||||
sfx_4_loop.wav \
|
||||
sfx_5_loop.wav \
|
||||
sfx_62_loop.wav \
|
||||
sfx_6_loop.wav \
|
||||
sfx_7_loop.wav \
|
||||
sfx_82_loop.wav
|
||||
|
||||
@@ -8,7 +8,7 @@ all: $(TARGET)
|
||||
include common.mk
|
||||
|
||||
OBJS = $(RE3_OBJS) $(RW_OBJS) \
|
||||
../src/audio/sampman_null.o
|
||||
../miami/audio/sampman_null.o
|
||||
|
||||
OBJS_SIM=$(OBJS:.o=.sim.o) \
|
||||
../vendor/koshle/hlekos.sim.o \
|
||||
@@ -47,11 +47,11 @@ ifeq ($(IS_MAC), yes)
|
||||
else
|
||||
# Using sse2 here for valgrind compatibility
|
||||
%.sim.o: %.c
|
||||
$(CC) -msse2 -mfpmath=sse -c -O0 -g -fno-pic -no-pie -o $@ $(CFLAGS) -I../vendor/koshle -I../vendor/emu -m32 -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
|
||||
$(CC) -msse2 -mfpmath=sse -c -O0 -g -fno-pic -no-pie -o $@ $(CFLAGS) -I../vendor/koshle -I../vendor/emu -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
|
||||
%.sim.o: %.cpp
|
||||
$(CXX) -msse2 -mfpmath=sse -c -O0 -g -fno-pic -no-pie -o $@ $(CXXFLAGS) -I../vendor/koshle -I../vendor/emu -m32 -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
|
||||
$(CXX) -msse2 -mfpmath=sse -c -O0 -g -fno-pic -no-pie -o $@ $(CXXFLAGS) -I../vendor/koshle -I../vendor/emu -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
|
||||
%.sim.o3: %.cpp
|
||||
$(CXX) -msse2 -mfpmath=sse -c -O3 -g -fno-pic -no-pie -o $@ $(CXXFLAGS) -I../vendor/koshle -I../vendor/emu -m32 -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
|
||||
$(CXX) -msse2 -mfpmath=sse -c -O3 -g -fno-pic -no-pie -o $@ $(CXXFLAGS) -I../vendor/koshle -I../vendor/emu -U_WIN32 -UWIN32 -UWINNT -Ui386 -DDC_SIM -D_FILE_OFFSET_BITS=64 $<
|
||||
endif
|
||||
|
||||
clean:
|
||||
@@ -62,6 +62,6 @@ $(TARGET): $(OBJS_SIM)
|
||||
$(CXX) -fno-pic -no-pie -o $(TARGET) $(OBJS_SIM) -lX11
|
||||
else
|
||||
$(TARGET): $(OBJS_SIM)
|
||||
$(CXX) -m32 -fno-pic -no-pie -o $(TARGET) $(OBJS_SIM) -lX11
|
||||
$(CXX) -fno-pic -no-pie -o $(TARGET) $(OBJS_SIM) -lX11
|
||||
endif
|
||||
-include $(DEPS_SIM)
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <cstring>
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
@@ -51,6 +52,7 @@ void pvrRegWrite(uint32 A, uint32 D) {}
|
||||
uint32_t pvr_map32(uint32_t offset32) {return 0;}
|
||||
void Hackpresent() { }
|
||||
void re3RemoveLeastUsedModel() { assert(false); }
|
||||
void re3EmergencyRemoveModel() { assert(false); }
|
||||
void RwTexDictionaryGtaStreamRead1(rw::Stream*){ assert(false); }
|
||||
void RwTexDictionaryGtaStreamRead2(rw::Stream*, rw::TexDictionary*) { assert(false); }
|
||||
void pvr_ta_data(void* data, int size) {
|
||||
@@ -238,6 +240,40 @@ PluginAttach(void)
|
||||
|
||||
const char* currentFile;
|
||||
|
||||
namespace rw {
|
||||
Image* readBMP(const char *filename);
|
||||
Image* readPNG(const char *filename);
|
||||
}
|
||||
|
||||
void InsertImage(RwTexDictionary* texDict, const char* file, const char* texName) {
|
||||
RwTexture *tex;
|
||||
RwRaster *raster;
|
||||
RwInt32 width, height, depth, format;
|
||||
RwImage *image = rw::readBMP(file);
|
||||
if (!image) {
|
||||
image = rw::readPNG(file);
|
||||
}
|
||||
|
||||
assert(image);
|
||||
|
||||
RwImageFindRasterFormat(image, rwRASTERTYPETEXTURE, &width, &height, &depth, &format);
|
||||
raster = RwRasterCreate(width, height, depth, format);
|
||||
RwRasterSetFromImage(raster, image);
|
||||
|
||||
tex = RwTextureCreate(raster);
|
||||
RwTextureSetName(tex, texName);
|
||||
|
||||
RwTextureSetFilterMode(tex, rwFILTERLINEAR);
|
||||
|
||||
RwTexDictionaryAddTexture(texDict, tex);
|
||||
|
||||
RwImageDestroy(image);
|
||||
}
|
||||
|
||||
std::vector<std::pair<const char*, const char*>> ImagesToAdd;
|
||||
std::vector<const char*> ImagesToRemove;
|
||||
bool listTextures = false;
|
||||
|
||||
int main(int argc, const char** argv) {
|
||||
if (argc >= 5) {
|
||||
int width = atoi(argv[3]);
|
||||
@@ -247,7 +283,7 @@ int main(int argc, const char** argv) {
|
||||
if(height >= 16 && height <= 1024)
|
||||
rw::dc::maxRasterHeight = height;
|
||||
}
|
||||
for (int i = 0; i < argc; i++) {
|
||||
for (int i = 5; i < argc; i++) {
|
||||
if (argv[i] != nullptr) {
|
||||
// Downsample Parameter
|
||||
if (strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "-D") == 0) {
|
||||
@@ -271,6 +307,22 @@ int main(int argc, const char** argv) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "--include-tex") == 0) {
|
||||
assert(i + 2 < argc);
|
||||
ImagesToAdd.emplace_back(argv[i+1], argv[i+2]);
|
||||
i += 2;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "--delete-tex") == 0) {
|
||||
assert(i + 1 < argc);
|
||||
ImagesToRemove.emplace_back(argv[i+1]);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "--list-tex") == 0) {
|
||||
listTextures = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,6 +350,31 @@ int main(int argc, const char** argv) {
|
||||
|
||||
RwStreamClose(stream, nil);
|
||||
|
||||
if (listTextures) {
|
||||
fprintf(stdout, "Incoming textures:\n");
|
||||
FORLIST(lnk, texDict->textures) {
|
||||
auto tex = rw::Texture::fromDict(lnk);
|
||||
fprintf(stdout, "texture: '%s'\n", tex->name);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto&& removedTextureName: ImagesToRemove) {
|
||||
auto removedTexture = texDict->find(removedTextureName);
|
||||
assert(removedTexture);
|
||||
texDict->remove(removedTexture);
|
||||
}
|
||||
for (auto&& extraTexture: ImagesToAdd) {
|
||||
InsertImage(texDict, extraTexture.first, extraTexture.second);
|
||||
}
|
||||
|
||||
if (listTextures) {
|
||||
fprintf(stdout, "Processing textures:\n");
|
||||
FORLIST(lnk, texDict->textures) {
|
||||
auto tex = rw::Texture::fromDict(lnk);
|
||||
fprintf(stdout, "texture: '%s'\n", tex->name);
|
||||
}
|
||||
}
|
||||
|
||||
auto streamOut = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, argv[2]);
|
||||
assert(streamOut && "failed to open output");
|
||||
|
||||
|
||||
1836
dreamcast/texlist.mk
1246
dreamcast/wavlist.mk
170
miami/CMakeLists.txt
Normal file
@@ -0,0 +1,170 @@
|
||||
find_package(Threads REQUIRED)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
|
||||
|
||||
function(header_directories RETURN_LIST)
|
||||
file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
|
||||
set(RELDIRS)
|
||||
foreach(SRC ${ALL_SRCS})
|
||||
file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}")
|
||||
get_filename_component(RELDIR "${RELSRC}" DIRECTORY)
|
||||
list(APPEND RELDIRS ${RELDIR})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES RELDIRS)
|
||||
set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
header_directories(${PROJECT}_INCLUDES)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/extras/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp" @ONLY)
|
||||
list(APPEND ${PROJECT}_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp")
|
||||
|
||||
add_executable(${EXECUTABLE} WIN32
|
||||
${${PROJECT}_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
librw::librw
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
target_include_directories(${EXECUTABLE}
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${${PROJECT}_INCLUDES}>
|
||||
)
|
||||
|
||||
target_compile_definitions(${EXECUTABLE}
|
||||
PRIVATE
|
||||
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
|
||||
LIBRW
|
||||
CMAKE_NO_AUTOLINK
|
||||
)
|
||||
|
||||
if(LIBRW_PLATFORM_D3D9)
|
||||
target_compile_definitions(${EXECUTABLE}
|
||||
PUBLIC
|
||||
USE_D3D9
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE CMAKE_BUILD)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE USE_OUR_VERSIONING)
|
||||
|
||||
if(${PROJECT}_AUDIO STREQUAL "OAL")
|
||||
find_package(OpenAL REQUIRED)
|
||||
if(TARGET OpenAL::OpenAL)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE OpenAL::OpenAL)
|
||||
else()
|
||||
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
|
||||
endif()
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
|
||||
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
|
||||
find_package(MilesSDK REQUIRED)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK)
|
||||
endif()
|
||||
|
||||
find_package(mpg123 REQUIRED)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
MPG123::libmpg123
|
||||
)
|
||||
if(${PROJECT}_WITH_OPUS)
|
||||
find_package(opusfile REQUIRED)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
opusfile::opusfile
|
||||
)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS)
|
||||
endif()
|
||||
if(${PROJECT}_WITH_LIBSNDFILE)
|
||||
find_package(SndFile REQUIRED)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
SndFile::SndFile
|
||||
)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE )
|
||||
|
||||
option(${PROJECT}_WITH_SANITIZERS "Use UB sanitizers (better crash log)" OFF)
|
||||
option(${PROJECT}_WITH_ASAN "Use Address sanitizer (better crash log)" OFF)
|
||||
|
||||
if(${PROJECT}_WITH_SANITIZERS)
|
||||
target_compile_options(${EXECUTABLE} PUBLIC
|
||||
-fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability
|
||||
-g3 -fno-omit-frame-pointer)
|
||||
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability)
|
||||
endif()
|
||||
|
||||
if(${PROJECT}_WITH_ASAN)
|
||||
target_compile_options(${EXECUTABLE} PUBLIC -fsanitize=address -g3 -fno-omit-frame-pointer)
|
||||
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=address)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
target_compile_options(${EXECUTABLE}
|
||||
PRIVATE
|
||||
"-Wall"
|
||||
)
|
||||
if (NOT LIBRW_PLATFORM_PS2)
|
||||
target_compile_options(${EXECUTABLE}
|
||||
PRIVATE
|
||||
-Wextra
|
||||
-Wdouble-promotion
|
||||
-Wpedantic
|
||||
)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(${EXECUTABLE}
|
||||
PUBLIC
|
||||
/Zc:sizedDealloc-
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NINTENDO_SWITCH)
|
||||
set(${PROJECT}_C_CXX_EXTENSIONS ON)
|
||||
else()
|
||||
set(${PROJECT}_C_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
|
||||
if(LIBRW_PLATFORM_GL3 AND LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||
include(CheckSymbolExists)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES glfw)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -DGLFW_EXPOSE_NATIVE_X11)
|
||||
check_symbol_exists(glfwGetX11Display "GLFW/glfw3.h;GLFW/glfw3native.h" GLFW_HAS_X11)
|
||||
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
if (GLFW_HAS_X11)
|
||||
find_package(X11 REQUIRED)
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE X11::X11)
|
||||
target_compile_definitions(${EXECUTABLE} PRIVATE GET_KEYBOARD_INPUT_FROM_X11)
|
||||
endif (GLFW_HAS_X11)
|
||||
endif()
|
||||
|
||||
set_target_properties(${EXECUTABLE}
|
||||
PROPERTIES
|
||||
C_STANDARD 11
|
||||
C_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS}
|
||||
C_STANDARD_REQUIRED ON
|
||||
CXX_STANDARD 11
|
||||
CXX_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS}
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
if(${PROJECT}_INSTALL)
|
||||
install(
|
||||
TARGETS ${EXECUTABLE}
|
||||
EXPORT ${EXECUTABLE}-targets
|
||||
RUNTIME DESTINATION "."
|
||||
)
|
||||
if(MSVC)
|
||||
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
reVC_platform_target(${EXECUTABLE} INSTALL)
|
||||
187
miami/animation/AnimBlendAssocGroup.cpp
Normal file
@@ -0,0 +1,187 @@
|
||||
#include "common.h"
|
||||
|
||||
#if defined _WIN32 && !defined __MINGW32__
|
||||
#if defined __MWERKS__
|
||||
#include <wctype.h>
|
||||
#else
|
||||
#include "ctype.h"
|
||||
#endif
|
||||
#else
|
||||
#include <cwctype>
|
||||
#endif
|
||||
|
||||
#include "General.h"
|
||||
#include "RwHelper.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "ModelInfo.h"
|
||||
#include "AnimManager.h"
|
||||
#include "RpAnimBlend.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "AnimBlendAssocGroup.h"
|
||||
|
||||
CAnimBlendAssocGroup::CAnimBlendAssocGroup(void)
|
||||
{
|
||||
animBlock = nil;
|
||||
assocList = nil;
|
||||
numAssociations = 0;
|
||||
firstAnimId = 0;
|
||||
groupId = -1;
|
||||
}
|
||||
|
||||
CAnimBlendAssocGroup::~CAnimBlendAssocGroup(void)
|
||||
{
|
||||
DestroyAssociations();
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssocGroup::DestroyAssociations(void)
|
||||
{
|
||||
if(assocList){
|
||||
delete[] assocList;
|
||||
assocList = nil;
|
||||
numAssociations = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
CAnimBlendAssocGroup::GetAnimation(uint32 id)
|
||||
{
|
||||
return &assocList[id - firstAnimId];
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
CAnimBlendAssocGroup::GetAnimation(const char *name)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < numAssociations; i++)
|
||||
if(!CGeneral::faststricmp(assocList[i].hierarchy->name, name))
|
||||
return &assocList[i];
|
||||
debug("\n\nCan't find the fucking animation %s\n\n\n", name);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
CAnimBlendAssociation*
|
||||
CAnimBlendAssocGroup::CopyAnimation(uint32 id)
|
||||
{
|
||||
CAnimBlendAssociation *anim = GetAnimation(id);
|
||||
if(anim == nil)
|
||||
return nil;
|
||||
|
||||
return new CAnimBlendAssociation(*anim);
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
CAnimBlendAssocGroup::CopyAnimation(const char *name)
|
||||
{
|
||||
CAnimBlendAssociation *anim = GetAnimation(name);
|
||||
if(anim == nil)
|
||||
return nil;
|
||||
|
||||
return new CAnimBlendAssociation(*anim);
|
||||
}
|
||||
|
||||
bool
|
||||
strcmpIgnoringDigits(const char *s1, const char *s2)
|
||||
{
|
||||
char c1, c2;
|
||||
|
||||
for(;;){
|
||||
c1 = *s1;
|
||||
c2 = *s2;
|
||||
if(c1) s1++;
|
||||
if(c2) s2++;
|
||||
if(c1 == '\0' && c2 == '\0') return true;
|
||||
#ifndef ASCII_STRCMP
|
||||
if(iswdigit(c1) && iswdigit(c2))
|
||||
#else
|
||||
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
||||
#endif
|
||||
continue;
|
||||
#ifndef ASCII_STRCMP
|
||||
c1 = toupper(c1);
|
||||
c2 = toupper(c2);
|
||||
#else
|
||||
c1 = __ascii_toupper(c1);
|
||||
c2 = __ascii_toupper(c2);
|
||||
#endif
|
||||
|
||||
if(c1 && c2 && c1 != c2)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CBaseModelInfo*
|
||||
GetModelFromName(const char *name)
|
||||
{
|
||||
int i;
|
||||
CBaseModelInfo *mi;
|
||||
char playername[32];
|
||||
|
||||
if(strncasecmp(name, "CSplay", 6) == 0 &&
|
||||
strncasecmp(CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName(), "ig", 2) == 0){
|
||||
strcpy(playername, CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName());
|
||||
playername[0] = 'C';
|
||||
playername[1] = 'S';
|
||||
name = playername;
|
||||
}
|
||||
|
||||
for(i = 0; i < MODELINFOSIZE; i++){
|
||||
mi = CModelInfo::GetModelInfo(i);
|
||||
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
||||
strcmpIgnoringDigits(mi->GetModelName(), name))
|
||||
return mi;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssocGroup::CreateAssociations(const char *name)
|
||||
{
|
||||
int i;
|
||||
CAnimBlock *animBlock;
|
||||
|
||||
DestroyAssociations();
|
||||
|
||||
animBlock = CAnimManager::GetAnimationBlock(name);
|
||||
assocList = new CAnimBlendAssociation[animBlock->numAnims];
|
||||
numAssociations = 0;
|
||||
|
||||
for(i = 0; i < animBlock->numAnims; i++){
|
||||
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
|
||||
CBaseModelInfo *model = GetModelFromName(anim->name);
|
||||
if(model){
|
||||
debug("Associated anim %s with model %s\n", anim->name, model->GetModelName());
|
||||
RpClump *clump = (RpClump*)model->CreateInstance();
|
||||
RpAnimBlendClumpInit(clump);
|
||||
assocList[i].Init(clump, anim);
|
||||
if(IsClumpSkinned(clump))
|
||||
RpClumpForAllAtomics(clump, AtomicRemoveAnimFromSkinCB, nil);
|
||||
RpClumpDestroy(clump);
|
||||
assocList[i].animId = firstAnimId + i;
|
||||
assocList[i].groupId = groupId;
|
||||
}else
|
||||
debug("\n\nCANNOT FIND MODELINFO WITH NAME %s\n\n\n", anim->name);
|
||||
}
|
||||
numAssociations = animBlock->numAnims;
|
||||
}
|
||||
|
||||
// Create associations from hierarchies for a given clump
|
||||
void
|
||||
CAnimBlendAssocGroup::CreateAssociations(const char *blockName, RpClump *clump, const char **animNames, int numAssocs)
|
||||
{
|
||||
int i;
|
||||
|
||||
DestroyAssociations();
|
||||
|
||||
animBlock = CAnimManager::GetAnimationBlock(blockName);
|
||||
assocList = new CAnimBlendAssociation[numAssocs];
|
||||
|
||||
numAssociations = 0;
|
||||
for(i = 0; i < numAssocs; i++){
|
||||
assocList[i].Init(clump, CAnimManager::GetAnimation(animNames[i], animBlock));
|
||||
assocList[i].animId = firstAnimId + i;
|
||||
assocList[i].groupId = groupId;
|
||||
}
|
||||
numAssociations = numAssocs;
|
||||
}
|
||||
24
miami/animation/AnimBlendAssocGroup.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
class CAnimBlendAssociation;
|
||||
struct CAnimBlock;
|
||||
|
||||
class CAnimBlendAssocGroup
|
||||
{
|
||||
public:
|
||||
CAnimBlock *animBlock;
|
||||
CAnimBlendAssociation *assocList;
|
||||
int32 numAssociations;
|
||||
int32 firstAnimId;
|
||||
int32 groupId; // id of self in ms_aAnimAssocGroups
|
||||
|
||||
CAnimBlendAssocGroup(void);
|
||||
~CAnimBlendAssocGroup(void);
|
||||
void DestroyAssociations(void);
|
||||
CAnimBlendAssociation *GetAnimation(uint32 id);
|
||||
CAnimBlendAssociation *GetAnimation(const char *name);
|
||||
CAnimBlendAssociation *CopyAnimation(uint32 id);
|
||||
CAnimBlendAssociation *CopyAnimation(const char *name);
|
||||
void CreateAssociations(const char *name);
|
||||
void CreateAssociations(const char *blockName, RpClump *clump, const char **animNames, int numAssocs);
|
||||
};
|
||||
230
miami/animation/AnimBlendAssociation.cpp
Normal file
@@ -0,0 +1,230 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "AnimBlendHierarchy.h"
|
||||
#include "AnimBlendClumpData.h"
|
||||
#include "RpAnimBlend.h"
|
||||
#include "AnimManager.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
CAnimBlendAssociation::CAnimBlendAssociation(void)
|
||||
{
|
||||
groupId = -1;
|
||||
nodes = nil;
|
||||
blendAmount = 1.0f;
|
||||
blendDelta = 0.0f;
|
||||
currentTime = 0.0f;
|
||||
speed = 1.0f;
|
||||
timeStep = 0.0f;
|
||||
animId = -1;
|
||||
flags = 0;
|
||||
callbackType = CB_NONE;
|
||||
link.Init();
|
||||
}
|
||||
|
||||
CAnimBlendAssociation::CAnimBlendAssociation(CAnimBlendAssociation &other)
|
||||
{
|
||||
nodes = nil;
|
||||
blendAmount = 1.0f;
|
||||
blendDelta = 0.0f;
|
||||
currentTime = 0.0f;
|
||||
speed = 1.0f;
|
||||
timeStep = 0.0f;
|
||||
callbackType = CB_NONE;
|
||||
link.Init();
|
||||
Init(other);
|
||||
}
|
||||
|
||||
CAnimBlendAssociation::~CAnimBlendAssociation(void)
|
||||
{
|
||||
FreeAnimBlendNodeArray();
|
||||
link.Remove();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::AllocateAnimBlendNodeArray(int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
nodes = (CAnimBlendNode*)RwMallocAlign(n*sizeof(CAnimBlendNode), 64);
|
||||
for(i = 0; i < n; i++)
|
||||
nodes[i].Init();
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::FreeAnimBlendNodeArray(void)
|
||||
{
|
||||
if(nodes)
|
||||
RwFreeAlign(nodes);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::Init(RpClump *clump, CAnimBlendHierarchy *hier)
|
||||
{
|
||||
int i;
|
||||
AnimBlendFrameData *frame;
|
||||
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
numNodes = clumpData->numFrames;
|
||||
AllocateAnimBlendNodeArray(numNodes);
|
||||
for(i = 0; i < numNodes; i++)
|
||||
nodes[i].association = this;
|
||||
hierarchy = hier;
|
||||
|
||||
// Init every node from a sequence and a Clump frame
|
||||
// NB: This is where the order of nodes is defined
|
||||
for(i = 0; i < hier->numSequences; i++){
|
||||
CAnimBlendSequence *seq = &hier->sequences[i];
|
||||
if(seq->boneTag == -1)
|
||||
frame = RpAnimBlendClumpFindFrame(clump, seq->name);
|
||||
else
|
||||
frame = RpAnimBlendClumpFindBone(clump, seq->boneTag);
|
||||
if(frame && seq->numFrames > 0)
|
||||
nodes[frame - clumpData->frames].sequence = seq;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::Init(CAnimBlendAssociation &assoc)
|
||||
{
|
||||
int i;
|
||||
|
||||
hierarchy = assoc.hierarchy;
|
||||
numNodes = assoc.numNodes;
|
||||
flags = assoc.flags;
|
||||
animId = assoc.animId;
|
||||
groupId = assoc.groupId;
|
||||
AllocateAnimBlendNodeArray(numNodes);
|
||||
for(i = 0; i < numNodes; i++){
|
||||
nodes[i] = assoc.nodes[i];
|
||||
nodes[i].association = this;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::SetBlend(float amount, float delta)
|
||||
{
|
||||
blendAmount = amount;
|
||||
blendDelta = delta;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::SetFinishCallback(void (*cb)(CAnimBlendAssociation*, void*), void *arg)
|
||||
{
|
||||
callbackType = CB_FINISH;
|
||||
callback = cb;
|
||||
callbackArg = arg;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::SetDeleteCallback(void (*cb)(CAnimBlendAssociation*, void*), void *arg)
|
||||
{
|
||||
callbackType = CB_DELETE;
|
||||
callback = cb;
|
||||
callbackArg = arg;
|
||||
}
|
||||
|
||||
#if defined(DC_TEXCONV)
|
||||
void
|
||||
CAnimBlendAssociation::SetCurrentTime(float time) {
|
||||
assert("false" && "Must not reach here");
|
||||
}
|
||||
#else
|
||||
void
|
||||
CAnimBlendAssociation::SetCurrentTime(float time)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(currentTime = time; currentTime >= hierarchy->totalLength; currentTime -= hierarchy->totalLength)
|
||||
if (!IsRepeating()) {
|
||||
currentTime = hierarchy->totalLength;
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
for(i = 0; i < numNodes; i++)
|
||||
if(nodes[i].sequence)
|
||||
nodes[i].FindKeyFrame(currentTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::SyncAnimation(CAnimBlendAssociation *other)
|
||||
{
|
||||
SetCurrentTime(other->currentTime/other->hierarchy->totalLength * hierarchy->totalLength);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::Start(float time)
|
||||
{
|
||||
flags |= ASSOC_RUNNING;
|
||||
SetCurrentTime(time);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendAssociation::UpdateTimeStep(float timeDelta, float relSpeed)
|
||||
{
|
||||
if(IsRunning())
|
||||
timeStep = (flags & ASSOC_MOVEMENT ? relSpeed*hierarchy->totalLength : speed) * timeDelta;
|
||||
}
|
||||
|
||||
bool
|
||||
CAnimBlendAssociation::UpdateTime(float timeDelta, float relSpeed)
|
||||
{
|
||||
if(!IsRunning())
|
||||
return true;
|
||||
if(currentTime >= hierarchy->totalLength){
|
||||
flags &= ~ASSOC_RUNNING;
|
||||
return true;
|
||||
}
|
||||
|
||||
currentTime += timeStep;
|
||||
|
||||
if(currentTime >= hierarchy->totalLength){
|
||||
// Ran past end
|
||||
|
||||
if(IsRepeating())
|
||||
currentTime -= hierarchy->totalLength;
|
||||
else{
|
||||
currentTime = hierarchy->totalLength;
|
||||
if(flags & ASSOC_FADEOUTWHENDONE){
|
||||
flags |= ASSOC_DELETEFADEDOUT;
|
||||
blendDelta = -4.0f;
|
||||
}
|
||||
if(callbackType == CB_FINISH){
|
||||
callbackType = CB_NONE;
|
||||
callback(this, callbackArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// return whether we still exist after this function
|
||||
bool
|
||||
CAnimBlendAssociation::UpdateBlend(float timeDelta)
|
||||
{
|
||||
blendAmount += blendDelta * timeDelta;
|
||||
|
||||
if(blendAmount <= 0.0f && blendDelta < 0.0f){
|
||||
// We're faded out and are not fading in
|
||||
blendAmount = 0.0f;
|
||||
blendDelta = Max(0.0f, blendDelta);
|
||||
if(flags & ASSOC_DELETEFADEDOUT){
|
||||
if(callbackType == CB_FINISH || callbackType == CB_DELETE)
|
||||
callback(this, callbackArg);
|
||||
delete this;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(blendAmount > 1.0f){
|
||||
// Maximally faded in, clamp values
|
||||
blendAmount = 1.0f;
|
||||
blendDelta = Min(0.0f, blendDelta);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
93
miami/animation/AnimBlendAssociation.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#pragma once
|
||||
|
||||
#include "AnimBlendList.h"
|
||||
#include "AnimBlendNode.h"
|
||||
#include "AnimBlendHierarchy.h"
|
||||
|
||||
enum {
|
||||
ASSOC_RUNNING = 1,
|
||||
ASSOC_REPEAT = 2,
|
||||
ASSOC_DELETEFADEDOUT = 4,
|
||||
ASSOC_FADEOUTWHENDONE = 8,
|
||||
ASSOC_PARTIAL = 0x10,
|
||||
ASSOC_MOVEMENT = 0x20, // ???
|
||||
ASSOC_HAS_TRANSLATION = 0x40,
|
||||
ASSOC_HAS_X_TRANSLATION = 0x80, // for 2d velocity extraction
|
||||
ASSOC_WALK = 0x100, // for CPed::PlayFootSteps(void)
|
||||
ASSOC_IDLE = 0x200, // only xpress scratch has it by default, but game adds it to player's idle animations later
|
||||
ASSOC_NOWALK = 0x400, // see CPed::PlayFootSteps(void)
|
||||
ASSOC_BLOCK = 0x800, // unused in assoc description, blocks other anims from being played
|
||||
ASSOC_FRONTAL = 0x1000, // anims that we fall to front
|
||||
ASSOC_DRIVING = 0x2000, // new in VC
|
||||
};
|
||||
|
||||
// Anim hierarchy associated with a clump
|
||||
// Holds the interpolated state of all nodes.
|
||||
// Also used as template for other clumps.
|
||||
class CAnimBlendAssociation
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
// callbackType
|
||||
CB_NONE,
|
||||
CB_FINISH,
|
||||
CB_DELETE
|
||||
};
|
||||
|
||||
CAnimBlendLink link;
|
||||
|
||||
int16 numNodes; // taken from CAnimBlendClumpData::numFrames
|
||||
int16 groupId; // ID of CAnimBlendAssocGroup this is in
|
||||
// NB: Order of these depends on order of nodes in Clump this was built from
|
||||
CAnimBlendNode *nodes;
|
||||
CAnimBlendHierarchy *hierarchy;
|
||||
float blendAmount;
|
||||
float blendDelta; // how much blendAmount changes over time
|
||||
float currentTime;
|
||||
float speed;
|
||||
float timeStep;
|
||||
int16 animId;
|
||||
int16 flags;
|
||||
int32 callbackType;
|
||||
void (*callback)(CAnimBlendAssociation*, void*);
|
||||
void *callbackArg;
|
||||
|
||||
bool IsRunning(void) { return !!(flags & ASSOC_RUNNING); }
|
||||
bool IsRepeating(void) { return !!(flags & ASSOC_REPEAT); }
|
||||
bool IsPartial(void) { return !!(flags & ASSOC_PARTIAL); }
|
||||
bool IsMovement(void) { return !!(flags & ASSOC_MOVEMENT); }
|
||||
bool HasTranslation(void) { return !!(flags & ASSOC_HAS_TRANSLATION); }
|
||||
bool HasXTranslation(void) { return !!(flags & ASSOC_HAS_X_TRANSLATION); }
|
||||
|
||||
float GetBlendAmount(float weight) { return IsPartial() ? blendAmount : blendAmount*weight; }
|
||||
CAnimBlendNode *GetNode(int i) { return &nodes[i]; }
|
||||
|
||||
CAnimBlendAssociation(void);
|
||||
CAnimBlendAssociation(CAnimBlendAssociation &other);
|
||||
#ifndef FIX_BUGS
|
||||
virtual
|
||||
#endif
|
||||
~CAnimBlendAssociation(void);
|
||||
void AllocateAnimBlendNodeArray(int n);
|
||||
void FreeAnimBlendNodeArray(void);
|
||||
void Init(RpClump *clump, CAnimBlendHierarchy *hier);
|
||||
void Init(CAnimBlendAssociation &assoc);
|
||||
void SetBlend(float amount, float delta);
|
||||
void SetFinishCallback(void (*callback)(CAnimBlendAssociation*, void*), void *arg);
|
||||
void SetDeleteCallback(void (*callback)(CAnimBlendAssociation*, void*), void *arg);
|
||||
void SetCurrentTime(float time);
|
||||
void SyncAnimation(CAnimBlendAssociation *other);
|
||||
void Start(float time);
|
||||
void UpdateTimeStep(float timeDelta, float relSpeed);
|
||||
bool UpdateTime(float timeDelta, float relSpeed);
|
||||
bool UpdateBlend(float timeDelta);
|
||||
|
||||
void SetRun(void) { flags |= ASSOC_RUNNING; }
|
||||
|
||||
float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
|
||||
float GetProgress() { return currentTime / hierarchy->totalLength; }
|
||||
|
||||
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
|
||||
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
|
||||
}
|
||||
};
|
||||
36
miami/animation/AnimBlendClumpData.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "AnimBlendClumpData.h"
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
CAnimBlendClumpData::CAnimBlendClumpData(void)
|
||||
{
|
||||
numFrames = 0;
|
||||
velocity2d = nil;
|
||||
frames = nil;
|
||||
link.Init();
|
||||
}
|
||||
|
||||
CAnimBlendClumpData::~CAnimBlendClumpData(void)
|
||||
{
|
||||
link.Remove();
|
||||
if(frames)
|
||||
RwFreeAlign(frames);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendClumpData::SetNumberOfFrames(int n)
|
||||
{
|
||||
if(frames)
|
||||
RwFreeAlign(frames);
|
||||
numFrames = n;
|
||||
frames = (AnimBlendFrameData*)RwMallocAlign(numFrames * sizeof(AnimBlendFrameData), 64);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendClumpData::ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *arg)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < numFrames; i++)
|
||||
cb(&frames[i], arg);
|
||||
}
|
||||
44
miami/animation/AnimBlendClumpData.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "AnimBlendList.h"
|
||||
|
||||
|
||||
struct AnimBlendFrameData
|
||||
{
|
||||
enum {
|
||||
IGNORE_ROTATION = 2,
|
||||
IGNORE_TRANSLATION = 4,
|
||||
VELOCITY_EXTRACTION = 8,
|
||||
VELOCITY_EXTRACTION_3D = 0x10,
|
||||
UPDATE_KEYFRAMES = 0x20
|
||||
};
|
||||
|
||||
uint8 flag;
|
||||
RwV3d resetPos;
|
||||
union {
|
||||
RwFrame *frame;
|
||||
RpHAnimStdInterpFrame *hanimFrame;
|
||||
};
|
||||
int32 nodeID;
|
||||
};
|
||||
VALIDATE_SIZE(AnimBlendFrameData, 0x18);
|
||||
|
||||
|
||||
class CAnimBlendClumpData
|
||||
{
|
||||
public:
|
||||
CAnimBlendLink link;
|
||||
int32 numFrames;
|
||||
union {
|
||||
CVector2D *velocity2d;
|
||||
CVector *velocity3d;
|
||||
};
|
||||
// order of frames is determined by RW hierarchy
|
||||
AnimBlendFrameData *frames;
|
||||
|
||||
CAnimBlendClumpData(void);
|
||||
~CAnimBlendClumpData(void);
|
||||
void SetNumberOfFrames(int n);
|
||||
void SetNumberOfBones(int n) { SetNumberOfFrames(n); }
|
||||
void ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *arg);
|
||||
};
|
||||
72
miami/animation/AnimBlendHierarchy.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "AnimBlendSequence.h"
|
||||
#include "AnimBlendHierarchy.h"
|
||||
#include "AnimManager.h"
|
||||
|
||||
CAnimBlendHierarchy::CAnimBlendHierarchy(void)
|
||||
{
|
||||
sequences = nil;
|
||||
numSequences = 0;
|
||||
totalLength = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendHierarchy::Shutdown(void)
|
||||
{
|
||||
RemoveAnimSequences();
|
||||
totalLength = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendHierarchy::SetName(char *name)
|
||||
{
|
||||
strncpy(this->name, name, 24);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendHierarchy::CalcTotalTime(void)
|
||||
{
|
||||
int i, j;
|
||||
totalLength = 0.0f;
|
||||
|
||||
for(i = 0; i < numSequences; i++){
|
||||
#ifdef FIX_BUGS
|
||||
if(sequences[i].numFrames == 0)
|
||||
continue;
|
||||
#endif
|
||||
float seqTime = 0.0f;
|
||||
for(j = 0; j < sequences[i].numFrames; j++)
|
||||
seqTime += sequences[i].GetDeltaTime(j);
|
||||
totalLength = Max(totalLength, seqTime);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendHierarchy::RemoveQuaternionFlips(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < numSequences; i++)
|
||||
sequences[i].RemoveQuaternionFlips();
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendHierarchy::RemoveAnimSequences(void)
|
||||
{
|
||||
delete[] sequences;
|
||||
sequences = nil;
|
||||
numSequences = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
void
|
||||
CAnimBlendHierarchy::MoveMemory(bool onlyone)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < numSequences; i++)
|
||||
if(sequences[i].MoveMemory() && onlyone)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
31
miami/animation/AnimBlendHierarchy.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "templates.h"
|
||||
|
||||
#ifdef MoveMemory
|
||||
#undef MoveMemory // windows shit
|
||||
#endif
|
||||
|
||||
class CAnimBlendSequence;
|
||||
|
||||
// A collection of sequences
|
||||
class CAnimBlendHierarchy
|
||||
{
|
||||
public:
|
||||
char name[24];
|
||||
CAnimBlendSequence *sequences;
|
||||
int16 numSequences;
|
||||
float totalLength;
|
||||
|
||||
CAnimBlendHierarchy(void);
|
||||
void Shutdown(void);
|
||||
void SetName(char *name);
|
||||
void CalcTotalTime(void);
|
||||
void RemoveQuaternionFlips(void);
|
||||
void RemoveAnimSequences(void);
|
||||
void Uncompress(void);
|
||||
void RemoveUncompressedData(void);
|
||||
void MoveMemory(bool onlyone = false);
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CAnimBlendHierarchy, 0x28);
|
||||
28
miami/animation/AnimBlendList.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
// name made up
|
||||
class CAnimBlendLink
|
||||
{
|
||||
public:
|
||||
CAnimBlendLink *next;
|
||||
CAnimBlendLink *prev;
|
||||
|
||||
void Init(void){
|
||||
next = nil;
|
||||
prev = nil;
|
||||
}
|
||||
void Prepend(CAnimBlendLink *link){
|
||||
if(next)
|
||||
next->prev = link;
|
||||
link->next = next;
|
||||
link->prev = this;
|
||||
next = link;
|
||||
}
|
||||
void Remove(void){
|
||||
if(prev)
|
||||
prev->next = next;
|
||||
if(next)
|
||||
next->prev = prev;
|
||||
Init();
|
||||
}
|
||||
};
|
||||
205
miami/animation/AnimBlendNode.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "AnimBlendNode.h"
|
||||
|
||||
void
|
||||
CAnimBlendNode::Init(void)
|
||||
{
|
||||
frameA = -1;
|
||||
frameB = -1;
|
||||
remainingTime = 0.0f;
|
||||
sequence = nil;
|
||||
association = nil;
|
||||
}
|
||||
|
||||
bool
|
||||
CAnimBlendNode::Update(CVector &trans, CQuaternion &rot, float weight)
|
||||
{
|
||||
bool looped = false;
|
||||
|
||||
trans = CVector(0.0f, 0.0f, 0.0f);
|
||||
rot = CQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
if(association->IsRunning()){
|
||||
remainingTime -= association->timeStep;
|
||||
if(remainingTime <= 0.0f)
|
||||
looped = NextKeyFrame();
|
||||
}
|
||||
|
||||
float blend = association->GetBlendAmount(weight);
|
||||
if(blend > 0.0f){
|
||||
float kfAdt = sequence->GetDeltaTime(frameA);
|
||||
float t = kfAdt == 0.0f ? 0.0f : (kfAdt - remainingTime)/kfAdt;
|
||||
if(sequence->type & CAnimBlendSequence::KF_TRANS){
|
||||
auto kfAt = sequence->GetTranslation(frameA);
|
||||
auto kfBt = sequence->GetTranslation(frameB);
|
||||
trans = kfBt + t*(kfAt - kfBt);
|
||||
trans *= blend;
|
||||
}
|
||||
if(sequence->type & CAnimBlendSequence::KF_ROT){
|
||||
auto kfAr = sequence->GetRotation(frameA);
|
||||
auto kfBr = sequence->GetRotation(frameB);
|
||||
rot.Slerp(kfBr, kfAr, theta, invSin, t);
|
||||
rot *= blend;
|
||||
}
|
||||
}
|
||||
|
||||
return looped;
|
||||
}
|
||||
|
||||
bool
|
||||
CAnimBlendNode::NextKeyFrame(void)
|
||||
{
|
||||
bool looped;
|
||||
|
||||
if(sequence->numFrames <= 1)
|
||||
return false;
|
||||
|
||||
looped = false;
|
||||
frameB = frameA;
|
||||
|
||||
// Advance as long as we have to
|
||||
while(remainingTime <= 0.0f){
|
||||
frameA++;
|
||||
|
||||
if(frameA >= sequence->numFrames){
|
||||
// reached end of animation
|
||||
if(!association->IsRepeating()){
|
||||
frameA--;
|
||||
remainingTime = 0.0f;
|
||||
return false;
|
||||
}
|
||||
looped = true;
|
||||
frameA = 0;
|
||||
}
|
||||
|
||||
remainingTime += sequence->GetDeltaTime(frameA);
|
||||
}
|
||||
|
||||
frameB = frameA - 1;
|
||||
if(frameB < 0)
|
||||
frameB += sequence->numFrames;
|
||||
|
||||
CalcDeltas();
|
||||
return looped;
|
||||
}
|
||||
|
||||
// bool
|
||||
// CAnimBlendNode::NextKeyFrameCompressed(void)
|
||||
// {
|
||||
// bool looped;
|
||||
|
||||
// if(sequence->numFrames <= 1)
|
||||
// return false;
|
||||
|
||||
// looped = false;
|
||||
// frameB = frameA;
|
||||
|
||||
// // Advance as long as we have to
|
||||
// while(remainingTime <= 0.0f){
|
||||
// frameA++;
|
||||
|
||||
// if(frameA >= sequence->numFrames){
|
||||
// // reached end of animation
|
||||
// if(!association->IsRepeating()){
|
||||
// frameA--;
|
||||
// remainingTime = 0.0f;
|
||||
// return false;
|
||||
// }
|
||||
// looped = true;
|
||||
// frameA = 0;
|
||||
// }
|
||||
|
||||
// remainingTime += sequence->GetKeyFrameCompressed(frameA)->GetDeltaTime();
|
||||
// }
|
||||
|
||||
// frameB = frameA - 1;
|
||||
// if(frameB < 0)
|
||||
// frameB += sequence->numFrames;
|
||||
|
||||
// CalcDeltasCompressed();
|
||||
// return looped;
|
||||
// }
|
||||
|
||||
// Set animation to time t
|
||||
bool
|
||||
CAnimBlendNode::FindKeyFrame(float t)
|
||||
{
|
||||
if(sequence->numFrames < 1)
|
||||
return false;
|
||||
|
||||
frameA = 0;
|
||||
frameB = frameA;
|
||||
|
||||
if(sequence->numFrames == 1){
|
||||
remainingTime = 0.0f;
|
||||
}else{
|
||||
// advance until t is between frameB and frameA
|
||||
while (t > sequence->GetDeltaTime(++frameA)) {
|
||||
t -= sequence->GetDeltaTime(frameA);
|
||||
if (frameA + 1 >= sequence->numFrames) {
|
||||
// reached end of animation
|
||||
if (!association->IsRepeating()) {
|
||||
CalcDeltas();
|
||||
remainingTime = 0.0f;
|
||||
return false;
|
||||
}
|
||||
frameA = 0;
|
||||
}
|
||||
frameB = frameA;
|
||||
}
|
||||
|
||||
remainingTime = sequence->GetDeltaTime(frameA) - t;
|
||||
}
|
||||
|
||||
CalcDeltas();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendNode::CalcDeltas(void)
|
||||
{
|
||||
if((sequence->type & CAnimBlendSequence::KF_ROT) == 0)
|
||||
return;
|
||||
auto kfAr = sequence->GetRotation(frameA);
|
||||
auto kfBr = sequence->GetRotation(frameB);
|
||||
float cos = DotProduct(kfAr, kfBr);
|
||||
if(cos > 1.0f)
|
||||
cos = 1.0f;
|
||||
theta = Acos(cos);
|
||||
invSin = theta == 0.0f ? 0.0f : 1.0f/Sin(theta);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendNode::GetCurrentTranslation(CVector &trans, float weight)
|
||||
{
|
||||
trans = CVector(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float blend = association->GetBlendAmount(weight);
|
||||
if(blend > 0.0f){
|
||||
auto kfAdt = sequence->GetDeltaTime(frameA);
|
||||
float t = kfAdt == 0.0f ? 0.0f : (kfAdt - remainingTime)/kfAdt;
|
||||
if(sequence->type & CAnimBlendSequence::KF_TRANS){
|
||||
auto kfAt = sequence->GetTranslation(frameA);
|
||||
auto kfBt = sequence->GetTranslation(frameB);
|
||||
trans = kfBt + t*(kfAt - kfBt);
|
||||
trans *= blend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CAnimBlendNode::GetEndTranslation(CVector &trans, float weight)
|
||||
{
|
||||
trans = CVector(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float blend = association->GetBlendAmount(weight);
|
||||
if(blend > 0.0f){
|
||||
if(sequence->type & CAnimBlendSequence::KF_TRANS){
|
||||
CVector pos = sequence->GetTranslation(sequence->numFrames-1);
|
||||
trans = pos * blend;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
miami/animation/AnimBlendNode.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "AnimBlendSequence.h"
|
||||
|
||||
class CAnimBlendAssociation;
|
||||
|
||||
// The interpolated state between two key frames in a sequence
|
||||
class CAnimBlendNode
|
||||
{
|
||||
public:
|
||||
// for slerp
|
||||
float theta; // angle between quaternions
|
||||
float invSin; // 1/Sin(theta)
|
||||
// indices into array in sequence
|
||||
int32 frameA; // next key frame
|
||||
int32 frameB; // previous key frame
|
||||
float remainingTime; // time until frames have to advance
|
||||
CAnimBlendSequence *sequence;
|
||||
CAnimBlendAssociation *association;
|
||||
|
||||
void Init(void);
|
||||
bool Update(CVector &trans, CQuaternion &rot, float weight);
|
||||
bool UpdateCompressed(CVector &trans, CQuaternion &rot, float weight);
|
||||
bool NextKeyFrame(void);
|
||||
bool NextKeyFrameCompressed(void);
|
||||
bool FindKeyFrame(float t);
|
||||
void CalcDeltas(void);
|
||||
void GetCurrentTranslation(CVector &trans, float weight);
|
||||
void GetEndTranslation(CVector &trans, float weight);
|
||||
};
|
||||
|
||||
|
||||
VALIDATE_SIZE(CAnimBlendNode, 0x1C);
|
||||
85
miami/animation/AnimBlendSequence.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "AnimBlendSequence.h"
|
||||
#include "MemoryHeap.h"
|
||||
|
||||
CAnimBlendSequence::CAnimBlendSequence(void)
|
||||
{
|
||||
type = 0;
|
||||
numFrames = 0;
|
||||
keyFrames = nil;
|
||||
boneTag = -1;
|
||||
}
|
||||
|
||||
CAnimBlendSequence::~CAnimBlendSequence(void)
|
||||
{
|
||||
if(keyFrames)
|
||||
RwFree(keyFrames);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendSequence::SetName(char *name)
|
||||
{
|
||||
strncpy(this->name, name, 24);
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendSequence::SetNumFrames(int numFrames, bool translation, bool compress)
|
||||
{
|
||||
int sz;
|
||||
|
||||
if(translation){
|
||||
type |= KF_ROT | KF_TRANS;
|
||||
if (compress) {
|
||||
type |= KF_COMPRESSED;
|
||||
sz = sizeof(KeyFrameTransCompressed);
|
||||
} else {
|
||||
sz = sizeof(KeyFrameTransUncompressed);
|
||||
}
|
||||
}else{
|
||||
sz = sizeof(KeyFrame);
|
||||
type |= KF_ROT;
|
||||
}
|
||||
keyFrames = RwMalloc(sz * numFrames);
|
||||
this->numFrames = numFrames;
|
||||
}
|
||||
|
||||
void
|
||||
CAnimBlendSequence::RemoveQuaternionFlips(void)
|
||||
{
|
||||
int i;
|
||||
CQuaternion last;
|
||||
|
||||
if(numFrames < 2)
|
||||
return;
|
||||
|
||||
last = GetRotation(0);
|
||||
for(i = 1; i < numFrames; i++){
|
||||
auto KFr = GetRotation(i);
|
||||
if(DotProduct(last, KFr) < 0.0f)
|
||||
SetRotation(i, -KFr);
|
||||
last = GetRotation(i);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CUSTOM_ALLOCATOR
|
||||
bool
|
||||
CAnimBlendSequence::MoveMemory(void)
|
||||
{
|
||||
if(keyFrames){
|
||||
void *newaddr = gMainHeap.MoveMemory(keyFrames);
|
||||
if(newaddr != keyFrames){
|
||||
keyFrames = newaddr;
|
||||
return true;
|
||||
}
|
||||
}else if(keyFramesCompressed){
|
||||
void *newaddr = gMainHeap.MoveMemory(keyFramesCompressed);
|
||||
if(newaddr != keyFramesCompressed){
|
||||
keyFramesCompressed = newaddr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
158
miami/animation/AnimBlendSequence.h
Normal file
@@ -0,0 +1,158 @@
|
||||
#pragma once
|
||||
|
||||
#include "Quaternion.h"
|
||||
|
||||
#ifdef MoveMemory
|
||||
#undef MoveMemory // windows shit
|
||||
#endif
|
||||
|
||||
// TODO: put them somewhere else?
|
||||
static int16 checked_f2i16(float f) {
|
||||
assert(f >= -32768 && f <= 32767);
|
||||
return f;
|
||||
}
|
||||
|
||||
static uint16 checked_f2u16(float f) {
|
||||
assert(f >= 0 && f <= 65535);
|
||||
return f;
|
||||
}
|
||||
|
||||
#define KF_MINDELTA (1/256.f)
|
||||
|
||||
struct KeyFrame {
|
||||
int16 rot[4]; // 4096
|
||||
uint16 dltTime; // 256
|
||||
|
||||
CQuaternion rotation_() {
|
||||
return { rot[0] * (1/4096.f), rot[1] * (1/4096.f), rot[2] * (1/4096.f), rot[3] * (1/4096.f) };
|
||||
}
|
||||
|
||||
void rotation_(const CQuaternion& q) {
|
||||
rot[0] = checked_f2i16(q.x * 4096.0f);
|
||||
rot[1] = checked_f2i16(q.y * 4096.0f);
|
||||
rot[2] = checked_f2i16(q.z * 4096.0f);
|
||||
rot[3] = checked_f2i16(q.w * 4096.0f);
|
||||
}
|
||||
|
||||
float deltaTime_() {
|
||||
return dltTime * (1/256.0f);
|
||||
}
|
||||
|
||||
void deltaTime_(float t) {
|
||||
dltTime = checked_f2u16(t * 256); // always round down
|
||||
}
|
||||
};
|
||||
|
||||
struct KeyFrameTransUncompressed : KeyFrame {
|
||||
// Some animations use bigger range, eg during the intro
|
||||
CVector trans;
|
||||
CVector translation_() {
|
||||
return trans;
|
||||
}
|
||||
|
||||
void translation_(const CVector &v) {
|
||||
trans = v;
|
||||
}
|
||||
};
|
||||
|
||||
struct KeyFrameTransCompressed : KeyFrame {
|
||||
int16 trans[3]; // 128
|
||||
|
||||
CVector translation_() {
|
||||
return { trans[0] * (1/128.f), trans[1] * (1/128.f), trans[2] * (1/128.f)};
|
||||
}
|
||||
|
||||
void translation_(const CVector &v) {
|
||||
trans[0] = checked_f2i16(v.x * 128.f);
|
||||
trans[1] = checked_f2i16(v.y * 128.f);
|
||||
trans[2] = checked_f2i16(v.z * 128.f);
|
||||
}
|
||||
};
|
||||
|
||||
// The sequence of key frames of one animated node
|
||||
class CAnimBlendSequence
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
KF_ROT = 1,
|
||||
KF_TRANS = 2,
|
||||
KF_COMPRESSED = 4, // only applicable for KF_TRANS
|
||||
};
|
||||
int32 type;
|
||||
char name[24];
|
||||
int32 numFrames;
|
||||
int16 boneTag;
|
||||
void *keyFrames;
|
||||
|
||||
CAnimBlendSequence(void);
|
||||
virtual ~CAnimBlendSequence(void);
|
||||
void SetName(char *name);
|
||||
void SetNumFrames(int numFrames, bool translation, bool compressed);
|
||||
void RemoveQuaternionFlips(void);
|
||||
|
||||
void SetTranslation(int n, const CVector &v) {
|
||||
if (type & KF_COMPRESSED) {
|
||||
((KeyFrameTransCompressed*)keyFrames)[n].translation_(v);
|
||||
} else if (type & KF_TRANS) {
|
||||
((KeyFrameTransUncompressed*)keyFrames)[n].translation_(v);
|
||||
} else {
|
||||
assert(false && "SetTranslation called on sequence without translation");
|
||||
}
|
||||
}
|
||||
|
||||
CVector GetTranslation(int n) {
|
||||
if (type & KF_COMPRESSED) {
|
||||
return ((KeyFrameTransCompressed*)keyFrames)[n].translation_();
|
||||
} else if (type & KF_TRANS) {
|
||||
return ((KeyFrameTransUncompressed*)keyFrames)[n].translation_();
|
||||
} else {
|
||||
assert(false && "GetTranslation called on sequence without translation");
|
||||
}
|
||||
}
|
||||
|
||||
void SetRotation(int n, const CQuaternion &q) {
|
||||
if (type & KF_COMPRESSED) {
|
||||
((KeyFrameTransCompressed*)keyFrames)[n].rotation_(q);
|
||||
} else if (type & KF_TRANS) {
|
||||
((KeyFrameTransUncompressed*)keyFrames)[n].rotation_(q);
|
||||
} else {
|
||||
((KeyFrame*)keyFrames)[n].rotation_(q);
|
||||
}
|
||||
}
|
||||
|
||||
CQuaternion GetRotation(int n) {
|
||||
if (type & KF_COMPRESSED) {
|
||||
return ((KeyFrameTransCompressed*)keyFrames)[n].rotation_();
|
||||
} else if (type & KF_TRANS) {
|
||||
return ((KeyFrameTransUncompressed*)keyFrames)[n].rotation_();
|
||||
} else {
|
||||
return ((KeyFrame*)keyFrames)[n].rotation_();
|
||||
}
|
||||
}
|
||||
|
||||
void SetDeltaTime(int n, float t) {
|
||||
if (type & KF_COMPRESSED) {
|
||||
((KeyFrameTransCompressed*)keyFrames)[n].deltaTime_(t);
|
||||
} else if (type & KF_TRANS) {
|
||||
((KeyFrameTransUncompressed*)keyFrames)[n].deltaTime_(t);
|
||||
} else {
|
||||
((KeyFrame*)keyFrames)[n].deltaTime_(t);
|
||||
}
|
||||
}
|
||||
|
||||
float GetDeltaTime(int n) {
|
||||
if (type & KF_COMPRESSED) {
|
||||
return ((KeyFrameTransCompressed*)keyFrames)[n].deltaTime_();
|
||||
} else if (type & KF_TRANS) {
|
||||
return ((KeyFrameTransUncompressed*)keyFrames)[n].deltaTime_();
|
||||
} else {
|
||||
return ((KeyFrame*)keyFrames)[n].deltaTime_();
|
||||
}
|
||||
}
|
||||
|
||||
bool HasTranslation(void) { return !!(type & KF_TRANS); }
|
||||
bool MoveMemory(void);
|
||||
|
||||
void SetBoneTag(int tag) { boneTag = tag; }
|
||||
};
|
||||
VALIDATE_SIZE(CAnimBlendSequence, 0x30);
|
||||
1407
miami/animation/AnimManager.cpp
Normal file
143
miami/animation/AnimManager.h
Normal file
@@ -0,0 +1,143 @@
|
||||
#pragma once
|
||||
|
||||
#include "AnimBlendHierarchy.h"
|
||||
#include "AnimationId.h"
|
||||
|
||||
enum AssocGroupId
|
||||
{
|
||||
ASSOCGRP_STD,
|
||||
ASSOCGRP_VAN,
|
||||
ASSOCGRP_COACH,
|
||||
ASSOCGRP_BIKE_STANDARD,
|
||||
ASSOCGRP_BIKE_VESPA,
|
||||
ASSOCGRP_BIKE_HARLEY,
|
||||
ASSOCGRP_BIKE_DIRT,
|
||||
ASSOCGRP_UNARMED,
|
||||
ASSOCGRP_SCREWDRIVER,
|
||||
ASSOCGRP_KNIFE,
|
||||
ASSOCGRP_BASEBALLBAT,
|
||||
ASSOCGRP_GOLFCLUB,
|
||||
ASSOCGRP_CHAINSAW,
|
||||
ASSOCGRP_PYTHON,
|
||||
ASSOCGRP_COLT,
|
||||
ASSOCGRP_SHOTGUN,
|
||||
ASSOCGRP_BUDDY,
|
||||
ASSOCGRP_TEC,
|
||||
ASSOCGRP_UZI,
|
||||
ASSOCGRP_RIFLE,
|
||||
ASSOCGRP_M60,
|
||||
ASSOCGRP_SNIPER,
|
||||
ASSOCGRP_THROW,
|
||||
ASSOCGRP_FLAMETHROWER,
|
||||
ASSOCGRP_MEDIC,
|
||||
ASSOCGRP_SUNBATHE,
|
||||
ASSOCGRP_PLAYER_IDLE,
|
||||
ASSOCGRP_RIOT,
|
||||
ASSOCGRP_STRIP,
|
||||
ASSOCGRP_LANCE,
|
||||
ASSOCGRP_PLAYER,
|
||||
ASSOCGRP_PLAYERROCKET,
|
||||
ASSOCGRP_PLAYER1ARMED,
|
||||
ASSOCGRP_PLAYER2ARMED,
|
||||
ASSOCGRP_PLAYERBBBAT,
|
||||
ASSOCGRP_PLAYERCHAINSAW,
|
||||
ASSOCGRP_SHUFFLE,
|
||||
ASSOCGRP_OLD,
|
||||
ASSOCGRP_GANG1,
|
||||
ASSOCGRP_GANG2,
|
||||
ASSOCGRP_FAT,
|
||||
ASSOCGRP_OLDFAT,
|
||||
ASSOCGRP_JOGGER,
|
||||
ASSOCGRP_WOMAN,
|
||||
ASSOCGRP_WOMANSHOP,
|
||||
ASSOCGRP_BUSYWOMAN,
|
||||
ASSOCGRP_SEXYWOMAN,
|
||||
ASSOCGRP_FATWOMAN,
|
||||
ASSOCGRP_OLDWOMAN,
|
||||
ASSOCGRP_JOGWOMAN,
|
||||
ASSOCGRP_PANICCHUNKY,
|
||||
ASSOCGRP_SKATE,
|
||||
#ifdef PC_PLAYER_CONTROLS
|
||||
ASSOCGRP_PLAYERBACK,
|
||||
ASSOCGRP_PLAYERLEFT,
|
||||
ASSOCGRP_PLAYERRIGHT,
|
||||
ASSOCGRP_ROCKETBACK,
|
||||
ASSOCGRP_ROCKETLEFT,
|
||||
ASSOCGRP_ROCKETRIGHT,
|
||||
ASSOCGRP_CHAINSAWBACK,
|
||||
ASSOCGRP_CHAINSAWLEFT,
|
||||
ASSOCGRP_CHAINSAWRIGHT,
|
||||
#endif
|
||||
|
||||
NUM_ANIM_ASSOC_GROUPS
|
||||
};
|
||||
|
||||
class CAnimBlendAssociation;
|
||||
class CAnimBlendAssocGroup;
|
||||
|
||||
#define MAX_ANIMBLOCK_NAME 20
|
||||
|
||||
// A block of hierarchies
|
||||
struct CAnimBlock
|
||||
{
|
||||
char name[MAX_ANIMBLOCK_NAME];
|
||||
bool isLoaded;
|
||||
int16 refCount;
|
||||
int32 firstIndex; // first animtion in ms_aAnimations
|
||||
int32 numAnims;
|
||||
};
|
||||
|
||||
struct AnimAssocDesc
|
||||
{
|
||||
int32 animId;
|
||||
int32 flags;
|
||||
};
|
||||
|
||||
struct AnimAssocDefinition
|
||||
{
|
||||
char const *name;
|
||||
char const *blockName;
|
||||
int32 modelIndex;
|
||||
int32 numAnims;
|
||||
char const **animNames;
|
||||
AnimAssocDesc *animDescs;
|
||||
};
|
||||
|
||||
class CAnimManager
|
||||
{
|
||||
static const AnimAssocDefinition ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS];
|
||||
static CAnimBlock ms_aAnimBlocks[NUMANIMBLOCKS];
|
||||
static CAnimBlendHierarchy ms_aAnimations[NUMANIMATIONS];
|
||||
static int32 ms_numAnimBlocks;
|
||||
static int32 ms_numAnimations;
|
||||
static CAnimBlendAssocGroup *ms_aAnimAssocGroups;
|
||||
static CLinkList<CAnimBlendHierarchy*> ms_animCache;
|
||||
public:
|
||||
|
||||
static void Initialise(void);
|
||||
static void Shutdown(void);
|
||||
static CAnimBlock *GetAnimationBlock(int32 block) { return &ms_aAnimBlocks[block]; }
|
||||
static CAnimBlock *GetAnimationBlock(const char *name);
|
||||
static int32 GetAnimationBlockIndex(const char *name);
|
||||
static int32 RegisterAnimBlock(const char *name);
|
||||
static int32 GetNumRefsToAnimBlock(int32 block);
|
||||
static void AddAnimBlockRef(int32 block);
|
||||
static void RemoveAnimBlockRefWithoutDelete(int32 block);
|
||||
static void RemoveAnimBlockRef(int32 block);
|
||||
static void RemoveAnimBlock(int32 block);
|
||||
static CAnimBlendHierarchy *GetAnimation(const char *name, CAnimBlock *animBlock);
|
||||
static CAnimBlendHierarchy *GetAnimation(int32 n) { return &ms_aAnimations[n]; }
|
||||
static const char *GetAnimGroupName(AssocGroupId groupId);
|
||||
static CAnimBlendAssociation *CreateAnimAssociation(AssocGroupId groupId, AnimationId animId);
|
||||
static CAnimBlendAssociation *GetAnimAssociation(AssocGroupId groupId, AnimationId animId);
|
||||
static CAnimBlendAssociation *GetAnimAssociation(AssocGroupId groupId, const char *name);
|
||||
static CAnimBlendAssociation *AddAnimation(RpClump *clump, AssocGroupId groupId, AnimationId animId);
|
||||
static CAnimBlendAssociation *AddAnimationAndSync(RpClump *clump, CAnimBlendAssociation *syncanim, AssocGroupId groupId, AnimationId animId);
|
||||
static CAnimBlendAssociation *BlendAnimation(RpClump *clump, AssocGroupId groupId, AnimationId animId, float delta);
|
||||
static void LoadAnimFiles(void);
|
||||
static void LoadAnimFile(const char *filename);
|
||||
static void LoadAnimFile(RwStream *stream, bool compress, char (*uncompressedAnims)[32] = nil);
|
||||
static void CreateAnimAssocGroups(void);
|
||||
static void RemoveLastAnimFile(void);
|
||||
static CAnimBlendAssocGroup* GetAnimAssocGroups(void) { return ms_aAnimAssocGroups; }
|
||||
};
|
||||
287
miami/animation/AnimationId.h
Normal file
@@ -0,0 +1,287 @@
|
||||
#pragma once
|
||||
|
||||
enum AnimationId
|
||||
{
|
||||
ANIM_STD_WALK,
|
||||
ANIM_STD_RUN,
|
||||
ANIM_STD_RUNFAST,
|
||||
ANIM_STD_IDLE,
|
||||
ANIM_STD_STARTWALK,
|
||||
ANIM_STD_RUNSTOP1,
|
||||
ANIM_STD_RUNSTOP2,
|
||||
ANIM_STD_IDLE_CAM,
|
||||
ANIM_STD_IDLE_HBHB,
|
||||
ANIM_STD_IDLE_TIRED,
|
||||
ANIM_STD_IDLE_BIGGUN,
|
||||
ANIM_STD_CHAT,
|
||||
ANIM_STD_HAILTAXI,
|
||||
ANIM_STD_KO_FRONT,
|
||||
ANIM_STD_KO_LEFT,
|
||||
ANIM_STD_KO_BACK,
|
||||
ANIM_STD_KO_RIGHT,
|
||||
ANIM_STD_KO_SHOT_FACE,
|
||||
ANIM_STD_KO_SHOT_STOMACH,
|
||||
ANIM_STD_KO_SHOT_ARM_L,
|
||||
ANIM_STD_KO_SHOT_ARM_R,
|
||||
ANIM_STD_KO_SHOT_LEG_L,
|
||||
ANIM_STD_KO_SHOT_LEG_R,
|
||||
ANIM_STD_SPINFORWARD_LEFT,
|
||||
ANIM_STD_SPINFORWARD_RIGHT,
|
||||
ANIM_STD_HIGHIMPACT_FRONT,
|
||||
ANIM_STD_HIGHIMPACT_LEFT,
|
||||
ANIM_STD_HIGHIMPACT_BACK,
|
||||
ANIM_STD_HIGHIMPACT_RIGHT,
|
||||
ANIM_STD_HITBYGUN_FRONT,
|
||||
ANIM_STD_HITBYGUN_LEFT,
|
||||
ANIM_STD_HITBYGUN_BACK,
|
||||
ANIM_STD_HITBYGUN_RIGHT,
|
||||
ANIM_STD_HIT_FRONT,
|
||||
ANIM_STD_HIT_LEFT,
|
||||
ANIM_STD_HIT_BACK,
|
||||
ANIM_STD_HIT_RIGHT,
|
||||
ANIM_STD_HIT_FLOOR,
|
||||
|
||||
/* names made up */
|
||||
ANIM_STD_HIT_BODYBLOW,
|
||||
ANIM_STD_HIT_CHEST,
|
||||
ANIM_STD_HIT_HEAD,
|
||||
ANIM_STD_HIT_WALK,
|
||||
/**/
|
||||
|
||||
ANIM_STD_HIT_WALL,
|
||||
ANIM_STD_HIT_FLOOR_FRONT,
|
||||
ANIM_STD_HIT_BEHIND,
|
||||
ANIM_STD_FIGHT_IDLE,
|
||||
ANIM_STD_FIGHT_2IDLE,
|
||||
ANIM_STD_FIGHT_SHUFFLE_F,
|
||||
|
||||
/* names made up */
|
||||
ANIM_STD_FIGHT_BODYBLOW,
|
||||
ANIM_STD_FIGHT_HEAD,
|
||||
ANIM_STD_FIGHT_KICK,
|
||||
ANIM_STD_FIGHT_KNEE,
|
||||
ANIM_STD_FIGHT_LHOOK,
|
||||
ANIM_STD_FIGHT_PUNCH,
|
||||
ANIM_STD_FIGHT_ROUNDHOUSE,
|
||||
ANIM_STD_FIGHT_LONGKICK,
|
||||
/**/
|
||||
|
||||
ANIM_STD_PARTIAL_PUNCH,
|
||||
|
||||
/* names made up */
|
||||
ANIM_STD_FIGHT_JAB,
|
||||
ANIM_STD_FIGHT_ELBOW_L,
|
||||
ANIM_STD_FIGHT_ELBOW_R,
|
||||
ANIM_STD_FIGHT_BKICK_L,
|
||||
ANIM_STD_FIGHT_BKICK_R,
|
||||
/**/
|
||||
|
||||
ANIM_STD_DETONATE,
|
||||
ANIM_STD_PUNCH,
|
||||
ANIM_STD_PARTIALPUNCH,
|
||||
ANIM_STD_KICKGROUND,
|
||||
|
||||
ANIM_STD_THROW_UNDER,
|
||||
ANIM_STD_FIGHT_SHUFFLE_B,
|
||||
|
||||
ANIM_STD_JACKEDCAR_RHS,
|
||||
ANIM_STD_JACKEDCAR_LO_RHS,
|
||||
ANIM_STD_JACKEDCAR_LHS,
|
||||
ANIM_STD_JACKEDCAR_LO_LHS,
|
||||
ANIM_STD_QUICKJACK,
|
||||
ANIM_STD_QUICKJACKED,
|
||||
ANIM_STD_CAR_ALIGN_DOOR_LHS,
|
||||
ANIM_STD_CAR_ALIGNHI_DOOR_LHS,
|
||||
ANIM_STD_CAR_OPEN_DOOR_LHS,
|
||||
ANIM_STD_CARDOOR_LOCKED_LHS,
|
||||
ANIM_STD_CAR_PULL_OUT_PED_LHS,
|
||||
ANIM_STD_CAR_PULL_OUT_PED_LO_LHS,
|
||||
ANIM_STD_CAR_GET_IN_LHS,
|
||||
ANIM_STD_CAR_GET_IN_LO_LHS,
|
||||
ANIM_STD_CAR_CLOSE_DOOR_LHS,
|
||||
ANIM_STD_CAR_CLOSE_DOOR_LO_LHS,
|
||||
ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LHS,
|
||||
ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LO_LHS,
|
||||
ANIM_STD_CAR_JUMP_IN_LO_LHS,
|
||||
ANIM_STD_GETOUT_LHS,
|
||||
ANIM_STD_GETOUT_LO_LHS,
|
||||
ANIM_STD_CAR_CLOSE_LHS,
|
||||
ANIM_STD_CAR_ALIGN_DOOR_RHS,
|
||||
ANIM_STD_CAR_ALIGNHI_DOOR_RHS,
|
||||
ANIM_STD_CAR_OPEN_DOOR_RHS,
|
||||
ANIM_STD_CARDOOR_LOCKED_RHS,
|
||||
ANIM_STD_CAR_PULL_OUT_PED_RHS,
|
||||
ANIM_STD_CAR_PULL_OUT_PED_LO_RHS,
|
||||
ANIM_STD_CAR_GET_IN_RHS,
|
||||
ANIM_STD_CAR_GET_IN_LO_RHS,
|
||||
ANIM_STD_CAR_CLOSE_DOOR_RHS,
|
||||
ANIM_STD_CAR_CLOSE_DOOR_LO_RHS,
|
||||
ANIM_STD_CAR_SHUFFLE_RHS,
|
||||
ANIM_STD_CAR_SHUFFLE_LO_RHS,
|
||||
ANIM_STD_CAR_SIT,
|
||||
ANIM_STD_CAR_SIT_LO,
|
||||
ANIM_STD_CAR_SIT_P,
|
||||
ANIM_STD_CAR_SIT_P_LO,
|
||||
ANIM_STD_CAR_DRIVE_LEFT,
|
||||
ANIM_STD_CAR_DRIVE_RIGHT,
|
||||
ANIM_STD_CAR_DRIVE_LEFT_LO,
|
||||
ANIM_STD_CAR_DRIVE_RIGHT_LO,
|
||||
ANIM_STD_CAR_DRIVEBY_LEFT,
|
||||
ANIM_STD_CAR_DRIVEBY_RIGHT,
|
||||
ANIM_STD_CAR_DRIVEBY_LEFT_LO,
|
||||
ANIM_STD_CAR_DRIVEBY_RIGHT_LO,
|
||||
ANIM_STD_CAR_LOOKBEHIND,
|
||||
ANIM_STD_BOAT_DRIVE,
|
||||
ANIM_STD_BOAT_DRIVE_LEFT,
|
||||
ANIM_STD_BOAT_DRIVE_RIGHT,
|
||||
ANIM_STD_BOAT_LOOKBEHIND,
|
||||
|
||||
ANIM_STD_BIKE_PICKUP_LHS,
|
||||
ANIM_STD_BIKE_PICKUP_RHS,
|
||||
ANIM_STD_BIKE_PULLUP_LHS,
|
||||
ANIM_STD_BIKE_PULLUP_RHS,
|
||||
ANIM_STD_BIKE_ELBOW_LHS,
|
||||
ANIM_STD_BIKE_ELBOW_RHS,
|
||||
ANIM_STD_BIKE_FALLOFF,
|
||||
ANIM_STD_BIKE_FALLBACK,
|
||||
|
||||
ANIM_STD_GETOUT_RHS,
|
||||
ANIM_STD_GETOUT_LO_RHS,
|
||||
ANIM_STD_CAR_CLOSE_RHS,
|
||||
ANIM_STD_CAR_HOOKERTALK,
|
||||
|
||||
ANIM_STD_TRAIN_GETIN,
|
||||
ANIM_STD_TRAIN_GETOUT,
|
||||
|
||||
ANIM_STD_CRAWLOUT_LHS,
|
||||
ANIM_STD_CRAWLOUT_RHS,
|
||||
ANIM_STD_ROLLOUT_LHS,
|
||||
ANIM_STD_ROLLOUT_RHS,
|
||||
|
||||
ANIM_STD_GET_UP,
|
||||
ANIM_STD_GET_UP_LEFT,
|
||||
ANIM_STD_GET_UP_RIGHT,
|
||||
ANIM_STD_GET_UP_FRONT,
|
||||
ANIM_STD_JUMP_LAUNCH,
|
||||
ANIM_STD_JUMP_GLIDE,
|
||||
ANIM_STD_JUMP_LAND,
|
||||
ANIM_STD_FALL,
|
||||
ANIM_STD_FALL_GLIDE,
|
||||
ANIM_STD_FALL_LAND,
|
||||
ANIM_STD_FALL_COLLAPSE,
|
||||
ANIM_STD_FALL_ONBACK,
|
||||
ANIM_STD_FALL_ONFRONT,
|
||||
|
||||
ANIM_STD_EVADE_STEP,
|
||||
ANIM_STD_EVADE_DIVE,
|
||||
ANIM_STD_XPRESS_SCRATCH,
|
||||
ANIM_STD_ROADCROSS,
|
||||
ANIM_STD_TURN180,
|
||||
ANIM_STD_ARREST,
|
||||
ANIM_STD_DROWN,
|
||||
ANIM_STD_DUCK_DOWN,
|
||||
ANIM_STD_DUCK_LOW,
|
||||
|
||||
ANIM_STD_DUCK_WEAPON,
|
||||
|
||||
ANIM_STD_RBLOCK_SHOOT,
|
||||
ANIM_STD_HANDSUP,
|
||||
ANIM_STD_HANDSCOWER,
|
||||
ANIM_STD_PARTIAL_FUCKU,
|
||||
ANIM_STD_PHONE_IN,
|
||||
ANIM_STD_PHONE_OUT,
|
||||
ANIM_STD_PHONE_TALK,
|
||||
|
||||
ANIM_STD_SEAT_DOWN,
|
||||
ANIM_STD_SEAT_UP,
|
||||
ANIM_STD_SEAT_IDLE,
|
||||
ANIM_STD_SEAT_RVRS,
|
||||
ANIM_STD_ATM,
|
||||
ANIM_STD_ABSEIL,
|
||||
|
||||
ANIM_STD_NUM,
|
||||
|
||||
ANIM_STD_VAN_OPEN_DOOR_REAR_LHS,
|
||||
ANIM_STD_VAN_GET_IN_REAR_LHS,
|
||||
ANIM_STD_VAN_CLOSE_DOOR_REAR_LHS,
|
||||
ANIM_STD_VAN_GET_OUT_REAR_LHS,
|
||||
ANIM_STD_VAN_OPEN_DOOR_REAR_RHS,
|
||||
ANIM_STD_VAN_GET_IN_REAR_RHS,
|
||||
ANIM_STD_VAN_CLOSE_DOOR_REAR_RHS,
|
||||
ANIM_STD_VAN_GET_OUT_REAR_RHS,
|
||||
|
||||
ANIM_STD_COACH_OPEN_LHS,
|
||||
ANIM_STD_COACH_OPEN_RHS,
|
||||
ANIM_STD_COACH_GET_IN_LHS,
|
||||
ANIM_STD_COACH_GET_IN_RHS,
|
||||
ANIM_STD_COACH_GET_OUT_LHS,
|
||||
|
||||
ANIM_BIKE_RIDE,
|
||||
ANIM_BIKE_READY,
|
||||
ANIM_BIKE_LEFT,
|
||||
ANIM_BIKE_RIGHT,
|
||||
ANIM_BIKE_LEANB,
|
||||
ANIM_BIKE_LEANF,
|
||||
ANIM_BIKE_WALKBACK,
|
||||
ANIM_BIKE_JUMPON_LHS,
|
||||
ANIM_BIKE_JUMPON_RHS,
|
||||
ANIM_BIKE_KICK,
|
||||
ANIM_BIKE_HIT,
|
||||
ANIM_BIKE_GETOFF_LHS,
|
||||
ANIM_BIKE_GETOFF_RHS,
|
||||
ANIM_BIKE_GETOFF_BACK,
|
||||
ANIM_BIKE_DRIVEBY_LHS,
|
||||
ANIM_BIKE_DRIVEBY_RHS,
|
||||
ANIM_BIKE_DRIVEBY_FORWARD,
|
||||
ANIM_BIKE_RIDE_P,
|
||||
|
||||
ANIM_ATTACK_1,
|
||||
ANIM_ATTACK_2,
|
||||
ANIM_ATTACK_EXTRA1,
|
||||
ANIM_ATTACK_EXTRA2,
|
||||
ANIM_ATTACK_3,
|
||||
|
||||
// our synonyms... because originals are hard to understand
|
||||
ANIM_WEAPON_FIRE = ANIM_ATTACK_1,
|
||||
ANIM_WEAPON_CROUCHFIRE,
|
||||
ANIM_WEAPON_FIRE_2ND = ANIM_WEAPON_CROUCHFIRE,
|
||||
ANIM_WEAPON_RELOAD,
|
||||
ANIM_WEAPON_CROUCHRELOAD,
|
||||
ANIM_WEAPON_FIRE_3RD,
|
||||
ANIM_THROWABLE_THROW = ANIM_ATTACK_1,
|
||||
ANIM_THROWABLE_THROWU,
|
||||
ANIM_THROWABLE_START_THROW,
|
||||
ANIM_MELEE_ATTACK = ANIM_ATTACK_1,
|
||||
ANIM_MELEE_ATTACK_2ND,
|
||||
ANIM_MELEE_ATTACK_START,
|
||||
ANIM_MELEE_IDLE_FIGHTMODE,
|
||||
ANIM_MELEE_ATTACK_FINISH,
|
||||
|
||||
ANIM_SUNBATHE_IDLE,
|
||||
ANIM_SUNBATHE_DOWN,
|
||||
ANIM_SUNBATHE_UP,
|
||||
ANIM_SUNBATHE_ESCAPE,
|
||||
|
||||
ANIM_MEDIC_CPR,
|
||||
|
||||
ANIM_PLAYER_IDLE1,
|
||||
ANIM_PLAYER_IDLE2,
|
||||
ANIM_PLAYER_IDLE3,
|
||||
ANIM_PLAYER_IDLE4,
|
||||
|
||||
ANIM_RIOT_ANGRY,
|
||||
ANIM_RIOT_ANGRY_B,
|
||||
ANIM_RIOT_CHANT,
|
||||
ANIM_RIOT_PUNCHES,
|
||||
ANIM_RIOT_SHOUT,
|
||||
ANIM_RIOT_CHALLENGE,
|
||||
ANIM_RIOT_FUCKYOU,
|
||||
|
||||
ANIM_STRIP_A,
|
||||
ANIM_STRIP_B,
|
||||
ANIM_STRIP_C,
|
||||
ANIM_STRIP_D,
|
||||
ANIM_STRIP_E,
|
||||
ANIM_STRIP_F,
|
||||
ANIM_STRIP_G,
|
||||
};
|
||||
59
miami/animation/Bones.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "common.h"
|
||||
#include "PedModelInfo.h"
|
||||
#include "Bones.h"
|
||||
|
||||
int
|
||||
ConvertPedNode2BoneTag(int node)
|
||||
{
|
||||
switch(node){
|
||||
case PED_MID: return BONE_spine1;
|
||||
case PED_HEAD: return BONE_head;
|
||||
case PED_UPPERARML: return BONE_l_upperarm;
|
||||
case PED_UPPERARMR: return BONE_r_upperarm;
|
||||
case PED_HANDL: return BONE_l_hand;
|
||||
case PED_HANDR: return BONE_r_hand;
|
||||
case PED_UPPERLEGL: return BONE_l_thigh;
|
||||
case PED_UPPERLEGR: return BONE_r_thigh;
|
||||
case PED_FOOTL: return BONE_l_foot;
|
||||
case PED_FOOTR: return BONE_r_foot;
|
||||
case PED_LOWERLEGR: return BONE_r_calf;
|
||||
case PED_LOWERLEGL: return BONE_l_calf;
|
||||
case PED_FOREARML: return BONE_l_forearm;
|
||||
case PED_FOREARMR: return BONE_r_forearm;
|
||||
case PED_CLAVICLEL: return BONE_l_clavicle;
|
||||
case PED_CLAVICLER: return BONE_r_clavicle;
|
||||
case PED_NECK: return BONE_neck;
|
||||
}
|
||||
assert(0 && "this node has no bone");
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char*
|
||||
ConvertBoneTag2BoneName(int tag)
|
||||
{
|
||||
switch(tag){
|
||||
case BONE_root: return "Root";
|
||||
case BONE_pelvis: return "Pelvis";
|
||||
case BONE_spine: return "Spine";
|
||||
case BONE_spine1: return "Spine1";
|
||||
case BONE_neck: return "Neck";
|
||||
case BONE_head: return "Head";
|
||||
case BONE_r_clavicle: return "Bip01 R Clavicle";
|
||||
case BONE_r_upperarm: return "R UpperArm";
|
||||
case BONE_r_forearm: return "R Forearm";
|
||||
case BONE_r_hand: return "R Hand";
|
||||
case BONE_r_finger: return "R Fingers";
|
||||
case BONE_l_clavicle: return "Bip01 L Clavicle";
|
||||
case BONE_l_upperarm: return "L UpperArm";
|
||||
case BONE_l_forearm: return "L Forearm";
|
||||
case BONE_l_hand: return "L Hand";
|
||||
case BONE_l_finger: return "L Fingers";
|
||||
case BONE_l_thigh: return "L Thigh";
|
||||
case BONE_l_calf: return "L Calf";
|
||||
case BONE_l_foot: return "L Foot";
|
||||
case BONE_r_thigh: return "R Thigh";
|
||||
case BONE_r_calf: return "R Calf";
|
||||
case BONE_r_foot: return "R Foot";
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
30
miami/animation/Bones.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
enum BoneTag
|
||||
{
|
||||
BONE_root = 0,
|
||||
BONE_pelvis = 1,
|
||||
BONE_spine = 2,
|
||||
BONE_spine1 = 3,
|
||||
BONE_neck = 4,
|
||||
BONE_head = 5,
|
||||
BONE_l_clavicle = 31,
|
||||
BONE_l_upperarm = 32,
|
||||
BONE_l_forearm = 33,
|
||||
BONE_l_hand = 34,
|
||||
BONE_l_finger = 35,
|
||||
BONE_r_clavicle = 21,
|
||||
BONE_r_upperarm = 22,
|
||||
BONE_r_forearm = 23,
|
||||
BONE_r_hand = 24,
|
||||
BONE_r_finger = 25,
|
||||
BONE_l_thigh = 41,
|
||||
BONE_l_calf = 42,
|
||||
BONE_l_foot = 43,
|
||||
BONE_r_thigh = 51,
|
||||
BONE_r_calf = 52,
|
||||
BONE_r_foot = 53,
|
||||
};
|
||||
|
||||
int ConvertPedNode2BoneTag(int node);
|
||||
const char *ConvertBoneTag2BoneName(int tag);
|
||||
669
miami/animation/CutsceneMgr.cpp
Normal file
@@ -0,0 +1,669 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "General.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "Directory.h"
|
||||
#include "Camera.h"
|
||||
#include "Streaming.h"
|
||||
#include "FileMgr.h"
|
||||
#include "main.h"
|
||||
#include "AnimManager.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "AnimBlendAssocGroup.h"
|
||||
#include "AnimBlendClumpData.h"
|
||||
#include "Pad.h"
|
||||
#include "DMAudio.h"
|
||||
#include "World.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Wanted.h"
|
||||
#include "RpAnimBlend.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "TempColModels.h"
|
||||
#include "ColStore.h"
|
||||
#include "Radar.h"
|
||||
#include "Pools.h"
|
||||
|
||||
const struct {
|
||||
const char *szTrackName;
|
||||
int iTrackId;
|
||||
} musicNameIdAssoc[] = {
|
||||
{ "ASS_1", STREAMED_SOUND_CUTSCENE_ASS_1 },
|
||||
{ "ASS_2", STREAMED_SOUND_CUTSCENE_ASS_2 },
|
||||
{ "BANK_1", STREAMED_SOUND_CUTSCENE_BANK_1 },
|
||||
{ "BANK_2A", STREAMED_SOUND_CUTSCENE_BANK_2A },
|
||||
{ "BANK_2B", STREAMED_SOUND_CUTSCENE_BANK_2B },
|
||||
{ "BANK_3A", STREAMED_SOUND_CUTSCENE_BANK_3A },
|
||||
{ "BANK_3B", STREAMED_SOUND_CUTSCENE_BANK_3B },
|
||||
{ "BANK_4", STREAMED_SOUND_CUTSCENE_BANK_4 },
|
||||
{ "BIKE_1", STREAMED_SOUND_CUTSCENE_BIKE_1 },
|
||||
{ "BIKE_2", STREAMED_SOUND_CUTSCENE_BIKE_2 },
|
||||
{ "BIKE_3", STREAMED_SOUND_CUTSCENE_BIKE_3 },
|
||||
{ "BUD_1", STREAMED_SOUND_CUTSCENE_BUD_1 },
|
||||
{ "BUD_2", STREAMED_SOUND_CUTSCENE_BUD_2 },
|
||||
{ "BUD_3", STREAMED_SOUND_CUTSCENE_BUD_3 },
|
||||
{ "CAP_1", STREAMED_SOUND_CUTSCENE_CAP_1 },
|
||||
{ "CAR_1", STREAMED_SOUND_CUTSCENE_CAR_1 },
|
||||
{ "CNT_1A", STREAMED_SOUND_CUTSCENE_CNT_1A },
|
||||
{ "CNT_1B", STREAMED_SOUND_CUTSCENE_CNT_1B },
|
||||
{ "CNT_2", STREAMED_SOUND_CUTSCENE_CNT_2 },
|
||||
{ "COK_1", STREAMED_SOUND_CUTSCENE_COK_1 },
|
||||
{ "COK_2A", STREAMED_SOUND_CUTSCENE_COK_2A },
|
||||
{ "COK_2B", STREAMED_SOUND_CUTSCENE_COK_2B },
|
||||
{ "COK_3", STREAMED_SOUND_CUTSCENE_COK_3 },
|
||||
{ "COK_4A", STREAMED_SOUND_CUTSCENE_COK_4A },
|
||||
{ "COK_4A2", STREAMED_SOUND_CUTSCENE_COK_4A2 },
|
||||
{ "COK_4B", STREAMED_SOUND_CUTSCENE_COK_4B },
|
||||
{ "COL_1", STREAMED_SOUND_CUTSCENE_COL_1 },
|
||||
{ "COL_2", STREAMED_SOUND_CUTSCENE_COL_2 },
|
||||
{ "COL_3A", STREAMED_SOUND_CUTSCENE_COL_3A },
|
||||
{ "COL_4A", STREAMED_SOUND_CUTSCENE_COL_4A },
|
||||
{ "COL_5A", STREAMED_SOUND_CUTSCENE_COL_5A },
|
||||
{ "COL_5B", STREAMED_SOUND_CUTSCENE_COL_5B },
|
||||
{ "CUB_1", STREAMED_SOUND_CUTSCENE_CUB_1 },
|
||||
{ "CUB_2", STREAMED_SOUND_CUTSCENE_CUB_2 },
|
||||
{ "CUB_3", STREAMED_SOUND_CUTSCENE_CUB_3 },
|
||||
{ "CUB_4", STREAMED_SOUND_CUTSCENE_CUB_4 },
|
||||
{ "DRUG_1", STREAMED_SOUND_CUTSCENE_DRUG_1 },
|
||||
{ "FIN", STREAMED_SOUND_CUTSCENE_FIN },
|
||||
{ "FIN_2", STREAMED_SOUND_CUTSCENE_FIN2 },
|
||||
{ "FINALE", STREAMED_SOUND_CUTSCENE_FINALE },
|
||||
{ "HAT_1", STREAMED_SOUND_CUTSCENE_HAT_1 },
|
||||
{ "HAT_2", STREAMED_SOUND_CUTSCENE_HAT_2 },
|
||||
{ "HAT_3", STREAMED_SOUND_CUTSCENE_HAT_3 },
|
||||
{ "ICE_1", STREAMED_SOUND_CUTSCENE_ICE_1 },
|
||||
{ "INT_A", STREAMED_SOUND_CUTSCENE_INT_A },
|
||||
{ "INT_B", STREAMED_SOUND_CUTSCENE_INT_B },
|
||||
{ "INT_D", STREAMED_SOUND_CUTSCENE_INT_D },
|
||||
{ "INT_M", STREAMED_SOUND_CUTSCENE_INT_M },
|
||||
{ "LAW_1A", STREAMED_SOUND_CUTSCENE_LAW_1A },
|
||||
{ "LAW_1B", STREAMED_SOUND_CUTSCENE_LAW_1B },
|
||||
{ "LAW_2A", STREAMED_SOUND_CUTSCENE_LAW_2A },
|
||||
{ "LAW_2B", STREAMED_SOUND_CUTSCENE_LAW_2B },
|
||||
{ "LAW_2C", STREAMED_SOUND_CUTSCENE_LAW_2C },
|
||||
{ "LAW_3", STREAMED_SOUND_CUTSCENE_LAW_3 },
|
||||
{ "LAW_4", STREAMED_SOUND_CUTSCENE_LAW_4 },
|
||||
{ "PHIL_1", STREAMED_SOUND_CUTSCENE_PHIL_1 },
|
||||
{ "PHIL_2", STREAMED_SOUND_CUTSCENE_PHIL_2 },
|
||||
{ "PORN_1", STREAMED_SOUND_CUTSCENE_PORN_1 },
|
||||
{ "PORN_2", STREAMED_SOUND_CUTSCENE_PORN_2 },
|
||||
{ "PORN_3", STREAMED_SOUND_CUTSCENE_PORN_3 },
|
||||
{ "PORN_4", STREAMED_SOUND_CUTSCENE_PORN_4 },
|
||||
{ "RESC_1A", STREAMED_SOUND_CUTSCENE_RESC_1A },
|
||||
{ "ROK_1", STREAMED_SOUND_CUTSCENE_ROK_1 },
|
||||
{ "ROK_2", STREAMED_SOUND_CUTSCENE_ROK_2 },
|
||||
{ "ROK_3A", STREAMED_SOUND_CUTSCENE_ROK_3A },
|
||||
{ "STRIPA", STREAMED_SOUND_CUTSCENE_STRIPA },
|
||||
{ "TAX_1", STREAMED_SOUND_CUTSCENE_TAX_1 },
|
||||
{ "TEX_1", STREAMED_SOUND_CUTSCENE_TEX_1 },
|
||||
{ "TEX_2", STREAMED_SOUND_CUTSCENE_TEX_2 },
|
||||
{ "TEX_3", STREAMED_SOUND_CUTSCENE_TEX_3 },
|
||||
{ "GSPOT", STREAMED_SOUND_CUTSCENE_GLIGHT },
|
||||
{ "FIST", STREAMED_SOUND_CUTSCENE_FIST },
|
||||
{ "EL_PH1", STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 },
|
||||
{ "EL_PH2", STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
FindCutsceneAudioTrackId(const char *szCutsceneName)
|
||||
{
|
||||
for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
|
||||
if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName))
|
||||
return musicNameIdAssoc[i].iTrackId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CCutsceneMgr::ms_running;
|
||||
bool CCutsceneMgr::ms_cutsceneProcessing;
|
||||
CDirectory *CCutsceneMgr::ms_pCutsceneDir;
|
||||
CCutsceneObject *CCutsceneMgr::ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
|
||||
int32 CCutsceneMgr::ms_numCutsceneObjs;
|
||||
bool CCutsceneMgr::ms_loaded;
|
||||
bool CCutsceneMgr::ms_animLoaded;
|
||||
bool CCutsceneMgr::ms_useLodMultiplier;
|
||||
char CCutsceneMgr::ms_cutsceneName[CUTSCENENAMESIZE];
|
||||
CAnimBlendAssocGroup CCutsceneMgr::ms_cutsceneAssociations;
|
||||
CVector CCutsceneMgr::ms_cutsceneOffset;
|
||||
float CCutsceneMgr::ms_cutsceneTimer;
|
||||
bool CCutsceneMgr::ms_wasCutsceneSkipped;
|
||||
uint32 CCutsceneMgr::ms_cutsceneLoadStatus;
|
||||
bool CCutsceneMgr::ms_useCutsceneShadows = true;
|
||||
|
||||
bool bCamLoaded;
|
||||
bool bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver; // pls don't shrink the name :P
|
||||
int32 NumberOfSavedWeapons;
|
||||
eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
|
||||
int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
|
||||
char uncompressedAnims[8][32];
|
||||
uint32 numUncompressedAnims;
|
||||
|
||||
|
||||
RpAtomic *
|
||||
CalculateBoundingSphereRadiusCB(RpAtomic *atomic, void *data)
|
||||
{
|
||||
float radius = RpAtomicGetBoundingSphere(atomic)->radius;
|
||||
RwV3d center = RpAtomicGetBoundingSphere(atomic)->center;
|
||||
|
||||
for (RwFrame *frame = RpAtomicGetFrame(atomic); RwFrameGetParent(frame); frame = RwFrameGetParent(frame))
|
||||
RwV3dTransformPoints(¢er, ¢er, 1, RwFrameGetMatrix(frame));
|
||||
|
||||
float size = RwV3dLength(¢er) + radius;
|
||||
if (size > *(float *)data)
|
||||
*(float *)data = size;
|
||||
return atomic;
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::Initialise(void)
|
||||
{
|
||||
ms_numCutsceneObjs = 0;
|
||||
ms_loaded = false;
|
||||
ms_wasCutsceneSkipped = false;
|
||||
ms_running = false;
|
||||
ms_useLodMultiplier = false;
|
||||
ms_animLoaded = false;
|
||||
ms_cutsceneProcessing = false;
|
||||
|
||||
ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE);
|
||||
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
||||
|
||||
numUncompressedAnims = 0;
|
||||
uncompressedAnims[0][0] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::Shutdown(void)
|
||||
{
|
||||
delete ms_pCutsceneDir;
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||
{
|
||||
int file;
|
||||
uint32 size;
|
||||
uint32 offset;
|
||||
CPlayerPed *pPlayerPed;
|
||||
|
||||
ms_cutsceneProcessing = true;
|
||||
ms_wasCutsceneSkipped = false;
|
||||
CTimer::Suspend();
|
||||
if (!bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver)
|
||||
CStreaming::RemoveCurrentZonesModels();
|
||||
|
||||
ms_pCutsceneDir->numEntries = 0;
|
||||
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
||||
|
||||
CStreaming::RemoveUnusedModelsInLoadedList();
|
||||
CGame::DrasticTidyUpMemory(true);
|
||||
|
||||
strcpy(ms_cutsceneName, szCutsceneName);
|
||||
|
||||
RwStream *stream;
|
||||
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG");
|
||||
assert(stream);
|
||||
|
||||
// Load animations
|
||||
sprintf(gString, "%s.IFP", szCutsceneName);
|
||||
if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
|
||||
CStreaming::MakeSpaceFor(size << 11);
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
RwStreamSkip(stream, offset << 11);
|
||||
CAnimManager::LoadAnimFile(stream, true, uncompressedAnims);
|
||||
ms_cutsceneAssociations.CreateAssociations(szCutsceneName);
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
ms_animLoaded = true;
|
||||
} else {
|
||||
ms_animLoaded = false;
|
||||
}
|
||||
RwStreamClose(stream, nil);
|
||||
|
||||
// Load camera data
|
||||
file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb");
|
||||
sprintf(gString, "%s.DAT", szCutsceneName);
|
||||
if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
CFileMgr::Seek(file, offset << 11, SEEK_SET);
|
||||
TheCamera.LoadPathSplines(file);
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
bCamLoaded = true;
|
||||
} else {
|
||||
bCamLoaded = false;
|
||||
}
|
||||
|
||||
CFileMgr::CloseFile(file);
|
||||
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale")) {
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
|
||||
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
|
||||
if (trackId != -1) {
|
||||
printf("Start preload audio %s\n", szCutsceneName);
|
||||
DMAudio.PreloadCutSceneMusic(trackId);
|
||||
printf("End preload audio %s\n", szCutsceneName);
|
||||
}
|
||||
}
|
||||
|
||||
ms_cutsceneTimer = 0.0f;
|
||||
ms_loaded = true;
|
||||
ms_cutsceneOffset = CVector(0.0f, 0.0f, 0.0f);
|
||||
|
||||
pPlayerPed = FindPlayerPed();
|
||||
pPlayerPed->m_pWanted->ClearQdCrimes();
|
||||
pPlayerPed->bIsVisible = false;
|
||||
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
|
||||
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
|
||||
|
||||
CTimer::Resume();
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::FinishCutscene()
|
||||
{
|
||||
ms_wasCutsceneSkipped = true;
|
||||
if (bCamLoaded) {
|
||||
CCutsceneMgr::ms_cutsceneTimer = TheCamera.GetCutSceneFinishTime() * 0.001f;
|
||||
TheCamera.FinishCutscene();
|
||||
}
|
||||
|
||||
FindPlayerPed()->bIsVisible = true;
|
||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::SetupCutsceneToStart(void)
|
||||
{
|
||||
if (bCamLoaded) {
|
||||
TheCamera.SetCamCutSceneOffSet(ms_cutsceneOffset);
|
||||
TheCamera.TakeControlWithSpline(JUMP_CUT);
|
||||
TheCamera.SetWideScreenOn();
|
||||
}
|
||||
|
||||
ms_cutsceneOffset.z++;
|
||||
|
||||
for (int i = ms_numCutsceneObjs - 1; i >= 0; i--) {
|
||||
assert(RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP);
|
||||
if (CAnimBlendAssociation *pAnimBlendAssoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)ms_pCutsceneObjects[i]->m_rwObject)) {
|
||||
assert(pAnimBlendAssoc->hierarchy->sequences[0].HasTranslation());
|
||||
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil) {
|
||||
pAnimBlendAssoc->flags &= (~ASSOC_HAS_TRANSLATION);
|
||||
} else {
|
||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + pAnimBlendAssoc->hierarchy->sequences[0].GetTranslation(0));
|
||||
}
|
||||
pAnimBlendAssoc->SetRun();
|
||||
} else {
|
||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset);
|
||||
}
|
||||
CWorld::Add(ms_pCutsceneObjects[i]);
|
||||
if (RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP) {
|
||||
ms_pCutsceneObjects[i]->UpdateRpHAnim();
|
||||
}
|
||||
}
|
||||
|
||||
CTimer::Update();
|
||||
CTimer::Update();
|
||||
ms_running = true;
|
||||
ms_cutsceneTimer = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject)
|
||||
{
|
||||
CAnimBlendAssociation *pNewAnim;
|
||||
CAnimBlendClumpData *pAnimBlendClumpData;
|
||||
|
||||
assert(RwObjectGetType(pObject->m_rwObject) == rpCLUMP);
|
||||
debug("Give cutscene anim %s\n", animName);
|
||||
RpAnimBlendClumpRemoveAllAssociations((RpClump*)pObject->m_rwObject);
|
||||
|
||||
pNewAnim = ms_cutsceneAssociations.GetAnimation(animName);
|
||||
if (!pNewAnim) {
|
||||
debug("\n\nHaven't I told you I can't find the fucking animation %s\n\n\n", animName);
|
||||
return;
|
||||
}
|
||||
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
pNewAnim = ms_cutsceneAssociations.CopyAnimation(animName);
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
|
||||
pNewAnim->SetCurrentTime(0.0f);
|
||||
pNewAnim->flags |= ASSOC_HAS_TRANSLATION;
|
||||
pNewAnim->flags &= ~ASSOC_RUNNING;
|
||||
|
||||
pAnimBlendClumpData = *RPANIMBLENDCLUMPDATA(pObject->m_rwObject);
|
||||
pAnimBlendClumpData->link.Prepend(&pNewAnim->link);
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::SetCutsceneAnimToLoop(const char* animName)
|
||||
{
|
||||
ms_cutsceneAssociations.GetAnimation(animName)->flags |= ASSOC_REPEAT;
|
||||
}
|
||||
|
||||
CCutsceneHead *
|
||||
CCutsceneMgr::AddCutsceneHead(CObject *pObject, int modelId)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
void UpdateCutsceneObjectBoundingBox(RpClump* clump, int modelId)
|
||||
{
|
||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
|
||||
CColModel* pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
|
||||
float radius = 0.0f;
|
||||
RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
|
||||
pColModel->boundingSphere.radius = radius;
|
||||
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
|
||||
pColModel->boundingBox.max = CVector(radius, radius, radius);
|
||||
}
|
||||
}
|
||||
|
||||
CCutsceneObject *
|
||||
CCutsceneMgr::CreateCutsceneObject(int modelId)
|
||||
{
|
||||
CBaseModelInfo *pModelInfo;
|
||||
CColModel *pColModel;
|
||||
CCutsceneObject *pCutsceneObject;
|
||||
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
debug("Created cutscene object %s\n", CModelInfo::GetModelInfo(modelId)->GetModelName());
|
||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
|
||||
pModelInfo = CModelInfo::GetModelInfo(modelId);
|
||||
pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
|
||||
pModelInfo->SetColModel(pColModel);
|
||||
UpdateCutsceneObjectBoundingBox((RpClump*)pModelInfo->GetRwObject(), modelId);
|
||||
} else if (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21) {
|
||||
pModelInfo = CModelInfo::GetModelInfo(modelId);
|
||||
if (pModelInfo->GetColModel() == &CTempColModels::ms_colModelPed1) {
|
||||
CColModel *colModel = new CColModel();
|
||||
colModel->boundingSphere.radius = 2.0f;
|
||||
colModel->boundingSphere.center = CVector(0.0f, 0.0f, 0.0f);
|
||||
pModelInfo->SetColModel(colModel, true);
|
||||
}
|
||||
pColModel = pModelInfo->GetColModel();
|
||||
float radius = 2.0f;
|
||||
pColModel->boundingSphere.radius = radius;
|
||||
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
|
||||
pColModel->boundingBox.max = CVector(radius, radius, radius);
|
||||
}
|
||||
|
||||
pCutsceneObject = new CCutsceneObject();
|
||||
pCutsceneObject->SetModelIndex(modelId);
|
||||
if (ms_useCutsceneShadows)
|
||||
pCutsceneObject->CreateShadow();
|
||||
ms_pCutsceneObjects[ms_numCutsceneObjs++] = pCutsceneObject;
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
return pCutsceneObject;
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::DeleteCutsceneData(void)
|
||||
{
|
||||
if (!ms_loaded) return;
|
||||
CTimer::Suspend();
|
||||
|
||||
ms_cutsceneProcessing = false;
|
||||
ms_useLodMultiplier = false;
|
||||
ms_useCutsceneShadows = true;
|
||||
|
||||
for (--ms_numCutsceneObjs; ms_numCutsceneObjs >= 0; ms_numCutsceneObjs--) {
|
||||
CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
|
||||
ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject();
|
||||
delete ms_pCutsceneObjects[ms_numCutsceneObjs];
|
||||
ms_pCutsceneObjects[ms_numCutsceneObjs] = nil;
|
||||
}
|
||||
ms_numCutsceneObjs = 0;
|
||||
|
||||
for (int i = MI_SPECIAL01; i < MI_SPECIAL21; i++) {
|
||||
CBaseModelInfo *minfo = CModelInfo::GetModelInfo(i);
|
||||
CColModel *colModel = minfo->GetColModel();
|
||||
if (colModel != &CTempColModels::ms_colModelPed1) {
|
||||
delete colModel;
|
||||
minfo->SetColModel(&CTempColModels::ms_colModelPed1);
|
||||
}
|
||||
}
|
||||
|
||||
if (ms_animLoaded)
|
||||
CAnimManager::RemoveLastAnimFile();
|
||||
|
||||
ms_animLoaded = false;
|
||||
numUncompressedAnims = 0;
|
||||
uncompressedAnims[0][0] = '\0';
|
||||
|
||||
if (bCamLoaded) {
|
||||
TheCamera.RestoreWithJumpCut();
|
||||
TheCamera.SetWideScreenOff();
|
||||
TheCamera.DeleteCutSceneCamDataMemory();
|
||||
}
|
||||
ms_running = false;
|
||||
ms_loaded = false;
|
||||
|
||||
FindPlayerPed()->bIsVisible = true;
|
||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
||||
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale")) {
|
||||
DMAudio.StopCutSceneMusic();
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||
}
|
||||
|
||||
CStreaming::ms_disableStreaming = false;
|
||||
CWorld::bProcessCutsceneOnly = false;
|
||||
|
||||
if(bCamLoaded)
|
||||
CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == FADE_2);
|
||||
|
||||
CPad::GetPad(0)->Clear(false);
|
||||
if (bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver) {
|
||||
CStreaming::LoadInitialPeds();
|
||||
CStreaming::LoadInitialWeapons();
|
||||
CStreaming::LoadInitialVehicles();
|
||||
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = false;
|
||||
|
||||
CPlayerPed *pPlayerPed = FindPlayerPed();
|
||||
for (int i = 0; i < NumberOfSavedWeapons; i++) {
|
||||
int32 weaponModelId = CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModelId;
|
||||
uint8 flags = CStreaming::ms_aInfoForModel[weaponModelId].m_flags;
|
||||
CStreaming::RequestModel(weaponModelId, STREAMFLAGS_DONT_REMOVE);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
if (CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id != -1) {
|
||||
CStreaming::RequestModel(CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id, 0);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
}
|
||||
if (!(flags & STREAMFLAGS_DONT_REMOVE))
|
||||
CStreaming::SetModelIsDeletable(weaponModelId);
|
||||
pPlayerPed->GiveWeapon(SavedWeaponIDs[i], SavedWeaponAmmo[i], true);
|
||||
}
|
||||
NumberOfSavedWeapons = 0;
|
||||
}
|
||||
|
||||
CTimer::Resume();
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::Update(void)
|
||||
{
|
||||
enum {
|
||||
CUTSCENE_LOADING_0 = 0,
|
||||
CUTSCENE_LOADING_AUDIO,
|
||||
CUTSCENE_LOADING_2,
|
||||
CUTSCENE_LOADING_3,
|
||||
CUTSCENE_LOADING_4
|
||||
};
|
||||
|
||||
switch (ms_cutsceneLoadStatus) {
|
||||
case CUTSCENE_LOADING_AUDIO:
|
||||
SetupCutsceneToStart();
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale"))
|
||||
DMAudio.PlayPreloadedCutSceneMusic();
|
||||
ms_cutsceneLoadStatus++;
|
||||
break;
|
||||
case CUTSCENE_LOADING_2:
|
||||
case CUTSCENE_LOADING_3:
|
||||
ms_cutsceneLoadStatus++;
|
||||
break;
|
||||
case CUTSCENE_LOADING_4:
|
||||
ms_cutsceneLoadStatus = CUTSCENE_LOADING_0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ms_running) return;
|
||||
|
||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
|
||||
|
||||
for (int i = 0; i < ms_numCutsceneObjs; i++) {
|
||||
int modelId = ms_pCutsceneObjects[i]->GetModelIndex();
|
||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05)
|
||||
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
|
||||
|
||||
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil && modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21)
|
||||
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
|
||||
}
|
||||
|
||||
if (bCamLoaded)
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
||||
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
||||
|| CPad::GetPad(0)->GetEnterJustDown()
|
||||
|| CPad::GetPad(0)->GetCharJustDown(' '))
|
||||
FinishCutscene();
|
||||
}
|
||||
}
|
||||
|
||||
bool CCutsceneMgr::HasCutsceneFinished(void) { return !bCamLoaded || TheCamera.GetPositionAlongSpline() == 1.0f; }
|
||||
|
||||
void
|
||||
CCutsceneMgr::LoadAnimationUncompressed(char const* name)
|
||||
{
|
||||
strcpy(uncompressedAnims[numUncompressedAnims], name);
|
||||
|
||||
// Because that's how CAnimManager knows the end of array
|
||||
++numUncompressedAnims;
|
||||
assert(numUncompressedAnims < ARRAY_SIZE(uncompressedAnims));
|
||||
uncompressedAnims[numUncompressedAnims][0] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::AttachObjectToParent(CObject *pObject, CEntity *pAttachTo)
|
||||
{
|
||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
|
||||
((CCutsceneObject*)pObject)->m_pAttachTo = RpClumpGetFrame(pAttachTo->GetClump());
|
||||
|
||||
debug("Attach %s to %s\n", CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(), CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame)
|
||||
{
|
||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
|
||||
((CCutsceneObject*)pObject)->m_pAttachTo = RpAnimBlendClumpFindFrame(pAttachTo->GetClump(), frame)->frame;
|
||||
debug("Attach %s to component %s of %s\n",
|
||||
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(),
|
||||
frame,
|
||||
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
|
||||
if (RwObjectGetType(pObject->m_rwObject) == rpCLUMP) {
|
||||
RpClump *clump = (RpClump*)pObject->m_rwObject;
|
||||
if (IsClumpSkinned(clump))
|
||||
RpAtomicGetBoundingSphere(GetFirstAtomic(clump))->radius *= 1.1f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int bone)
|
||||
{
|
||||
RpHAnimHierarchy *hanim = GetAnimHierarchyFromSkinClump(pAttachTo->GetClump());
|
||||
RwInt32 id = RpHAnimIDGetIndex(hanim, bone);
|
||||
RwMatrix *matrixArray = RpHAnimHierarchyGetMatrixArray(hanim);
|
||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = pAttachTo;
|
||||
((CCutsceneObject*)pObject)->m_pAttachTo = &matrixArray[id];
|
||||
debug("Attach %s to %s\n",
|
||||
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(),
|
||||
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
|
||||
{
|
||||
CStreaming::ms_disableStreaming = true;
|
||||
CColStore::RemoveAllCollision();
|
||||
CWorld::bProcessCutsceneOnly = true;
|
||||
ms_cutsceneProcessing = true;
|
||||
|
||||
for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CPed *pPed = CPools::GetPedPool()->GetSlot(i);
|
||||
if (pPed) {
|
||||
if (!pPed->IsPlayer() && pPed->CanBeDeleted()) {
|
||||
CWorld::Remove(pPed);
|
||||
delete pPed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = CPools::GetVehiclePool()->GetSize() - 1; i >= 0; i--) {
|
||||
CVehicle *pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (pVehicle) {
|
||||
if (pVehicle->CanBeDeleted()) {
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;
|
||||
CStreaming::RemoveCurrentZonesModels();
|
||||
CStreaming::SetModelIsDeletable(MI_MALE01);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_MALE01);
|
||||
CStreaming::SetModelIsDeletable(MI_TAXI_D);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_TAXI_D);
|
||||
CStreaming::SetModelIsDeletable(MI_NIGHTSTICK);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK);
|
||||
CStreaming::SetModelIsDeletable(MI_MISSILE);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_MISSILE);
|
||||
CStreaming::SetModelIsDeletable(MI_POLICE);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_POLICE);
|
||||
|
||||
while (CStreaming::RemoveLoadedVehicle()) ;
|
||||
|
||||
CRadar::RemoveRadarSections();
|
||||
|
||||
for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i);
|
||||
if (pDummy)
|
||||
pDummy->DeleteRwObject();
|
||||
}
|
||||
|
||||
for (int i = CPools::GetObjectPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CObject* pObject = CPools::GetObjectPool()->GetSlot(i);
|
||||
if (pObject)
|
||||
pObject->DeleteRwObject();
|
||||
}
|
||||
|
||||
for (int i = CPools::GetBuildingPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CBuilding* pBuilding = CPools::GetBuildingPool()->GetSlot(i);
|
||||
if (pBuilding && pBuilding->m_rwObject != nil && pBuilding->bIsBIGBuilding && pBuilding->bStreamBIGBuilding) {
|
||||
if (pBuilding->bIsBIGBuilding)
|
||||
CStreaming::RequestModel(pBuilding->GetModelIndex(), 0);
|
||||
if (!pBuilding->bImBeingRendered)
|
||||
pBuilding->DeleteRwObject();
|
||||
}
|
||||
}
|
||||
|
||||
CPlayerPed *pPlayerPed = FindPlayerPed();
|
||||
pPlayerPed->RemoveWeaponAnims(0, -1000.0f);
|
||||
NumberOfSavedWeapons = 0;
|
||||
|
||||
for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
|
||||
if (pPlayerPed->m_weapons[i].m_eWeaponType != WEAPONTYPE_UNARMED) {
|
||||
SavedWeaponIDs[NumberOfSavedWeapons] = pPlayerPed->m_weapons[i].m_eWeaponType;
|
||||
SavedWeaponAmmo[NumberOfSavedWeapons] = pPlayerPed->m_weapons[i].m_nAmmoTotal;
|
||||
NumberOfSavedWeapons++;
|
||||
}
|
||||
}
|
||||
|
||||
pPlayerPed->ClearWeapons();
|
||||
CGame::DrasticTidyUpMemory(true);
|
||||
}
|
||||
61
miami/animation/CutsceneMgr.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
#include "CutsceneObject.h"
|
||||
|
||||
#define CUTSCENENAMESIZE 8
|
||||
|
||||
class CDirectory;
|
||||
class CAnimBlendAssocGroup;
|
||||
class CCutsceneHead;
|
||||
|
||||
class CCutsceneMgr
|
||||
{
|
||||
static bool ms_running;
|
||||
static CCutsceneObject *ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
|
||||
|
||||
static int32 ms_numCutsceneObjs;
|
||||
static bool ms_loaded;
|
||||
static bool ms_animLoaded;
|
||||
static bool ms_useLodMultiplier;
|
||||
|
||||
static char ms_cutsceneName[CUTSCENENAMESIZE];
|
||||
static CAnimBlendAssocGroup ms_cutsceneAssociations;
|
||||
static CVector ms_cutsceneOffset;
|
||||
static float ms_cutsceneTimer;
|
||||
static bool ms_wasCutsceneSkipped;
|
||||
static bool ms_cutsceneProcessing;
|
||||
static bool ms_useCutsceneShadows;
|
||||
public:
|
||||
static CDirectory *ms_pCutsceneDir;
|
||||
static uint32 ms_cutsceneLoadStatus;
|
||||
|
||||
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
|
||||
static bool IsRunning(void) { return ms_running; }
|
||||
static bool HasLoaded(void) { return ms_loaded; }
|
||||
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
|
||||
static bool WasCutsceneSkipped(void) { return ms_wasCutsceneSkipped; }
|
||||
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
|
||||
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
|
||||
static int GetCutsceneTimeInMilleseconds(void) { return 1000.0f * ms_cutsceneTimer; }
|
||||
static char *GetCutsceneName(void) { return ms_cutsceneName; }
|
||||
static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
|
||||
static bool HasCutsceneFinished(void);
|
||||
|
||||
static void Initialise(void);
|
||||
static void Shutdown(void);
|
||||
static void LoadCutsceneData(const char *szCutsceneName);
|
||||
static void FinishCutscene(void);
|
||||
static void SetupCutsceneToStart(void);
|
||||
static void SetCutsceneAnim(const char *animName, CObject *pObject);
|
||||
static void SetCutsceneAnimToLoop(const char *animName);
|
||||
static CCutsceneHead *AddCutsceneHead(CObject *pObject, int modelId);
|
||||
static CCutsceneObject *CreateCutsceneObject(int modelId);
|
||||
static void DeleteCutsceneData(void);
|
||||
static void LoadAnimationUncompressed(char const*);
|
||||
static void Update(void);
|
||||
|
||||
static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo);
|
||||
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
|
||||
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int frame);
|
||||
static void RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
|
||||
static void DisableCutsceneShadows() { ms_useCutsceneShadows = false; }
|
||||
};
|
||||
446
miami/animation/FrameUpdate.cpp
Normal file
@@ -0,0 +1,446 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "NodeName.h"
|
||||
#include "VisibilityPlugins.h"
|
||||
#include "AnimBlendClumpData.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "RpAnimBlend.h"
|
||||
|
||||
CAnimBlendClumpData *gpAnimBlendClump;
|
||||
|
||||
// PS2 names without "NonSkinned"
|
||||
void FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
void FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
void FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
|
||||
void FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
void FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
void FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
|
||||
void
|
||||
FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
CVector vec, pos(0.0f, 0.0f, 0.0f);
|
||||
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float totalBlendAmount = 0.0f;
|
||||
RwMatrix *mat = RwFrameGetMatrix(frame->frame);
|
||||
CAnimBlendNode **node;
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
||||
gpAnimBlendClump->velocity2d){
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
||||
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
|
||||
else
|
||||
FrameUpdateCallBackWithVelocityExtractionNonSkinned(frame, arg);
|
||||
return;
|
||||
}
|
||||
|
||||
if(updateData->foobar)
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->association->IsPartial())
|
||||
totalBlendAmount += (*node)->association->blendAmount;
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
if((*node)->sequence){
|
||||
(*node)->Update(vec, q, 1.0f-totalBlendAmount);
|
||||
if((*node)->sequence->HasTranslation())
|
||||
pos += vec;
|
||||
#ifdef FIX_BUGS
|
||||
if(DotProduct(rot, q) < 0.0f)
|
||||
rot -= q;
|
||||
else
|
||||
#endif
|
||||
rot += q;
|
||||
}
|
||||
++*node;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_ROTATION) == 0){
|
||||
RwMatrixSetIdentity(mat);
|
||||
rot.Normalise();
|
||||
rot.Get(mat);
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
mat->pos.x = pos.x;
|
||||
mat->pos.y = pos.y;
|
||||
mat->pos.z = pos.z;
|
||||
mat->pos.x += frame->resetPos.x;
|
||||
mat->pos.y += frame->resetPos.y;
|
||||
mat->pos.z += frame->resetPos.z;
|
||||
}
|
||||
RwMatrixUpdate(mat);
|
||||
}
|
||||
|
||||
void
|
||||
FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
CVector vec, pos(0.0f, 0.0f, 0.0f);
|
||||
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float totalBlendAmount = 0.0f;
|
||||
float transx = 0.0f, transy = 0.0f;
|
||||
float curx = 0.0f, cury = 0.0f;
|
||||
float endx = 0.0f, endy = 0.0f;
|
||||
bool looped = false;
|
||||
RwMatrix *mat = RwFrameGetMatrix(frame->frame);
|
||||
CAnimBlendNode **node;
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(updateData->foobar)
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->association->IsPartial())
|
||||
totalBlendAmount += (*node)->association->blendAmount;
|
||||
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->sequence->HasTranslation()){
|
||||
if((*node)->association->HasTranslation()){
|
||||
(*node)->GetCurrentTranslation(vec, 1.0f-totalBlendAmount);
|
||||
cury += vec.y;
|
||||
if((*node)->association->HasXTranslation())
|
||||
curx += vec.x;
|
||||
}
|
||||
}
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
if((*node)->sequence){
|
||||
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
|
||||
#ifdef FIX_BUGS
|
||||
if(DotProduct(rot, q) < 0.0f)
|
||||
rot -= q;
|
||||
else
|
||||
#endif
|
||||
rot += q;
|
||||
if((*node)->sequence->HasTranslation()){
|
||||
pos += vec;
|
||||
if((*node)->association->HasTranslation()){
|
||||
transy += vec.y;
|
||||
if((*node)->association->HasXTranslation())
|
||||
transx += vec.x;
|
||||
looped |= nodelooped;
|
||||
if(nodelooped){
|
||||
(*node)->GetEndTranslation(vec, 1.0f-totalBlendAmount);
|
||||
endy += vec.y;
|
||||
if((*node)->association->HasXTranslation())
|
||||
endx += vec.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
++*node;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_ROTATION) == 0){
|
||||
RwMatrixSetIdentity(mat);
|
||||
rot.Normalise();
|
||||
rot.Get(mat);
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
gpAnimBlendClump->velocity2d->x = transx - curx;
|
||||
gpAnimBlendClump->velocity2d->y = transy - cury;
|
||||
if(looped){
|
||||
gpAnimBlendClump->velocity2d->x += endx;
|
||||
gpAnimBlendClump->velocity2d->y += endy;
|
||||
}
|
||||
mat->pos.x = pos.x - transx;
|
||||
mat->pos.y = pos.y - transy;
|
||||
mat->pos.z = pos.z;
|
||||
if(mat->pos.z >= -0.8f) {
|
||||
if(mat->pos.z < -0.4f)
|
||||
mat->pos.z += (2.5f * mat->pos.z + 2.0f) * frame->resetPos.z;
|
||||
else
|
||||
mat->pos.z += frame->resetPos.z;
|
||||
}
|
||||
mat->pos.x += frame->resetPos.x;
|
||||
mat->pos.y += frame->resetPos.y;
|
||||
}
|
||||
RwMatrixUpdate(mat);
|
||||
}
|
||||
|
||||
// original code uses do loops?
|
||||
void
|
||||
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
CVector vec, pos(0.0f, 0.0f, 0.0f);
|
||||
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float totalBlendAmount = 0.0f;
|
||||
CVector trans(0.0f, 0.0f, 0.0f);
|
||||
CVector cur(0.0f, 0.0f, 0.0f);
|
||||
CVector end(0.0f, 0.0f, 0.0f);
|
||||
bool looped = false;
|
||||
RwMatrix *mat = RwFrameGetMatrix(frame->frame);
|
||||
CAnimBlendNode **node;
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(updateData->foobar)
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->association->IsPartial())
|
||||
totalBlendAmount += (*node)->association->blendAmount;
|
||||
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->sequence->HasTranslation()){
|
||||
if((*node)->association->HasTranslation()){
|
||||
(*node)->GetCurrentTranslation(vec, 1.0f-totalBlendAmount);
|
||||
cur += vec;
|
||||
}
|
||||
}
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
if((*node)->sequence){
|
||||
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
|
||||
#ifdef FIX_BUGS
|
||||
if(DotProduct(rot, q) < 0.0f)
|
||||
rot -= q;
|
||||
else
|
||||
#endif
|
||||
rot += q;
|
||||
if((*node)->sequence->HasTranslation()){
|
||||
pos += vec;
|
||||
if((*node)->association->HasTranslation()){
|
||||
trans += vec;
|
||||
looped |= nodelooped;
|
||||
if(nodelooped){
|
||||
(*node)->GetEndTranslation(vec, 1.0f-totalBlendAmount);
|
||||
end += vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
++*node;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_ROTATION) == 0){
|
||||
RwMatrixSetIdentity(mat);
|
||||
rot.Normalise();
|
||||
rot.Get(mat);
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
*gpAnimBlendClump->velocity3d = trans - cur;
|
||||
if(looped)
|
||||
*gpAnimBlendClump->velocity3d += end;
|
||||
mat->pos.x = (pos - trans).x + frame->resetPos.x;
|
||||
mat->pos.y = (pos - trans).y + frame->resetPos.y;
|
||||
mat->pos.z = (pos - trans).z + frame->resetPos.z;
|
||||
}
|
||||
RwMatrixUpdate(mat);
|
||||
}
|
||||
|
||||
void
|
||||
FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
CVector vec, pos(0.0f, 0.0f, 0.0f);
|
||||
float transBlendAmount = 0.0f;
|
||||
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float totalBlendAmount = 0.0f;
|
||||
RpHAnimStdInterpFrame *xform = frame->hanimFrame;
|
||||
CAnimBlendNode **node;
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
||||
gpAnimBlendClump->velocity2d){
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
||||
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
|
||||
else
|
||||
FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg);
|
||||
return;
|
||||
}
|
||||
|
||||
if(updateData->foobar)
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->association->IsPartial())
|
||||
totalBlendAmount += (*node)->association->blendAmount;
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
if((*node)->sequence){
|
||||
(*node)->Update(vec, q, 1.0f-totalBlendAmount);
|
||||
if((*node)->sequence->HasTranslation()){
|
||||
pos += vec;
|
||||
transBlendAmount += (*node)->association->blendAmount;
|
||||
}
|
||||
if(DotProduct(rot, q) < 0.0f)
|
||||
rot -= q;
|
||||
else
|
||||
rot += q;
|
||||
}
|
||||
++*node;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_ROTATION) == 0){
|
||||
rot.Normalise();
|
||||
xform->q.imag.x = rot.x;
|
||||
xform->q.imag.y = rot.y;
|
||||
xform->q.imag.z = rot.z;
|
||||
xform->q.real = rot.w;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
xform->t.x = transBlendAmount*pos.x;
|
||||
xform->t.y = transBlendAmount*pos.y;
|
||||
xform->t.z = transBlendAmount*pos.z;
|
||||
xform->t.x += (1.0f-transBlendAmount)*frame->resetPos.x;
|
||||
xform->t.y += (1.0f-transBlendAmount)*frame->resetPos.y;
|
||||
xform->t.z += (1.0f-transBlendAmount)*frame->resetPos.z;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
CVector vec, pos(0.0f, 0.0f, 0.0f);
|
||||
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float totalBlendAmount = 0.0f;
|
||||
float transx = 0.0f, transy = 0.0f;
|
||||
float curx = 0.0f, cury = 0.0f;
|
||||
float endx = 0.0f, endy = 0.0f;
|
||||
bool looped = false;
|
||||
RpHAnimStdInterpFrame *xform = frame->hanimFrame;
|
||||
CAnimBlendNode **node;
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(updateData->foobar)
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->association->IsPartial())
|
||||
totalBlendAmount += (*node)->association->blendAmount;
|
||||
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->sequence->HasTranslation()){
|
||||
if((*node)->association->HasTranslation()){
|
||||
(*node)->GetCurrentTranslation(vec, 1.0f-totalBlendAmount);
|
||||
cury += vec.y;
|
||||
if((*node)->association->HasXTranslation())
|
||||
curx += vec.x;
|
||||
}
|
||||
}
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
if((*node)->sequence){
|
||||
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
|
||||
if(DotProduct(rot, q) < 0.0f)
|
||||
rot -= q;
|
||||
else
|
||||
rot += q;
|
||||
if((*node)->sequence->HasTranslation()){
|
||||
pos += vec;
|
||||
if((*node)->association->HasTranslation()){
|
||||
transy += vec.y;
|
||||
if((*node)->association->HasXTranslation())
|
||||
transx += vec.x;
|
||||
looped |= nodelooped;
|
||||
if(nodelooped){
|
||||
(*node)->GetEndTranslation(vec, 1.0f-totalBlendAmount);
|
||||
endy += vec.y;
|
||||
if((*node)->association->HasXTranslation())
|
||||
endx += vec.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
++*node;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_ROTATION) == 0){
|
||||
rot.Normalise();
|
||||
xform->q.imag.x = rot.x;
|
||||
xform->q.imag.y = rot.y;
|
||||
xform->q.imag.z = rot.z;
|
||||
xform->q.real = rot.w;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
gpAnimBlendClump->velocity2d->x = transx - curx;
|
||||
gpAnimBlendClump->velocity2d->y = transy - cury;
|
||||
if(looped){
|
||||
gpAnimBlendClump->velocity2d->x += endx;
|
||||
gpAnimBlendClump->velocity2d->y += endy;
|
||||
}
|
||||
xform->t.x = pos.x - transx;
|
||||
xform->t.y = pos.y - transy;
|
||||
xform->t.z = pos.z;
|
||||
if(xform->t.z >= -0.8f) {
|
||||
if(xform->t.z < -0.4f)
|
||||
xform->t.z += (2.5f * xform->t.z + 2.0f) * frame->resetPos.z;
|
||||
else
|
||||
xform->t.z += frame->resetPos.z;
|
||||
}
|
||||
xform->t.x += frame->resetPos.x;
|
||||
xform->t.y += frame->resetPos.y;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
CVector vec, pos(0.0f, 0.0f, 0.0f);
|
||||
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float totalBlendAmount = 0.0f;
|
||||
CVector trans(0.0f, 0.0f, 0.0f);
|
||||
CVector cur(0.0f, 0.0f, 0.0f);
|
||||
CVector end(0.0f, 0.0f, 0.0f);
|
||||
bool looped = false;
|
||||
RpHAnimStdInterpFrame *xform = frame->hanimFrame;
|
||||
CAnimBlendNode **node;
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(updateData->foobar)
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->association->IsPartial())
|
||||
totalBlendAmount += (*node)->association->blendAmount;
|
||||
|
||||
for(node = updateData->nodes; *node; node++)
|
||||
if((*node)->sequence && (*node)->sequence->HasTranslation()){
|
||||
if((*node)->association->HasTranslation()){
|
||||
(*node)->GetCurrentTranslation(vec, 1.0f-totalBlendAmount);
|
||||
cur += vec;
|
||||
}
|
||||
}
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
if((*node)->sequence){
|
||||
bool nodelooped = (*node)->Update(vec, q, 1.0f-totalBlendAmount);
|
||||
#ifdef FIX_BUGS
|
||||
if(DotProduct(rot, q) < 0.0f)
|
||||
rot -= q;
|
||||
else
|
||||
#endif
|
||||
rot += q;
|
||||
if((*node)->sequence->HasTranslation()){
|
||||
pos += vec;
|
||||
if((*node)->association->HasTranslation()){
|
||||
trans += vec;
|
||||
looped |= nodelooped;
|
||||
if(nodelooped){
|
||||
(*node)->GetEndTranslation(vec, 1.0f-totalBlendAmount);
|
||||
end += vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
++*node;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_ROTATION) == 0){
|
||||
rot.Normalise();
|
||||
xform->q.imag.x = rot.x;
|
||||
xform->q.imag.y = rot.y;
|
||||
xform->q.imag.z = rot.z;
|
||||
xform->q.real = rot.w;
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
*gpAnimBlendClump->velocity3d = trans - cur;
|
||||
if(looped)
|
||||
*gpAnimBlendClump->velocity3d += end;
|
||||
xform->t.x = (pos - trans).x + frame->resetPos.x;
|
||||
xform->t.y = (pos - trans).y + frame->resetPos.y;
|
||||
xform->t.z = (pos - trans).z + frame->resetPos.z;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity2d)
|
||||
FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg);
|
||||
}
|
||||
518
miami/animation/RpAnimBlend.cpp
Normal file
@@ -0,0 +1,518 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "RwHelper.h"
|
||||
#include "General.h"
|
||||
#include "NodeName.h"
|
||||
#include "VisibilityPlugins.h"
|
||||
#include "Bones.h"
|
||||
#include "AnimBlendClumpData.h"
|
||||
#include "AnimBlendHierarchy.h"
|
||||
#include "AnimBlendAssociation.h"
|
||||
#include "AnimManager.h"
|
||||
#include "RpAnimBlend.h"
|
||||
#include "PedModelInfo.h"
|
||||
|
||||
RwInt32 ClumpOffset;
|
||||
|
||||
enum
|
||||
{
|
||||
ID_RPANIMBLEND = MAKECHUNKID(rwVENDORID_ROCKSTAR, 0xFD),
|
||||
};
|
||||
|
||||
void*
|
||||
AnimBlendClumpCreate(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
|
||||
{
|
||||
*RWPLUGINOFFSET(CAnimBlendClumpData*, object, offsetInObject) = nil;
|
||||
return object;
|
||||
}
|
||||
|
||||
void*
|
||||
AnimBlendClumpDestroy(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
|
||||
{
|
||||
CAnimBlendClumpData *data;
|
||||
data = *RPANIMBLENDCLUMPDATA(object);
|
||||
if(data){
|
||||
RpAnimBlendClumpRemoveAllAssociations((RpClump*)object);
|
||||
delete data;
|
||||
*RPANIMBLENDCLUMPDATA(object) = nil;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
void *AnimBlendClumpCopy(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject) { return nil; }
|
||||
|
||||
bool
|
||||
RpAnimBlendPluginAttach(void)
|
||||
{
|
||||
ClumpOffset = RpClumpRegisterPlugin(sizeof(CAnimBlendClumpData*), ID_RPANIMBLEND,
|
||||
AnimBlendClumpCreate, AnimBlendClumpDestroy, AnimBlendClumpCopy);
|
||||
return ClumpOffset >= 0;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendGetNextAssociation(CAnimBlendAssociation *assoc)
|
||||
{
|
||||
if(assoc->link.next)
|
||||
return CAnimBlendAssociation::FromLink(assoc->link.next);
|
||||
return nil;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendGetNextAssociation(CAnimBlendAssociation *assoc, uint32 mask)
|
||||
{
|
||||
CAnimBlendLink *link;
|
||||
for(link = assoc->link.next; link; link = link->next){
|
||||
assoc = CAnimBlendAssociation::FromLink(link);
|
||||
if(assoc->flags & mask)
|
||||
return assoc;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendAllocateData(RpClump *clump)
|
||||
{
|
||||
*RPANIMBLENDCLUMPDATA(clump) = new CAnimBlendClumpData;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RpAnimBlendClumpSetBlendDeltas(RpClump *clump, uint32 mask, float delta)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
if(mask == 0 || (assoc->flags & mask))
|
||||
assoc->blendDelta = delta;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpRemoveAllAssociations(RpClump *clump)
|
||||
{
|
||||
RpAnimBlendClumpRemoveAssociations(clump, 0);
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpRemoveAssociations(RpClump *clump, uint32 mask)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
CAnimBlendLink *next;
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = next){
|
||||
next = link->next;
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
if(mask == 0 || (assoc->flags & mask))
|
||||
if(assoc)
|
||||
delete assoc;
|
||||
}
|
||||
}
|
||||
|
||||
RwFrame*
|
||||
FrameForAllChildrenCountCallBack(RwFrame *frame, void *data)
|
||||
{
|
||||
int *numFrames = (int*)data;
|
||||
(*numFrames)++;
|
||||
RwFrameForAllChildren(frame, FrameForAllChildrenCountCallBack, data);
|
||||
return frame;
|
||||
}
|
||||
|
||||
RwFrame*
|
||||
FrameForAllChildrenFillFrameArrayCallBack(RwFrame *frame, void *data)
|
||||
{
|
||||
AnimBlendFrameData **frames = (AnimBlendFrameData**)data;
|
||||
(*frames)->frame = frame;
|
||||
(*frames)++;
|
||||
RwFrameForAllChildren(frame, FrameForAllChildrenFillFrameArrayCallBack, frames);
|
||||
return frame;
|
||||
}
|
||||
|
||||
// FrameInitCallBack on PS2
|
||||
void
|
||||
FrameInitCBnonskin(AnimBlendFrameData *frameData, void*)
|
||||
{
|
||||
frameData->flag = 0;
|
||||
frameData->resetPos = *RwMatrixGetPos(RwFrameGetMatrix(frameData->frame));
|
||||
}
|
||||
|
||||
void
|
||||
FrameInitCBskin(AnimBlendFrameData *frameData, void*)
|
||||
{
|
||||
frameData->flag = 0;
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpInitSkinned(RpClump *clump)
|
||||
{
|
||||
int i;
|
||||
RwV3d boneTab[64];
|
||||
CAnimBlendClumpData *clumpData;
|
||||
RpAtomic *atomic;
|
||||
RpSkin *skin;
|
||||
RpHAnimHierarchy *hier;
|
||||
int numBones;
|
||||
|
||||
RpAnimBlendAllocateData(clump);
|
||||
clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
atomic = GetFirstAtomic(clump);
|
||||
assert(atomic);
|
||||
skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic));
|
||||
assert(skin);
|
||||
numBones = RpSkinGetNumBones(skin);
|
||||
clumpData->SetNumberOfBones(numBones);
|
||||
hier = GetAnimHierarchyFromSkinClump(clump);
|
||||
assert(hier);
|
||||
memset(boneTab, 0, sizeof(boneTab));
|
||||
SkinGetBonePositionsToTable(clump, boneTab);
|
||||
|
||||
AnimBlendFrameData *frames = clumpData->frames;
|
||||
for(i = 0; i < numBones; i++){
|
||||
frames[i].nodeID = HIERNODEID(hier, i);
|
||||
frames[i].resetPos = boneTab[i];
|
||||
#ifdef LIBRW
|
||||
frames[i].hanimFrame = (RpHAnimStdInterpFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
|
||||
#else
|
||||
frames[i].hanimFrame = (RpHAnimStdInterpFrame*)rtANIMGETINTERPFRAME(hier->currentAnim, i);
|
||||
#endif
|
||||
}
|
||||
clumpData->ForAllFrames(FrameInitCBskin, nil);
|
||||
clumpData->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION;
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpInitNotSkinned(RpClump *clump)
|
||||
{
|
||||
int numFrames = 0;
|
||||
CAnimBlendClumpData *clumpData;
|
||||
RwFrame *root;
|
||||
AnimBlendFrameData *frames;
|
||||
|
||||
RpAnimBlendAllocateData(clump);
|
||||
clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
root = RpClumpGetFrame(clump);
|
||||
RwFrameForAllChildren(root, FrameForAllChildrenCountCallBack, &numFrames);
|
||||
clumpData->SetNumberOfFrames(numFrames);
|
||||
frames = clumpData->frames;
|
||||
RwFrameForAllChildren(root, FrameForAllChildrenFillFrameArrayCallBack, &frames);
|
||||
clumpData->ForAllFrames(FrameInitCBnonskin, nil);
|
||||
clumpData->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION;
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpInit(RpClump *clump)
|
||||
{
|
||||
if(IsClumpSkinned(clump))
|
||||
RpAnimBlendClumpInitSkinned(clump);
|
||||
else
|
||||
RpAnimBlendClumpInitNotSkinned(clump);
|
||||
}
|
||||
|
||||
bool
|
||||
RpAnimBlendClumpIsInitialized(RpClump *clump)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
return clumpData && clumpData->numFrames != 0;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetAssociation(RpClump *clump, uint32 id)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
|
||||
if(clumpData == nil) return nil;
|
||||
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
if(assoc->animId == id)
|
||||
return assoc;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetMainAssociation(RpClump *clump, CAnimBlendAssociation **assocRet, float *blendRet)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
|
||||
if(clumpData == nil) return nil;
|
||||
|
||||
CAnimBlendAssociation *mainAssoc = nil;
|
||||
CAnimBlendAssociation *secondAssoc = nil;
|
||||
float mainBlend = 0.0f;
|
||||
float secondBlend = 0.0f;
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
|
||||
if(assoc->IsPartial())
|
||||
continue;
|
||||
|
||||
if(assoc->blendAmount > mainBlend){
|
||||
secondBlend = mainBlend;
|
||||
mainBlend = assoc->blendAmount;
|
||||
|
||||
secondAssoc = mainAssoc;
|
||||
mainAssoc = assoc;
|
||||
}else if(assoc->blendAmount > secondBlend){
|
||||
secondBlend = assoc->blendAmount;
|
||||
secondAssoc = assoc;
|
||||
}
|
||||
}
|
||||
if(assocRet) *assocRet = secondAssoc;
|
||||
if(blendRet) *blendRet = secondBlend;
|
||||
return mainAssoc;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetMainPartialAssociation(RpClump *clump)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
|
||||
if(clumpData == nil) return nil;
|
||||
|
||||
CAnimBlendAssociation *mainAssoc = nil;
|
||||
float mainBlend = 0.0f;
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
|
||||
if(!assoc->IsPartial())
|
||||
continue;
|
||||
|
||||
if(assoc->blendAmount > mainBlend){
|
||||
mainBlend = assoc->blendAmount;
|
||||
mainAssoc = assoc;
|
||||
}
|
||||
}
|
||||
return mainAssoc;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetMainAssociation_N(RpClump *clump, int n)
|
||||
{
|
||||
int i;
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
|
||||
if(clumpData == nil) return nil;
|
||||
|
||||
i = 0;
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
|
||||
if(assoc->IsPartial())
|
||||
continue;
|
||||
|
||||
if(i == n)
|
||||
return assoc;
|
||||
i++;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetMainPartialAssociation_N(RpClump *clump, int n)
|
||||
{
|
||||
int i;
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
|
||||
if(clumpData == nil) return nil;
|
||||
|
||||
i = 0;
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
|
||||
if(!assoc->IsPartial())
|
||||
continue;
|
||||
|
||||
if(i == n)
|
||||
return assoc;
|
||||
i++;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetFirstAssociation(RpClump *clump, uint32 mask)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
|
||||
if(clumpData == nil) return nil;
|
||||
|
||||
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
||||
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
||||
if(assoc->flags & mask)
|
||||
return assoc;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
CAnimBlendAssociation*
|
||||
RpAnimBlendClumpGetFirstAssociation(RpClump *clump)
|
||||
{
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
if(!RpAnimBlendClumpIsInitialized(clump))
|
||||
return nil;
|
||||
if(clumpData->link.next)
|
||||
return CAnimBlendAssociation::FromLink(clumpData->link.next);
|
||||
return nil;
|
||||
}
|
||||
|
||||
// FillFrameArrayCallBack on PS2
|
||||
void
|
||||
FillFrameArrayCBnonskin(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
AnimBlendFrameData **frames = (AnimBlendFrameData**)arg;
|
||||
frames[CVisibilityPlugins::GetFrameHierarchyId(frame->frame)] = frame;
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpFillFrameArraySkin(RpClump *clump, AnimBlendFrameData **frames)
|
||||
{
|
||||
int i;
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump);
|
||||
for(i = PED_MID; i < PED_NODE_MAX; i++)
|
||||
frames[i] = &clumpData->frames[RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(i))];
|
||||
}
|
||||
|
||||
void
|
||||
RpAnimBlendClumpFillFrameArray(RpClump *clump, AnimBlendFrameData **frames)
|
||||
{
|
||||
if(IsClumpSkinned(clump))
|
||||
RpAnimBlendClumpFillFrameArraySkin(clump, frames);
|
||||
else
|
||||
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FillFrameArrayCBnonskin, frames);
|
||||
}
|
||||
|
||||
AnimBlendFrameData *pFrameDataFound;
|
||||
|
||||
void
|
||||
FrameFindByNameCBnonskin(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
char *nodename = GetFrameNodeName(frame->frame);
|
||||
if(!CGeneral::faststricmp(nodename, (char*)arg))
|
||||
pFrameDataFound = frame;
|
||||
}
|
||||
|
||||
void
|
||||
FrameFindByNameCBskin(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
const char *name = ConvertBoneTag2BoneName(frame->nodeID);
|
||||
if(name && CGeneral::faststricmp(name, (char*)arg) == 0)
|
||||
pFrameDataFound = frame;
|
||||
}
|
||||
|
||||
void
|
||||
FrameFindByBoneCB(AnimBlendFrameData *frame, void *arg)
|
||||
{
|
||||
if(frame->nodeID == (int32)(uintptr)arg)
|
||||
pFrameDataFound = frame;
|
||||
}
|
||||
|
||||
AnimBlendFrameData*
|
||||
RpAnimBlendClumpFindFrame(RpClump *clump, const char *name)
|
||||
{
|
||||
pFrameDataFound = nil;
|
||||
if(IsClumpSkinned(clump))
|
||||
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FrameFindByNameCBskin, (void*)name);
|
||||
else
|
||||
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FrameFindByNameCBnonskin, (void*)name);
|
||||
return pFrameDataFound;
|
||||
}
|
||||
|
||||
AnimBlendFrameData*
|
||||
RpAnimBlendClumpFindBone(RpClump *clump, uint32 boneTag)
|
||||
{
|
||||
pFrameDataFound = nil;
|
||||
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FrameFindByBoneCB, (void*)boneTag);
|
||||
return pFrameDataFound;
|
||||
}
|
||||
|
||||
#if !defined(DC_TEXCONV)
|
||||
void
|
||||
RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateData *updateData, int32 numNodes)
|
||||
{
|
||||
CAnimBlendNode **node;
|
||||
int i;
|
||||
|
||||
for(node = updateData->nodes; *node; node++){
|
||||
CAnimBlendAssociation *a = (*node)->association;
|
||||
for(i = 0; i < numNodes; i++)
|
||||
if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 ||
|
||||
gpAnimBlendClump->velocity2d == nil){
|
||||
if((*node)[i].sequence)
|
||||
(*node)[i].FindKeyFrame(a->currentTime - a->timeStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void
|
||||
RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateData *updateData, int32 numNodes) { assert(false); }
|
||||
#endif
|
||||
|
||||
#if !defined(DC_TEXCONV)
|
||||
// TODO:
|
||||
// CAnimBlendClumpData::LoadFramesIntoSPR
|
||||
// CAnimBlendClumpData::ForAllFramesInSPR
|
||||
void
|
||||
RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta, bool doRender)
|
||||
{
|
||||
int i;
|
||||
CAnimBlendAssociation *assoc;
|
||||
AnimBlendFrameUpdateData updateData;
|
||||
float totalLength = 0.0f;
|
||||
float totalBlend = 0.0f;
|
||||
CAnimBlendLink *link, *next;
|
||||
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
||||
gpAnimBlendClump = clumpData;
|
||||
|
||||
if(clumpData->link.next == nil)
|
||||
return;
|
||||
|
||||
// Update blend and get node array
|
||||
i = 0;
|
||||
updateData.foobar = 0;
|
||||
for(link = clumpData->link.next; link; link = next){
|
||||
next = link->next;
|
||||
assoc = CAnimBlendAssociation::FromLink(link);
|
||||
if(assoc->UpdateBlend(timeDelta)){
|
||||
if(assoc->hierarchy->sequences){
|
||||
if(i < 11)
|
||||
updateData.nodes[i++] = assoc->GetNode(0);
|
||||
if(assoc->flags & ASSOC_MOVEMENT){
|
||||
totalLength += assoc->hierarchy->totalLength/assoc->speed * assoc->blendAmount;
|
||||
totalBlend += assoc->blendAmount;
|
||||
}else
|
||||
updateData.foobar = 1;
|
||||
}else
|
||||
debug("anim %s is not loaded\n", assoc->hierarchy->name);
|
||||
}
|
||||
}
|
||||
|
||||
for(link = clumpData->link.next; link; link = link->next){
|
||||
assoc = CAnimBlendAssociation::FromLink(link);
|
||||
assoc->UpdateTimeStep(timeDelta, totalLength == 0.0f ? 1.0f : totalBlend/totalLength);
|
||||
}
|
||||
|
||||
updateData.nodes[i] = nil;
|
||||
|
||||
if(doRender){
|
||||
if(clumpData->frames[0].flag & AnimBlendFrameData::UPDATE_KEYFRAMES)
|
||||
RpAnimBlendNodeUpdateKeyframes(clumpData->frames, &updateData, clumpData->numFrames);
|
||||
if(IsClumpSkinned(clump))
|
||||
clumpData->ForAllFrames(FrameUpdateCallBackSkinned, &updateData);
|
||||
else
|
||||
clumpData->ForAllFrames(FrameUpdateCallBackNonSkinned, &updateData);
|
||||
clumpData->frames[0].flag &= ~AnimBlendFrameData::UPDATE_KEYFRAMES;
|
||||
}else{
|
||||
clumpData->ForAllFrames(FrameUpdateCallBackOffscreen, &updateData);
|
||||
clumpData->frames[0].flag |= AnimBlendFrameData::UPDATE_KEYFRAMES;
|
||||
}
|
||||
|
||||
for(link = clumpData->link.next; link; link = link->next){
|
||||
assoc = CAnimBlendAssociation::FromLink(link);
|
||||
assoc->UpdateTime(timeDelta, totalLength == 0.0f ? 1.0f : totalBlend/totalLength);
|
||||
}
|
||||
RwFrameUpdateObjects(RpClumpGetFrame(clump));
|
||||
}
|
||||
#else
|
||||
void
|
||||
RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta, bool doRender) { assert(false); }
|
||||
#endif
|
||||
45
miami/animation/RpAnimBlend.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
class CAnimBlendNode;
|
||||
class CAnimBlendAssociation;
|
||||
class CAnimBlendClumpData;
|
||||
struct AnimBlendFrameData;
|
||||
|
||||
struct AnimBlendFrameUpdateData
|
||||
{
|
||||
int foobar; // TODO: figure out what this actually means
|
||||
CAnimBlendNode *nodes[16];
|
||||
};
|
||||
|
||||
extern RwInt32 ClumpOffset;
|
||||
#define RPANIMBLENDCLUMPDATA(o) (RWPLUGINOFFSET(CAnimBlendClumpData*, o, ClumpOffset))
|
||||
|
||||
bool RpAnimBlendPluginAttach(void);
|
||||
CAnimBlendAssociation *RpAnimBlendGetNextAssociation(CAnimBlendAssociation *assoc);
|
||||
CAnimBlendAssociation *RpAnimBlendGetNextAssociation(CAnimBlendAssociation *assoc, uint32 mask);
|
||||
void RpAnimBlendAllocateData(RpClump *clump);
|
||||
|
||||
void RpAnimBlendClumpSetBlendDeltas(RpClump *clump, uint32 mask, float delta);
|
||||
void RpAnimBlendClumpRemoveAllAssociations(RpClump *clump);
|
||||
void RpAnimBlendClumpRemoveAssociations(RpClump *clump, uint32 mask);
|
||||
void RpAnimBlendClumpInit(RpClump *clump);
|
||||
bool RpAnimBlendClumpIsInitialized(RpClump *clump);
|
||||
void RpAnimBlendClumpFillFrameArray(RpClump* clump, AnimBlendFrameData** frames);
|
||||
AnimBlendFrameData *RpAnimBlendClumpFindFrame(RpClump *clump, const char *name);
|
||||
AnimBlendFrameData *RpAnimBlendClumpFindBone(RpClump *clump, uint32 boneTag);
|
||||
void FillFrameArrayCallBack(AnimBlendFrameData *frame, void *arg);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetAssociation(RpClump *clump, uint32 id);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetMainAssociation(RpClump *clump, CAnimBlendAssociation **assocRet, float *blendRet);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetMainPartialAssociation(RpClump *clump);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetMainAssociation_N(RpClump *clump, int n);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetMainPartialAssociation_N(RpClump *clump, int n);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetFirstAssociation(RpClump *clump, uint32 mask);
|
||||
CAnimBlendAssociation *RpAnimBlendClumpGetFirstAssociation(RpClump *clump);
|
||||
void RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateData *updateData, int32 numNodes);
|
||||
void RpAnimBlendClumpUpdateAnimations(RpClump* clump, float timeDelta, bool doRender = true);
|
||||
|
||||
|
||||
extern CAnimBlendClumpData *gpAnimBlendClump;
|
||||
void FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
void FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg);
|
||||
void FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg);
|
||||
405
miami/audio/AudioCollision.cpp
Normal file
@@ -0,0 +1,405 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "DMAudio.h"
|
||||
#include "Entity.h"
|
||||
#include "AudioCollision.h"
|
||||
#include "AudioManager.h"
|
||||
#include "AudioSamples.h"
|
||||
#include "SurfaceTable.h"
|
||||
#include "sampman.h"
|
||||
|
||||
void
|
||||
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
|
||||
float velocity)
|
||||
{
|
||||
float distSquared;
|
||||
CVector v1;
|
||||
CVector v2;
|
||||
|
||||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_bIsPaused ||
|
||||
(velocity < 0.0016f && collisionPower < 0.01f))
|
||||
return;
|
||||
|
||||
if(entity1->IsBuilding()) {
|
||||
v1 = v2 = entity2->GetPosition();
|
||||
} else if(entity2->IsBuilding()) {
|
||||
v1 = v2 = entity1->GetPosition();
|
||||
} else {
|
||||
v1 = entity1->GetPosition();
|
||||
v2 = entity2->GetPosition();
|
||||
}
|
||||
CVector pos = (v1 + v2) * 0.5f;
|
||||
distSquared = GetDistanceSquared(pos);
|
||||
if(distSquared < SQR(COLLISION_MAX_DIST)) {
|
||||
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
|
||||
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
|
||||
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
|
||||
m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
|
||||
m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
|
||||
m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
|
||||
m_sCollisionManager.m_sQueue.m_vecPosition = pos;
|
||||
m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
|
||||
m_sCollisionManager.AddCollisionToRequestedQueue();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioCollisionManager::AddCollisionToRequestedQueue()
|
||||
{
|
||||
uint32 collisionsIndex;
|
||||
uint32 i;
|
||||
|
||||
|
||||
if (m_bCollisionsInQueue < NUMAUDIOCOLLISIONS)
|
||||
collisionsIndex = m_bCollisionsInQueue++;
|
||||
else {
|
||||
collisionsIndex = m_bIndicesTable[NUMAUDIOCOLLISIONS - 1];
|
||||
if (m_sQueue.m_fDistance >= m_asCollisions1[collisionsIndex].m_fDistance) return;
|
||||
}
|
||||
|
||||
m_asCollisions1[collisionsIndex] = m_sQueue;
|
||||
|
||||
i = 0;
|
||||
if(collisionsIndex) {
|
||||
while(m_asCollisions1[m_bIndicesTable[i]].m_fDistance <= m_asCollisions1[collisionsIndex].m_fDistance) {
|
||||
if(++i >= collisionsIndex) {
|
||||
m_bIndicesTable[i] = collisionsIndex;
|
||||
return;
|
||||
}
|
||||
}
|
||||
memmove(&m_bIndicesTable[i + 1], &m_bIndicesTable[i], NUMAUDIOCOLLISIONS - 1 - i);
|
||||
}
|
||||
m_bIndicesTable[i] = collisionsIndex;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServiceCollisions()
|
||||
{
|
||||
int i, j;
|
||||
bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS];
|
||||
bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS];
|
||||
|
||||
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE;
|
||||
|
||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||
if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
|
||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
|
||||
) {
|
||||
abRepeatedCollision1[index] = TRUE;
|
||||
abRepeatedCollision2[j] = TRUE;
|
||||
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
|
||||
if (!abRepeatedCollision2[i]) {
|
||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
|
||||
m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||
if (!abRepeatedCollision1[index]) {
|
||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||
if (!abRepeatedCollision2[j]) {
|
||||
m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
|
||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
|
||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
m_sCollisionManager.m_bCollisionsInQueue = 0;
|
||||
}
|
||||
|
||||
static const uint32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_GRAVEL_1,
|
||||
SFX_COL_MUD_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_CAR_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_SCAFFOLD_POLE_1,
|
||||
SFX_COL_GARAGE_DOOR_1,
|
||||
SFX_COL_CAR_PANEL_1,
|
||||
SFX_COL_THICK_METAL_PLATE_1,
|
||||
SFX_COL_SCAFFOLD_POLE_1,
|
||||
SFX_COL_LAMP_POST_1,
|
||||
SFX_COL_HYDRANT_1,
|
||||
SFX_COL_HYDRANT_1,
|
||||
SFX_COL_METAL_CHAIN_FENCE_1,
|
||||
SFX_COL_PED_1,
|
||||
SFX_COL_SAND_1,
|
||||
SFX_SPLASH_1,
|
||||
SFX_COL_WOOD_CRATES_1,
|
||||
SFX_COL_WOOD_BENCH_1,
|
||||
SFX_COL_WOOD_SOLID_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_GRASS_1,
|
||||
SFX_COL_VEG_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_CONTAINER_1,
|
||||
SFX_COL_NEWS_VENDOR_1,
|
||||
SFX_TYRE_BUMP,
|
||||
SFX_COL_CARDBOARD_1,
|
||||
SFX_COL_TARMAC_1,
|
||||
SFX_COL_GATE,
|
||||
SFX_COL_SAND_1,
|
||||
SFX_COL_TARMAC_1 };
|
||||
|
||||
void
|
||||
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
||||
{
|
||||
uint16 s1;
|
||||
uint16 s2;
|
||||
|
||||
uint32 emittingVol;
|
||||
float ratio;
|
||||
|
||||
static uint16 counter = 28;
|
||||
|
||||
for(int32 i = 0; i < 2; i++) {
|
||||
if(i) {
|
||||
s1 = col.m_bSurface2;
|
||||
s2 = col.m_bSurface1;
|
||||
} else {
|
||||
s1 = col.m_bSurface1;
|
||||
s2 = col.m_bSurface2;
|
||||
}
|
||||
ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1);
|
||||
if(s1 == SURFACE_CAR && s2 == SURFACE_PED) ratio /= 4.0f;
|
||||
if(s1 == SURFACE_CAR && ratio < 0.6f) {
|
||||
s1 = SURFACE_CAR_PANEL;
|
||||
ratio = Min(1.f, 2.f * ratio);
|
||||
}
|
||||
emittingVol = 40 * ratio;
|
||||
if(emittingVol) {
|
||||
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
||||
m_sQueueSample.m_nVolume =
|
||||
ComputeVolume(emittingVol, COLLISION_MAX_DIST, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume > 0) {
|
||||
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
|
||||
switch(m_sQueueSample.m_nSampleIndex) {
|
||||
case SFX_COL_TARMAC_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[3] % 5;
|
||||
break;
|
||||
case SFX_COL_CAR_PANEL_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[0] % 6;
|
||||
break;
|
||||
case SFX_COL_LAMP_POST_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[1] % 2;
|
||||
break;
|
||||
case SFX_COL_METAL_CHAIN_FENCE_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[3] % 4;
|
||||
break;
|
||||
case SFX_COL_PED_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[4] % 2;
|
||||
break;
|
||||
case SFX_COL_WOOD_CRATES_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[4] % 4;
|
||||
break;
|
||||
case SFX_COL_WOOD_BENCH_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[1] % 4;
|
||||
break;
|
||||
case SFX_COL_VEG_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[2] % 5;
|
||||
break;
|
||||
case SFX_COL_NEWS_VENDOR_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[2] % 3;
|
||||
break;
|
||||
case SFX_COL_CAR_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[1] % 5;
|
||||
break;
|
||||
case SFX_COL_CARDBOARD_1:
|
||||
m_sQueueSample.m_nSampleIndex += m_anRandomTable[3] % 2;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
switch(s1) {
|
||||
case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break;
|
||||
case SURFACE_GIRDER: m_sQueueSample.m_nFrequency = 8819; break;
|
||||
case SURFACE_WATER:
|
||||
m_sQueueSample.m_nFrequency =
|
||||
2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
|
||||
break;
|
||||
case SURFACE_RUBBER: m_sQueueSample.m_nFrequency = 6000; break;
|
||||
case SURFACE_PLASTIC: m_sQueueSample.m_nFrequency = 8000; break;
|
||||
default:
|
||||
m_sQueueSample.m_nFrequency =
|
||||
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
|
||||
break;
|
||||
}
|
||||
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
|
||||
m_sQueueSample.m_nCounter = counter++;
|
||||
if(counter >= 255) counter = 28;
|
||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = FALSE;
|
||||
m_sQueueSample.m_nPriority = 11;
|
||||
m_sQueueSample.m_nLoopCount = 1;
|
||||
SET_EMITTING_VOLUME(emittingVol);
|
||||
RESET_LOOP_OFFSETS
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_MaxDistance = COLLISION_MAX_DIST;
|
||||
m_sQueueSample.m_bStatic = TRUE;
|
||||
SET_SOUND_REVERB(TRUE);
|
||||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
|
||||
{
|
||||
bool8 distCalculated = FALSE;
|
||||
if(col.m_fIntensity2 > 0.0016f) {
|
||||
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
|
||||
if(emittingVol) {
|
||||
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
|
||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, COLLISION_MAX_DIST, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_nVolume > 0) {
|
||||
m_sQueueSample.m_nCounter = counter;
|
||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = FALSE;
|
||||
m_sQueueSample.m_nPriority = 7;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
SET_EMITTING_VOLUME(emittingVol);
|
||||
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_MaxDistance = COLLISION_MAX_DIST;
|
||||
m_sQueueSample.m_bStatic = FALSE;
|
||||
m_sQueueSample.m_nFramesToPlay = 5;
|
||||
SET_SOUND_REVERB(TRUE);
|
||||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32
|
||||
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
|
||||
{
|
||||
uint8 surface1 = audioCollision.m_bSurface1;
|
||||
uint8 surface2 = audioCollision.m_bSurface2;
|
||||
int32 vol;
|
||||
float ratio;
|
||||
|
||||
if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
|
||||
surface2 == SURFACE_HEDGE) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
|
||||
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
|
||||
vol = 50.f * ratio;
|
||||
} else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
|
||||
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
|
||||
vol = 30.f * ratio;
|
||||
} else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY || surface2 == SURFACE_MUD_DRY ||
|
||||
surface1 == SURFACE_SAND || surface2 == SURFACE_SAND || surface1 == SURFACE_SAND_BEACH || surface2 == SURFACE_SAND_BEACH) {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
|
||||
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
|
||||
vol = 50.f * ratio;
|
||||
} else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
|
||||
return 0;
|
||||
} else {
|
||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||
m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
|
||||
m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
|
||||
vol = 40.f * ratio;
|
||||
}
|
||||
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
|
||||
return vol;
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionOneShotRatio(uint32 a, float b)
|
||||
{
|
||||
switch(a) {
|
||||
case SURFACE_DEFAULT:
|
||||
case SURFACE_TARMAC:
|
||||
case SURFACE_PAVEMENT:
|
||||
case SURFACE_STEEP_CLIFF:
|
||||
case SURFACE_TRANSPARENT_STONE:
|
||||
case SURFACE_CONCRETE_BEACH: return GetCollisionRatio(b, 10.f, 60.f, 50.f);
|
||||
case SURFACE_GRASS:
|
||||
case SURFACE_GRAVEL:
|
||||
case SURFACE_MUD_DRY:
|
||||
case SURFACE_CARDBOARDBOX: return GetCollisionRatio(b, 0.f, 2.f, 2.f);
|
||||
case SURFACE_CAR: return GetCollisionRatio(b, 6.f, 50.f, 44.f);
|
||||
case SURFACE_GLASS:
|
||||
case SURFACE_METAL_CHAIN_FENCE: return GetCollisionRatio(b, 0.1f, 10.f, 9.9f);
|
||||
case SURFACE_TRANSPARENT_CLOTH:
|
||||
case SURFACE_THICK_METAL_PLATE: return GetCollisionRatio(b, 30.f, 130.f, 100.f);
|
||||
case SURFACE_GARAGE_DOOR: return GetCollisionRatio(b, 20.f, 100.f, 80.f);
|
||||
case SURFACE_CAR_PANEL: return GetCollisionRatio(b, 0.f, 4.f, 4.f);
|
||||
case SURFACE_SCAFFOLD_POLE:
|
||||
case SURFACE_METAL_GATE:
|
||||
case SURFACE_LAMP_POST: return GetCollisionRatio(b, 1.f, 10.f, 9.f);
|
||||
case SURFACE_FIRE_HYDRANT: return GetCollisionRatio(b, 1.f, 15.f, 14.f);
|
||||
case SURFACE_GIRDER: return GetCollisionRatio(b, 8.f, 50.f, 42.f);
|
||||
case SURFACE_PED: return GetCollisionRatio(b, 0.f, 20.f, 20.f);
|
||||
case SURFACE_SAND:
|
||||
case SURFACE_WATER:
|
||||
case SURFACE_RUBBER:
|
||||
case SURFACE_WHEELBASE:
|
||||
case SURFACE_SAND_BEACH: return GetCollisionRatio(b, 0.f, 10.f, 10.f);
|
||||
case SURFACE_WOOD_CRATES: return GetCollisionRatio(b, 1.f, 4.f, 3.f);
|
||||
case SURFACE_WOOD_BENCH: return GetCollisionRatio(b, 0.1f, 5.f, 4.9f);
|
||||
case SURFACE_WOOD_SOLID: return GetCollisionRatio(b, 0.1f, 40.f, 39.9f);
|
||||
case SURFACE_PLASTIC: return GetCollisionRatio(b, 0.1f, 4.f, 3.9f);
|
||||
case SURFACE_HEDGE: return GetCollisionRatio(b, 0.f, 0.5f, 0.5f);
|
||||
case SURFACE_CONTAINER: return GetCollisionRatio(b, 4.f, 40.f, 36.f);
|
||||
case SURFACE_NEWS_VENDOR: return GetCollisionRatio(b, 0.f, 5.f, 5.f);
|
||||
default: break;
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c)
|
||||
{
|
||||
return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
|
||||
}
|
||||
|
||||
float
|
||||
cAudioManager::GetCollisionRatio(float a, float b, float c, float d)
|
||||
{
|
||||
float e;
|
||||
e = a;
|
||||
if(a <= b) return 0.0f;
|
||||
if(c <= a) e = c;
|
||||
return (e - b) / d;
|
||||
}
|
||||
57
miami/audio/AudioCollision.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#define NUMAUDIOCOLLISIONS 10
|
||||
|
||||
class CEntity;
|
||||
|
||||
class cAudioCollision
|
||||
{
|
||||
public:
|
||||
CEntity *m_pEntity1;
|
||||
CEntity *m_pEntity2;
|
||||
uint8 m_bSurface1;
|
||||
uint8 m_bSurface2;
|
||||
float m_fIntensity1;
|
||||
float m_fIntensity2;
|
||||
CVector m_vecPosition;
|
||||
float m_fDistance;
|
||||
int32 m_nBaseVolume;
|
||||
|
||||
cAudioCollision() { Reset(); }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_pEntity1 = nil;
|
||||
m_pEntity2 = nil;
|
||||
m_bSurface1 = 0;
|
||||
m_bSurface2 = 0;
|
||||
m_fIntensity1 = m_fIntensity2 = 0.0f;
|
||||
m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_fDistance = 0.0f;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAudioCollision, 40);
|
||||
|
||||
class cAudioCollisionManager
|
||||
{
|
||||
public:
|
||||
cAudioCollision m_asCollisions1[NUMAUDIOCOLLISIONS];
|
||||
cAudioCollision m_asCollisions2[NUMAUDIOCOLLISIONS];
|
||||
uint8 m_bIndicesTable[NUMAUDIOCOLLISIONS];
|
||||
uint8 m_bCollisionsInQueue;
|
||||
cAudioCollision m_sQueue;
|
||||
|
||||
cAudioCollisionManager()
|
||||
{
|
||||
m_sQueue.Reset();
|
||||
|
||||
for(int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
|
||||
m_bCollisionsInQueue = 0;
|
||||
}
|
||||
void AddCollisionToRequestedQueue();
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAudioCollisionManager, 0x354);
|
||||
10279
miami/audio/AudioLogic.cpp
Normal file
1434
miami/audio/AudioManager.cpp
Normal file
649
miami/audio/AudioManager.h
Normal file
@@ -0,0 +1,649 @@
|
||||
#pragma once
|
||||
|
||||
#include "audio_enums.h"
|
||||
#include "AudioCollision.h"
|
||||
#include "PolRadio.h"
|
||||
#include "VehicleModelInfo.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
class tSound
|
||||
{
|
||||
public:
|
||||
int32 m_nEntityIndex; // audio entity index
|
||||
uint32 m_nCounter; // I'm not sure what this is but it looks like a virtual counter to determine the same sound in queue
|
||||
// Values higher than 255 are used by reflections
|
||||
uint32 m_nSampleIndex; // An index of sample from AudioSamples.h
|
||||
uint8 m_nBankIndex; // A sound bank index. IDK what's the point of it here since samples are hardcoded anyway
|
||||
bool8 m_bIs2D; // If TRUE then sound is played in 2D space (such as frontend or police radio)
|
||||
uint32 m_nPriority; // The multiplier for the sound priority (see m_nFinalPriority below). Lesser value means higher priority
|
||||
uint32 m_nFrequency; // Sound frequency, plain and simple
|
||||
uint8 m_nVolume; // Sound volume (0..127), only used as an actual volume without EXTERNAL_3D_SOUND (see m_nEmittingVolume)
|
||||
float m_fDistance; // Distance to camera (useless if m_bIs2D == TRUE)
|
||||
uint32 m_nLoopCount; // 0 - always loop, 1 - don't loop, other values never seen
|
||||
#ifndef GTA_PS2
|
||||
// Loop offsets
|
||||
uint32 m_nLoopStart;
|
||||
int32 m_nLoopEnd;
|
||||
#endif
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
uint8 m_nEmittingVolume; // The volume in 3D space, provided to 3D audio engine
|
||||
#endif
|
||||
float m_fSpeedMultiplier; // Used for doppler effect. 0.0f - unaffected by doppler
|
||||
float m_MaxDistance; // The maximum distance at which sound could be heard. Minimum distance = MaxDistance / 5 or MaxDistance / 4 in case of emitting volume (useless if m_bIs2D == TRUE)
|
||||
bool8 m_bStatic; // If TRUE then sound parameters cannot be changed during playback (frequency, position, etc.)
|
||||
CVector m_vecPos; // Position of sound in 3D space. Unused if m_bIs2D == TRUE
|
||||
#if !defined(GTA_PS2) || defined(AUDIO_REVERB) // GTA_PS2 because this field exists on mobile but not on PS2
|
||||
bool8 m_bReverb; // Toggles reverb effect
|
||||
#endif
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
uint8 m_nReflectionDelay; // Number of frames before reflection could be played. This is calculated internally by AudioManager and shouldn't be set by queued sample
|
||||
bool8 m_bReflections; // Add sound reflections
|
||||
#endif
|
||||
uint8 m_nPan; // Sound panning (0-127). Controls the volume of the playback coming from left and right speaker. Calculated internally unless m_bIs2D==TRUE.
|
||||
// 0 = L 100% R 0%
|
||||
// 63 = L 100% R 100%
|
||||
// 127 = L 0% R 100%
|
||||
uint8 m_nFrontRearPan; // Used on PS2 for surround panning
|
||||
#ifndef FIX_BUGS
|
||||
uint32 m_nFramesToPlay; // Number of frames the sound would be played (if it stops being queued).
|
||||
// This one is being set by queued sample for looping sounds, otherwise calculated inside AudioManager
|
||||
#else
|
||||
float m_nFramesToPlay; // Made into float for high fps fix
|
||||
#endif
|
||||
|
||||
// all fields below are internal to AudioManager calculations and aren't set by queued sample
|
||||
bool8 m_bIsBeingPlayed; // Set to TRUE when the sound was added or changed on current frame to avoid it being overwritten
|
||||
bool8 m_bIsPlayingFinished; // Not sure about the name. Set to TRUE when sampman channel becomes free
|
||||
uint32 m_nFinalPriority; // Actual value used to compare priority, calculated using volume and m_nPriority. Lesser value means higher priority
|
||||
int8 m_nVolumeChange; // How much m_nVolume should reduce per each frame.
|
||||
#if defined(FIX_BUGS) && defined(EXTERNAL_3D_SOUND)
|
||||
int8 m_nEmittingVolumeChange; // same as above but for m_nEmittingVolume
|
||||
#endif
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(tSound, 96);
|
||||
|
||||
class CPhysical;
|
||||
class CAutomobile;
|
||||
|
||||
class tAudioEntity
|
||||
{
|
||||
public:
|
||||
eAudioType m_nType;
|
||||
void *m_pEntity;
|
||||
bool8 m_bIsUsed;
|
||||
bool8 m_bStatus;
|
||||
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
|
||||
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
|
||||
uint8 m_AudioEvents;
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(tAudioEntity, 40);
|
||||
|
||||
class tPedComment
|
||||
{
|
||||
public:
|
||||
uint32 m_nSampleIndex;
|
||||
int32 m_nEntityIndex;
|
||||
CVector m_vecPos;
|
||||
float m_fDistance;
|
||||
uint8 m_nVolume;
|
||||
int8 m_nLoadingTimeout; // how many iterations we gonna wait until dropping the sample if it's still not loaded (only useful on PS2)
|
||||
#if defined(EXTERNAL_3D_SOUND) && defined(FIX_BUGS)
|
||||
uint8 m_nEmittingVolume;
|
||||
#endif
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(tPedComment, 28);
|
||||
|
||||
class cPedComments
|
||||
{
|
||||
public:
|
||||
tPedComment m_aPedCommentQueue[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
|
||||
uint8 m_aPedCommentOrderList[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
|
||||
uint8 m_nPedCommentCount[NUM_SOUND_QUEUES];
|
||||
uint8 m_nActiveQueue;
|
||||
#ifdef GTA_PC
|
||||
bool8 m_bDelay;
|
||||
uint32 m_nDelayTimer;
|
||||
#endif
|
||||
|
||||
cPedComments()
|
||||
{
|
||||
for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
|
||||
for (int j = 0; j < NUM_SOUND_QUEUES; j++) {
|
||||
m_aPedCommentQueue[j][i].m_nLoadingTimeout = -1;
|
||||
m_aPedCommentOrderList[j][i] = NUM_PED_COMMENTS_SLOTS;
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_SOUND_QUEUES; i++)
|
||||
m_nPedCommentCount[i] = 0;
|
||||
m_nActiveQueue = 0;
|
||||
}
|
||||
void Add(tPedComment *com);
|
||||
void Process();
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cPedComments, 0x490);
|
||||
|
||||
#define MISSION_AUDIO_SLOTS (2)
|
||||
|
||||
// name made up
|
||||
class cAudioScriptObjectManager
|
||||
{
|
||||
public:
|
||||
int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
|
||||
int32 m_nScriptObjectEntityTotal;
|
||||
|
||||
cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
|
||||
~cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
|
||||
};
|
||||
|
||||
|
||||
class cTransmission;
|
||||
class CEntity;
|
||||
class CPlane;
|
||||
class CVehicle;
|
||||
class CPed;
|
||||
|
||||
class cPedParams
|
||||
{
|
||||
public:
|
||||
bool8 m_bDistanceCalculated;
|
||||
float m_fDistance;
|
||||
CPed *m_pPed;
|
||||
|
||||
cPedParams()
|
||||
{
|
||||
m_bDistanceCalculated = false;
|
||||
m_fDistance = 0.0f;
|
||||
m_pPed = nil;
|
||||
}
|
||||
};
|
||||
|
||||
class cVehicleParams
|
||||
{
|
||||
public:
|
||||
int32 m_VehicleType;
|
||||
bool8 m_bDistanceCalculated;
|
||||
float m_fDistance;
|
||||
CVehicle *m_pVehicle;
|
||||
cTransmission *m_pTransmission;
|
||||
uint32 m_nIndex;
|
||||
float m_fVelocityChange;
|
||||
|
||||
cVehicleParams()
|
||||
{
|
||||
m_VehicleType = -1;
|
||||
m_bDistanceCalculated = false;
|
||||
m_fDistance = 0.0f;
|
||||
m_pVehicle = nil;
|
||||
m_pTransmission = nil;
|
||||
m_nIndex = 0;
|
||||
m_fVelocityChange = 0.0f;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cVehicleParams, 0x1C);
|
||||
|
||||
#if GTA_VERSION < GTAVC_PC_10
|
||||
enum {
|
||||
/*
|
||||
REFLECTION_YMAX = 0, top
|
||||
REFLECTION_YMIN = 1, bottom
|
||||
REFLECTION_XMIN = 2, left
|
||||
REFLECTION_XMAX = 3, right
|
||||
REFLECTION_ZMAX = 4,
|
||||
*/
|
||||
|
||||
REFLECTION_TOP = 0,
|
||||
REFLECTION_BOTTOM,
|
||||
REFLECTION_LEFT,
|
||||
REFLECTION_RIGHT,
|
||||
REFLECTION_UP,
|
||||
MAX_REFLECTIONS,
|
||||
};
|
||||
#else
|
||||
enum {
|
||||
REFLECTION_NORTH = 0,
|
||||
REFLECTION_SOUTH,
|
||||
REFLECTION_WEST,
|
||||
REFLECTION_EAST,
|
||||
REFLECTION_CEIL_NORTH,
|
||||
REFLECTION_CEIL_SOUTH,
|
||||
REFLECTION_CEIL_WEST,
|
||||
REFLECTION_CEIL_EAST,
|
||||
MAX_REFLECTIONS,
|
||||
};
|
||||
#endif
|
||||
|
||||
enum PLAY_STATUS { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED };
|
||||
enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_LOADING };
|
||||
|
||||
class cAudioManager
|
||||
{
|
||||
public:
|
||||
bool8 m_bIsInitialised;
|
||||
bool8 m_bIsSurround; // used on PS2
|
||||
bool8 m_bReduceReleasingPriority;
|
||||
uint8 m_nActiveSamples;
|
||||
bool8 m_bDoubleVolume; // unused
|
||||
bool8 m_bDynamicAcousticModelingStatus;
|
||||
uint8 m_nChannelOffset;
|
||||
float m_fSpeedOfSound;
|
||||
bool8 m_bTimerJustReset;
|
||||
uint32 m_nTimer;
|
||||
tSound m_sQueueSample;
|
||||
uint8 m_nActiveQueue;
|
||||
tSound m_aRequestedQueue[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_aRequestedOrderList[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_nRequestedCount[NUM_SOUND_QUEUES];
|
||||
tSound m_asActiveSamples[NUM_CHANNELS_GENERIC];
|
||||
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
|
||||
uint32 m_aAudioEntityOrderList[NUM_AUDIOENTITIES];
|
||||
uint32 m_nAudioEntitiesCount;
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
|
||||
float m_afReflectionsDistances[MAX_REFLECTIONS];
|
||||
#endif
|
||||
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
||||
|
||||
// miami
|
||||
bool8 m_bIsPlayerShutUp;
|
||||
uint8 m_nPlayerMood;
|
||||
uint32 m_nPlayerMoodTimer;
|
||||
uint32 field_4B38_vc;
|
||||
bool8 m_bGenericSfx;
|
||||
|
||||
cPedComments m_sPedComments;
|
||||
int32 m_nFireAudioEntity;
|
||||
int32 m_nWaterCannonEntity;
|
||||
int32 m_nPoliceChannelEntity;
|
||||
cPoliceRadioQueue m_sPoliceRadioQueue;
|
||||
cAMCrime m_aCrimes[10];
|
||||
int32 m_nFrontEndEntity;
|
||||
int32 m_nCollisionEntity;
|
||||
cAudioCollisionManager m_sCollisionManager;
|
||||
int32 m_nProjectileEntity;
|
||||
int32 m_nEscalatorEntity;
|
||||
int32 m_nExtraSoundsEntity;
|
||||
#ifdef GTA_BRIDGE
|
||||
int32 m_nBridgeEntity;
|
||||
#endif
|
||||
|
||||
// Mission audio stuff
|
||||
// So instead of making an array of struct they've added [MISSION_AUDIO_SLOTS] to every field...
|
||||
// Only someone with a VERY EXTRAORDINARY mind could have come up with that
|
||||
CVector m_vecMissionAudioPosition[MISSION_AUDIO_SLOTS];
|
||||
bool8 m_bIsMissionAudio2D[MISSION_AUDIO_SLOTS];
|
||||
uint32 m_nMissionAudioSampleIndex[MISSION_AUDIO_SLOTS];
|
||||
uint8 m_nMissionAudioLoadingStatus[MISSION_AUDIO_SLOTS];
|
||||
uint8 m_nMissionAudioPlayStatus[MISSION_AUDIO_SLOTS];
|
||||
bool8 m_bIsMissionAudioPlaying[MISSION_AUDIO_SLOTS];
|
||||
int32 m_nMissionAudioFramesToPlay[MISSION_AUDIO_SLOTS]; // possibly unsigned
|
||||
bool8 m_bIsMissionAudioAllowedToPlay[MISSION_AUDIO_SLOTS];
|
||||
bool8 m_bIsMissionAudioPhoneCall[MISSION_AUDIO_SLOTS];
|
||||
uint8 m_nGlobalSfxVolumeMultiplier; // used to lower sfx volume during phone calls
|
||||
|
||||
int32 m_anRandomTable[5];
|
||||
uint8 m_nTimeSpent;
|
||||
bool8 m_bIsPaused;
|
||||
bool8 m_bWasPaused;
|
||||
uint32 m_FrameCounter;
|
||||
|
||||
cAudioManager();
|
||||
~cAudioManager();
|
||||
|
||||
void Initialise();
|
||||
void Terminate();
|
||||
void Service();
|
||||
int32 CreateEntity(eAudioType type, void *entity);
|
||||
void DestroyEntity(int32 id); // inlined in vc
|
||||
bool8 GetEntityStatus(int32 id);
|
||||
void SetEntityStatus(int32 id, bool8 status);
|
||||
void *GetEntityPointer(int32 id);
|
||||
void PlayOneShot(int32 index, uint16 sound, float vol);
|
||||
void SetEffectsMasterVolume(uint8 volume);
|
||||
void SetMusicMasterVolume(uint8 volume);
|
||||
void SetMP3BoostVolume(uint8 volume);
|
||||
void SetEffectsFadeVol(uint8 volume);
|
||||
void SetMusicFadeVol(uint8 volume);
|
||||
void SetOutputMode(bool8 surround);
|
||||
void ResetTimers(uint32 time);
|
||||
void DestroyAllGameCreatedEntities();
|
||||
|
||||
#ifdef GTA_PC
|
||||
uint8 GetNum3DProvidersAvailable();
|
||||
char *Get3DProviderName(uint8 id);
|
||||
int8 GetCurrent3DProviderIndex();
|
||||
int8 AutoDetect3DProviders();
|
||||
int8 SetCurrent3DProvider(uint8 which);
|
||||
void SetSpeakerConfig(int32 conf);
|
||||
bool8 IsMP3RadioChannelAvailable();
|
||||
void ReleaseDigitalHandle();
|
||||
void ReacquireDigitalHandle();
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
void SetDynamicAcousticModelingStatus(bool8 status);
|
||||
#endif
|
||||
bool8 CheckForAnAudioFileOnCD();
|
||||
char GetCDAudioDriveLetter();
|
||||
bool8 IsAudioInitialised();
|
||||
#endif
|
||||
|
||||
void ServiceSoundEffects();
|
||||
uint8 ComputeVolume(uint8 emittingVolume, float maxDistance, float distance);
|
||||
void TranslateEntity(Const CVector *v1, CVector *v2);
|
||||
int32 ComputeFrontRearMix(float, CVector *);
|
||||
int32 ComputePan(float, CVector *);
|
||||
uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier);
|
||||
int32 RandomDisplacement(uint32 seed);
|
||||
void InterrogateAudioEntities(); // inlined
|
||||
void AddSampleToRequestedQueue();
|
||||
void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
void AddReflectionsToRequestedQueue();
|
||||
void UpdateReflections();
|
||||
#endif
|
||||
void AddReleasingSounds();
|
||||
void ProcessActiveQueues();
|
||||
void ClearRequestedQueue(); // inlined in vc
|
||||
void ClearActiveSamples();
|
||||
void GenerateIntegerRandomNumberTable();
|
||||
#ifdef GTA_PS2
|
||||
void LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code
|
||||
#endif
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
|
||||
void AdjustSamplesVolume(); // inlined
|
||||
uint8 ComputeEmittingVolume(uint8 emittingVolume, float maxDistance, float distance); // inlined
|
||||
#endif
|
||||
|
||||
// audio logic
|
||||
void PreInitialiseGameSpecificSetup();
|
||||
void PostInitialiseGameSpecificSetup();
|
||||
void PreTerminateGameSpecificShutdown();
|
||||
void PostTerminateGameSpecificShutdown();
|
||||
void ResetAudioLogicTimers(uint32 timer);
|
||||
void ProcessReverb();
|
||||
float GetDistanceSquared(const CVector &v); // inlined in vc
|
||||
void CalculateDistance(bool8 &condition, float dist);
|
||||
CVehicle *FindVehicleOfPlayer();
|
||||
void ProcessSpecial();
|
||||
void ProcessEntity(int32 sound);
|
||||
void ProcessPhysical(int32 id);
|
||||
|
||||
// vehicles
|
||||
void ProcessVehicle(CVehicle *vehicle);
|
||||
bool8 ProcessCarHeli(cVehicleParams ¶ms);
|
||||
void ProcessRainOnVehicle(cVehicleParams ¶ms);
|
||||
bool8 ProcessReverseGear(cVehicleParams ¶ms);
|
||||
void ProcessModelHeliVehicle(cVehicleParams ¶ms);
|
||||
void ProcessModelVehicle(cVehicleParams ¶ms);
|
||||
bool8 ProcessVehicleFlatTyre(cVehicleParams ¶ms);
|
||||
bool8 ProcessVehicleRoadNoise(cVehicleParams ¶ms);
|
||||
bool8 ProcessWetRoadNoise(cVehicleParams ¶ms);
|
||||
bool8 ProcessVehicleEngine(cVehicleParams ¶ms);
|
||||
void UpdateGasPedalAudio(CVehicle *veh, int vehType);
|
||||
void PlayerJustGotInCar();
|
||||
void PlayerJustLeftCar();
|
||||
void AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping);
|
||||
void ProcessCesna(cVehicleParams ¶ms);
|
||||
void ProcessPlayersVehicleEngine(cVehicleParams ¶ms, CVehicle *veh);
|
||||
bool8 ProcessVehicleSkidding(cVehicleParams ¶ms);
|
||||
float GetVehicleDriveWheelSkidValue(CVehicle *veh, tWheelState wheelState, float gasPedalAudio, cTransmission *transmission, float velocityChange);
|
||||
float GetVehicleNonDriveWheelSkidValue(CVehicle *veh, tWheelState wheelState, cTransmission *transmission, float velocityChange);
|
||||
bool8 ProcessVehicleHorn(cVehicleParams ¶ms);
|
||||
bool8 UsesSiren(cVehicleParams ¶ms);
|
||||
bool8 UsesSirenSwitching(cVehicleParams ¶ms);
|
||||
bool8 ProcessVehicleSirenOrAlarm(cVehicleParams ¶ms);
|
||||
bool8 UsesReverseWarning(uint32 model);
|
||||
bool8 ProcessVehicleReverseWarning(cVehicleParams ¶ms);
|
||||
bool8 ProcessVehicleDoors(cVehicleParams ¶ms);
|
||||
bool8 ProcessAirBrakes(cVehicleParams ¶ms);
|
||||
bool8 HasAirBrakes(uint32 model);
|
||||
bool8 ProcessEngineDamage(cVehicleParams ¶ms);
|
||||
bool8 ProcessCarBombTick(cVehicleParams ¶ms);
|
||||
void ProcessVehicleOneShots(cVehicleParams ¶ms);
|
||||
#ifdef GTA_TRAIN
|
||||
bool8 ProcessTrainNoise(cVehicleParams ¶ms);
|
||||
#endif
|
||||
bool8 ProcessBoatEngine(cVehicleParams ¶ms);
|
||||
bool8 ProcessBoatMovingOverWater(cVehicleParams ¶ms);
|
||||
void ProcessPlane(cVehicleParams ¶ms);
|
||||
void ProcessJumbo(cVehicleParams ¶ms);
|
||||
void ProcessJumboTaxi();
|
||||
void ProcessJumboAccel(CPlane *plane);
|
||||
void ProcessJumboTakeOff(CPlane *plane);
|
||||
void ProcessJumboFlying();
|
||||
void ProcessJumboLanding(CPlane *plane);
|
||||
void ProcessJumboDecel(CPlane *plane);
|
||||
bool8 SetupJumboTaxiSound(uint8 vol);
|
||||
bool8 SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
|
||||
bool8 SetupJumboEngineSound(uint8 vol, uint32 freq);
|
||||
bool8 SetupJumboFlySound(uint8 emittingVol);
|
||||
bool8 SetupJumboRumbleSound(uint8 emittingVol);
|
||||
int32 GetJumboTaxiFreq(); // inlined in vc
|
||||
|
||||
// peds
|
||||
void ProcessPed(CPhysical *ped);
|
||||
void ProcessPedOneShots(cPedParams ¶ms);
|
||||
void SetPedTalkingStatus(CPed *ped, bool8 status);
|
||||
void SetPlayersMood(uint8 mood, uint32 time);
|
||||
void ProcessPlayerMood();
|
||||
|
||||
// ped comments
|
||||
void SetupPedComments(cPedParams ¶ms, uint16 sound);
|
||||
uint32 GetPedCommentSfx(CPed *ped, uint16 sound);
|
||||
void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset);
|
||||
uint32 GetPlayerTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetGenericMaleTalkSfx(CPed *ped, uint16 sound); // inlined in vc
|
||||
uint32 GetGenericFemaleTalkSfx(CPed *ped, uint16 sound); // inlined in vc
|
||||
uint32 GetDefaultTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetCopTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetSwatTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetFBITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetArmyTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetMedicTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetFiremanTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYG1TalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYG2TalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFOSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMYSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMOSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYRITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFORITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMYRITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMORITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFOBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMYBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMOBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYBUTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYMDTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYCGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFYPRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHFOTRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMOTRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMOCATalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYCRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFYSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFOSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMOSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFYRITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFORITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYRITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFYBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFOBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMOBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYBUTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFYPRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBFOTRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMOTRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYPITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMYBBTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYCRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYSKTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYSKTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFOSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMOSTTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYRITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFORITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYRITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMORITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFOBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMOBETalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYCWTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYGOTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFOGOTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMOGOTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYLGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYLGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYBUTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYBUTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMOBUTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYPRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFOTRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMOTRTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYPITalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMOCATalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYSHTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFOSHTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetJFOTOTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetJMOTOTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHNTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBKTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetCBTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetSGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetCLTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetGDTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetPGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetViceWhiteTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetViceBlackTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetBMODKTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetHMYAPTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWFYJGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetWMYJGTalkSfx(CPed *ped, uint16 sound);
|
||||
uint32 GetSpecialCharacterTalkSfx(CPed *ped, int32 model, uint16 sound);
|
||||
|
||||
void DebugPlayPedComment(int32 sound);
|
||||
|
||||
// particles
|
||||
void ProcessExplosions(int32 explosion);
|
||||
void ProcessFires(int32 entity);
|
||||
void ProcessWaterCannon(int32);
|
||||
|
||||
// script objects
|
||||
void ProcessScriptObject(int32 id);
|
||||
void ProcessOneShotScriptObject(uint8 sound);
|
||||
void ProcessLoopingScriptObject(uint8 sound);
|
||||
|
||||
// misc
|
||||
void ProcessWeather(int32 id);
|
||||
void ProcessFrontEnd();
|
||||
//void ProcessCrane();
|
||||
void ProcessProjectiles();
|
||||
void ProcessEscalators();
|
||||
void ProcessExtraSounds();
|
||||
void ProcessGarages();
|
||||
void ProcessFireHydrant();
|
||||
|
||||
#ifdef GTA_BRIDGE
|
||||
void ProcessBridge();
|
||||
void ProcessBridgeWarning();
|
||||
void ProcessBridgeMotor();
|
||||
void ProcessBridgeOneShots();
|
||||
#endif
|
||||
|
||||
// mission audio
|
||||
const char *GetMissionAudioLoadedLabel(uint8 slot);
|
||||
bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission);
|
||||
void PreloadMissionAudio(uint8 slot, Const char *name);
|
||||
uint8 GetMissionAudioLoadingStatus(uint8 slot);
|
||||
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
|
||||
void PlayLoadedMissionAudio(uint8 slot);
|
||||
bool8 ShouldDuckMissionAudio(uint8 slot);
|
||||
bool8 IsMissionAudioSamplePlaying(uint8 slot);
|
||||
bool8 IsMissionAudioSampleFinished(uint8 slot);
|
||||
void ClearMissionAudio(uint8 slot); // inlined in vc
|
||||
void ProcessMissionAudioSlot(uint8 slot);
|
||||
void ProcessMissionAudio();
|
||||
|
||||
// police radio
|
||||
void InitialisePoliceRadioZones();
|
||||
void InitialisePoliceRadio();
|
||||
void ResetPoliceRadio();
|
||||
void SetMissionScriptPoliceAudio(uint32 sfx); // inlined and optimized
|
||||
int8 GetMissionScriptPoliceAudioPlayingStatus();
|
||||
void DoPoliceRadioCrackle();
|
||||
void ServicePoliceRadio();
|
||||
void ServicePoliceRadioChannel(uint8 wantedLevel);
|
||||
bool8 SetupCrimeReport();
|
||||
void SetupSuspectLastSeenReport();
|
||||
void ReportCrime(eCrimeType crime, const CVector &pos);
|
||||
void PlaySuspectLastSeen(float x, float y, float z);
|
||||
void AgeCrimes(); // inlined in vc
|
||||
|
||||
// collision stuff
|
||||
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float intensity2);
|
||||
void ServiceCollisions();
|
||||
void SetUpOneShotCollisionSound(const cAudioCollision &col);
|
||||
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
|
||||
float GetCollisionOneShotRatio(uint32 a, float b);
|
||||
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c); // not used
|
||||
float GetCollisionRatio(float a, float b, float c, float d); // inlined in vc
|
||||
|
||||
float Sqrt(float v) const { return v <= 0.0f ? 0.0f : ::Sqrt(v); }
|
||||
};
|
||||
|
||||
/*
|
||||
Manual loop points are not on PS2 so let's have these macros to avoid massive ifndefs.
|
||||
Setting these manually was pointless anyway since they never change from sdt values.
|
||||
What were they thinking?
|
||||
*/
|
||||
#ifndef GTA_PS2
|
||||
#define RESET_LOOP_OFFSETS \
|
||||
m_sQueueSample.m_nLoopStart = 0; \
|
||||
m_sQueueSample.m_nLoopEnd = -1;
|
||||
#define SET_LOOP_OFFSETS(sample) \
|
||||
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(sample); \
|
||||
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(sample);
|
||||
#else
|
||||
#define RESET_LOOP_OFFSETS
|
||||
#define SET_LOOP_OFFSETS(sample)
|
||||
#endif
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
#define SET_EMITTING_VOLUME(vol) m_sQueueSample.m_nEmittingVolume = vol
|
||||
#else
|
||||
#define SET_EMITTING_VOLUME(vol)
|
||||
#endif
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
#define SET_SOUND_REFLECTION(b) m_sQueueSample.m_bReflections = b
|
||||
#else
|
||||
#define SET_SOUND_REFLECTION(b)
|
||||
#endif
|
||||
#ifdef AUDIO_REVERB
|
||||
#define SET_SOUND_REVERB(b) m_sQueueSample.m_bReverb = b
|
||||
#else
|
||||
#define SET_SOUND_REVERB(b)
|
||||
#endif
|
||||
|
||||
#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
|
||||
static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
|
||||
#endif
|
||||
|
||||
extern cAudioManager AudioManager;
|
||||
|
||||
enum
|
||||
{
|
||||
PED_COMMENT_VOLUME = 127,
|
||||
PED_COMMENT_VOLUME_BEHIND_WALL = 31,
|
||||
COLLISION_MAX_DIST = 60,
|
||||
};
|
||||
10130
miami/audio/AudioSamples.h
Normal file
103
miami/audio/AudioScriptObject.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "AudioScriptObject.h"
|
||||
#include "Pools.h"
|
||||
#include "DMAudio.h"
|
||||
#include "SaveBuf.h"
|
||||
|
||||
cAudioScriptObject::cAudioScriptObject()
|
||||
{
|
||||
Reset();
|
||||
};
|
||||
|
||||
cAudioScriptObject::~cAudioScriptObject()
|
||||
{
|
||||
Reset();
|
||||
};
|
||||
|
||||
void
|
||||
cAudioScriptObject::Reset()
|
||||
{
|
||||
AudioId = SCRIPT_SOUND_INVALID;
|
||||
Posn = CVector(0.0f, 0.0f, 0.0f);
|
||||
AudioEntity = AEHANDLE_NONE;
|
||||
}
|
||||
|
||||
void *
|
||||
cAudioScriptObject::operator new(size_t sz) throw()
|
||||
{
|
||||
return CPools::GetAudioScriptObjectPool()->New();
|
||||
}
|
||||
|
||||
void *
|
||||
cAudioScriptObject::operator new(size_t sz, int handle) throw()
|
||||
{
|
||||
return CPools::GetAudioScriptObjectPool()->New(handle);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioScriptObject::operator delete(void *p, size_t sz) throw()
|
||||
{
|
||||
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioScriptObject::operator delete(void *p, int handle) throw()
|
||||
{
|
||||
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioScriptObject::LoadAllAudioScriptObjects(uint8 *buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
|
||||
CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
int32 pool_size;
|
||||
ReadSaveBuf(&pool_size, buf);
|
||||
for (int32 i = 0; i < pool_size; i++) {
|
||||
int32 handle;
|
||||
ReadSaveBuf(&handle, buf);
|
||||
cAudioScriptObject *p = new(handle) cAudioScriptObject;
|
||||
assert(p != nil);
|
||||
ReadSaveBuf(p, buf);
|
||||
p->AudioEntity = DMAudio.CreateLoopingScriptObject(p);
|
||||
}
|
||||
|
||||
VALIDATESAVEBUF(size);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioScriptObject::SaveAllAudioScriptObjects(uint8 *buf, uint32 *size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
|
||||
int32 pool_size = CPools::GetAudioScriptObjectPool()->GetNoOfUsedSpaces();
|
||||
*size = SAVE_HEADER_SIZE + sizeof(int32) + pool_size * (sizeof(cAudioScriptObject) + sizeof(int32));
|
||||
WriteSaveHeader(buf, 'A', 'U', 'D', '\0', *size - SAVE_HEADER_SIZE);
|
||||
WriteSaveBuf(buf, pool_size);
|
||||
|
||||
int32 i = CPools::GetAudioScriptObjectPool()->GetSize();
|
||||
while (i--) {
|
||||
cAudioScriptObject *p = CPools::GetAudioScriptObjectPool()->GetSlot(i);
|
||||
if (p != nil) {
|
||||
WriteSaveBuf(buf, CPools::GetAudioScriptObjectPool()->GetIndex(p));
|
||||
WriteSaveBuf(buf, *p);
|
||||
}
|
||||
}
|
||||
|
||||
VALIDATESAVEBUF(*size);
|
||||
}
|
||||
|
||||
void
|
||||
PlayOneShotScriptObject(uint8 id, CVector const &pos)
|
||||
{
|
||||
if (!DMAudio.IsAudioInitialised()) return;
|
||||
|
||||
cAudioScriptObject *audioScriptObject = new cAudioScriptObject();
|
||||
audioScriptObject->Posn = pos;
|
||||
audioScriptObject->AudioId = id;
|
||||
audioScriptObject->AudioEntity = AEHANDLE_NONE;
|
||||
DMAudio.CreateOneShotScriptObject(audioScriptObject);
|
||||
}
|
||||
26
miami/audio/AudioScriptObject.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
class cAudioScriptObject
|
||||
{
|
||||
public:
|
||||
int16 AudioId;
|
||||
CVector Posn;
|
||||
int32 AudioEntity;
|
||||
|
||||
cAudioScriptObject();
|
||||
~cAudioScriptObject();
|
||||
|
||||
void Reset(); /// ok
|
||||
|
||||
static void* operator new(size_t) throw();
|
||||
static void* operator new(size_t, int) throw();
|
||||
static void operator delete(void*, size_t) throw();
|
||||
static void operator delete(void*, int) throw();
|
||||
|
||||
static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size);
|
||||
static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size);
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAudioScriptObject, 20);
|
||||
|
||||
extern void PlayOneShotScriptObject(uint8 id, CVector const &pos);
|
||||
408
miami/audio/DMAudio.cpp
Normal file
@@ -0,0 +1,408 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "DMAudio.h"
|
||||
#include "MusicManager.h"
|
||||
#include "AudioManager.h"
|
||||
#include "AudioScriptObject.h"
|
||||
#include "sampman.h"
|
||||
|
||||
cDMAudio DMAudio;
|
||||
|
||||
void
|
||||
cDMAudio::Initialise(void)
|
||||
{
|
||||
AudioManager.Initialise();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::Terminate(void)
|
||||
{
|
||||
AudioManager.Terminate();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::Service(void)
|
||||
{
|
||||
AudioManager.Service();
|
||||
}
|
||||
|
||||
int32
|
||||
cDMAudio::CreateEntity(eAudioType type, void *UID)
|
||||
{
|
||||
return AudioManager.CreateEntity(type, (CPhysical *)UID);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::DestroyEntity(int32 audioEntity)
|
||||
{
|
||||
AudioManager.DestroyEntity(audioEntity);
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::GetEntityStatus(int32 audioEntity)
|
||||
{
|
||||
return AudioManager.GetEntityStatus(audioEntity);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status)
|
||||
{
|
||||
AudioManager.SetEntityStatus(audioEntity, status);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayOneShot(int32 audioEntity, uint16 oneShot, float volume)
|
||||
{
|
||||
AudioManager.PlayOneShot(audioEntity, oneShot, volume);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::DestroyAllGameCreatedEntities(void)
|
||||
{
|
||||
AudioManager.DestroyAllGameCreatedEntities();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetOutputMode(bool8 surround)
|
||||
{
|
||||
AudioManager.SetOutputMode(surround);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetMP3BoostVolume(uint8 volume)
|
||||
{
|
||||
uint8 vol = volume;
|
||||
if (vol > MAX_VOLUME) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetMP3BoostVolume(vol);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetEffectsMasterVolume(uint8 volume)
|
||||
{
|
||||
uint8 vol = volume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetEffectsMasterVolume(vol);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetMusicMasterVolume(uint8 volume)
|
||||
{
|
||||
uint8 vol = volume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetMusicMasterVolume(vol);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetEffectsFadeVol(uint8 volume)
|
||||
{
|
||||
uint8 vol = volume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetEffectsFadeVol(vol);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetMusicFadeVol(uint8 volume)
|
||||
{
|
||||
uint8 vol = volume;
|
||||
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
|
||||
|
||||
AudioManager.SetMusicFadeVol(vol);
|
||||
}
|
||||
|
||||
uint8
|
||||
cDMAudio::GetNum3DProvidersAvailable(void)
|
||||
{
|
||||
return AudioManager.GetNum3DProvidersAvailable();
|
||||
}
|
||||
|
||||
char *
|
||||
cDMAudio::Get3DProviderName(uint8 id)
|
||||
{
|
||||
return AudioManager.Get3DProviderName(id);
|
||||
}
|
||||
|
||||
int8 cDMAudio::AutoDetect3DProviders(void)
|
||||
{
|
||||
return AudioManager.AutoDetect3DProviders();
|
||||
}
|
||||
|
||||
int8
|
||||
cDMAudio::GetCurrent3DProviderIndex(void)
|
||||
{
|
||||
return AudioManager.GetCurrent3DProviderIndex();
|
||||
}
|
||||
|
||||
int8
|
||||
cDMAudio::SetCurrent3DProvider(uint8 which)
|
||||
{
|
||||
return AudioManager.SetCurrent3DProvider(which);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetSpeakerConfig(int32 config)
|
||||
{
|
||||
AudioManager.SetSpeakerConfig(config);
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::IsMP3RadioChannelAvailable(void)
|
||||
{
|
||||
return AudioManager.IsMP3RadioChannelAvailable();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ReleaseDigitalHandle(void)
|
||||
{
|
||||
AudioManager.ReleaseDigitalHandle();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ReacquireDigitalHandle(void)
|
||||
{
|
||||
AudioManager.ReacquireDigitalHandle();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
|
||||
{
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
AudioManager.SetDynamicAcousticModelingStatus(status);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::CheckForAnAudioFileOnCD(void)
|
||||
{
|
||||
return AudioManager.CheckForAnAudioFileOnCD();
|
||||
}
|
||||
|
||||
char
|
||||
cDMAudio::GetCDAudioDriveLetter(void)
|
||||
{
|
||||
return AudioManager.GetCDAudioDriveLetter();
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::IsAudioInitialised(void)
|
||||
{
|
||||
return AudioManager.IsAudioInitialised();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ResetPoliceRadio()
|
||||
{
|
||||
AudioManager.ResetPoliceRadio();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
|
||||
{
|
||||
AudioManager.ReportCrime(crime, pos);
|
||||
}
|
||||
|
||||
int32
|
||||
cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject)
|
||||
{
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
AudioManager.SetEntityStatus(audioEntity, TRUE);
|
||||
|
||||
return audioEntity;
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::DestroyLoopingScriptObject(int32 audioEntity)
|
||||
{
|
||||
AudioManager.DestroyEntity(audioEntity);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject)
|
||||
{
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
{
|
||||
AudioManager.SetEntityStatus(audioEntity, TRUE);
|
||||
AudioManager.PlayOneShot(audioEntity, scriptObject->AudioId, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlaySuspectLastSeen(float x, float y, float z)
|
||||
{
|
||||
AudioManager.PlaySuspectLastSeen(x, y, z);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ReportCollision(CEntity *entityA, CEntity *entityB, uint8 surfaceTypeA, uint8 surfaceTypeB, float collisionPower, float velocity)
|
||||
{
|
||||
AudioManager.ReportCollision(entityA, entityB, surfaceTypeA, surfaceTypeB, collisionPower, velocity);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayFrontEndSound(uint16 frontend, uint32 volume)
|
||||
{
|
||||
AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, frontend, (float)volume);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayRadioAnnouncement(uint32 announcement)
|
||||
{
|
||||
MusicManager.PlayAnnouncement(announcement);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayFrontEndTrack(uint32 track, bool8 frontendFlag)
|
||||
{
|
||||
MusicManager.PlayFrontEndTrack(track, frontendFlag);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::StopFrontEndTrack(void)
|
||||
{
|
||||
MusicManager.StopFrontEndTrack();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ResetTimers(uint32 time)
|
||||
{
|
||||
AudioManager.ResetTimers(time);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ChangeMusicMode(uint8 mode)
|
||||
{
|
||||
MusicManager.ChangeMusicMode(mode);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PreloadCutSceneMusic(uint32 track)
|
||||
{
|
||||
MusicManager.PreloadCutSceneMusic(track);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayPreloadedCutSceneMusic(void)
|
||||
{
|
||||
MusicManager.PlayPreloadedCutSceneMusic();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::StopCutSceneMusic(void)
|
||||
{
|
||||
MusicManager.StopCutSceneMusic();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PreloadMissionAudio(uint8 slot, Const char *missionAudio)
|
||||
{
|
||||
AudioManager.PreloadMissionAudio(slot, missionAudio);
|
||||
}
|
||||
|
||||
uint8
|
||||
cDMAudio::GetMissionAudioLoadingStatus(uint8 slot)
|
||||
{
|
||||
return AudioManager.GetMissionAudioLoadingStatus(slot);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetMissionAudioLocation(uint8 slot, float x, float y, float z)
|
||||
{
|
||||
AudioManager.SetMissionAudioLocation(slot, x, y, z);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::PlayLoadedMissionAudio(uint8 slot)
|
||||
{
|
||||
AudioManager.PlayLoadedMissionAudio(slot);
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::IsMissionAudioSamplePlaying(uint8 slot)
|
||||
{
|
||||
return AudioManager.IsMissionAudioSamplePlaying(slot);
|
||||
}
|
||||
|
||||
bool8
|
||||
cDMAudio::IsMissionAudioSampleFinished(uint8 slot)
|
||||
{
|
||||
return AudioManager.IsMissionAudioSampleFinished(slot);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ClearMissionAudio(uint8 slot)
|
||||
{
|
||||
AudioManager.ClearMissionAudio(slot);
|
||||
}
|
||||
|
||||
const char *
|
||||
cDMAudio::GetMissionAudioLoadedLabel(uint8 slot)
|
||||
{
|
||||
return AudioManager.GetMissionAudioLoadedLabel(slot);
|
||||
}
|
||||
|
||||
uint8
|
||||
cDMAudio::GetRadioInCar(void)
|
||||
{
|
||||
return MusicManager.GetRadioInCar();
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetRadioInCar(uint32 radio)
|
||||
{
|
||||
MusicManager.SetRadioInCar(radio);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetRadioChannel(uint32 radio, int32 pos)
|
||||
{
|
||||
MusicManager.SetRadioChannelByScript(radio, pos);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetStartingTrackPositions(bool8 isStartGame)
|
||||
{
|
||||
MusicManager.SetStartingTrackPositions(isStartGame);
|
||||
}
|
||||
|
||||
float *
|
||||
cDMAudio::GetListenTimeArray()
|
||||
{
|
||||
return MusicManager.GetListenTimeArray();
|
||||
}
|
||||
|
||||
uint32
|
||||
cDMAudio::GetFavouriteRadioStation()
|
||||
{
|
||||
return MusicManager.GetFavouriteRadioStation();
|
||||
}
|
||||
|
||||
int32
|
||||
cDMAudio::GetRadioPosition(uint32 station)
|
||||
{
|
||||
return MusicManager.GetRadioPosition(station);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetPedTalkingStatus(CPed *ped, bool8 status)
|
||||
{
|
||||
return AudioManager.SetPedTalkingStatus(ped, status);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::SetPlayersMood(uint8 mood, uint32 time)
|
||||
{
|
||||
return AudioManager.SetPlayersMood(mood, time);
|
||||
}
|
||||
|
||||
void
|
||||
cDMAudio::ShutUpPlayerTalking(bool8 state)
|
||||
{
|
||||
AudioManager.m_bIsPlayerShutUp = state;
|
||||
}
|
||||
107
miami/audio/DMAudio.h
Normal file
@@ -0,0 +1,107 @@
|
||||
#pragma once
|
||||
|
||||
#include "audio_enums.h"
|
||||
#include "soundlist.h"
|
||||
#include "Crime.h"
|
||||
|
||||
#define AEHANDLE_IS_FAILED(h) ((h)<0)
|
||||
#define AEHANDLE_IS_OK(h) ((h)>=0)
|
||||
|
||||
#define NO_AUDIO_PROVIDER -3
|
||||
#define AUDIO_PROVIDER_NOT_DETERMINED -99
|
||||
|
||||
class cAudioScriptObject;
|
||||
class CEntity;
|
||||
|
||||
class cDMAudio
|
||||
{
|
||||
public:
|
||||
~cDMAudio()
|
||||
{ }
|
||||
|
||||
void Initialise(void);
|
||||
void Terminate(void);
|
||||
void Service(void);
|
||||
|
||||
int32 CreateEntity(eAudioType type, void *UID);
|
||||
void DestroyEntity(int32 audioEntity);
|
||||
bool8 GetEntityStatus(int32 audioEntity);
|
||||
void SetEntityStatus(int32 audioEntity, bool8 status);
|
||||
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
|
||||
void DestroyAllGameCreatedEntities(void);
|
||||
|
||||
void SetOutputMode(bool8 surround);
|
||||
void SetMP3BoostVolume(uint8 volume);
|
||||
void SetEffectsMasterVolume(uint8 volume);
|
||||
void SetMusicMasterVolume(uint8 volume);
|
||||
void SetEffectsFadeVol(uint8 volume);
|
||||
void SetMusicFadeVol(uint8 volume);
|
||||
|
||||
uint8 GetNum3DProvidersAvailable(void);
|
||||
char *Get3DProviderName(uint8 id);
|
||||
|
||||
int8 AutoDetect3DProviders(void);
|
||||
|
||||
int8 GetCurrent3DProviderIndex(void);
|
||||
int8 SetCurrent3DProvider(uint8 which);
|
||||
|
||||
void SetSpeakerConfig(int32 config);
|
||||
|
||||
bool8 IsMP3RadioChannelAvailable(void);
|
||||
|
||||
void ReleaseDigitalHandle(void);
|
||||
void ReacquireDigitalHandle(void);
|
||||
|
||||
void SetDynamicAcousticModelingStatus(bool8 status);
|
||||
|
||||
bool8 CheckForAnAudioFileOnCD(void);
|
||||
|
||||
char GetCDAudioDriveLetter(void);
|
||||
bool8 IsAudioInitialised(void);
|
||||
|
||||
void ResetPoliceRadio();
|
||||
void ReportCrime(eCrimeType crime, CVector const &pos);
|
||||
|
||||
int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject);
|
||||
void DestroyLoopingScriptObject(int32 audioEntity);
|
||||
void CreateOneShotScriptObject(cAudioScriptObject *scriptObject);
|
||||
|
||||
void PlaySuspectLastSeen(float x, float y, float z);
|
||||
|
||||
void ReportCollision(CEntity *entityA, CEntity *entityB, uint8 surfaceTypeA, uint8 surfaceTypeB, float collisionPower, float velocity);
|
||||
|
||||
void PlayFrontEndSound(uint16 frontend, uint32 volume);
|
||||
void PlayRadioAnnouncement(uint32 announcement);
|
||||
void PlayFrontEndTrack(uint32 track, bool8 frontendFlag);
|
||||
void StopFrontEndTrack(void);
|
||||
|
||||
void ResetTimers(uint32 time);
|
||||
|
||||
void ChangeMusicMode(uint8 mode);
|
||||
|
||||
void PreloadCutSceneMusic(uint32 track);
|
||||
void PlayPreloadedCutSceneMusic(void);
|
||||
void StopCutSceneMusic(void);
|
||||
|
||||
void PreloadMissionAudio(uint8 slot, Const char *missionAudio);
|
||||
uint8 GetMissionAudioLoadingStatus(uint8 slot);
|
||||
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
|
||||
void PlayLoadedMissionAudio(uint8 slot);
|
||||
bool8 IsMissionAudioSamplePlaying(uint8 slot);
|
||||
bool8 IsMissionAudioSampleFinished(uint8 slot);
|
||||
void ClearMissionAudio(uint8 slot);
|
||||
const char *GetMissionAudioLoadedLabel(uint8 slot);
|
||||
|
||||
uint8 GetRadioInCar(void);
|
||||
void SetRadioInCar(uint32 radio);
|
||||
void SetRadioChannel(uint32 radio, int32 pos);
|
||||
|
||||
void SetStartingTrackPositions(bool8 isStartGame);
|
||||
float *GetListenTimeArray();
|
||||
uint32 GetFavouriteRadioStation();
|
||||
int32 GetRadioPosition(uint32 station);
|
||||
void SetPedTalkingStatus(class CPed *ped, bool8 status);
|
||||
void SetPlayersMood(uint8 mood, uint32 time);
|
||||
void ShutUpPlayerTalking(bool8 state);
|
||||
};
|
||||
extern cDMAudio DMAudio;
|
||||
1423
miami/audio/MusicManager.cpp
Normal file
113
miami/audio/MusicManager.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#pragma once
|
||||
|
||||
#include "audio_enums.h"
|
||||
|
||||
class tStreamedSample
|
||||
{
|
||||
public:
|
||||
uint32 m_nLength;
|
||||
uint32 m_nPosition;
|
||||
uint32 m_nLastPosCheckTimer;
|
||||
};
|
||||
|
||||
class CVehicle;
|
||||
class CPed;
|
||||
|
||||
class cMusicManager
|
||||
{
|
||||
public:
|
||||
bool8 m_bIsInitialised;
|
||||
bool8 m_bDisabled;
|
||||
bool8 m_bSetNextStation;
|
||||
uint8 m_nVolumeLatency;
|
||||
uint8 m_nCurrentVolume;
|
||||
uint8 m_nMaxVolume;
|
||||
uint32 m_nAnnouncement;
|
||||
bool8 m_bAnnouncementInProgress;
|
||||
tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS];
|
||||
bool8 m_bResetTimers;
|
||||
uint32 m_nResetTime;
|
||||
bool8 m_bRadioSetByScript;
|
||||
uint8 m_nRadioStationScript;
|
||||
int32 m_nRadioPosition;
|
||||
uint32 m_nRadioInCar;
|
||||
uint32 m_nFrontendTrack;
|
||||
uint32 m_nPlayingTrack;
|
||||
uint8 m_nUpcomingMusicMode;
|
||||
uint8 m_nMusicMode;
|
||||
bool8 m_FrontendLoopFlag;
|
||||
bool8 m_bTrackChangeStarted;
|
||||
uint32 m_nNextTrack;
|
||||
bool8 m_nNextLoopFlag;
|
||||
bool8 m_bVerifyNextTrackStartedToPlay;
|
||||
bool8 m_bGameplayAllowsRadio;
|
||||
bool8 m_bRadioStreamReady;
|
||||
int8 nFramesSinceCutsceneEnded;
|
||||
bool8 m_bUserResumedGame;
|
||||
bool8 m_bMusicModeChangeStarted;
|
||||
uint8 m_nMusicModeToBeSet;
|
||||
bool8 m_bEarlyFrontendTrack;
|
||||
float aListenTimeArray[NUM_RADIOS];
|
||||
float m_nLastTrackServiceTime;
|
||||
|
||||
public:
|
||||
cMusicManager();
|
||||
bool8 IsInitialised() { return m_bIsInitialised; }
|
||||
uint8 GetMusicMode() { return m_nMusicMode; }
|
||||
uint32 GetCurrentTrack() { return m_nPlayingTrack; }
|
||||
|
||||
void ResetMusicAfterReload();
|
||||
void SetStartingTrackPositions(bool8 isNewGameTimer);
|
||||
bool8 Initialise();
|
||||
void Terminate();
|
||||
|
||||
void ChangeMusicMode(uint8 mode);
|
||||
void StopFrontEndTrack();
|
||||
|
||||
bool8 PlayerInCar();
|
||||
void DisplayRadioStationName();
|
||||
|
||||
void PlayAnnouncement(uint32);
|
||||
void PlayFrontEndTrack(uint32, bool8);
|
||||
void PreloadCutSceneMusic(uint32);
|
||||
void PlayPreloadedCutSceneMusic(void);
|
||||
void StopCutSceneMusic(void);
|
||||
uint32 GetRadioInCar(void);
|
||||
void SetRadioInCar(uint32);
|
||||
void SetRadioChannelByScript(uint32, int32);
|
||||
|
||||
void ResetTimers(uint32);
|
||||
void Service();
|
||||
void ServiceFrontEndMode();
|
||||
void ServiceGameMode();
|
||||
void ServiceAmbience();
|
||||
void ServiceTrack(CVehicle *veh, CPed *ped);
|
||||
|
||||
bool8 UsesPoliceRadio(CVehicle *veh);
|
||||
bool8 UsesTaxiRadio(CVehicle *veh);
|
||||
uint32 GetTrackStartPos(uint32 track);
|
||||
|
||||
void ComputeAmbienceVol(bool8 reset, uint8& outVolume);
|
||||
bool8 ServiceAnnouncement();
|
||||
|
||||
uint32 GetCarTuning();
|
||||
uint32 GetNextCarTuning();
|
||||
bool8 ChangeRadioChannel();
|
||||
void RecordRadioStats();
|
||||
void SetUpCorrectAmbienceTrack();
|
||||
float *GetListenTimeArray();
|
||||
uint32 GetRadioPosition(uint32 station);
|
||||
uint32 GetFavouriteRadioStation();
|
||||
void SetMalibuClubTrackPos(uint8 pos);
|
||||
void SetStripClubTrackPos(uint8 pos);
|
||||
bool8 CheckForMusicInterruptions();
|
||||
|
||||
void Enable();
|
||||
void Disable();
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cMusicManager, 0x95C);
|
||||
|
||||
extern cMusicManager MusicManager;
|
||||
extern bool8 g_bAnnouncementReadPosAlready; // we have a symbol of this so it was declared in .h
|
||||
float GetHeightScale();
|
||||
750
miami/audio/PolRadio.cpp
Normal file
@@ -0,0 +1,750 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "DMAudio.h"
|
||||
|
||||
#include "AudioManager.h"
|
||||
|
||||
#include "AudioSamples.h"
|
||||
#include "MusicManager.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "PolRadio.h"
|
||||
#include "Replay.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "Zones.h"
|
||||
#include "sampman.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
struct tPoliceRadioZone {
|
||||
char m_aName[8];
|
||||
uint32 m_nSampleIndex;
|
||||
int32 field_12;
|
||||
};
|
||||
|
||||
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
|
||||
|
||||
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
|
||||
int8 g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
|
||||
bool8 gSpecialSuspectLastSeenReport;
|
||||
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
|
||||
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadioZones()
|
||||
{
|
||||
for (int32 i = 0; i < NUMAUDIOZONES; i++)
|
||||
memset(ZoneSfx[i].m_aName, 0, 8);
|
||||
|
||||
#define SETZONESFX(i, name, sample) \
|
||||
strcpy(ZoneSfx[i].m_aName, name); \
|
||||
ZoneSfx[i].m_nSampleIndex = sample;
|
||||
|
||||
SETZONESFX(0, "VICE_C", SFX_POLICE_RADIO_VICE_CITY);
|
||||
SETZONESFX(1, "IND_ZON", SFX_POLICE_RADIO_VICE_CITY_BEACH);
|
||||
SETZONESFX(2, "COM_ZON", SFX_POLICE_RADIO_VICE_CITY_MAINLAND);
|
||||
SETZONESFX(3, "BEACH1", SFX_POLICE_RADIO_OCEAN_BEACH);
|
||||
SETZONESFX(4, "BEACH2", SFX_POLICE_RADIO_WASHINGTON_BEACH);
|
||||
SETZONESFX(5, "BEACH3", SFX_POLICE_RADIO_VICE_POINT);
|
||||
SETZONESFX(6, "GOLFC", SFX_POLICE_RADIO_LEAF_LINKS);
|
||||
SETZONESFX(7, "STARI", SFX_POLICE_RADIO_STARFISH_ISLAND);
|
||||
SETZONESFX(8, "DOCKS", SFX_POLICE_RADIO_VICEPORT);
|
||||
SETZONESFX(9, "HAVANA", SFX_POLICE_RADIO_LITTLE_HAVANA);
|
||||
SETZONESFX(10, "HAITI", SFX_POLICE_RADIO_LITTLE_HAITI);
|
||||
SETZONESFX(11, "PORNI", SFX_POLICE_RADIO_PRAWN_ISLAND);
|
||||
SETZONESFX(12, "DTOWN", SFX_POLICE_RADIO_DOWNTOWN);
|
||||
SETZONESFX(13, "A_PORT", SFX_POLICE_RADIO_ESCOBAR_INTERNATIONAL);
|
||||
|
||||
#undef SETZONESFX
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::InitialisePoliceRadio()
|
||||
{
|
||||
m_sPoliceRadioQueue.Reset();
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_aCrimes); i++)
|
||||
m_aCrimes[i].type = CRIME_NONE;
|
||||
#if !defined(GTA_PS2) || defined(AUDIO_REVERB)
|
||||
SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE);
|
||||
#endif
|
||||
gSpecialSuspectLastSeenReport = FALSE;
|
||||
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
|
||||
gMinTimeToNextReport[i] = m_FrameCounter;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ResetPoliceRadio()
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
InitialisePoliceRadio();
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
|
||||
{
|
||||
if (!m_bIsInitialised) return;
|
||||
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) {
|
||||
g_nMissionAudioPlayingStatus = PLAY_STATUS_STOPPED;
|
||||
g_nMissionAudioSfx = sfx;
|
||||
}
|
||||
}
|
||||
|
||||
int8
|
||||
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus()
|
||||
{
|
||||
return g_nMissionAudioPlayingStatus;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::DoPoliceRadioCrackle()
|
||||
{
|
||||
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
|
||||
m_sQueueSample.m_nCounter = 0;
|
||||
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
|
||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_bIs2D = TRUE;
|
||||
m_sQueueSample.m_nPriority = 10;
|
||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
|
||||
SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE)
|
||||
m_sQueueSample.m_bStatic = FALSE;
|
||||
SET_SOUND_REVERB(FALSE);
|
||||
m_sQueueSample.m_nPan = 63;
|
||||
m_sQueueSample.m_nFramesToPlay = 3;
|
||||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServicePoliceRadio()
|
||||
{
|
||||
int32 wantedLevel = 0; // uninitialized variable
|
||||
static uint32 nLastSeen = 300;
|
||||
|
||||
if(!m_bIsInitialised) return;
|
||||
|
||||
if(!m_bIsPaused) {
|
||||
bool8 crimeReport = SetupCrimeReport();
|
||||
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||
return;
|
||||
#endif
|
||||
CPlayerPed *playerPed = FindPlayerPed();
|
||||
if (playerPed) {
|
||||
wantedLevel = playerPed->m_pWanted->GetWantedLevel();
|
||||
if (!crimeReport) {
|
||||
if (wantedLevel != 0) {
|
||||
if (nLastSeen != 0)
|
||||
#ifdef FIX_BUGS
|
||||
nLastSeen -= CTimer::GetLogicalFramesPassed();
|
||||
#else
|
||||
nLastSeen--;
|
||||
#endif
|
||||
else {
|
||||
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
|
||||
SetupSuspectLastSeenReport();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ServicePoliceRadioChannel(wantedLevel);
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||
{
|
||||
bool8 processed = FALSE;
|
||||
uint32 sample;
|
||||
uint32 freq;
|
||||
|
||||
static int cWait = 0;
|
||||
static bool8 bChannelOpen = FALSE;
|
||||
static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||
static uint32 PoliceChannelFreq = 22050;
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (m_bIsPaused) {
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
SampleManager.PauseStream(TRUE, 1);
|
||||
}
|
||||
} else {
|
||||
if (m_bWasPaused && g_nMissionAudioSfx != NO_SAMPLE &&
|
||||
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||
SampleManager.PauseStream(FALSE, 1);
|
||||
}
|
||||
if (m_sPoliceRadioQueue.m_nSamplesInQueue == 0) bChannelOpen = FALSE;
|
||||
if (cWait) {
|
||||
#ifdef FIX_BUGS
|
||||
cWait -= CTimer::GetLogicalFramesPassed();
|
||||
#else
|
||||
--cWait;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
|
||||
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
|
||||
if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
|
||||
}
|
||||
if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||
if (SampleManager.IsStreamPlaying(1)) {
|
||||
DoPoliceRadioCrackle();
|
||||
} else {
|
||||
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
|
||||
g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
|
||||
g_nMissionAudioSfx = NO_SAMPLE;
|
||||
cWait = 30;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if (!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
|
||||
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
|
||||
SampleManager.StartPreloadedStreamedFile(1);
|
||||
g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
|
||||
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (bChannelOpen) DoPoliceRadioCrackle();
|
||||
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
|
||||
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.m_nSamplesInQueue != 0) {
|
||||
sample = m_sPoliceRadioQueue.Remove();
|
||||
if (wantedLevel == 0) {
|
||||
if (gSpecialSuspectLastSeenReport) {
|
||||
gSpecialSuspectLastSeenReport = FALSE;
|
||||
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
|
||||
bChannelOpen = FALSE;
|
||||
processed = TRUE;
|
||||
}
|
||||
}
|
||||
if (sample == NO_SAMPLE) {
|
||||
if (!processed) cWait = 30;
|
||||
} else {
|
||||
SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, SFX_BANK_0);
|
||||
switch (sample) {
|
||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_1:
|
||||
freq = m_anRandomTable[4] % 2000 + 10025;
|
||||
bChannelOpen = bChannelOpen == FALSE;
|
||||
break;
|
||||
default: freq = SampleManager.GetSampleBaseFrequency(sample); break;
|
||||
}
|
||||
PoliceChannelFreq = freq;
|
||||
#ifdef USE_TIME_SCALE_FOR_AUDIO
|
||||
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq * CTimer::GetTimeScale());
|
||||
#else
|
||||
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
|
||||
#endif
|
||||
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
|
||||
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
|
||||
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
|
||||
#ifndef GTA_PS2
|
||||
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
|
||||
#endif
|
||||
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
|
||||
}
|
||||
if (processed) ResetPoliceRadio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8
|
||||
cAudioManager::SetupCrimeReport()
|
||||
{
|
||||
int16 audioZoneId;
|
||||
CZone *zone;
|
||||
float rangeX;
|
||||
float rangeY;
|
||||
float halfX;
|
||||
float halfY;
|
||||
float quarterX;
|
||||
float quarterY;
|
||||
int i;
|
||||
uint32 sampleIndex;
|
||||
bool8 processed = FALSE;
|
||||
|
||||
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return FALSE;
|
||||
|
||||
if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue <= 9) {
|
||||
AgeCrimes();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||
if (m_aCrimes[i].type != CRIME_NONE)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(m_aCrimes)) return FALSE;
|
||||
audioZoneId = CTheZones::FindAudioZone(&m_aCrimes[i].position);
|
||||
if (audioZoneId >= 0 && audioZoneId < NUMAUDIOZONES) {
|
||||
zone = CTheZones::GetAudioZone(audioZoneId);
|
||||
for (int j = 0; j < NUMAUDIOZONES; j++) {
|
||||
if (strcmp(zone->name, ZoneSfx[j].m_aName) == 0) {
|
||||
sampleIndex = ZoneSfx[j].m_nSampleIndex;
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(m_anRandomTable[0] % 3 + SFX_WEVE_GOT);
|
||||
m_sPoliceRadioQueue.Add(SFX_A_10);
|
||||
switch (m_aCrimes[i].type) {
|
||||
case CRIME_PED_BURNED:
|
||||
case CRIME_HIT_PED_NASTYWEAPON:
|
||||
m_aCrimes[i].type = CRIME_HIT_PED;
|
||||
break;
|
||||
case CRIME_COP_BURNED:
|
||||
case CRIME_HIT_COP_NASTYWEAPON:
|
||||
m_aCrimes[i].type = CRIME_HIT_COP;
|
||||
break;
|
||||
case CRIME_VEHICLE_BURNED: m_aCrimes[i].type = CRIME_STEAL_CAR; break;
|
||||
case CRIME_DESTROYED_CESSNA: m_aCrimes[i].type = CRIME_SHOOT_HELI; break;
|
||||
case CRIME_EXPLOSION: m_aCrimes[i].type = CRIME_STEAL_CAR; break; // huh?
|
||||
default: break;
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
m_sPoliceRadioQueue.Add(m_aCrimes[i].type + SFX_CRIME_1 - 1);
|
||||
#else
|
||||
m_sPoliceRadioQueue.Add(m_aCrimes[i].type + SFX_CRIME_1);
|
||||
#endif
|
||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||
rangeX = zone->maxx - zone->minx;
|
||||
rangeY = zone->maxy - zone->miny;
|
||||
halfX = 0.5f * rangeX + zone->minx;
|
||||
halfY = 0.5f * rangeY + zone->miny;
|
||||
quarterX = 0.25f * rangeX;
|
||||
quarterY = 0.25f * rangeY;
|
||||
|
||||
if (m_aCrimes[i].position.y > halfY + quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||
processed = TRUE;
|
||||
} else if (m_aCrimes[i].position.y < halfY - quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
if (m_aCrimes[i].position.x > halfX + quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||
else if (m_aCrimes[i].position.x < halfX - quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||
else if (!processed)
|
||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||
|
||||
m_sPoliceRadioQueue.Add(sampleIndex);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_aCrimes[i].type = CRIME_NONE;
|
||||
AgeCrimes();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Const uint32 gCarColourTable[][3] = {
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLACK, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_WHITE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_BRIGHT, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, SFX_POLICE_RADIO_BLUE, SFX_POLICE_RADIO_GREY},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_RED, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_ORANGE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_YELLOW, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_GREEN, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_BLUE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_PURPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{NO_SAMPLE, SFX_POLICE_RADIO_SILVER, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_LIGHT, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE},
|
||||
{SFX_POLICE_RADIO_DARK, NO_SAMPLE, NO_SAMPLE}
|
||||
};
|
||||
|
||||
void
|
||||
cAudioManager::SetupSuspectLastSeenReport()
|
||||
{
|
||||
CVehicle *veh;
|
||||
uint8 color1;
|
||||
uint32 main_color;
|
||||
uint32 sample;
|
||||
|
||||
uint32 color_pre_modifier;
|
||||
uint32 color_post_modifier;
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||
veh = FindVehicleOfPlayer();
|
||||
if (veh != nil) {
|
||||
if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 9) {
|
||||
color1 = veh->m_currentColour1;
|
||||
if (color1 >= ARRAY_SIZE(gCarColourTable)) {
|
||||
debug("\n *** UNKNOWN CAR COLOUR %d *** ", color1);
|
||||
} else {
|
||||
main_color = gCarColourTable[color1][1];
|
||||
color_pre_modifier = gCarColourTable[color1][0];
|
||||
color_post_modifier = gCarColourTable[color1][2];
|
||||
switch (veh->GetModelIndex()) {
|
||||
case MI_LANDSTAL:
|
||||
case MI_PATRIOT:
|
||||
case MI_RANCHER:
|
||||
case MI_FBIRANCH:
|
||||
case MI_SANDKING:
|
||||
sample = SFX_POLICE_RADIO_OFFROAD;
|
||||
break;
|
||||
case MI_IDAHO:
|
||||
case MI_MANANA:
|
||||
case MI_ESPERANT:
|
||||
case MI_CUBAN:
|
||||
case MI_STALLION:
|
||||
case MI_SABRE:
|
||||
case MI_SABRETUR:
|
||||
case MI_VIRGO:
|
||||
case MI_BLISTAC:
|
||||
sample = SFX_POLICE_RADIO_TUDOOR;
|
||||
break;
|
||||
case MI_STINGER:
|
||||
case MI_INFERNUS:
|
||||
case MI_CHEETAH:
|
||||
case MI_BANSHEE:
|
||||
case MI_PHEONIX:
|
||||
case MI_COMET:
|
||||
case MI_DELUXO:
|
||||
case MI_HOTRING:
|
||||
sample = SFX_POLICE_RADIO_SPORTS_CAR;
|
||||
break;
|
||||
case MI_LINERUN:
|
||||
sample = SFX_POLICE_RADIO_RIG;
|
||||
break;
|
||||
case MI_PEREN:
|
||||
case MI_REGINA:
|
||||
sample = SFX_POLICE_RADIO_STATION_WAGON;
|
||||
break;
|
||||
case MI_SENTINEL:
|
||||
case MI_FBICAR:
|
||||
case MI_WASHING:
|
||||
case MI_SENTXS:
|
||||
case MI_ADMIRAL:
|
||||
case MI_GLENDALE:
|
||||
case MI_OCEANIC:
|
||||
case MI_HERMES:
|
||||
case MI_GREENWOO:
|
||||
sample = SFX_POLICE_RADIO_SEDAN;
|
||||
break;
|
||||
case MI_RIO:
|
||||
sample = SFX_POLICE_RADIO_CRUISER;
|
||||
break;
|
||||
case MI_FIRETRUCK:
|
||||
sample = SFX_POLICE_RADIO_FIRE_TRUCK;
|
||||
break;
|
||||
case MI_TRASH:
|
||||
sample = SFX_POLICE_RADIO_GARBAGE_TRUCK;
|
||||
break;
|
||||
case MI_STRETCH:
|
||||
case MI_LOVEFIST:
|
||||
sample = SFX_POLICE_RADIO_STRETCH;
|
||||
break;
|
||||
case MI_VOODOO:
|
||||
sample = SFX_POLICE_RADIO_LOWRIDER;
|
||||
break;
|
||||
case MI_PONY:
|
||||
case MI_MOONBEAM:
|
||||
case MI_SECURICA:
|
||||
case MI_RUMPO:
|
||||
case MI_GANGBUR:
|
||||
case MI_YANKEE:
|
||||
case MI_TOPFUN:
|
||||
case MI_BURRITO:
|
||||
case MI_SPAND:
|
||||
sample = SFX_POLICE_RADIO_VAN;
|
||||
break;
|
||||
case MI_MULE:
|
||||
case MI_BARRACKS:
|
||||
case MI_PACKER:
|
||||
case MI_FLATBED:
|
||||
sample = SFX_POLICE_RADIO_TRUCK;
|
||||
break;
|
||||
case MI_AMBULAN:
|
||||
sample = SFX_POLICE_RADIO_AMBULANCE;
|
||||
break;
|
||||
case MI_TAXI:
|
||||
case MI_CABBIE:
|
||||
case MI_ZEBRA:
|
||||
case MI_KAUFMAN:
|
||||
sample = SFX_POLICE_RADIO_TAXI;
|
||||
break;
|
||||
case MI_BOBCAT:
|
||||
case MI_WALTON:
|
||||
sample = SFX_POLICE_RADIO_PICKUP;
|
||||
break;
|
||||
case MI_MRWHOOP:
|
||||
sample = SFX_POLICE_RADIO_ICE_CREAM_VAN;
|
||||
break;
|
||||
case MI_BFINJECT:
|
||||
sample = SFX_POLICE_RADIO_BUGGY;
|
||||
break;
|
||||
case MI_HUNTER:
|
||||
case MI_CHOPPER:
|
||||
case MI_SEASPAR:
|
||||
case MI_SPARROW:
|
||||
case MI_MAVERICK:
|
||||
case MI_VCNMAV:
|
||||
case MI_POLMAV:
|
||||
sample = SFX_POLICE_RADIO_HELICOPTER;
|
||||
break;
|
||||
case MI_POLICE:
|
||||
sample = SFX_POLICE_RADIO_POLICE_CAR;
|
||||
break;
|
||||
case MI_ENFORCER:
|
||||
sample = SFX_POLICE_RADIO_SWAT_VAN;
|
||||
break;
|
||||
case MI_PREDATOR:
|
||||
case MI_SQUALO:
|
||||
case MI_SPEEDER:
|
||||
sample = SFX_POLICE_RADIO_SPEEDBOAT;
|
||||
break;
|
||||
case MI_BUS:
|
||||
sample = SFX_POLICE_RADIO_BUS;
|
||||
break;
|
||||
case MI_RHINO:
|
||||
sample = SFX_POLICE_RADIO_TANK;
|
||||
break;
|
||||
case MI_ANGEL:
|
||||
case MI_PCJ600:
|
||||
case MI_FREEWAY:
|
||||
case MI_SANCHEZ:
|
||||
sample = SFX_POLICE_RADIO_MOTOBIKE;
|
||||
break;
|
||||
case MI_COACH:
|
||||
sample = SFX_POLICE_RADIO_COACH;
|
||||
break;
|
||||
case MI_ROMERO:
|
||||
sample = SFX_POLICE_RADIO_HEARSE;
|
||||
break;
|
||||
case MI_PIZZABOY:
|
||||
case MI_FAGGIO:
|
||||
sample = SFX_POLICE_RADIO_MOPED;
|
||||
break;
|
||||
case MI_DEADDODO:
|
||||
case MI_SKIMMER:
|
||||
sample = SFX_POLICE_RADIO_PLANE;
|
||||
break;
|
||||
case MI_REEFER:
|
||||
case MI_TROPIC:
|
||||
case MI_COASTG:
|
||||
case MI_MARQUIS:
|
||||
case MI_JETMAX:
|
||||
sample = SFX_POLICE_RADIO_BOAT;
|
||||
break;
|
||||
case MI_CADDY:
|
||||
sample = SFX_POLICE_RADIO_GOLF_CART;
|
||||
break;
|
||||
case MI_DINGHY:
|
||||
sample = SFX_POLICE_RADIO_DINGHY;
|
||||
break;
|
||||
default:
|
||||
//debug("\n *** UNKNOWN CAR MODEL INDEX %d *** ", veh->GetModelIndex());
|
||||
return;
|
||||
}
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
if (m_anRandomTable[3] % 2)
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_LAST_SEEN);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_IN_A);
|
||||
if (color_pre_modifier != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(color_pre_modifier);
|
||||
if (main_color != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(main_color);
|
||||
if (color_post_modifier != NO_SAMPLE)
|
||||
m_sPoliceRadioQueue.Add(color_post_modifier);
|
||||
m_sPoliceRadioQueue.Add(sample);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
}
|
||||
}
|
||||
} else if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 4) {
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_ON_FOOT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
||||
{
|
||||
int32 lastCrime = ARRAY_SIZE(m_aCrimes);
|
||||
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
|
||||
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||
if (m_aCrimes[i].type != CRIME_NONE) {
|
||||
if (m_aCrimes[i].type == type) {
|
||||
m_aCrimes[i].position = pos;
|
||||
m_aCrimes[i].timer = 0;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
lastCrime = i;
|
||||
}
|
||||
|
||||
if (lastCrime < ARRAY_SIZE(m_aCrimes)) {
|
||||
m_aCrimes[lastCrime].type = type;
|
||||
m_aCrimes[lastCrime].position = pos;
|
||||
m_aCrimes[lastCrime].timer = 0;
|
||||
gMinTimeToNextReport[type] = m_FrameCounter + 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
||||
{
|
||||
int16 audioZone;
|
||||
CZone *zone;
|
||||
float rangeX;
|
||||
float rangeY;
|
||||
float halfX;
|
||||
float halfY;
|
||||
float quarterX;
|
||||
float quarterY;
|
||||
uint32 sample;
|
||||
bool8 processed = FALSE;
|
||||
CVector vec = CVector(x, y, z);
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 9) {
|
||||
audioZone = CTheZones::FindAudioZone(&vec);
|
||||
if (audioZone >= 0 && audioZone < NUMAUDIOZONES) {
|
||||
zone = CTheZones::GetAudioZone(audioZone);
|
||||
for (int i = 0; i < NUMAUDIOZONES; i++) {
|
||||
if (strcmp(zone->name, ZoneSfx[i].m_aName) == 0) {
|
||||
sample = ZoneSfx[i].m_nSampleIndex;
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_LAST_SEEN);
|
||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||
rangeX = zone->maxx - zone->minx;
|
||||
rangeY = zone->maxy - zone->miny;
|
||||
halfX = 0.5f * rangeX + zone->minx;
|
||||
halfY = 0.5f * rangeY + zone->miny;
|
||||
quarterX = 0.25f * rangeX;
|
||||
quarterY = 0.25f * rangeY;
|
||||
|
||||
if (vec.y > halfY + quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||
processed = TRUE;
|
||||
} else if (vec.y < halfY - quarterY) {
|
||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
if (vec.x > halfX + quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||
else if (vec.x < halfX - quarterX)
|
||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||
else if (!processed)
|
||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||
m_sPoliceRadioQueue.Add(sample);
|
||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||
m_sPoliceRadioQueue.Add(NO_SAMPLE);
|
||||
gSpecialSuspectLastSeenReport = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::AgeCrimes()
|
||||
{
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||
if (m_aCrimes[i].type != CRIME_NONE) {
|
||||
if (++m_aCrimes[i].timer > 1200) m_aCrimes[i].type = CRIME_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
67
miami/audio/PolRadio.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include "Crime.h"
|
||||
#include "AudioSamples.h"
|
||||
|
||||
struct cAMCrime {
|
||||
int32 type;
|
||||
CVector position;
|
||||
uint16 timer;
|
||||
|
||||
cAMCrime()
|
||||
{
|
||||
type = CRIME_NONE;
|
||||
position = CVector(0.0f, 0.0f, 0.0f);
|
||||
timer = 0;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cAMCrime, 20);
|
||||
|
||||
#define POLICE_RADIO_QUEUE_MAX_SAMPLES 60
|
||||
|
||||
class cPoliceRadioQueue
|
||||
{
|
||||
public:
|
||||
uint32 m_aSamples[POLICE_RADIO_QUEUE_MAX_SAMPLES];
|
||||
uint8 m_nSamplesInQueue;
|
||||
uint8 m_nAddOffset;
|
||||
uint8 m_nRemoveOffset;
|
||||
|
||||
cPoliceRadioQueue()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_nAddOffset = 0;
|
||||
m_nRemoveOffset = 0;
|
||||
m_nSamplesInQueue = 0;
|
||||
}
|
||||
|
||||
bool8 Add(uint32 sample)
|
||||
{
|
||||
if (m_nSamplesInQueue != POLICE_RADIO_QUEUE_MAX_SAMPLES) {
|
||||
m_aSamples[m_nAddOffset] = sample;
|
||||
m_nSamplesInQueue++;
|
||||
m_nAddOffset = (m_nAddOffset + 1) % POLICE_RADIO_QUEUE_MAX_SAMPLES;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint32 Remove()
|
||||
{
|
||||
if (m_nSamplesInQueue != 0) {
|
||||
uint32 sample = m_aSamples[m_nRemoveOffset];
|
||||
m_nSamplesInQueue--;
|
||||
m_nRemoveOffset = (m_nRemoveOffset + 1) % POLICE_RADIO_QUEUE_MAX_SAMPLES;
|
||||
return sample;
|
||||
}
|
||||
return NO_SAMPLE;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(cPoliceRadioQueue, 244);
|
||||
1336
miami/audio/audio_enums.h
Normal file
706
miami/audio/eax/eax-util.cpp
Normal file
@@ -0,0 +1,706 @@
|
||||
/***********************************************************************************************\
|
||||
* *
|
||||
* EAX-UTIL.CPP - utilities for EAX 3.0 *
|
||||
* Function declaration for EAX Morphing *
|
||||
* String names of the all the presets defined in eax-util.h *
|
||||
* Arrays grouping together all the EAX presets in a scenario *
|
||||
* *
|
||||
************************************************************************************************/
|
||||
|
||||
#include "eax-util.h"
|
||||
#include <math.h>
|
||||
|
||||
// Function prototypes used by EAX3ListenerInterpolate
|
||||
void Clamp(EAXVECTOR *eaxVector);
|
||||
bool CheckEAX3LP(LPEAXLISTENERPROPERTIES lpEAX3LP);
|
||||
|
||||
|
||||
/***********************************************************************************************\
|
||||
*
|
||||
* Definition of the EAXMorph function - EAX3ListenerInterpolate
|
||||
*
|
||||
\***********************************************************************************************/
|
||||
|
||||
/*
|
||||
EAX3ListenerInterpolate
|
||||
lpStart - Initial EAX 3 Listener parameters
|
||||
lpFinish - Final EAX 3 Listener parameters
|
||||
flRatio - Ratio Destination : Source (0.0 == Source, 1.0 == Destination)
|
||||
lpResult - Interpolated EAX 3 Listener parameters
|
||||
bCheckValues - Check EAX 3.0 parameters are in range, default = false (no checking)
|
||||
*/
|
||||
bool EAX3ListenerInterpolate(LPEAXLISTENERPROPERTIES lpStart, LPEAXLISTENERPROPERTIES lpFinish,
|
||||
float flRatio, LPEAXLISTENERPROPERTIES lpResult, bool bCheckValues)
|
||||
{
|
||||
EAXVECTOR StartVector, FinalVector;
|
||||
|
||||
float flInvRatio;
|
||||
|
||||
if (bCheckValues)
|
||||
{
|
||||
if (!CheckEAX3LP(lpStart))
|
||||
return false;
|
||||
|
||||
if (!CheckEAX3LP(lpFinish))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flRatio >= 1.0f)
|
||||
{
|
||||
memcpy(lpResult, lpFinish, sizeof(EAXLISTENERPROPERTIES));
|
||||
return true;
|
||||
}
|
||||
else if (flRatio <= 0.0f)
|
||||
{
|
||||
memcpy(lpResult, lpStart, sizeof(EAXLISTENERPROPERTIES));
|
||||
return true;
|
||||
}
|
||||
|
||||
flInvRatio = (1.0f - flRatio);
|
||||
|
||||
// Environment
|
||||
lpResult->ulEnvironment = 26; // (UNDEFINED environment)
|
||||
|
||||
// Environment Size
|
||||
if (lpStart->flEnvironmentSize == lpFinish->flEnvironmentSize)
|
||||
lpResult->flEnvironmentSize = lpStart->flEnvironmentSize;
|
||||
else
|
||||
lpResult->flEnvironmentSize = (float)exp( (log(lpStart->flEnvironmentSize) * flInvRatio) + (log(lpFinish->flEnvironmentSize) * flRatio) );
|
||||
|
||||
// Environment Diffusion
|
||||
if (lpStart->flEnvironmentDiffusion == lpFinish->flEnvironmentDiffusion)
|
||||
lpResult->flEnvironmentDiffusion = lpStart->flEnvironmentDiffusion;
|
||||
else
|
||||
lpResult->flEnvironmentDiffusion = (lpStart->flEnvironmentDiffusion * flInvRatio) + (lpFinish->flEnvironmentDiffusion * flRatio);
|
||||
|
||||
// Room
|
||||
if (lpStart->lRoom == lpFinish->lRoom)
|
||||
lpResult->lRoom = lpStart->lRoom;
|
||||
else
|
||||
lpResult->lRoom = (int)( ((float)lpStart->lRoom * flInvRatio) + ((float)lpFinish->lRoom * flRatio) );
|
||||
|
||||
// Room HF
|
||||
if (lpStart->lRoomHF == lpFinish->lRoomHF)
|
||||
lpResult->lRoomHF = lpStart->lRoomHF;
|
||||
else
|
||||
lpResult->lRoomHF = (int)( ((float)lpStart->lRoomHF * flInvRatio) + ((float)lpFinish->lRoomHF * flRatio) );
|
||||
|
||||
// Room LF
|
||||
if (lpStart->lRoomLF == lpFinish->lRoomLF)
|
||||
lpResult->lRoomLF = lpStart->lRoomLF;
|
||||
else
|
||||
lpResult->lRoomLF = (int)( ((float)lpStart->lRoomLF * flInvRatio) + ((float)lpFinish->lRoomLF * flRatio) );
|
||||
|
||||
// Decay Time
|
||||
if (lpStart->flDecayTime == lpFinish->flDecayTime)
|
||||
lpResult->flDecayTime = lpStart->flDecayTime;
|
||||
else
|
||||
lpResult->flDecayTime = (float)exp( (log(lpStart->flDecayTime) * flInvRatio) + (log(lpFinish->flDecayTime) * flRatio) );
|
||||
|
||||
// Decay HF Ratio
|
||||
if (lpStart->flDecayHFRatio == lpFinish->flDecayHFRatio)
|
||||
lpResult->flDecayHFRatio = lpStart->flDecayHFRatio;
|
||||
else
|
||||
lpResult->flDecayHFRatio = (float)exp( (log(lpStart->flDecayHFRatio) * flInvRatio) + (log(lpFinish->flDecayHFRatio) * flRatio) );
|
||||
|
||||
// Decay LF Ratio
|
||||
if (lpStart->flDecayLFRatio == lpFinish->flDecayLFRatio)
|
||||
lpResult->flDecayLFRatio = lpStart->flDecayLFRatio;
|
||||
else
|
||||
lpResult->flDecayLFRatio = (float)exp( (log(lpStart->flDecayLFRatio) * flInvRatio) + (log(lpFinish->flDecayLFRatio) * flRatio) );
|
||||
|
||||
// Reflections
|
||||
if (lpStart->lReflections == lpFinish->lReflections)
|
||||
lpResult->lReflections = lpStart->lReflections;
|
||||
else
|
||||
lpResult->lReflections = (int)( ((float)lpStart->lReflections * flInvRatio) + ((float)lpFinish->lReflections * flRatio) );
|
||||
|
||||
// Reflections Delay
|
||||
if (lpStart->flReflectionsDelay == lpFinish->flReflectionsDelay)
|
||||
lpResult->flReflectionsDelay = lpStart->flReflectionsDelay;
|
||||
else
|
||||
lpResult->flReflectionsDelay = (float)exp( (log(lpStart->flReflectionsDelay+0.0001f) * flInvRatio) + (log(lpFinish->flReflectionsDelay+0.0001f) * flRatio) );
|
||||
|
||||
// Reflections Pan
|
||||
|
||||
// To interpolate the vector correctly we need to ensure that both the initial and final vectors vectors are clamped to a length of 1.0f
|
||||
StartVector = lpStart->vReflectionsPan;
|
||||
FinalVector = lpFinish->vReflectionsPan;
|
||||
|
||||
Clamp(&StartVector);
|
||||
Clamp(&FinalVector);
|
||||
|
||||
if (lpStart->vReflectionsPan.x == lpFinish->vReflectionsPan.x)
|
||||
lpResult->vReflectionsPan.x = lpStart->vReflectionsPan.x;
|
||||
else
|
||||
lpResult->vReflectionsPan.x = FinalVector.x + (flInvRatio * (StartVector.x - FinalVector.x));
|
||||
|
||||
if (lpStart->vReflectionsPan.y == lpFinish->vReflectionsPan.y)
|
||||
lpResult->vReflectionsPan.y = lpStart->vReflectionsPan.y;
|
||||
else
|
||||
lpResult->vReflectionsPan.y = FinalVector.y + (flInvRatio * (StartVector.y - FinalVector.y));
|
||||
|
||||
if (lpStart->vReflectionsPan.z == lpFinish->vReflectionsPan.z)
|
||||
lpResult->vReflectionsPan.z = lpStart->vReflectionsPan.z;
|
||||
else
|
||||
lpResult->vReflectionsPan.z = FinalVector.z + (flInvRatio * (StartVector.z - FinalVector.z));
|
||||
|
||||
// Reverb
|
||||
if (lpStart->lReverb == lpFinish->lReverb)
|
||||
lpResult->lReverb = lpStart->lReverb;
|
||||
else
|
||||
lpResult->lReverb = (int)( ((float)lpStart->lReverb * flInvRatio) + ((float)lpFinish->lReverb * flRatio) );
|
||||
|
||||
// Reverb Delay
|
||||
if (lpStart->flReverbDelay == lpFinish->flReverbDelay)
|
||||
lpResult->flReverbDelay = lpStart->flReverbDelay;
|
||||
else
|
||||
lpResult->flReverbDelay = (float)exp( (log(lpStart->flReverbDelay+0.0001f) * flInvRatio) + (log(lpFinish->flReverbDelay+0.0001f) * flRatio) );
|
||||
|
||||
// Reverb Pan
|
||||
|
||||
// To interpolate the vector correctly we need to ensure that both the initial and final vectors are clamped to a length of 1.0f
|
||||
StartVector = lpStart->vReverbPan;
|
||||
FinalVector = lpFinish->vReverbPan;
|
||||
|
||||
Clamp(&StartVector);
|
||||
Clamp(&FinalVector);
|
||||
|
||||
if (lpStart->vReverbPan.x == lpFinish->vReverbPan.x)
|
||||
lpResult->vReverbPan.x = lpStart->vReverbPan.x;
|
||||
else
|
||||
lpResult->vReverbPan.x = FinalVector.x + (flInvRatio * (StartVector.x - FinalVector.x));
|
||||
|
||||
if (lpStart->vReverbPan.y == lpFinish->vReverbPan.y)
|
||||
lpResult->vReverbPan.y = lpStart->vReverbPan.y;
|
||||
else
|
||||
lpResult->vReverbPan.y = FinalVector.y + (flInvRatio * (StartVector.y - FinalVector.y));
|
||||
|
||||
if (lpStart->vReverbPan.z == lpFinish->vReverbPan.z)
|
||||
lpResult->vReverbPan.z = lpStart->vReverbPan.z;
|
||||
else
|
||||
lpResult->vReverbPan.z = FinalVector.z + (flInvRatio * (StartVector.z - FinalVector.z));
|
||||
|
||||
// Echo Time
|
||||
if (lpStart->flEchoTime == lpFinish->flEchoTime)
|
||||
lpResult->flEchoTime = lpStart->flEchoTime;
|
||||
else
|
||||
lpResult->flEchoTime = (float)exp( (log(lpStart->flEchoTime) * flInvRatio) + (log(lpFinish->flEchoTime) * flRatio) );
|
||||
|
||||
// Echo Depth
|
||||
if (lpStart->flEchoDepth == lpFinish->flEchoDepth)
|
||||
lpResult->flEchoDepth = lpStart->flEchoDepth;
|
||||
else
|
||||
lpResult->flEchoDepth = (lpStart->flEchoDepth * flInvRatio) + (lpFinish->flEchoDepth * flRatio);
|
||||
|
||||
// Modulation Time
|
||||
if (lpStart->flModulationTime == lpFinish->flModulationTime)
|
||||
lpResult->flModulationTime = lpStart->flModulationTime;
|
||||
else
|
||||
lpResult->flModulationTime = (float)exp( (log(lpStart->flModulationTime) * flInvRatio) + (log(lpFinish->flModulationTime) * flRatio) );
|
||||
|
||||
// Modulation Depth
|
||||
if (lpStart->flModulationDepth == lpFinish->flModulationDepth)
|
||||
lpResult->flModulationDepth = lpStart->flModulationDepth;
|
||||
else
|
||||
lpResult->flModulationDepth = (lpStart->flModulationDepth * flInvRatio) + (lpFinish->flModulationDepth * flRatio);
|
||||
|
||||
// Air Absorption HF
|
||||
if (lpStart->flAirAbsorptionHF == lpFinish->flAirAbsorptionHF)
|
||||
lpResult->flAirAbsorptionHF = lpStart->flAirAbsorptionHF;
|
||||
else
|
||||
lpResult->flAirAbsorptionHF = (lpStart->flAirAbsorptionHF * flInvRatio) + (lpFinish->flAirAbsorptionHF * flRatio);
|
||||
|
||||
// HF Reference
|
||||
if (lpStart->flHFReference == lpFinish->flHFReference)
|
||||
lpResult->flHFReference = lpStart->flHFReference;
|
||||
else
|
||||
lpResult->flHFReference = (float)exp( (log(lpStart->flHFReference) * flInvRatio) + (log(lpFinish->flHFReference) * flRatio) );
|
||||
|
||||
// LF Reference
|
||||
if (lpStart->flLFReference == lpFinish->flLFReference)
|
||||
lpResult->flLFReference = lpStart->flLFReference;
|
||||
else
|
||||
lpResult->flLFReference = (float)exp( (log(lpStart->flLFReference) * flInvRatio) + (log(lpFinish->flLFReference) * flRatio) );
|
||||
|
||||
// Room Rolloff Factor
|
||||
if (lpStart->flRoomRolloffFactor == lpFinish->flRoomRolloffFactor)
|
||||
lpResult->flRoomRolloffFactor = lpStart->flRoomRolloffFactor;
|
||||
else
|
||||
lpResult->flRoomRolloffFactor = (lpStart->flRoomRolloffFactor * flInvRatio) + (lpFinish->flRoomRolloffFactor * flRatio);
|
||||
|
||||
// Flags
|
||||
lpResult->ulFlags = (lpStart->ulFlags & lpFinish->ulFlags);
|
||||
|
||||
// Clamp Delays
|
||||
if (lpResult->flReflectionsDelay > EAXLISTENER_MAXREFLECTIONSDELAY)
|
||||
lpResult->flReflectionsDelay = EAXLISTENER_MAXREFLECTIONSDELAY;
|
||||
|
||||
if (lpResult->flReverbDelay > EAXLISTENER_MAXREVERBDELAY)
|
||||
lpResult->flReverbDelay = EAXLISTENER_MAXREVERBDELAY;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
CheckEAX3LP
|
||||
Checks that the parameters in the EAX 3 Listener Properties structure are in-range
|
||||
*/
|
||||
bool CheckEAX3LP(LPEAXLISTENERPROPERTIES lpEAX3LP)
|
||||
{
|
||||
if ( (lpEAX3LP->lRoom < EAXLISTENER_MINROOM) || (lpEAX3LP->lRoom > EAXLISTENER_MAXROOM) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->lRoomHF < EAXLISTENER_MINROOMHF) || (lpEAX3LP->lRoomHF > EAXLISTENER_MAXROOMHF) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->lRoomLF < EAXLISTENER_MINROOMLF) || (lpEAX3LP->lRoomLF > EAXLISTENER_MAXROOMLF) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->ulEnvironment < EAXLISTENER_MINENVIRONMENT) || (lpEAX3LP->ulEnvironment > EAXLISTENER_MAXENVIRONMENT) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flEnvironmentSize < EAXLISTENER_MINENVIRONMENTSIZE) || (lpEAX3LP->flEnvironmentSize > EAXLISTENER_MAXENVIRONMENTSIZE) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flEnvironmentDiffusion < EAXLISTENER_MINENVIRONMENTDIFFUSION) || (lpEAX3LP->flEnvironmentDiffusion > EAXLISTENER_MAXENVIRONMENTDIFFUSION) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flDecayTime < EAXLISTENER_MINDECAYTIME) || (lpEAX3LP->flDecayTime > EAXLISTENER_MAXDECAYTIME) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flDecayHFRatio < EAXLISTENER_MINDECAYHFRATIO) || (lpEAX3LP->flDecayHFRatio > EAXLISTENER_MAXDECAYHFRATIO) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flDecayLFRatio < EAXLISTENER_MINDECAYLFRATIO) || (lpEAX3LP->flDecayLFRatio > EAXLISTENER_MAXDECAYLFRATIO) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->lReflections < EAXLISTENER_MINREFLECTIONS) || (lpEAX3LP->lReflections > EAXLISTENER_MAXREFLECTIONS) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flReflectionsDelay < EAXLISTENER_MINREFLECTIONSDELAY) || (lpEAX3LP->flReflectionsDelay > EAXLISTENER_MAXREFLECTIONSDELAY) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->lReverb < EAXLISTENER_MINREVERB) || (lpEAX3LP->lReverb > EAXLISTENER_MAXREVERB) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flReverbDelay < EAXLISTENER_MINREVERBDELAY) || (lpEAX3LP->flReverbDelay > EAXLISTENER_MAXREVERBDELAY) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flEchoTime < EAXLISTENER_MINECHOTIME) || (lpEAX3LP->flEchoTime > EAXLISTENER_MAXECHOTIME) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flEchoDepth < EAXLISTENER_MINECHODEPTH) || (lpEAX3LP->flEchoDepth > EAXLISTENER_MAXECHODEPTH) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flModulationTime < EAXLISTENER_MINMODULATIONTIME) || (lpEAX3LP->flModulationTime > EAXLISTENER_MAXMODULATIONTIME) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flModulationDepth < EAXLISTENER_MINMODULATIONDEPTH) || (lpEAX3LP->flModulationDepth > EAXLISTENER_MAXMODULATIONDEPTH) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flAirAbsorptionHF < EAXLISTENER_MINAIRABSORPTIONHF) || (lpEAX3LP->flAirAbsorptionHF > EAXLISTENER_MAXAIRABSORPTIONHF) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flHFReference < EAXLISTENER_MINHFREFERENCE) || (lpEAX3LP->flHFReference > EAXLISTENER_MAXHFREFERENCE) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flLFReference < EAXLISTENER_MINLFREFERENCE) || (lpEAX3LP->flLFReference > EAXLISTENER_MAXLFREFERENCE) )
|
||||
return false;
|
||||
|
||||
if ( (lpEAX3LP->flRoomRolloffFactor < EAXLISTENER_MINROOMROLLOFFFACTOR) || (lpEAX3LP->flRoomRolloffFactor > EAXLISTENER_MAXROOMROLLOFFFACTOR) )
|
||||
return false;
|
||||
|
||||
if (lpEAX3LP->ulFlags & EAXLISTENERFLAGS_RESERVED)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Clamp
|
||||
Clamps the length of the vector to 1.0f
|
||||
*/
|
||||
void Clamp(EAXVECTOR *eaxVector)
|
||||
{
|
||||
float flMagnitude;
|
||||
float flInvMagnitude;
|
||||
|
||||
flMagnitude = (float)sqrt((eaxVector->x*eaxVector->x) + (eaxVector->y*eaxVector->y) + (eaxVector->z*eaxVector->z));
|
||||
|
||||
if (flMagnitude <= 1.0f)
|
||||
return;
|
||||
|
||||
flInvMagnitude = 1.0f / flMagnitude;
|
||||
|
||||
eaxVector->x *= flInvMagnitude;
|
||||
eaxVector->y *= flInvMagnitude;
|
||||
eaxVector->z *= flInvMagnitude;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************\
|
||||
*
|
||||
* To assist those developers wishing to add EAX effects to their level editors, each of the
|
||||
|
||||
* List of string names of the various EAX 3.0 presets defined in eax-util.h
|
||||
* Arrays to group together presets of the same scenario
|
||||
*
|
||||
\***********************************************************************************************/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of scenario names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_SCENARIO_NAMES[] =
|
||||
{
|
||||
"Castle",
|
||||
"Factory",
|
||||
"IcePalace",
|
||||
"SpaceStation",
|
||||
"WoodenShip",
|
||||
"Sports",
|
||||
"Prefab",
|
||||
"Domes and Pipes",
|
||||
"Outdoors",
|
||||
"Mood",
|
||||
"Driving",
|
||||
"City",
|
||||
"Miscellaneous",
|
||||
"Original"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of standardised location names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_LOCATION_NAMES[] =
|
||||
{
|
||||
"Hall",
|
||||
"Large Room",
|
||||
"Medium Room",
|
||||
"Small Room",
|
||||
"Cupboard",
|
||||
"Alcove",
|
||||
"Long Passage",
|
||||
"Short Passage",
|
||||
"Courtyard"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Standardised Location effects can be accessed //
|
||||
// from a matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_STANDARD_PRESETS[EAX30_NUM_STANDARD_SCENARIOS][EAX30_NUM_LOCATIONS]=
|
||||
{
|
||||
{EAX30_PRESET_CASTLE_HALL, EAX30_PRESET_CASTLE_LARGEROOM, EAX30_PRESET_CASTLE_MEDIUMROOM, EAX30_PRESET_CASTLE_SMALLROOM, EAX30_PRESET_CASTLE_CUPBOARD, EAX30_PRESET_CASTLE_ALCOVE, EAX30_PRESET_CASTLE_LONGPASSAGE, EAX30_PRESET_CASTLE_SHORTPASSAGE, EAX30_PRESET_CASTLE_COURTYARD},
|
||||
{EAX30_PRESET_FACTORY_HALL, EAX30_PRESET_FACTORY_LARGEROOM, EAX30_PRESET_FACTORY_MEDIUMROOM, EAX30_PRESET_FACTORY_SMALLROOM, EAX30_PRESET_FACTORY_CUPBOARD, EAX30_PRESET_FACTORY_ALCOVE, EAX30_PRESET_FACTORY_LONGPASSAGE, EAX30_PRESET_FACTORY_SHORTPASSAGE, EAX30_PRESET_FACTORY_COURTYARD},
|
||||
{EAX30_PRESET_ICEPALACE_HALL, EAX30_PRESET_ICEPALACE_LARGEROOM, EAX30_PRESET_ICEPALACE_MEDIUMROOM, EAX30_PRESET_ICEPALACE_SMALLROOM, EAX30_PRESET_ICEPALACE_CUPBOARD, EAX30_PRESET_ICEPALACE_ALCOVE, EAX30_PRESET_ICEPALACE_LONGPASSAGE, EAX30_PRESET_ICEPALACE_SHORTPASSAGE, EAX30_PRESET_ICEPALACE_COURTYARD},
|
||||
{EAX30_PRESET_SPACESTATION_HALL,EAX30_PRESET_SPACESTATION_LARGEROOM,EAX30_PRESET_SPACESTATION_MEDIUMROOM, EAX30_PRESET_SPACESTATION_SMALLROOM,EAX30_PRESET_SPACESTATION_CUPBOARD, EAX30_PRESET_SPACESTATION_ALCOVE, EAX30_PRESET_SPACESTATION_LONGPASSAGE, EAX30_PRESET_SPACESTATION_SHORTPASSAGE, EAX30_PRESET_SPACESTATION_HALL},
|
||||
{EAX30_PRESET_WOODEN_HALL, EAX30_PRESET_WOODEN_LARGEROOM, EAX30_PRESET_WOODEN_MEDIUMROOM, EAX30_PRESET_WOODEN_SMALLROOM, EAX30_PRESET_WOODEN_CUPBOARD, EAX30_PRESET_WOODEN_ALCOVE, EAX30_PRESET_WOODEN_LONGPASSAGE, EAX30_PRESET_WOODEN_SHORTPASSAGE, EAX30_PRESET_WOODEN_COURTYARD},
|
||||
};
|
||||
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of original environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_ORIGINAL_PRESET_NAMES[] =
|
||||
{
|
||||
"Generic",
|
||||
"Padded Cell",
|
||||
"Room",
|
||||
"Bathroom",
|
||||
"Living Room",
|
||||
"Stone Room",
|
||||
"Auditorium",
|
||||
"Concert Hall",
|
||||
"Cave",
|
||||
"Arena",
|
||||
"Hangar",
|
||||
"Carpetted Hallway",
|
||||
"Hallway",
|
||||
"Stone Corridor",
|
||||
"Alley",
|
||||
"Forest",
|
||||
"City",
|
||||
"Mountains",
|
||||
"Quarry",
|
||||
"Plain",
|
||||
"Parking Lot",
|
||||
"Sewer Pipe",
|
||||
"Underwater",
|
||||
"Drugged",
|
||||
"Dizzy",
|
||||
"Psychotic"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Sports effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_ORIGINAL_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_GENERIC,
|
||||
EAX30_PRESET_PADDEDCELL,
|
||||
EAX30_PRESET_ROOM,
|
||||
EAX30_PRESET_BATHROOM,
|
||||
EAX30_PRESET_LIVINGROOM,
|
||||
EAX30_PRESET_STONEROOM,
|
||||
EAX30_PRESET_AUDITORIUM,
|
||||
EAX30_PRESET_CONCERTHALL,
|
||||
EAX30_PRESET_CAVE,
|
||||
EAX30_PRESET_ARENA,
|
||||
EAX30_PRESET_HANGAR,
|
||||
EAX30_PRESET_CARPETTEDHALLWAY,
|
||||
EAX30_PRESET_HALLWAY,
|
||||
EAX30_PRESET_STONECORRIDOR,
|
||||
EAX30_PRESET_ALLEY,
|
||||
EAX30_PRESET_FOREST,
|
||||
EAX30_PRESET_CITY,
|
||||
EAX30_PRESET_MOUNTAINS,
|
||||
EAX30_PRESET_QUARRY,
|
||||
EAX30_PRESET_PLAIN,
|
||||
EAX30_PRESET_PARKINGLOT,
|
||||
EAX30_PRESET_SEWERPIPE,
|
||||
EAX30_PRESET_UNDERWATER,
|
||||
EAX30_PRESET_DRUGGED,
|
||||
EAX30_PRESET_DIZZY,
|
||||
EAX30_PRESET_PSYCHOTIC
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of sport environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_SPORTS_PRESET_NAMES[] =
|
||||
{
|
||||
"Empty Stadium",
|
||||
"Full Stadium",
|
||||
"Stadium Tannoy",
|
||||
"Squash Court",
|
||||
"Small Swimming Pool",
|
||||
"Large Swimming Pool",
|
||||
"Gymnasium"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Sports effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_SPORTS_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_SPORT_EMPTYSTADIUM,
|
||||
EAX30_PRESET_SPORT_FULLSTADIUM,
|
||||
EAX30_PRESET_SPORT_STADIUMTANNOY,
|
||||
EAX30_PRESET_SPORT_SQUASHCOURT,
|
||||
EAX30_PRESET_SPORT_SMALLSWIMMINGPOOL,
|
||||
EAX30_PRESET_SPORT_LARGESWIMMINGPOOL,
|
||||
EAX30_PRESET_SPORT_GYMNASIUM
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of prefab environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_PREFAB_PRESET_NAMES[] =
|
||||
{
|
||||
"Workshop",
|
||||
"School Room",
|
||||
"Practise Room",
|
||||
"Outhouse",
|
||||
"Caravan"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Prefab effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_PREFAB_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_PREFAB_WORKSHOP,
|
||||
EAX30_PRESET_PREFAB_SCHOOLROOM,
|
||||
EAX30_PRESET_PREFAB_PRACTISEROOM,
|
||||
EAX30_PRESET_PREFAB_OUTHOUSE,
|
||||
EAX30_PRESET_PREFAB_CARAVAN
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Domes & Pipes environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_DOMESNPIPES_PRESET_NAMES[] =
|
||||
{
|
||||
"Domed Tomb",
|
||||
"Saint Paul's Dome",
|
||||
"Small Pipe",
|
||||
"Long Thin Pipe",
|
||||
"Large Pipe",
|
||||
"Resonant Pipe"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Domes & Pipes effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_DOMESNPIPES_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_DOME_TOMB,
|
||||
EAX30_PRESET_DOME_SAINTPAULS,
|
||||
EAX30_PRESET_PIPE_SMALL,
|
||||
EAX30_PRESET_PIPE_LONGTHIN,
|
||||
EAX30_PRESET_PIPE_LARGE,
|
||||
EAX30_PRESET_PIPE_RESONANT
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Outdoors environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_OUTDOORS_PRESET_NAMES[] =
|
||||
{
|
||||
"Backyard",
|
||||
"Rolling Plains",
|
||||
"Deep Canyon",
|
||||
"Creek",
|
||||
"Valley"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Outdoors effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_OUTDOORS_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_OUTDOORS_BACKYARD,
|
||||
EAX30_PRESET_OUTDOORS_ROLLINGPLAINS,
|
||||
EAX30_PRESET_OUTDOORS_DEEPCANYON,
|
||||
EAX30_PRESET_OUTDOORS_CREEK,
|
||||
EAX30_PRESET_OUTDOORS_VALLEY
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Mood environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_MOOD_PRESET_NAMES[] =
|
||||
{
|
||||
"Heaven",
|
||||
"Hell",
|
||||
"Memory"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Mood effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_MOOD_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_MOOD_HEAVEN,
|
||||
EAX30_PRESET_MOOD_HELL,
|
||||
EAX30_PRESET_MOOD_MEMORY
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of driving environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_DRIVING_PRESET_NAMES[] =
|
||||
{
|
||||
"Race Commentator",
|
||||
"Pit Garage",
|
||||
"In-car (Stripped out racer)",
|
||||
"In-car (Sportscar)",
|
||||
"In-car (Luxury)",
|
||||
"Full Grandstand",
|
||||
"Empty Grandstand",
|
||||
"Tunnel"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Driving effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_DRIVING_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_DRIVING_COMMENTATOR,
|
||||
EAX30_PRESET_DRIVING_PITGARAGE,
|
||||
EAX30_PRESET_DRIVING_INCAR_RACER,
|
||||
EAX30_PRESET_DRIVING_INCAR_SPORTS,
|
||||
EAX30_PRESET_DRIVING_INCAR_LUXURY,
|
||||
EAX30_PRESET_DRIVING_FULLGRANDSTAND,
|
||||
EAX30_PRESET_DRIVING_EMPTYGRANDSTAND,
|
||||
EAX30_PRESET_DRIVING_TUNNEL
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of City environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_CITY_PRESET_NAMES[] =
|
||||
{
|
||||
"City Streets",
|
||||
"Subway",
|
||||
"Museum",
|
||||
"Library",
|
||||
"Underpass",
|
||||
"Abandoned City"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// City effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_CITY_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_CITY_STREETS,
|
||||
EAX30_PRESET_CITY_SUBWAY,
|
||||
EAX30_PRESET_CITY_MUSEUM,
|
||||
EAX30_PRESET_CITY_LIBRARY,
|
||||
EAX30_PRESET_CITY_UNDERPASS,
|
||||
EAX30_PRESET_CITY_ABANDONED
|
||||
};
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Misc environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
const char* EAX30_MISC_PRESET_NAMES[] =
|
||||
{
|
||||
"Dusty Box Room",
|
||||
"Chapel",
|
||||
"Small Water Room"
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Misc effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
EAXLISTENERPROPERTIES EAX30_MISC_PRESETS[] =
|
||||
{
|
||||
EAX30_PRESET_DUSTYROOM,
|
||||
EAX30_PRESET_CHAPEL,
|
||||
EAX30_PRESET_SMALLWATERROOM
|
||||
};
|
||||
|
||||
765
miami/audio/eax/eax-util.h
Normal file
@@ -0,0 +1,765 @@
|
||||
/*******************************************************************\
|
||||
* *
|
||||
* EAX-UTIL.H - utilities for Environmental Audio Extensions v. 3.0 *
|
||||
* Definitions of the Original 26 EAX Presets *
|
||||
* Definitions for some new EAX Presets *
|
||||
* Definitions of some Material Presets *
|
||||
* Function declaration for EAX Morphing *
|
||||
* *
|
||||
\*******************************************************************/
|
||||
|
||||
#ifndef EAXUTIL_INCLUDED
|
||||
#define EAXUTIL_INCLUDED
|
||||
|
||||
#include <eax.h>
|
||||
|
||||
/***********************************************************************************************
|
||||
* Function : EAX3ListenerInterpolate
|
||||
* Params : lpStart - Initial EAX 3 Listener parameters
|
||||
* : lpFinish - Final EAX 3 Listener parameters
|
||||
* : flRatio - Ratio Destination : Source (0.0 == Source, 1.0 == Destination)
|
||||
* : lpResult - Interpolated EAX 3 Listener parameters
|
||||
* : bCheckValues - Check EAX 3.0 parameters are in range,
|
||||
- default == false (no checking)
|
||||
************************************************************************************************/
|
||||
bool EAX3ListenerInterpolate(EAXLISTENERPROPERTIES *lpStartEAX3LP, EAXLISTENERPROPERTIES *lpFinishEAX3LP,
|
||||
float flRatio, EAXLISTENERPROPERTIES *lpResultEAX3LP, bool bCheckValues = false);
|
||||
|
||||
|
||||
/***********************************************************************************************\
|
||||
*
|
||||
* Legacy environment presets for use with DSPROPERTY_EAXLISTENER_ALLPARAMETERS.
|
||||
* Each array conforms to the DSPROPSETID_EAX30_ListenerProperties structure defined in EAX.H.
|
||||
*
|
||||
************************************************************************************************/
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_GENERIC \
|
||||
{0, 7.5f, 1.000f, -1000, -100, 0, 1.49f, 0.83f, 1.00f, -2602, 0.007f, 0.00f,0.00f,0.00f, 200, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_PADDEDCELL \
|
||||
{1, 1.4f, 1.000f, -1000, -6000, 0, 0.17f, 0.10f, 1.00f, -1204, 0.001f, 0.00f,0.00f,0.00f, 207, 0.002f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_ROOM \
|
||||
{2, 1.9f, 1.000f, -1000, -454, 0, 0.40f, 0.83f, 1.00f, -1646, 0.002f, 0.00f,0.00f,0.00f, 53, 0.003f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_BATHROOM \
|
||||
{3, 1.4f, 1.000f, -1000, -1200, 0, 1.49f, 0.54f, 1.00f, -370, 0.007f, 0.00f,0.00f,0.00f, 1030, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_LIVINGROOM \
|
||||
{4, 2.5f, 1.000f, -1000, -6000, 0, 0.50f, 0.10f, 1.00f, -1376, 0.003f, 0.00f,0.00f,0.00f, -1104, 0.004f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_STONEROOM \
|
||||
{5, 11.6f, 1.000f, -1000, -300, 0, 2.31f, 0.64f, 1.00f, -711, 0.012f, 0.00f,0.00f,0.00f, 83, 0.017f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_AUDITORIUM \
|
||||
{6, 21.6f, 1.000f, -1000, -476, 0, 4.32f, 0.59f, 1.00f, -789, 0.020f, 0.00f,0.00f,0.00f, -289, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_CONCERTHALL \
|
||||
{7, 19.6f, 1.000f, -1000, -500, 0, 3.92f, 0.70f, 1.00f, -1230, 0.020f, 0.00f,0.00f,0.00f, -02, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_CAVE \
|
||||
{8, 14.6f, 1.000f, -1000, 0, 0, 2.91f, 1.30f, 1.00f, -602, 0.015f, 0.00f,0.00f,0.00f, -302, 0.022f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_ARENA \
|
||||
{9, 36.2f, 1.000f, -1000, -698, 0, 7.24f, 0.33f, 1.00f, -1166, 0.020f, 0.00f,0.00f,0.00f, 16, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_HANGAR \
|
||||
{10, 50.3f, 1.000f, -1000, -1000, 0, 10.05f, 0.23f, 1.00f, -602, 0.020f, 0.00f,0.00f,0.00f, 198, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_CARPETTEDHALLWAY \
|
||||
{11, 1.9f, 1.000f, -1000, -4000, 0, 0.30f, 0.10f, 1.00f, -1831, 0.002f, 0.00f,0.00f,0.00f, -1630, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_HALLWAY \
|
||||
{12, 1.8f, 1.000f, -1000, -300, 0, 1.49f, 0.59f, 1.00f, -1219, 0.007f, 0.00f,0.00f,0.00f, 441, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_STONECORRIDOR \
|
||||
{13, 13.5f, 1.000f, -1000, -237, 0, 2.70f, 0.79f, 1.00f, -1214, 0.013f, 0.00f,0.00f,0.00f, 395, 0.020f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_ALLEY \
|
||||
{14, 7.5f, 0.300f, -1000, -270, 0, 1.49f, 0.86f, 1.00f, -1204, 0.007f, 0.00f,0.00f,0.00f, -4, 0.011f, 0.00f,0.00f,0.00f, 0.125f, 0.950f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_FOREST \
|
||||
{15, 38.0f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f,0.00f,0.00f, -229, 0.088f, 0.00f,0.00f,0.00f, 0.125f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_CITY \
|
||||
{16, 7.5f, 0.500f, -1000, -800, 0, 1.49f, 0.67f, 1.00f, -2273, 0.007f, 0.00f,0.00f,0.00f, -1691, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_MOUNTAINS \
|
||||
{17, 100.0f, 0.270f, -1000, -2500, 0, 1.49f, 0.21f, 1.00f, -2780, 0.300f, 0.00f,0.00f,0.00f, -1434, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_QUARRY \
|
||||
{18, 17.5f, 1.000f, -1000, -1000, 0, 1.49f, 0.83f, 1.00f, -10000, 0.061f, 0.00f,0.00f,0.00f, 500, 0.025f, 0.00f,0.00f,0.00f, 0.125f, 0.700f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_PLAIN \
|
||||
{19, 42.5f, 0.210f, -1000, -2000, 0, 1.49f, 0.50f, 1.00f, -2466, 0.179f, 0.00f,0.00f,0.00f, -1926, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_PARKINGLOT \
|
||||
{20, 8.3f, 1.000f, -1000, 0, 0, 1.65f, 1.50f, 1.00f, -1363, 0.008f, 0.00f,0.00f,0.00f, -1153, 0.012f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_SEWERPIPE \
|
||||
{21, 1.7f, 0.800f, -1000, -1000, 0, 2.81f, 0.14f, 1.00f, 429, 0.014f, 0.00f,0.00f,0.00f, 1023, 0.021f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_UNDERWATER \
|
||||
{22, 1.8f, 1.000f, -1000, -4000, 0, 1.49f, 0.10f, 1.00f, -449, 0.007f, 0.00f,0.00f,0.00f, 1700, 0.011f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 1.180f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_DRUGGED \
|
||||
{23, 1.9f, 0.500f, -1000, 0, 0, 8.39f, 1.39f, 1.00f, -115, 0.002f, 0.00f,0.00f,0.00f, 985, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_DIZZY \
|
||||
{24, 1.8f, 0.600f, -1000, -400, 0, 17.23f, 0.56f, 1.00f, -1713, 0.020f, 0.00f,0.00f,0.00f, -613, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.810f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_PSYCHOTIC \
|
||||
{25, 1.0f, 0.500f, -1000, -151, 0, 7.56f, 0.91f, 1.00f, -626, 0.020f, 0.00f,0.00f,0.00f, 774, 0.030f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 4.000f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
|
||||
|
||||
/***********************************************************************************************\
|
||||
*
|
||||
* New environment presets for use with DSPROPERTY_EAXLISTENER_ALLPARAMETERS.
|
||||
* Each array conforms to the DSPROPSETID_EAX30_ListenerProperties structure defined in EAX.H.
|
||||
*
|
||||
************************************************************************************************/
|
||||
|
||||
// STANDARDISED-LOCATION SCENARIOS
|
||||
|
||||
// CASTLE PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_CASTLE_SMALLROOM \
|
||||
{ 26, 8.3f, 0.890f, -1100, -800, -2000, 1.22f, 0.83f, 0.31f, -100, 0.022f, 0.00f,0.00f,0.00f, 0, 0.011f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_SHORTPASSAGE \
|
||||
{ 26, 8.3f, 0.890f, -1000, -1000, -2000, 2.32f, 0.83f, 0.31f, -100, 0.007f, 0.00f,0.00f,0.00f, -500, 0.023f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_MEDIUMROOM \
|
||||
{ 26, 8.3f, 0.930f, -1000, -1100, -2000, 2.04f, 0.83f, 0.46f, -300, 0.022f, 0.00f,0.00f,0.00f, -200, 0.011f, 0.00f,0.00f,0.00f, 0.155f, 0.030f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_LONGPASSAGE \
|
||||
{ 26, 8.3f, 0.890f, -1000, -800, -2000, 3.42f, 0.83f, 0.31f, -200, 0.007f, 0.00f,0.00f,0.00f, -600, 0.023f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_LARGEROOM \
|
||||
{ 26, 8.3f, 0.820f, -1000, -1100, -1800, 2.53f, 0.83f, 0.50f, -900, 0.034f, 0.00f,0.00f,0.00f, -400, 0.016f, 0.00f,0.00f,0.00f, 0.185f, 0.070f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_HALL \
|
||||
{ 26, 8.3f, 0.810f, -1000, -1100, -1500, 3.14f, 0.79f, 0.62f, -1300, 0.056f, 0.00f,0.00f,0.00f, -500, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_CUPBOARD \
|
||||
{ 26, 8.3f, 0.890f, -1000, -1100, -2000, 0.67f, 0.87f, 0.31f, 300, 0.010f, 0.00f,0.00f,0.00f, 300, 0.007f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CASTLE_COURTYARD \
|
||||
{ 26, 8.3f, 0.420f, -1100, -700, -900, 2.13f, 0.61f, 0.23f, -2300, 0.112f, 0.00f,0.00f,0.00f, -1500, 0.036f, 0.00f,0.00f,0.00f, 0.250f, 0.370f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_CASTLE_ALCOVE \
|
||||
{ 26, 8.3f, 0.890f, -1000, -600, -2000, 1.64f, 0.87f, 0.31f, -100, 0.007f, 0.00f,0.00f,0.00f, -500, 0.034f, 0.00f,0.00f,0.00f, 0.138f, 0.080f, 0.250f, 0.000f, -5.0f, 5168.6f, 139.5f, 0.00f, 0x20 }
|
||||
|
||||
|
||||
// FACTORY PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_FACTORY_ALCOVE \
|
||||
{ 26, 1.8f, 0.590f, -1200, -200, -600, 3.14f, 0.65f, 1.31f, 300, 0.010f, 0.00f,0.00f,0.00f, -1200, 0.038f, 0.00f,0.00f,0.00f, 0.114f, 0.100f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_SHORTPASSAGE \
|
||||
{ 26, 1.8f, 0.640f, -1200, -200, -600, 2.53f, 0.65f, 1.31f, 0, 0.010f, 0.00f,0.00f,0.00f, -600, 0.038f, 0.00f,0.00f,0.00f, 0.135f, 0.230f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_MEDIUMROOM \
|
||||
{ 26, 1.9f, 0.820f, -1200, -200, -600, 2.76f, 0.65f, 1.31f, -1100, 0.022f, 0.00f,0.00f,0.00f, -400, 0.023f, 0.00f,0.00f,0.00f, 0.174f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_LONGPASSAGE \
|
||||
{ 26, 1.8f, 0.640f, -1200, -200, -600, 4.06f, 0.65f, 1.31f, 0, 0.020f, 0.00f,0.00f,0.00f, -900, 0.037f, 0.00f,0.00f,0.00f, 0.135f, 0.230f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_LARGEROOM \
|
||||
{ 26, 1.9f, 0.750f, -1200, -300, -400, 4.24f, 0.51f, 1.31f, -1500, 0.039f, 0.00f,0.00f,0.00f, -600, 0.023f, 0.00f,0.00f,0.00f, 0.231f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_HALL \
|
||||
{ 26, 1.9f, 0.750f, -1000, -300, -400, 7.43f, 0.51f, 1.31f, -2400, 0.073f, 0.00f,0.00f,0.00f, -500, 0.027f, 0.00f,0.00f,0.00f, 0.250f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_CUPBOARD \
|
||||
{ 26, 1.7f, 0.630f, -1200, -200, -600, 0.49f, 0.65f, 1.31f, 200, 0.010f, 0.00f,0.00f,0.00f, 200, 0.032f, 0.00f,0.00f,0.00f, 0.107f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_COURTYARD \
|
||||
{ 26, 1.7f, 0.570f, -1000, -1000, -400, 2.32f, 0.29f, 0.56f, -2400, 0.090f, 0.00f,0.00f,0.00f, -2000, 0.039f, 0.00f,0.00f,0.00f, 0.250f, 0.290f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_FACTORY_SMALLROOM \
|
||||
{ 26, 1.8f, 0.820f, -1200, -200, -600, 1.72f, 0.65f, 1.31f, -300, 0.010f, 0.00f,0.00f,0.00f, -200, 0.024f, 0.00f,0.00f,0.00f, 0.119f, 0.070f, 0.250f, 0.000f, -0.0f, 3762.6f, 362.5f, 0.00f, 0x20 }
|
||||
|
||||
// ICE PALACE PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_ICEPALACE_ALCOVE \
|
||||
{ 26, 2.7f, 0.840f, -1000, -500, -1100, 2.76f, 1.46f, 0.28f, 100, 0.010f, 0.00f,0.00f,0.00f, -1200, 0.030f, 0.00f,0.00f,0.00f, 0.161f, 0.090f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_SHORTPASSAGE \
|
||||
{ 26, 2.7f, 0.750f, -1000, -500, -1100, 1.79f, 1.46f, 0.28f, -600, 0.010f, 0.00f,0.00f,0.00f, -700, 0.019f, 0.00f,0.00f,0.00f, 0.177f, 0.090f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_MEDIUMROOM \
|
||||
{ 26, 2.7f, 0.870f, -1000, -500, -700, 2.22f, 1.53f, 0.32f, -800, 0.039f, 0.00f,0.00f,0.00f, -1200, 0.027f, 0.00f,0.00f,0.00f, 0.186f, 0.120f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_LONGPASSAGE \
|
||||
{ 26, 2.7f, 0.770f, -1000, -500, -800, 3.01f, 1.46f, 0.28f, -200, 0.012f, 0.00f,0.00f,0.00f, -800, 0.025f, 0.00f,0.00f,0.00f, 0.186f, 0.040f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_LARGEROOM \
|
||||
{ 26, 2.9f, 0.810f, -1000, -500, -700, 3.14f, 1.53f, 0.32f, -1200, 0.039f, 0.00f,0.00f,0.00f, -1300, 0.027f, 0.00f,0.00f,0.00f, 0.214f, 0.110f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_HALL \
|
||||
{ 26, 2.9f, 0.760f, -1000, -700, -500, 5.49f, 1.53f, 0.38f, -1900, 0.054f, 0.00f,0.00f,0.00f, -1400, 0.052f, 0.00f,0.00f,0.00f, 0.226f, 0.110f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_CUPBOARD \
|
||||
{ 26, 2.7f, 0.830f, -1000, -600, -1300, 0.76f, 1.53f, 0.26f, 100, 0.012f, 0.00f,0.00f,0.00f, 100, 0.016f, 0.00f,0.00f,0.00f, 0.143f, 0.080f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_COURTYARD \
|
||||
{ 26, 2.9f, 0.590f, -1000, -1100, -1000, 2.04f, 1.20f, 0.38f, -2000, 0.073f, 0.00f,0.00f,0.00f, -2200, 0.043f, 0.00f,0.00f,0.00f, 0.235f, 0.480f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_ICEPALACE_SMALLROOM \
|
||||
{ 26, 2.7f, 0.840f, -1000, -500, -1100, 1.51f, 1.53f, 0.27f, -100, 0.010f, 0.00f,0.00f,0.00f, -900, 0.011f, 0.00f,0.00f,0.00f, 0.164f, 0.140f, 0.250f, 0.000f, -0.0f, 12428.5f, 99.6f, 0.00f, 0x20 }
|
||||
|
||||
// SPACE STATION PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_SPACESTATION_ALCOVE \
|
||||
{ 26, 1.5f, 0.780f, -1100, -300, -100, 1.16f, 0.81f, 0.55f, 300, 0.007f, 0.00f,0.00f,0.00f, -500, 0.018f, 0.00f,0.00f,0.00f, 0.192f, 0.210f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_MEDIUMROOM \
|
||||
{ 26, 1.5f, 0.750f, -1000, -400, -100, 3.01f, 0.50f, 0.55f, -1000, 0.034f, 0.00f,0.00f,0.00f, -700, 0.035f, 0.00f,0.00f,0.00f, 0.209f, 0.310f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_SHORTPASSAGE \
|
||||
{ 26, 1.5f, 0.870f, -1000, -400, -100, 3.57f, 0.50f, 0.55f, 0, 0.012f, 0.00f,0.00f,0.00f, -600, 0.016f, 0.00f,0.00f,0.00f, 0.172f, 0.200f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_LONGPASSAGE \
|
||||
{ 26, 1.9f, 0.820f, -1000, -400, -100, 4.62f, 0.62f, 0.55f, 0, 0.012f, 0.00f,0.00f,0.00f, -800, 0.031f, 0.00f,0.00f,0.00f, 0.250f, 0.230f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_LARGEROOM \
|
||||
{ 26, 1.8f, 0.810f, -1000, -400, -100, 3.89f, 0.38f, 0.61f, -1200, 0.056f, 0.00f,0.00f,0.00f, -800, 0.035f, 0.00f,0.00f,0.00f, 0.233f, 0.280f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_HALL \
|
||||
{ 26, 1.9f, 0.870f, -1000, -400, -100, 7.11f, 0.38f, 0.61f, -1500, 0.100f, 0.00f,0.00f,0.00f, -1000, 0.047f, 0.00f,0.00f,0.00f, 0.250f, 0.250f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_CUPBOARD \
|
||||
{ 26, 1.4f, 0.560f, -1000, -300, -100, 0.79f, 0.81f, 0.55f, 200, 0.007f, 0.00f,0.00f,0.00f, 400, 0.018f, 0.00f,0.00f,0.00f, 0.181f, 0.310f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPACESTATION_SMALLROOM \
|
||||
{ 26, 1.5f, 0.700f, -1000, -300, -100, 1.72f, 0.82f, 0.55f, -400, 0.007f, 0.00f,0.00f,0.00f, -500, 0.013f, 0.00f,0.00f,0.00f, 0.188f, 0.260f, 0.250f, 0.000f, -5.0f, 3316.1f, 458.2f, 0.00f, 0x20 }
|
||||
|
||||
// WOODEN GALLEON PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_WOODEN_ALCOVE \
|
||||
{ 26, 7.5f, 1.000f, -1100, -1800, -1000, 1.22f, 0.62f, 0.91f, -100, 0.012f, 0.00f,0.00f,0.00f, -600, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_SHORTPASSAGE \
|
||||
{ 26, 7.5f, 1.000f, -1100, -1800, -1000, 1.45f, 0.50f, 0.87f, -300, 0.012f, 0.00f,0.00f,0.00f, -700, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_MEDIUMROOM \
|
||||
{ 26, 7.5f, 1.000f, -1200, -2000, -1100, 1.07f, 0.42f, 0.82f, -300, 0.039f, 0.00f,0.00f,0.00f, -400, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_LONGPASSAGE \
|
||||
{ 26, 7.5f, 1.000f, -1100, -2000, -1000, 1.79f, 0.40f, 0.79f, -200, 0.020f, 0.00f,0.00f,0.00f, -1000, 0.036f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_LARGEROOM \
|
||||
{ 26, 7.5f, 1.000f, -1200, -2100, -1100, 1.45f, 0.33f, 0.82f, -300, 0.056f, 0.00f,0.00f,0.00f, -500, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_HALL \
|
||||
{ 26, 7.5f, 1.000f, -1200, -2200, -1100, 1.95f, 0.30f, 0.82f, -300, 0.068f, 0.00f,0.00f,0.00f, -500, 0.063f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_CUPBOARD \
|
||||
{ 26, 7.5f, 1.000f, -1000, -1700, -1000, 0.56f, 0.46f, 0.91f, -100, 0.012f, 0.00f,0.00f,0.00f, -100, 0.028f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_SMALLROOM \
|
||||
{ 26, 7.5f, 1.000f, -1200, -1900, -1000, 0.79f, 0.32f, 0.87f, -200, 0.032f, 0.00f,0.00f,0.00f, -300, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_WOODEN_COURTYARD \
|
||||
{ 26, 7.5f, 0.650f, -1700, -2200, -1000, 1.79f, 0.35f, 0.79f, -700, 0.063f, 0.00f,0.00f,0.00f, -2300, 0.032f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 4705.0f, 99.6f, 0.00f, 0x3f }
|
||||
|
||||
|
||||
// OTHER SCENARIOS
|
||||
|
||||
// SPORTS PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_SPORT_EMPTYSTADIUM \
|
||||
{ 26, 7.2f, 1.000f, -1300, -700, -200, 6.26f, 0.51f, 1.10f, -2400, 0.183f, 0.00f,0.00f,0.00f, -1100, 0.038f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPORT_SQUASHCOURT \
|
||||
{ 26, 7.5f, 0.750f, -1100, -1000, -200, 2.22f, 0.91f, 1.16f, -700, 0.007f, 0.00f,0.00f,0.00f, -300, 0.011f, 0.00f,0.00f,0.00f, 0.126f, 0.190f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPORT_SMALLSWIMMINGPOOL \
|
||||
{ 26, 36.2f, 0.700f, -1400, -200, -100, 2.76f, 1.25f, 1.14f, -400, 0.020f, 0.00f,0.00f,0.00f, -300, 0.030f, 0.00f,0.00f,0.00f, 0.179f, 0.150f, 0.895f, 0.190f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_SPORT_LARGESWIMMINGPOOL\
|
||||
{ 26, 36.2f, 0.820f, -1200, -200, 0, 5.49f, 1.31f, 1.14f, -700, 0.039f, 0.00f,0.00f,0.00f, -800, 0.049f, 0.00f,0.00f,0.00f, 0.222f, 0.550f, 1.159f, 0.210f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_SPORT_GYMNASIUM \
|
||||
{ 26, 7.5f, 0.810f, -1200, -700, -100, 3.14f, 1.06f, 1.35f, -800, 0.029f, 0.00f,0.00f,0.00f, -700, 0.045f, 0.00f,0.00f,0.00f, 0.146f, 0.140f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPORT_FULLSTADIUM \
|
||||
{ 26, 7.2f, 1.000f, -1300, -2300, -200, 5.25f, 0.17f, 0.80f, -2000, 0.188f, 0.00f,0.00f,0.00f, -1300, 0.038f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_SPORT_STADIUMTANNOY \
|
||||
{ 26, 3.0f, 0.780f, -900, -500, -600, 2.53f, 0.88f, 0.68f, -1100, 0.230f, 0.00f,0.00f,0.00f, -600, 0.063f, 0.00f,0.00f,0.00f, 0.250f, 0.200f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
|
||||
// PREFAB PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_PREFAB_WORKSHOP \
|
||||
{ 26, 1.9f, 1.000f, -1000, -1700, -800, 0.76f, 1.00f, 1.00f, 0, 0.012f, 0.00f,0.00f,0.00f, -200, 0.012f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_PREFAB_SCHOOLROOM \
|
||||
{ 26, 1.86f, 0.690f, -1100, -400, -600, 0.98f, 0.45f, 0.18f, 300, 0.017f, 0.00f,0.00f,0.00f, 0, 0.015f, 0.00f,0.00f,0.00f, 0.095f, 0.140f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_PREFAB_PRACTISEROOM \
|
||||
{ 26, 1.86f, 0.870f, -1000, -800, -600, 1.12f, 0.56f, 0.18f, 200, 0.010f, 0.00f,0.00f,0.00f, -200, 0.011f, 0.00f,0.00f,0.00f, 0.095f, 0.140f, 0.250f, 0.000f, -0.0f, 7176.9f, 211.2f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_PREFAB_OUTHOUSE \
|
||||
{ 26, 80.3f, 0.820f, -1100, -1900, -1600, 1.38f, 0.38f, 0.35f, -100, 0.024f, 0.00f,0.00f,-0.00f, -800, 0.044f, 0.00f,0.00f,0.00f, 0.121f, 0.170f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_PREFAB_CARAVAN \
|
||||
{ 26, 8.3f, 1.000f, -1000, -2100, -1800, 0.43f, 1.50f, 1.00f, 0, 0.012f, 0.00f,0.00f,0.00f, 400, 0.012f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x1f }
|
||||
// for US developers, a caravan is the same as a trailer =o)
|
||||
|
||||
|
||||
// DOME AND PIPE PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_DOME_TOMB \
|
||||
{ 26, 51.8f, 0.790f, -1000, -900, -1300, 4.18f, 0.21f, 0.10f, -825, 0.030f, 0.00f,0.00f,0.00f, -125, 0.022f, 0.00f,0.00f,0.00f, 0.177f, 0.190f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_PIPE_SMALL \
|
||||
{ 26, 50.3f, 1.000f, -1000, -900, -1300, 5.04f, 0.10f, 0.10f, -600, 0.032f, 0.00f,0.00f,0.00f, 400, 0.015f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_DOME_SAINTPAULS \
|
||||
{ 26, 50.3f, 0.870f, -1000, -900, -1300, 10.48f, 0.19f, 0.10f, -1500, 0.090f, 0.00f,0.00f,0.00f, -500, 0.042f, 0.00f,0.00f,0.00f, 0.250f, 0.120f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_PIPE_LONGTHIN \
|
||||
{ 26, 1.6f, 0.910f, -1200, -700, -1100, 9.21f, 0.18f, 0.10f, -300, 0.010f, 0.00f,0.00f,0.00f, -1000, 0.022f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_PIPE_LARGE \
|
||||
{ 26, 50.3f, 1.000f, -1000, -900, -1300, 8.45f, 0.10f, 0.10f, -800, 0.046f, 0.00f,0.00f,0.00f, 0, 0.032f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_PIPE_RESONANT \
|
||||
{ 26, 1.3f, 0.910f, -1200, -700, -1100, 6.81f, 0.18f, 0.10f, -300, 0.010f, 0.00f,0.00f,0.00f, -700, 0.022f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 2854.4f, 20.0f, 0.00f, 0x0 }
|
||||
|
||||
// OUTDOORS PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_OUTDOORS_BACKYARD \
|
||||
{ 26, 80.3f, 0.450f, -1100, -1200, -600, 1.12f, 0.34f, 0.46f, -1100, 0.049f, 0.00f,0.00f,-0.00f, -1300, 0.023f, 0.00f,0.00f,0.00f, 0.218f, 0.340f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_OUTDOORS_ROLLINGPLAINS \
|
||||
{ 26, 80.3f, 0.000f, -1100, -3900, -400, 2.13f, 0.21f, 0.46f, -2000, 0.300f, 0.00f,0.00f,-0.00f, -1500, 0.019f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_OUTDOORS_DEEPCANYON \
|
||||
{ 26, 80.3f, 0.740f, -1100, -1500, -400, 3.89f, 0.21f, 0.46f, -2000, 0.193f, 0.00f,0.00f,-0.00f, -1100, 0.019f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_OUTDOORS_CREEK \
|
||||
{ 26, 80.3f, 0.350f, -1100, -1500, -600, 2.13f, 0.21f, 0.46f, -1700, 0.115f, 0.00f,0.00f,-0.00f, -1100, 0.031f, 0.00f,0.00f,0.00f, 0.218f, 0.340f, 0.250f, 0.000f, -5.0f, 4399.1f, 242.9f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_OUTDOORS_VALLEY \
|
||||
{ 26, 80.3f, 0.280f, -1100, -3100, -1600, 2.88f, 0.26f, 0.35f, -3200, 0.163f, 0.00f,0.00f,-0.00f, -1000, 0.100f, 0.00f,0.00f,0.00f, 0.250f, 0.340f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
|
||||
|
||||
|
||||
// MOOD PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_MOOD_HEAVEN \
|
||||
{ 26, 19.6f, 0.940f, -1000, -200, -700, 5.04f, 1.12f, 0.56f, -1230, 0.020f, 0.00f,0.00f,0.00f, -200, 0.029f, 0.00f,0.00f,0.00f, 0.250f, 0.080f, 2.742f, 0.050f, -2.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_MOOD_HELL \
|
||||
{ 26, 100.0f, 0.570f, -1000, -900, -700, 3.57f, 0.49f, 2.00f, -10000, 0.020f, 0.00f,0.00f,0.00f, 100, 0.030f, 0.00f,0.00f,0.00f, 0.110f, 0.040f, 2.109f, 0.520f, -5.0f, 5000.0f, 139.5f, 0.00f, 0x40 }
|
||||
#define EAX30_PRESET_MOOD_MEMORY \
|
||||
{ 26, 8.0f, 0.850f, -1000, -400, -900, 4.06f, 0.82f, 0.56f, -2800, 0.000f, 0.00f,0.00f,0.00f, -500, 0.000f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.474f, 0.450f, -2.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
|
||||
|
||||
// DRIVING SIMULATION PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_DRIVING_COMMENTATOR \
|
||||
{ 26, 3.0f, 0.000f, -900, -500, -600, 2.42f, 0.88f, 0.68f, -1400, 0.093f, 0.00f,0.00f,0.00f, -1200, 0.017f, 0.00f,0.00f,0.00f, 0.250f, 1.000f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_DRIVING_PITGARAGE \
|
||||
{ 26, 1.9f, 0.590f, -1400, -300, -500, 1.72f, 0.93f, 0.87f, -500, 0.000f, 0.00f,0.00f,0.00f, 0, 0.016f, 0.00f,0.00f,0.00f, 0.250f, 0.110f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_DRIVING_INCAR_RACER \
|
||||
{ 26, 1.1f, 0.800f, -700, 0, -200, 0.17f, 2.00f, 0.41f, 500, 0.007f, 0.00f,0.00f,0.00f, -500, 0.015f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -0.0f, 10268.2f, 251.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_DRIVING_INCAR_SPORTS \
|
||||
{ 26, 1.1f, 0.800f, -900, -400, 0, 0.17f, 0.75f, 0.41f, 0, 0.010f, 0.00f,0.00f,0.00f, -600, 0.000f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -0.0f, 10268.2f, 251.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_DRIVING_INCAR_LUXURY \
|
||||
{ 26, 1.6f, 1.000f, -800, -2000, -600, 0.13f, 0.41f, 0.46f, -200, 0.010f, 0.00f,0.00f,0.00f, 300, 0.010f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -0.0f, 10268.2f, 251.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_DRIVING_FULLGRANDSTAND \
|
||||
{ 26, 8.3f, 1.000f, -1100, -1100, -400, 3.01f, 1.37f, 1.28f, -900, 0.090f, 0.00f,0.00f,0.00f, -1700, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 10420.2f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_DRIVING_EMPTYGRANDSTAND \
|
||||
{ 26, 8.3f, 1.000f, -700, 0, -200, 4.62f, 1.75f, 1.40f, -1363, 0.090f, 0.00f,0.00f,0.00f, -1900, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.000f, -5.0f, 10420.2f, 250.0f, 0.00f, 0x1f }
|
||||
#define EAX30_PRESET_DRIVING_TUNNEL \
|
||||
{ 26, 3.1f, 0.810f, -900, -800, -100, 3.42f, 0.94f, 1.31f, -300, 0.051f, 0.00f,0.00f,0.00f, -500, 0.047f, 0.00f,0.00f,0.00f, 0.214f, 0.050f, 0.250f, 0.000f, -0.0f, 5000.0f, 155.3f, 0.00f, 0x20 }
|
||||
|
||||
// CITY PRESETS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_CITY_STREETS \
|
||||
{ 26, 3.0f, 0.780f, -1100, -300, -100, 1.79f, 1.12f, 0.91f, -1700, 0.046f, 0.00f,0.00f,0.00f, -2800, 0.028f, 0.00f,0.00f,0.00f, 0.250f, 0.200f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CITY_SUBWAY \
|
||||
{ 26, 3.0f, 0.740f, -1100, -300, -100, 3.01f, 1.23f, 0.91f, -700, 0.046f, 0.00f,0.00f,0.00f, -1000, 0.028f, 0.00f,0.00f,0.00f, 0.125f, 0.210f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CITY_MUSEUM \
|
||||
{ 26, 80.3f, 0.820f, -1100, -1500, -1500, 3.28f, 1.40f, 0.57f, -1600, 0.039f, 0.00f,0.00f,-0.00f, -600, 0.034f, 0.00f,0.00f,0.00f, 0.130f, 0.170f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_CITY_LIBRARY \
|
||||
{ 26, 80.3f, 0.820f, -1100, -1100, -2100, 2.76f, 0.89f, 0.41f, -1100, 0.029f, 0.00f,0.00f,-0.00f, -500, 0.020f, 0.00f,0.00f,0.00f, 0.130f, 0.170f, 0.250f, 0.000f, -0.0f, 2854.4f, 107.5f, 0.00f, 0x0 }
|
||||
#define EAX30_PRESET_CITY_UNDERPASS \
|
||||
{ 26, 3.0f, 0.820f, -1500, -700, -100, 3.57f, 1.12f, 0.91f, -1500, 0.059f, 0.00f,0.00f,0.00f, -1100, 0.037f, 0.00f,0.00f,0.00f, 0.250f, 0.140f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CITY_ABANDONED \
|
||||
{ 26, 3.0f, 0.690f, -1100, -200, -100, 3.28f, 1.17f, 0.91f, -1400, 0.044f, 0.00f,0.00f,0.00f, -2400, 0.024f, 0.00f,0.00f,0.00f, 0.250f, 0.200f, 0.250f, 0.000f, -0.0f, 5000.0f, 250.0f, 0.00f, 0x20 }
|
||||
|
||||
// MISC ROOMS
|
||||
|
||||
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
|
||||
#define EAX30_PRESET_DUSTYROOM \
|
||||
{ 26, 1.8f, 0.560f, -1100, -200, -300, 1.79f, 0.38f, 0.21f, -600, 0.002f, 0.00f,0.00f,0.00f, 200, 0.006f, 0.00f,0.00f,0.00f, 0.202f, 0.050f, 0.250f, 0.000f, -3.0f, 13046.0f, 163.3f, 0.00f, 0x20 }
|
||||
#define EAX30_PRESET_CHAPEL \
|
||||
{ 26, 19.6f, 0.840f, -1000, -500, 0, 4.62f, 0.64f, 1.23f, -700, 0.032f, 0.00f,0.00f,0.00f, -800, 0.049f, 0.00f,0.00f,0.00f, 0.250f, 0.000f, 0.250f, 0.110f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f }
|
||||
#define EAX30_PRESET_SMALLWATERROOM \
|
||||
{ 26, 36.2f, 0.700f, -1200, -698, 0, 1.51f, 1.25f, 1.14f, -100, 0.020f, 0.00f,0.00f,0.00f, 200, 0.030f, 0.00f,0.00f,0.00f, 0.179f, 0.150f, 0.895f, 0.190f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x0 }
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Effect Scenarios enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EAX30_SCENARIO_CASTLE = 0,
|
||||
EAX30_SCENARIO_FACTORY,
|
||||
EAX30_SCENARIO_ICEPALACE,
|
||||
EAX30_SCENARIO_SPACESTATION,
|
||||
EAX30_SCENARIO_WOODGALLEON,
|
||||
EAX30_SCENARIO_SPORTS,
|
||||
EAX30_SCENARIO_PREFAB,
|
||||
EAX30_SCENARIO_DOMESNPIPES,
|
||||
EAX30_SCENARIO_OUTDOORS,
|
||||
EAX30_SCENARIO_MOOD,
|
||||
EAX30_SCENARIO_DRIVING,
|
||||
EAX30_SCENARIO_CITY,
|
||||
EAX30_SCENARIO_MISC,
|
||||
EAX30_SCENARIO_ORIGINAL
|
||||
}
|
||||
EAX30_SCENARIO;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Number of Effect Scenarios //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#define EAX30_NUM_SCENARIOS 14
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Number of Effect Scenarios with standardised //
|
||||
// locations //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#define EAX30_NUM_STANDARD_SCENARIOS 5
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of scenario names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_SCENARIO_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Standardised Locations enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EAX30_LOCATION_HALL = 0,
|
||||
EAX30_LOCATION_LARGEROOM,
|
||||
EAX30_LOCATION_MEDIUMROOM,
|
||||
EAX30_LOCATION_SMALLROOM,
|
||||
EAX30_LOCATION_CUPBOARD,
|
||||
EAX30_LOCATION_ALCOVE,
|
||||
EAX30_LOCATION_LONGPASSAGE,
|
||||
EAX30_LOCATION_SHORTPASSAGE,
|
||||
EAX30_LOCATION_COURTYARD
|
||||
}
|
||||
EAX30_LOCATION;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Number of Standardised Locations //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#define EAX30_NUM_LOCATIONS 9
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of standardised location names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_LOCATION_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Number of effects in each scenario //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
#define EAX30_NUM_ORIGINAL_PRESETS 26
|
||||
#define EAX30_NUM_CASTLE_PRESETS EAX30_NUM_LOCATIONS
|
||||
#define EAX30_NUM_FACTORY_PRESETS EAX30_NUM_LOCATIONS
|
||||
#define EAX30_NUM_ICEPALACE_PRESETS EAX30_NUM_LOCATIONS
|
||||
#define EAX30_NUM_SPACESTATION_PRESETS EAX30_NUM_LOCATIONS
|
||||
#define EAX30_NUM_WOODGALLEON_PRESETS EAX30_NUM_LOCATIONS
|
||||
#define EAX30_NUM_SPORTS_PRESETS 7
|
||||
#define EAX30_NUM_PREFAB_PRESETS 5
|
||||
#define EAX30_NUM_DOMESNPIPES_PRESETS 6
|
||||
#define EAX30_NUM_OUTDOORS_PRESETS 5
|
||||
#define EAX30_NUM_MOOD_PRESETS 3
|
||||
#define EAX30_NUM_DRIVING_PRESETS 8
|
||||
#define EAX30_NUM_CITY_PRESETS 6
|
||||
#define EAX30_NUM_MISC_PRESETS 3
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Standardised Location effects can be accessed //
|
||||
// from a matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_STANDARD_PRESETS[EAX30_NUM_STANDARD_SCENARIOS][EAX30_NUM_LOCATIONS];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Original Preset effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ORIGINAL_GENERIC = 0,
|
||||
ORIGINAL_PADDEDCELL,
|
||||
ORIGINAL_ROOM,
|
||||
ORIGINAL_BATHROOM,
|
||||
ORIGINAL_LIVINGROOM,
|
||||
ORIGINAL_STONEROOM,
|
||||
ORIGINAL_AUDITORIUM,
|
||||
ORIGINAL_CONCERTHALL,
|
||||
ORIGINAL_CAVE,
|
||||
ORIGINAL_ARENA,
|
||||
ORIGINAL_HANGAR,
|
||||
ORIGINAL_CARPETTEDHALLWAY,
|
||||
ORIGINAL_HALLWAY,
|
||||
ORIGINAL_STONECORRIDOR,
|
||||
ORIGINAL_ALLEY,
|
||||
ORIGINAL_FOREST,
|
||||
ORIGINAL_CITY,
|
||||
ORIGINAL_MOUNTAINS,
|
||||
ORIGINAL_QUARRY,
|
||||
ORIGINAL_PLAIN,
|
||||
ORIGINAL_PARKINGLOT,
|
||||
ORIGINAL_SEWERPIPE,
|
||||
ORIGINAL_UNDERWATER,
|
||||
ORIGINAL_DRUGGED,
|
||||
ORIGINAL_DIZZY,
|
||||
ORIGINAL_PSYCHOTIC
|
||||
}
|
||||
EAX30_ORIGINAL_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of original environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_ORIGINAL_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Original effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_ORIGINAL_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Sports scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPORT_EMPTYSTADIUM=0,
|
||||
SPORT_FULLSTADIUM,
|
||||
SPORT_STADIUMTANNOY,
|
||||
SPORT_SQUASHCOURT,
|
||||
SPORT_SMALLSWIMMINGPOOL,
|
||||
SPORT_LARGESWIMMINGPOOL,
|
||||
SPORT_GYMNASIUM
|
||||
}
|
||||
EAX30_SPORTS_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of sport environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_SPORTS_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Sports effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_SPORTS_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Prefab scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PREFAB_WORKSHOP,
|
||||
PREFAB_SCHOOLROOM,
|
||||
PREFAB_PRACTISEROOM,
|
||||
PREFAB_OUTHOUSE,
|
||||
PREFAB_CARAVAN
|
||||
}
|
||||
EAX30_PREFAB_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of prefab environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_PREFAB_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Prefab effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_PREFAB_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Domes & Pipes effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DOME_TOMB,
|
||||
DOME_SAINTPAULS,
|
||||
PIPE_SMALL,
|
||||
PIPE_LONGTHIN,
|
||||
PIPE_LARGE,
|
||||
PIPE_RESONANT
|
||||
}
|
||||
EAX30_DOMESNPIPES_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Domes & Pipes environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_DOMESNPIPES_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Domes & Pipes effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_DOMESNPIPES_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Outdoors scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OUTDOORS_BACKYARD,
|
||||
OUTDOORS_ROLLINGPLAINS,
|
||||
OUTDOORS_DEEPCANYON,
|
||||
OUTDOORS_CREEK,
|
||||
OUTDOORS_VALLEY
|
||||
}
|
||||
EAX30_OUTDOORS_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Outdoors environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_OUTDOORS_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Outdoors effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_OUTDOORS_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Mood scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MOOD_HEAVEN,
|
||||
MOOD_HELL,
|
||||
MOOD_MEMORY
|
||||
}
|
||||
EAX30_MOOD_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Mood environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_MOOD_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Mood effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_MOOD_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Driving scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DRIVING_COMMENTATOR,
|
||||
DRIVING_PITGARAGE,
|
||||
DRIVING_INCAR_RACER,
|
||||
DRIVING_INCAR_SPORTS,
|
||||
DRIVING_INCAR_LUXURY,
|
||||
DRIVING_FULLGRANDSTAND,
|
||||
DRIVING_EMPTYGRANDSTAND,
|
||||
DRIVING_TUNNEL
|
||||
}
|
||||
EAX30_DRIVING_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of driving environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_DRIVING_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Driving effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_DRIVING_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// City scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CITY_STREETS,
|
||||
CITY_SUBWAY,
|
||||
CITY_MUSEUM,
|
||||
CITY_LIBRARY,
|
||||
CITY_UNDERPASS,
|
||||
CITY_ABANDONED
|
||||
}
|
||||
EAX30_CITY_PRESET_ENUMS;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of City environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_CITY_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// City effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_CITY_PRESETS[];
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Misc scenario effects enumerated //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DUSTYROOM,
|
||||
CHAPEL,
|
||||
SMALLWATERROOM
|
||||
}
|
||||
EAX30_MISC_PRESET_ENUMS;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Array of Misc environment names //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern const char* EAX30_MISC_PRESET_NAMES[];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Misc effects matrix //
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
extern EAXLISTENERPROPERTIES EAX30_MISC_PRESETS[];
|
||||
|
||||
|
||||
/***********************************************************************************************\
|
||||
*
|
||||
* Material transmission presets
|
||||
*
|
||||
* Three values in this order :-
|
||||
*
|
||||
* 1. Occlusion (or Obstruction)
|
||||
* 2. Occlusion LF Ratio (or Obstruction LF Ratio)
|
||||
* 3. Occlusion Room Ratio
|
||||
*
|
||||
************************************************************************************************/
|
||||
|
||||
|
||||
// Single window material preset
|
||||
#define EAX_MATERIAL_SINGLEWINDOW (-2800)
|
||||
#define EAX_MATERIAL_SINGLEWINDOWLF 0.71f
|
||||
#define EAX_MATERIAL_SINGLEWINDOWROOMRATIO 0.43f
|
||||
|
||||
// Double window material preset
|
||||
#define EAX_MATERIAL_DOUBLEWINDOW (-5000)
|
||||
#define EAX_MATERIAL_DOUBLEWINDOWLF 0.40f
|
||||
#define EAX_MATERIAL_DOUBLEWINDOWROOMRATIO 0.24f
|
||||
|
||||
// Thin door material preset
|
||||
#define EAX_MATERIAL_THINDOOR (-1800)
|
||||
#define EAX_MATERIAL_THINDOORLF 0.66f
|
||||
#define EAX_MATERIAL_THINDOORROOMRATIO 0.66f
|
||||
|
||||
// Thick door material preset
|
||||
#define EAX_MATERIAL_THICKDOOR (-4400)
|
||||
#define EAX_MATERIAL_THICKDOORLF 0.64f
|
||||
#define EAX_MATERIAL_THICKDOORROOMRATIO 0.27f
|
||||
|
||||
// Wood wall material preset
|
||||
#define EAX_MATERIAL_WOODWALL (-4000)
|
||||
#define EAX_MATERIAL_WOODWALLLF 0.50f
|
||||
#define EAX_MATERIAL_WOODWALLROOMRATIO 0.30f
|
||||
|
||||
// Brick wall material preset
|
||||
#define EAX_MATERIAL_BRICKWALL (-5000)
|
||||
#define EAX_MATERIAL_BRICKWALLLF 0.60f
|
||||
#define EAX_MATERIAL_BRICKWALLROOMRATIO 0.24f
|
||||
|
||||
// Stone wall material preset
|
||||
#define EAX_MATERIAL_STONEWALL (-6000)
|
||||
#define EAX_MATERIAL_STONEWALLLF 0.68f
|
||||
#define EAX_MATERIAL_STONEWALLROOMRATIO 0.20f
|
||||
|
||||
// Curtain material preset
|
||||
#define EAX_MATERIAL_CURTAIN (-1200)
|
||||
#define EAX_MATERIAL_CURTAINLF 0.15f
|
||||
#define EAX_MATERIAL_CURTAINROOMRATIO 1.00f
|
||||
|
||||
|
||||
#endif // EAXUTIL_INCLUDED
|
||||
536
miami/audio/eax/eax.h
Normal file
@@ -0,0 +1,536 @@
|
||||
/*******************************************************************\
|
||||
* *
|
||||
* EAX.H - Environmental Audio Extensions version 3.0 *
|
||||
* for OpenAL and DirectSound3D *
|
||||
* *
|
||||
********************************************************************/
|
||||
|
||||
#ifndef EAX_H_INCLUDED
|
||||
#define EAX_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef AUDIO_OAL
|
||||
#include <dsound.h>
|
||||
|
||||
/*
|
||||
* EAX Wrapper Interface (using Direct X 7) {4FF53B81-1CE0-11d3-AAB8-00A0C95949D5}
|
||||
*/
|
||||
DEFINE_GUID(CLSID_EAXDirectSound,
|
||||
0x4ff53b81,
|
||||
0x1ce0,
|
||||
0x11d3,
|
||||
0xaa, 0xb8, 0x0, 0xa0, 0xc9, 0x59, 0x49, 0xd5);
|
||||
|
||||
/*
|
||||
* EAX Wrapper Interface (using Direct X 8) {CA503B60-B176-11d4-A094-D0C0BF3A560C}
|
||||
*/
|
||||
DEFINE_GUID(CLSID_EAXDirectSound8,
|
||||
0xca503b60,
|
||||
0xb176,
|
||||
0x11d4,
|
||||
0xa0, 0x94, 0xd0, 0xc0, 0xbf, 0x3a, 0x56, 0xc);
|
||||
|
||||
|
||||
|
||||
#ifdef DIRECTSOUND_VERSION
|
||||
#if DIRECTSOUND_VERSION >= 0x0800
|
||||
__declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate8(GUID*, LPDIRECTSOUND8*, IUnknown FAR *);
|
||||
typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE8)(GUID*, LPDIRECTSOUND8*, IUnknown FAR*);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__declspec(dllimport) HRESULT WINAPI EAXDirectSoundCreate(GUID*, LPDIRECTSOUND*, IUnknown FAR *);
|
||||
typedef HRESULT (FAR PASCAL *LPEAXDIRECTSOUNDCREATE)(GUID*, LPDIRECTSOUND*, IUnknown FAR*);
|
||||
|
||||
__declspec(dllimport) void CDECL GetCurrentVersion(LPDWORD major, LPDWORD minor);
|
||||
typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor);
|
||||
|
||||
|
||||
#else // AUDIO_OAL
|
||||
#include <AL/al.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
typedef struct _GUID
|
||||
{
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
#endif // !GUID_DEFINED
|
||||
|
||||
#ifndef DEFINE_GUID
|
||||
#ifndef INITGUID
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
extern const GUID /*FAR*/ name
|
||||
#else
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
|
||||
#endif // INITGUID
|
||||
#endif // DEFINE_GUID
|
||||
|
||||
|
||||
/*
|
||||
* EAX OpenAL Extension
|
||||
*/
|
||||
typedef ALenum (*EAXSet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
|
||||
typedef ALenum (*EAXGet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint);
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
/*
|
||||
* EAX 3.0 listener property set {A8FA6880-B476-11d3-BDB9-00C0F02DDF87}
|
||||
*/
|
||||
DEFINE_GUID(DSPROPSETID_EAX30_ListenerProperties,
|
||||
0xa8fa6882,
|
||||
0xb476,
|
||||
0x11d3,
|
||||
0xbd, 0xb9, 0x00, 0xc0, 0xf0, 0x2d, 0xdf, 0x87);
|
||||
|
||||
// For compatibility with future EAX versions:
|
||||
#define DSPROPSETID_EAX_ListenerProperties DSPROPSETID_EAX30_ListenerProperties
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSPROPERTY_EAXLISTENER_NONE,
|
||||
DSPROPERTY_EAXLISTENER_ALLPARAMETERS,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENT,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE,
|
||||
DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION,
|
||||
DSPROPERTY_EAXLISTENER_ROOM,
|
||||
DSPROPERTY_EAXLISTENER_ROOMHF,
|
||||
DSPROPERTY_EAXLISTENER_ROOMLF,
|
||||
DSPROPERTY_EAXLISTENER_DECAYTIME,
|
||||
DSPROPERTY_EAXLISTENER_DECAYHFRATIO,
|
||||
DSPROPERTY_EAXLISTENER_DECAYLFRATIO,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONS,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY,
|
||||
DSPROPERTY_EAXLISTENER_REFLECTIONSPAN,
|
||||
DSPROPERTY_EAXLISTENER_REVERB,
|
||||
DSPROPERTY_EAXLISTENER_REVERBDELAY,
|
||||
DSPROPERTY_EAXLISTENER_REVERBPAN,
|
||||
DSPROPERTY_EAXLISTENER_ECHOTIME,
|
||||
DSPROPERTY_EAXLISTENER_ECHODEPTH,
|
||||
DSPROPERTY_EAXLISTENER_MODULATIONTIME,
|
||||
DSPROPERTY_EAXLISTENER_MODULATIONDEPTH,
|
||||
DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF,
|
||||
DSPROPERTY_EAXLISTENER_HFREFERENCE,
|
||||
DSPROPERTY_EAXLISTENER_LFREFERENCE,
|
||||
DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXLISTENER_FLAGS
|
||||
} DSPROPERTY_EAX_LISTENERPROPERTY;
|
||||
|
||||
// OR these flags with property id
|
||||
#define DSPROPERTY_EAXLISTENER_IMMEDIATE 0x00000000 // changes take effect immediately
|
||||
#define DSPROPERTY_EAXLISTENER_DEFERRED 0x80000000 // changes take effect later
|
||||
#define DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXLISTENER_NONE | \
|
||||
DSPROPERTY_EAXLISTENER_IMMEDIATE)
|
||||
|
||||
typedef struct _EAXVECTOR {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} EAXVECTOR;
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXLISTENER_ALLPARAMETERS
|
||||
// - all levels are hundredths of decibels
|
||||
// - all times and delays are in seconds
|
||||
//
|
||||
// NOTE: This structure may change in future EAX versions.
|
||||
// It is recommended to initialize fields by name:
|
||||
// myListener.lRoom = -1000;
|
||||
// myListener.lRoomHF = -100;
|
||||
// ...
|
||||
// myListener.dwFlags = myFlags /* see EAXLISTENERFLAGS below */ ;
|
||||
// instead of:
|
||||
// myListener = { -1000, -100, ... , 0x00000009 };
|
||||
// If you want to save and load presets in binary form, you
|
||||
// should define your own structure to insure future compatibility.
|
||||
//
|
||||
typedef struct _EAXLISTENERPROPERTIES
|
||||
{
|
||||
unsigned long ulEnvironment; // sets all listener properties
|
||||
float flEnvironmentSize; // environment size in meters
|
||||
float flEnvironmentDiffusion; // environment diffusion
|
||||
long lRoom; // room effect level (at mid frequencies)
|
||||
long lRoomHF; // relative room effect level at high frequencies
|
||||
long lRoomLF; // relative room effect level at low frequencies
|
||||
float flDecayTime; // reverberation decay time at mid frequencies
|
||||
float flDecayHFRatio; // high-frequency to mid-frequency decay time ratio
|
||||
float flDecayLFRatio; // low-frequency to mid-frequency decay time ratio
|
||||
long lReflections; // early reflections level relative to room effect
|
||||
float flReflectionsDelay; // initial reflection delay time
|
||||
EAXVECTOR vReflectionsPan; // early reflections panning vector
|
||||
long lReverb; // late reverberation level relative to room effect
|
||||
float flReverbDelay; // late reverberation delay time relative to initial reflection
|
||||
EAXVECTOR vReverbPan; // late reverberation panning vector
|
||||
float flEchoTime; // echo time
|
||||
float flEchoDepth; // echo depth
|
||||
float flModulationTime; // modulation time
|
||||
float flModulationDepth; // modulation depth
|
||||
float flAirAbsorptionHF; // change in level per meter at high frequencies
|
||||
float flHFReference; // reference high frequency
|
||||
float flLFReference; // reference low frequency
|
||||
float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
|
||||
unsigned long ulFlags; // modifies the behavior of properties
|
||||
} EAXLISTENERPROPERTIES, *LPEAXLISTENERPROPERTIES;
|
||||
|
||||
// used by DSPROPERTY_EAXLISTENER_ENVIRONMENT
|
||||
enum
|
||||
{
|
||||
EAX_ENVIRONMENT_GENERIC,
|
||||
EAX_ENVIRONMENT_PADDEDCELL,
|
||||
EAX_ENVIRONMENT_ROOM,
|
||||
EAX_ENVIRONMENT_BATHROOM,
|
||||
EAX_ENVIRONMENT_LIVINGROOM,
|
||||
EAX_ENVIRONMENT_STONEROOM,
|
||||
EAX_ENVIRONMENT_AUDITORIUM,
|
||||
EAX_ENVIRONMENT_CONCERTHALL,
|
||||
EAX_ENVIRONMENT_CAVE,
|
||||
EAX_ENVIRONMENT_ARENA,
|
||||
EAX_ENVIRONMENT_HANGAR,
|
||||
EAX_ENVIRONMENT_CARPETEDHALLWAY,
|
||||
EAX_ENVIRONMENT_HALLWAY,
|
||||
EAX_ENVIRONMENT_STONECORRIDOR,
|
||||
EAX_ENVIRONMENT_ALLEY,
|
||||
EAX_ENVIRONMENT_FOREST,
|
||||
EAX_ENVIRONMENT_CITY,
|
||||
EAX_ENVIRONMENT_MOUNTAINS,
|
||||
EAX_ENVIRONMENT_QUARRY,
|
||||
EAX_ENVIRONMENT_PLAIN,
|
||||
EAX_ENVIRONMENT_PARKINGLOT,
|
||||
EAX_ENVIRONMENT_SEWERPIPE,
|
||||
EAX_ENVIRONMENT_UNDERWATER,
|
||||
EAX_ENVIRONMENT_DRUGGED,
|
||||
EAX_ENVIRONMENT_DIZZY,
|
||||
EAX_ENVIRONMENT_PSYCHOTIC,
|
||||
|
||||
EAX_ENVIRONMENT_UNDEFINED,
|
||||
|
||||
EAX_ENVIRONMENT_COUNT
|
||||
};
|
||||
|
||||
// Used by DSPROPERTY_EAXLISTENER_FLAGS
|
||||
//
|
||||
// Note: The number and order of flags may change in future EAX versions.
|
||||
// It is recommended to use the flag defines as follows:
|
||||
// myFlags = EAXLISTENERFLAGS_DECAYTIMESCALE | EAXLISTENERFLAGS_REVERBSCALE;
|
||||
// instead of:
|
||||
// myFlags = 0x00000009;
|
||||
//
|
||||
// These flags determine what properties are affected by environment size.
|
||||
#define EAXLISTENERFLAGS_DECAYTIMESCALE 0x00000001 // reverberation decay time
|
||||
#define EAXLISTENERFLAGS_REFLECTIONSSCALE 0x00000002 // reflection level
|
||||
#define EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE 0x00000004 // initial reflection delay time
|
||||
#define EAXLISTENERFLAGS_REVERBSCALE 0x00000008 // reflections level
|
||||
#define EAXLISTENERFLAGS_REVERBDELAYSCALE 0x00000010 // late reverberation delay time
|
||||
#define EAXLISTENERFLAGS_ECHOTIMESCALE 0x00000040 // echo time
|
||||
#define EAXLISTENERFLAGS_MODULATIONTIMESCALE 0x00000080 // modulation time
|
||||
|
||||
// This flag limits high-frequency decay time according to air absorption.
|
||||
#define EAXLISTENERFLAGS_DECAYHFLIMIT 0x00000020
|
||||
|
||||
#define EAXLISTENERFLAGS_RESERVED 0xFFFFFF00 // reserved future use
|
||||
|
||||
// Property ranges and defaults:
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENT 0
|
||||
#define EAXLISTENER_MAXENVIRONMENT (EAX_ENVIRONMENT_COUNT-1)
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENT EAX_ENVIRONMENT_GENERIC
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENTSIZE 1.0f
|
||||
#define EAXLISTENER_MAXENVIRONMENTSIZE 100.0f
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENTSIZE 7.5f
|
||||
|
||||
#define EAXLISTENER_MINENVIRONMENTDIFFUSION 0.0f
|
||||
#define EAXLISTENER_MAXENVIRONMENTDIFFUSION 1.0f
|
||||
#define EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION 1.0f
|
||||
|
||||
#define EAXLISTENER_MINROOM (-10000)
|
||||
#define EAXLISTENER_MAXROOM 0
|
||||
#define EAXLISTENER_DEFAULTROOM (-1000)
|
||||
|
||||
#define EAXLISTENER_MINROOMHF (-10000)
|
||||
#define EAXLISTENER_MAXROOMHF 0
|
||||
#define EAXLISTENER_DEFAULTROOMHF (-100)
|
||||
|
||||
#define EAXLISTENER_MINROOMLF (-10000)
|
||||
#define EAXLISTENER_MAXROOMLF 0
|
||||
#define EAXLISTENER_DEFAULTROOMLF 0
|
||||
|
||||
#define EAXLISTENER_MINDECAYTIME 0.1f
|
||||
#define EAXLISTENER_MAXDECAYTIME 20.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYTIME 1.49f
|
||||
|
||||
#define EAXLISTENER_MINDECAYHFRATIO 0.1f
|
||||
#define EAXLISTENER_MAXDECAYHFRATIO 2.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYHFRATIO 0.83f
|
||||
|
||||
#define EAXLISTENER_MINDECAYLFRATIO 0.1f
|
||||
#define EAXLISTENER_MAXDECAYLFRATIO 2.0f
|
||||
#define EAXLISTENER_DEFAULTDECAYLFRATIO 1.00f
|
||||
|
||||
#define EAXLISTENER_MINREFLECTIONS (-10000)
|
||||
#define EAXLISTENER_MAXREFLECTIONS 1000
|
||||
#define EAXLISTENER_DEFAULTREFLECTIONS (-2602)
|
||||
|
||||
#define EAXLISTENER_MINREFLECTIONSDELAY 0.0f
|
||||
#define EAXLISTENER_MAXREFLECTIONSDELAY 0.3f
|
||||
#define EAXLISTENER_DEFAULTREFLECTIONSDELAY 0.007f
|
||||
|
||||
#define EAXLISTENER_MINREVERB (-10000)
|
||||
#define EAXLISTENER_MAXREVERB 2000
|
||||
#define EAXLISTENER_DEFAULTREVERB 200
|
||||
|
||||
#define EAXLISTENER_MINREVERBDELAY 0.0f
|
||||
#define EAXLISTENER_MAXREVERBDELAY 0.1f
|
||||
#define EAXLISTENER_DEFAULTREVERBDELAY 0.011f
|
||||
|
||||
#define EAXLISTENER_MINECHOTIME 0.075f
|
||||
#define EAXLISTENER_MAXECHOTIME 0.25f
|
||||
#define EAXLISTENER_DEFAULTECHOTIME 0.25f
|
||||
|
||||
#define EAXLISTENER_MINECHODEPTH 0.0f
|
||||
#define EAXLISTENER_MAXECHODEPTH 1.0f
|
||||
#define EAXLISTENER_DEFAULTECHODEPTH 0.0f
|
||||
|
||||
#define EAXLISTENER_MINMODULATIONTIME 0.04f
|
||||
#define EAXLISTENER_MAXMODULATIONTIME 4.0f
|
||||
#define EAXLISTENER_DEFAULTMODULATIONTIME 0.25f
|
||||
|
||||
#define EAXLISTENER_MINMODULATIONDEPTH 0.0f
|
||||
#define EAXLISTENER_MAXMODULATIONDEPTH 1.0f
|
||||
#define EAXLISTENER_DEFAULTMODULATIONDEPTH 0.0f
|
||||
|
||||
#define EAXLISTENER_MINAIRABSORPTIONHF (-100.0f)
|
||||
#define EAXLISTENER_MAXAIRABSORPTIONHF 0.0f
|
||||
#define EAXLISTENER_DEFAULTAIRABSORPTIONHF (-5.0f)
|
||||
|
||||
#define EAXLISTENER_MINHFREFERENCE 1000.0f
|
||||
#define EAXLISTENER_MAXHFREFERENCE 20000.0f
|
||||
#define EAXLISTENER_DEFAULTHFREFERENCE 5000.0f
|
||||
|
||||
#define EAXLISTENER_MINLFREFERENCE 20.0f
|
||||
#define EAXLISTENER_MAXLFREFERENCE 1000.0f
|
||||
#define EAXLISTENER_DEFAULTLFREFERENCE 250.0f
|
||||
|
||||
#define EAXLISTENER_MINROOMROLLOFFFACTOR 0.0f
|
||||
#define EAXLISTENER_MAXROOMROLLOFFFACTOR 10.0f
|
||||
#define EAXLISTENER_DEFAULTROOMROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXLISTENER_DEFAULTFLAGS (EAXLISTENERFLAGS_DECAYTIMESCALE | \
|
||||
EAXLISTENERFLAGS_REFLECTIONSSCALE | \
|
||||
EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | \
|
||||
EAXLISTENERFLAGS_REVERBSCALE | \
|
||||
EAXLISTENERFLAGS_REVERBDELAYSCALE | \
|
||||
EAXLISTENERFLAGS_DECAYHFLIMIT)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* EAX 3.0 buffer property set {A8FA6881-B476-11d3-BDB9-00C0F02DDF87}
|
||||
*/
|
||||
DEFINE_GUID(DSPROPSETID_EAX30_BufferProperties,
|
||||
0xa8fa6881,
|
||||
0xb476,
|
||||
0x11d3,
|
||||
0xbd, 0xb9, 0x0, 0xc0, 0xf0, 0x2d, 0xdf, 0x87);
|
||||
|
||||
// For compatibility with future EAX versions:
|
||||
#define DSPROPSETID_EAX_BufferProperties DSPROPSETID_EAX30_BufferProperties
|
||||
#define DSPROPSETID_EAX_SourceProperties DSPROPSETID_EAX30_BufferProperties
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DSPROPERTY_EAXBUFFER_NONE,
|
||||
DSPROPERTY_EAXBUFFER_ALLPARAMETERS,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTIONPARAMETERS,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONPARAMETERS,
|
||||
DSPROPERTY_EAXBUFFER_EXCLUSIONPARAMETERS,
|
||||
DSPROPERTY_EAXBUFFER_DIRECT,
|
||||
DSPROPERTY_EAXBUFFER_DIRECTHF,
|
||||
DSPROPERTY_EAXBUFFER_ROOM,
|
||||
DSPROPERTY_EAXBUFFER_ROOMHF,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTION,
|
||||
DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSION,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OCCLUSIONDIRECTRATIO,
|
||||
DSPROPERTY_EAXBUFFER_EXCLUSION,
|
||||
DSPROPERTY_EAXBUFFER_EXCLUSIONLFRATIO,
|
||||
DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF,
|
||||
DSPROPERTY_EAXBUFFER_DOPPLERFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_ROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR,
|
||||
DSPROPERTY_EAXBUFFER_FLAGS
|
||||
} DSPROPERTY_EAX_BUFFERPROPERTY;
|
||||
|
||||
// OR these flags with property id
|
||||
#define DSPROPERTY_EAXBUFFER_IMMEDIATE 0x00000000 // changes take effect immediately
|
||||
#define DSPROPERTY_EAXBUFFER_DEFERRED 0x80000000 // changes take effect later
|
||||
#define DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS (DSPROPERTY_EAXBUFFER_NONE | \
|
||||
DSPROPERTY_EAXBUFFER_IMMEDIATE)
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXBUFFER_ALLPARAMETERS
|
||||
// - all levels are hundredths of decibels
|
||||
// - all delays are in seconds
|
||||
//
|
||||
// NOTE: This structure may change in future EAX versions.
|
||||
// It is recommended to initialize fields by name:
|
||||
// myBuffer.lDirect = 0;
|
||||
// myBuffer.lDirectHF = -200;
|
||||
// ...
|
||||
// myBuffer.dwFlags = myFlags /* see EAXBUFFERFLAGS below */ ;
|
||||
// instead of:
|
||||
// myBuffer = { 0, -200, ... , 0x00000003 };
|
||||
//
|
||||
typedef struct _EAXBUFFERPROPERTIES
|
||||
{
|
||||
long lDirect; // direct path level (at low and mid frequencies)
|
||||
long lDirectHF; // relative direct path level at high frequencies
|
||||
long lRoom; // room effect level (at low and mid frequencies)
|
||||
long lRoomHF; // relative room effect level at high frequencies
|
||||
long lObstruction; // main obstruction control (attenuation at high frequencies)
|
||||
float flObstructionLFRatio; // obstruction low-frequency level re. main control
|
||||
long lOcclusion; // main occlusion control (attenuation at high frequencies)
|
||||
float flOcclusionLFRatio; // occlusion low-frequency level re. main control
|
||||
float flOcclusionRoomRatio; // relative occlusion control for room effect
|
||||
float flOcclusionDirectRatio; // relative occlusion control for direct path
|
||||
long lExclusion; // main exlusion control (attenuation at high frequencies)
|
||||
float flExclusionLFRatio; // exclusion low-frequency level re. main control
|
||||
long lOutsideVolumeHF; // outside sound cone level at high frequencies
|
||||
float flDopplerFactor; // like DS3D flDopplerFactor but per source
|
||||
float flRolloffFactor; // like DS3D flRolloffFactor but per source
|
||||
float flRoomRolloffFactor; // like DS3D flRolloffFactor but for room effect
|
||||
float flAirAbsorptionFactor; // multiplies DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF
|
||||
unsigned long ulFlags; // modifies the behavior of properties
|
||||
} EAXBUFFERPROPERTIES, *LPEAXBUFFERPROPERTIES;
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXBUFFER_OBSTRUCTION,
|
||||
typedef struct _EAXOBSTRUCTIONPROPERTIES
|
||||
{
|
||||
long lObstruction;
|
||||
float flObstructionLFRatio;
|
||||
} EAXOBSTRUCTIONPROPERTIES, *LPEAXOBSTRUCTIONPROPERTIES;
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXBUFFER_OCCLUSION
|
||||
typedef struct _EAXOCCLUSIONPROPERTIES
|
||||
{
|
||||
long lOcclusion;
|
||||
float flOcclusionLFRatio;
|
||||
float flOcclusionRoomRatio;
|
||||
float flOcclusionDirectRatio;
|
||||
} EAXOCCLUSIONPROPERTIES, *LPEAXOCCLUSIONPROPERTIES;
|
||||
|
||||
// Use this structure for DSPROPERTY_EAXBUFFER_EXCLUSION
|
||||
typedef struct _EAXEXCLUSIONPROPERTIES
|
||||
{
|
||||
long lExclusion;
|
||||
float flExclusionLFRatio;
|
||||
} EAXEXCLUSIONPROPERTIES, *LPEAXEXCLUSIONPROPERTIES;
|
||||
|
||||
// Used by DSPROPERTY_EAXBUFFER_FLAGS
|
||||
// TRUE: value is computed automatically - property is an offset
|
||||
// FALSE: value is used directly
|
||||
//
|
||||
// Note: The number and order of flags may change in future EAX versions.
|
||||
// To insure future compatibility, use flag defines as follows:
|
||||
// myFlags = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO;
|
||||
// instead of:
|
||||
// myFlags = 0x00000003;
|
||||
//
|
||||
#define EAXBUFFERFLAGS_DIRECTHFAUTO 0x00000001 // affects DSPROPERTY_EAXBUFFER_DIRECTHF
|
||||
#define EAXBUFFERFLAGS_ROOMAUTO 0x00000002 // affects DSPROPERTY_EAXBUFFER_ROOM
|
||||
#define EAXBUFFERFLAGS_ROOMHFAUTO 0x00000004 // affects DSPROPERTY_EAXBUFFER_ROOMHF
|
||||
|
||||
#define EAXBUFFERFLAGS_RESERVED 0xFFFFFFF8 // reserved future use
|
||||
|
||||
// Property ranges and defaults:
|
||||
|
||||
#define EAXBUFFER_MINDIRECT (-10000)
|
||||
#define EAXBUFFER_MAXDIRECT 1000
|
||||
#define EAXBUFFER_DEFAULTDIRECT 0
|
||||
|
||||
#define EAXBUFFER_MINDIRECTHF (-10000)
|
||||
#define EAXBUFFER_MAXDIRECTHF 0
|
||||
#define EAXBUFFER_DEFAULTDIRECTHF 0
|
||||
|
||||
#define EAXBUFFER_MINROOM (-10000)
|
||||
#define EAXBUFFER_MAXROOM 1000
|
||||
#define EAXBUFFER_DEFAULTROOM 0
|
||||
|
||||
#define EAXBUFFER_MINROOMHF (-10000)
|
||||
#define EAXBUFFER_MAXROOMHF 0
|
||||
#define EAXBUFFER_DEFAULTROOMHF 0
|
||||
|
||||
#define EAXBUFFER_MINOBSTRUCTION (-10000)
|
||||
#define EAXBUFFER_MAXOBSTRUCTION 0
|
||||
#define EAXBUFFER_DEFAULTOBSTRUCTION 0
|
||||
|
||||
#define EAXBUFFER_MINOBSTRUCTIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOBSTRUCTIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO 0.0f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSION (-10000)
|
||||
#define EAXBUFFER_MAXOCCLUSION 0
|
||||
#define EAXBUFFER_DEFAULTOCCLUSION 0
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONLFRATIO 0.25f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONROOMRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONROOMRATIO 10.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO 1.5f
|
||||
|
||||
#define EAXBUFFER_MINOCCLUSIONDIRECTRATIO 0.0f
|
||||
#define EAXBUFFER_MAXOCCLUSIONDIRECTRATIO 10.0f
|
||||
#define EAXBUFFER_DEFAULTOCCLUSIONDIRECTRATIO 1.0f
|
||||
|
||||
#define EAXBUFFER_MINEXCLUSION (-10000)
|
||||
#define EAXBUFFER_MAXEXCLUSION 0
|
||||
#define EAXBUFFER_DEFAULTEXCLUSION 0
|
||||
|
||||
#define EAXBUFFER_MINEXCLUSIONLFRATIO 0.0f
|
||||
#define EAXBUFFER_MAXEXCLUSIONLFRATIO 1.0f
|
||||
#define EAXBUFFER_DEFAULTEXCLUSIONLFRATIO 1.0f
|
||||
|
||||
#define EAXBUFFER_MINOUTSIDEVOLUMEHF (-10000)
|
||||
#define EAXBUFFER_MAXOUTSIDEVOLUMEHF 0
|
||||
#define EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF 0
|
||||
|
||||
#define EAXBUFFER_MINDOPPLERFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXDOPPLERFACTOR 10.f
|
||||
#define EAXBUFFER_DEFAULTDOPPLERFACTOR 0.0f
|
||||
|
||||
#define EAXBUFFER_MINROLLOFFFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXROLLOFFFACTOR 10.f
|
||||
#define EAXBUFFER_DEFAULTROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXBUFFER_MINROOMROLLOFFFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXROOMROLLOFFFACTOR 10.f
|
||||
#define EAXBUFFER_DEFAULTROOMROLLOFFFACTOR 0.0f
|
||||
|
||||
#define EAXBUFFER_MINAIRABSORPTIONFACTOR 0.0f
|
||||
#define EAXBUFFER_MAXAIRABSORPTIONFACTOR 10.0f
|
||||
#define EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR 1.0f
|
||||
|
||||
#define EAXBUFFER_DEFAULTFLAGS (EAXBUFFERFLAGS_DIRECTHFAUTO | \
|
||||
EAXBUFFERFLAGS_ROOMAUTO | \
|
||||
EAXBUFFERFLAGS_ROOMHFAUTO )
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
291
miami/audio/oal/aldlist.cpp
Normal file
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Creative Labs Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or
|
||||
* promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "aldlist.h"
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
/*
|
||||
* Init call
|
||||
*/
|
||||
ALDeviceList::ALDeviceList()
|
||||
{
|
||||
char *devices;
|
||||
int index;
|
||||
const char *defaultDeviceName;
|
||||
const char *actualDeviceName;
|
||||
|
||||
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
|
||||
nNumOfDevices = 0;
|
||||
|
||||
defaultDeviceIndex = 0;
|
||||
|
||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) {
|
||||
devices = (char *)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
|
||||
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
|
||||
|
||||
index = 0;
|
||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||
while (*devices != '\0') {
|
||||
if (strcmp(defaultDeviceName, devices) == 0) {
|
||||
defaultDeviceIndex = index;
|
||||
}
|
||||
ALCdevice *device = alcOpenDevice(devices);
|
||||
if (device) {
|
||||
ALCcontext *context = alcCreateContext(device, NULL);
|
||||
if (context) {
|
||||
alcMakeContextCurrent(context);
|
||||
// if new actual device name isn't already in the list, then add it...
|
||||
actualDeviceName = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER);
|
||||
if ((actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
|
||||
ALDEVICEINFO &ALDeviceInfo = aDeviceInfo[nNumOfDevices++];
|
||||
ALDeviceInfo.bSelected = true;
|
||||
ALDeviceInfo.SetName(actualDeviceName);
|
||||
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
|
||||
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
|
||||
|
||||
// Check for ALC Extensions
|
||||
if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EXT_CAPTURE;
|
||||
if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EXT_EFX;
|
||||
|
||||
// Check for AL Extensions
|
||||
if (alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EXT_OFFSET;
|
||||
|
||||
if (alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EXT_LINEAR_DISTANCE;
|
||||
if (alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EXT_EXPONENT_DISTANCE;
|
||||
|
||||
if (alIsExtensionPresent("EAX2.0") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EAX2;
|
||||
if (alIsExtensionPresent("EAX3.0") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EAX3;
|
||||
if (alIsExtensionPresent("EAX4.0") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EAX4;
|
||||
if (alIsExtensionPresent("EAX5.0") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EAX5;
|
||||
|
||||
if (alIsExtensionPresent("EAX-RAM") == AL_TRUE)
|
||||
ALDeviceInfo.Extensions |= ADEXT_EAX_RAM;
|
||||
|
||||
// Get Source Count
|
||||
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
|
||||
}
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcDestroyContext(context);
|
||||
}
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
devices += strlen(devices) + 1;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
ResetFilters();
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit call
|
||||
*/
|
||||
ALDeviceList::~ALDeviceList()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the number of devices in the complete device list
|
||||
*/
|
||||
unsigned int ALDeviceList::GetNumDevices()
|
||||
{
|
||||
return nNumOfDevices;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the device name at an index in the complete device list
|
||||
*/
|
||||
const char * ALDeviceList::GetDeviceName(unsigned int index)
|
||||
{
|
||||
if (index < GetNumDevices())
|
||||
return aDeviceInfo[index].strDeviceName;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the major and minor version numbers for a device at a specified index in the complete list
|
||||
*/
|
||||
void ALDeviceList::GetDeviceVersion(unsigned int index, int *major, int *minor)
|
||||
{
|
||||
if (index < GetNumDevices()) {
|
||||
if (major)
|
||||
*major = aDeviceInfo[index].iMajorVersion;
|
||||
if (minor)
|
||||
*minor = aDeviceInfo[index].iMinorVersion;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the maximum number of Sources that can be generate on the given device
|
||||
*/
|
||||
unsigned int ALDeviceList::GetMaxNumSources(unsigned int index)
|
||||
{
|
||||
if (index < GetNumDevices())
|
||||
return aDeviceInfo[index].uiSourceCount;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if the extension is supported on the given device
|
||||
*/
|
||||
bool ALDeviceList::IsExtensionSupported(int index, unsigned short ext)
|
||||
{
|
||||
return !!(aDeviceInfo[index].Extensions & ext);
|
||||
}
|
||||
|
||||
/*
|
||||
* returns the index of the default device in the complete device list
|
||||
*/
|
||||
int ALDeviceList::GetDefaultDevice()
|
||||
{
|
||||
return defaultDeviceIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deselects devices which don't have the specified minimum version
|
||||
*/
|
||||
void ALDeviceList::FilterDevicesMinVer(int major, int minor)
|
||||
{
|
||||
int dMajor, dMinor;
|
||||
for (unsigned int i = 0; i < nNumOfDevices; i++) {
|
||||
GetDeviceVersion(i, &dMajor, &dMinor);
|
||||
if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) {
|
||||
aDeviceInfo[i].bSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Deselects devices which don't have the specified maximum version
|
||||
*/
|
||||
void ALDeviceList::FilterDevicesMaxVer(int major, int minor)
|
||||
{
|
||||
int dMajor, dMinor;
|
||||
for (unsigned int i = 0; i < nNumOfDevices; i++) {
|
||||
GetDeviceVersion(i, &dMajor, &dMinor);
|
||||
if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) {
|
||||
aDeviceInfo[i].bSelected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Deselects device which don't support the given extension name
|
||||
*/
|
||||
void
|
||||
ALDeviceList::FilterDevicesExtension(unsigned short ext)
|
||||
{
|
||||
for (unsigned int i = 0; i < nNumOfDevices; i++) {
|
||||
if (!IsExtensionSupported(i, ext))
|
||||
aDeviceInfo[i].bSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Resets all filtering, such that all devices are in the list
|
||||
*/
|
||||
void ALDeviceList::ResetFilters()
|
||||
{
|
||||
for (unsigned int i = 0; i < GetNumDevices(); i++) {
|
||||
aDeviceInfo[i].bSelected = true;
|
||||
}
|
||||
filterIndex = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets index of first filtered device
|
||||
*/
|
||||
int ALDeviceList::GetFirstFilteredDevice()
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < GetNumDevices(); i++) {
|
||||
if (aDeviceInfo[i].bSelected == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
filterIndex = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets index of next filtered device
|
||||
*/
|
||||
int ALDeviceList::GetNextFilteredDevice()
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = filterIndex; i < GetNumDevices(); i++) {
|
||||
if (aDeviceInfo[i].bSelected == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
filterIndex = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal function to detemine max number of Sources that can be generated
|
||||
*/
|
||||
unsigned int ALDeviceList::GetMaxNumSources()
|
||||
{
|
||||
ALuint uiSources[256];
|
||||
unsigned int iSourceCount = 0;
|
||||
|
||||
// Clear AL Error Code
|
||||
alGetError();
|
||||
|
||||
// Generate up to 256 Sources, checking for any errors
|
||||
for (iSourceCount = 0; iSourceCount < 256; iSourceCount++)
|
||||
{
|
||||
alGenSources(1, &uiSources[iSourceCount]);
|
||||
if (alGetError() != AL_NO_ERROR)
|
||||
break;
|
||||
}
|
||||
|
||||
// Release the Sources
|
||||
alDeleteSources(iSourceCount, uiSources);
|
||||
if (alGetError() != AL_NO_ERROR)
|
||||
{
|
||||
for (unsigned int i = 0; i < 256; i++)
|
||||
{
|
||||
alDeleteSources(1, &uiSources[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return iSourceCount;
|
||||
}
|
||||
#endif
|
||||
82
miami/audio/oal/aldlist.h
Normal file
@@ -0,0 +1,82 @@
|
||||
#ifndef ALDEVICELIST_H
|
||||
#define ALDEVICELIST_H
|
||||
|
||||
#include "oal_utils.h"
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#pragma warning(disable: 4786) //disable warning "identifier was truncated to '255' characters in the browser information"
|
||||
|
||||
enum
|
||||
{
|
||||
ADEXT_EXT_CAPTURE = (1 << 0),
|
||||
ADEXT_EXT_EFX = (1 << 1),
|
||||
ADEXT_EXT_OFFSET = (1 << 2),
|
||||
ADEXT_EXT_LINEAR_DISTANCE = (1 << 3),
|
||||
ADEXT_EXT_EXPONENT_DISTANCE = (1 << 4),
|
||||
ADEXT_EAX2 = (1 << 5),
|
||||
ADEXT_EAX3 = (1 << 6),
|
||||
ADEXT_EAX4 = (1 << 7),
|
||||
ADEXT_EAX5 = (1 << 8),
|
||||
ADEXT_EAX_RAM = (1 << 9),
|
||||
};
|
||||
|
||||
struct ALDEVICEINFO {
|
||||
char *strDeviceName;
|
||||
int iMajorVersion;
|
||||
int iMinorVersion;
|
||||
unsigned int uiSourceCount;
|
||||
unsigned short Extensions;
|
||||
bool bSelected;
|
||||
|
||||
ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), bSelected(false)
|
||||
{
|
||||
strDeviceName = NULL;
|
||||
Extensions = 0;
|
||||
}
|
||||
|
||||
~ALDEVICEINFO()
|
||||
{
|
||||
delete[] strDeviceName;
|
||||
strDeviceName = NULL;
|
||||
}
|
||||
|
||||
void SetName(const char *name)
|
||||
{
|
||||
if(strDeviceName) delete[] strDeviceName;
|
||||
strDeviceName = new char[strlen(name) + 1];
|
||||
strcpy(strDeviceName, name);
|
||||
}
|
||||
};
|
||||
|
||||
typedef ALDEVICEINFO *LPALDEVICEINFO;
|
||||
|
||||
class ALDeviceList
|
||||
{
|
||||
private:
|
||||
ALDEVICEINFO aDeviceInfo[64];
|
||||
unsigned int nNumOfDevices;
|
||||
int defaultDeviceIndex;
|
||||
int filterIndex;
|
||||
|
||||
public:
|
||||
ALDeviceList ();
|
||||
~ALDeviceList ();
|
||||
unsigned int GetNumDevices();
|
||||
const char *GetDeviceName(unsigned int index);
|
||||
void GetDeviceVersion(unsigned int index, int *major, int *minor);
|
||||
unsigned int GetMaxNumSources(unsigned int index);
|
||||
bool IsExtensionSupported(int index, unsigned short ext);
|
||||
int GetDefaultDevice();
|
||||
void FilterDevicesMinVer(int major, int minor);
|
||||
void FilterDevicesMaxVer(int major, int minor);
|
||||
void FilterDevicesExtension(unsigned short ext);
|
||||
void ResetFilters();
|
||||
int GetFirstFilteredDevice();
|
||||
int GetNextFilteredDevice();
|
||||
|
||||
private:
|
||||
unsigned int GetMaxNumSources();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // ALDEVICELIST_H
|
||||
295
miami/audio/oal/channel.cpp
Normal file
@@ -0,0 +1,295 @@
|
||||
#include "common.h"
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#include "channel.h"
|
||||
#include "sampman.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
extern bool IsFXSupported();
|
||||
|
||||
ALuint alSources[NUM_CHANNELS];
|
||||
ALuint alFilters[NUM_CHANNELS];
|
||||
ALuint alBuffers[NUM_CHANNELS];
|
||||
bool bChannelsCreated = false;
|
||||
|
||||
int32 CChannel::channelsThatNeedService = 0;
|
||||
|
||||
uint8 tempStereoBuffer[PED_BLOCKSIZE * 2];
|
||||
|
||||
void
|
||||
CChannel::InitChannels()
|
||||
{
|
||||
alGenSources(NUM_CHANNELS, alSources);
|
||||
alGenBuffers(NUM_CHANNELS, alBuffers);
|
||||
if (IsFXSupported())
|
||||
alGenFilters(NUM_CHANNELS, alFilters);
|
||||
bChannelsCreated = true;
|
||||
}
|
||||
|
||||
void
|
||||
CChannel::DestroyChannels()
|
||||
{
|
||||
if (bChannelsCreated)
|
||||
{
|
||||
alDeleteSources(NUM_CHANNELS, alSources);
|
||||
memset(alSources, 0, sizeof(alSources));
|
||||
alDeleteBuffers(NUM_CHANNELS, alBuffers);
|
||||
memset(alBuffers, 0, sizeof(alBuffers));
|
||||
if (IsFXSupported())
|
||||
{
|
||||
alDeleteFilters(NUM_CHANNELS, alFilters);
|
||||
memset(alFilters, 0, sizeof(alFilters));
|
||||
}
|
||||
bChannelsCreated = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CChannel::CChannel()
|
||||
{
|
||||
Data = nil;
|
||||
DataSize = 0;
|
||||
bIs2D = false;
|
||||
SetDefault();
|
||||
}
|
||||
|
||||
void CChannel::SetDefault()
|
||||
{
|
||||
Pitch = 1.0f;
|
||||
Gain = 1.0f;
|
||||
Mix = 0.0f;
|
||||
|
||||
Position[0] = 0.0f; Position[1] = 0.0f; Position[2] = 0.0f;
|
||||
Distances[0] = 0.0f; Distances[1] = FLT_MAX;
|
||||
|
||||
LoopCount = 1;
|
||||
LastProcessedOffset = UINT32_MAX;
|
||||
LoopPoints[0] = 0; LoopPoints[1] = -1;
|
||||
|
||||
Frequency = MAX_FREQ;
|
||||
}
|
||||
|
||||
void CChannel::Reset()
|
||||
{
|
||||
// Here is safe because ctor don't call this
|
||||
if (LoopCount > 1)
|
||||
channelsThatNeedService--;
|
||||
|
||||
ClearBuffer();
|
||||
SetDefault();
|
||||
}
|
||||
|
||||
void CChannel::Init(uint32 _id, bool Is2D)
|
||||
{
|
||||
id = _id;
|
||||
if ( HasSource() )
|
||||
{
|
||||
alSourcei(alSources[id], AL_SOURCE_RELATIVE, AL_TRUE);
|
||||
if ( IsFXSupported() )
|
||||
alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
|
||||
|
||||
if ( Is2D )
|
||||
{
|
||||
bIs2D = true;
|
||||
alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
||||
alSourcef(alSources[id], AL_GAIN, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CChannel::Term()
|
||||
{
|
||||
Stop();
|
||||
if ( HasSource() )
|
||||
{
|
||||
if ( IsFXSupported() )
|
||||
{
|
||||
alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CChannel::Start()
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
if ( !Data ) return;
|
||||
|
||||
if ( bIs2D )
|
||||
{
|
||||
// convert mono data to stereo
|
||||
int16 *monoData = (int16*)Data;
|
||||
int16 *stereoData = (int16*)tempStereoBuffer;
|
||||
for (size_t i = 0; i < DataSize / 2; i++)
|
||||
{
|
||||
*(stereoData++) = *monoData;
|
||||
*(stereoData++) = *(monoData++);
|
||||
}
|
||||
alBufferData(alBuffers[id], AL_FORMAT_STEREO16, tempStereoBuffer, DataSize * 2, Frequency);
|
||||
}
|
||||
else
|
||||
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
||||
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
|
||||
alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
|
||||
alSourcei(alSources[id], AL_BUFFER, alBuffers[id]);
|
||||
alSourcePlay(alSources[id]);
|
||||
}
|
||||
|
||||
void CChannel::Stop()
|
||||
{
|
||||
if ( HasSource() )
|
||||
alSourceStop(alSources[id]);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
bool CChannel::HasSource()
|
||||
{
|
||||
return alSources[id] != AL_NONE;
|
||||
}
|
||||
|
||||
bool CChannel::IsUsed()
|
||||
{
|
||||
if ( HasSource() )
|
||||
{
|
||||
ALint sourceState;
|
||||
alGetSourcei(alSources[id], AL_SOURCE_STATE, &sourceState);
|
||||
return sourceState == AL_PLAYING;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CChannel::SetPitch(float pitch)
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
alSourcef(alSources[id], AL_PITCH, pitch);
|
||||
}
|
||||
|
||||
void CChannel::SetGain(float gain)
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
alSourcef(alSources[id], AL_GAIN, gain);
|
||||
}
|
||||
|
||||
void CChannel::SetVolume(int32 vol)
|
||||
{
|
||||
SetGain(ALfloat(vol) / MAX_VOLUME);
|
||||
}
|
||||
|
||||
void CChannel::SetSampleData(void *_data, size_t _DataSize, int32 freq)
|
||||
{
|
||||
Data = _data;
|
||||
DataSize = _DataSize;
|
||||
Frequency = freq;
|
||||
}
|
||||
|
||||
void CChannel::SetCurrentFreq(uint32 freq)
|
||||
{
|
||||
SetPitch(ALfloat(freq) / Frequency);
|
||||
}
|
||||
|
||||
void CChannel::SetLoopCount(int32 count)
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
|
||||
// 0: loop indefinitely, 1: play one time, 2: play two times etc...
|
||||
// only > 1 needs manual processing
|
||||
|
||||
if (LoopCount > 1 && count < 2)
|
||||
channelsThatNeedService--;
|
||||
else if (LoopCount < 2 && count > 1)
|
||||
channelsThatNeedService++;
|
||||
|
||||
alSourcei(alSources[id], AL_LOOPING, count == 1 ? AL_FALSE : AL_TRUE);
|
||||
LoopCount = count;
|
||||
}
|
||||
|
||||
bool CChannel::Update()
|
||||
{
|
||||
if (!HasSource()) return false;
|
||||
if (LoopCount < 2) return false;
|
||||
|
||||
ALint state;
|
||||
alGetSourcei(alSources[id], AL_SOURCE_STATE, &state);
|
||||
if (state == AL_STOPPED) {
|
||||
debug("Looping channels(%d in this case) shouldn't report AL_STOPPED, but nvm\n", id);
|
||||
SetLoopCount(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(channelsThatNeedService > 0 && "Ref counting is broken");
|
||||
|
||||
ALint offset;
|
||||
alGetSourcei(alSources[id], AL_SAMPLE_OFFSET, &offset);
|
||||
|
||||
// Rewound
|
||||
if (offset < LastProcessedOffset) {
|
||||
LoopCount--;
|
||||
if (LoopCount == 1) {
|
||||
// Playing last tune...
|
||||
channelsThatNeedService--;
|
||||
alSourcei(alSources[id], AL_LOOPING, AL_FALSE);
|
||||
}
|
||||
}
|
||||
LastProcessedOffset = offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CChannel::SetLoopPoints(ALint start, ALint end)
|
||||
{
|
||||
LoopPoints[0] = start;
|
||||
LoopPoints[1] = end;
|
||||
}
|
||||
|
||||
void CChannel::SetPosition(float x, float y, float z)
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
alSource3f(alSources[id], AL_POSITION, x, y, z);
|
||||
}
|
||||
|
||||
void CChannel::SetDistances(float max, float min)
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
alSourcef (alSources[id], AL_MAX_DISTANCE, max);
|
||||
alSourcef (alSources[id], AL_REFERENCE_DISTANCE, min);
|
||||
alSourcef (alSources[id], AL_MAX_GAIN, 1.0f);
|
||||
alSourcef (alSources[id], AL_ROLLOFF_FACTOR, 1.0f);
|
||||
}
|
||||
|
||||
void CChannel::SetPan(int32 pan)
|
||||
{
|
||||
SetPosition((pan-63)/64.0f, 0.0f, Sqrt(1.0f-SQR((pan-63)/64.0f)));
|
||||
}
|
||||
|
||||
void CChannel::ClearBuffer()
|
||||
{
|
||||
if ( !HasSource() ) return;
|
||||
alSourcei(alSources[id], AL_LOOPING, AL_FALSE);
|
||||
alSourcei(alSources[id], AL_BUFFER, AL_NONE);
|
||||
Data = nil;
|
||||
DataSize = 0;
|
||||
}
|
||||
|
||||
void CChannel::SetReverbMix(ALuint slot, float mix)
|
||||
{
|
||||
if ( !IsFXSupported() ) return;
|
||||
if ( !HasSource() ) return;
|
||||
if ( alFilters[id] == AL_FILTER_NULL ) return;
|
||||
|
||||
Mix = mix;
|
||||
EAX3_SetReverbMix(alFilters[id], mix);
|
||||
alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, slot, 0, alFilters[id]);
|
||||
}
|
||||
|
||||
void CChannel::UpdateReverb(ALuint slot)
|
||||
{
|
||||
if ( !IsFXSupported() ) return;
|
||||
if ( !HasSource() ) return;
|
||||
if ( alFilters[id] == AL_FILTER_NULL ) return;
|
||||
EAX3_SetReverbMix(alFilters[id], Mix);
|
||||
alSource3i(alSources[id], AL_AUXILIARY_SEND_FILTER, slot, 0, alFilters[id]);
|
||||
}
|
||||
|
||||
#endif
|
||||
55
miami/audio/oal/channel.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#include "oal/oal_utils.h"
|
||||
#include <AL/al.h>
|
||||
#include <AL/alext.h>
|
||||
#include <AL/efx.h>
|
||||
|
||||
|
||||
class CChannel
|
||||
{
|
||||
uint32 id;
|
||||
float Pitch, Gain;
|
||||
float Mix;
|
||||
void *Data;
|
||||
size_t DataSize;
|
||||
int32 Frequency;
|
||||
float Position[3];
|
||||
float Distances[2];
|
||||
int32 LoopCount;
|
||||
ALint LoopPoints[2];
|
||||
ALint LastProcessedOffset;
|
||||
bool bIs2D;
|
||||
public:
|
||||
static int32 channelsThatNeedService;
|
||||
|
||||
static void InitChannels();
|
||||
static void DestroyChannels();
|
||||
|
||||
CChannel();
|
||||
void SetDefault();
|
||||
void Reset();
|
||||
void Init(uint32 _id, bool Is2D = false);
|
||||
void Term();
|
||||
void Start();
|
||||
void Stop();
|
||||
bool HasSource();
|
||||
bool IsUsed();
|
||||
void SetPitch(float pitch);
|
||||
void SetGain(float gain);
|
||||
void SetVolume(int32 vol);
|
||||
void SetSampleData(void *_data, size_t _DataSize, int32 freq);
|
||||
void SetCurrentFreq(uint32 freq);
|
||||
void SetLoopCount(int32 count);
|
||||
void SetLoopPoints(ALint start, ALint end);
|
||||
void SetPosition(float x, float y, float z);
|
||||
void SetDistances(float max, float min);
|
||||
void SetPan(int32 pan);
|
||||
void ClearBuffer();
|
||||
void SetReverbMix(ALuint slot, float mix);
|
||||
void UpdateReverb(ALuint slot);
|
||||
bool Update();
|
||||
};
|
||||
|
||||
#endif
|
||||
181
miami/audio/oal/oal_utils.cpp
Normal file
@@ -0,0 +1,181 @@
|
||||
#include "common.h"
|
||||
#include "oal_utils.h"
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
|
||||
/*
|
||||
* When linking to a static openal-soft library,
|
||||
* the extension function inside the openal library conflict with the variables here.
|
||||
* Therefore declare these re3 owned symbols in a private namespace.
|
||||
*/
|
||||
|
||||
namespace re3_openal {
|
||||
|
||||
LPALGENEFFECTS alGenEffects;
|
||||
LPALDELETEEFFECTS alDeleteEffects;
|
||||
LPALISEFFECT alIsEffect;
|
||||
LPALEFFECTI alEffecti;
|
||||
LPALEFFECTIV alEffectiv;
|
||||
LPALEFFECTF alEffectf;
|
||||
LPALEFFECTFV alEffectfv;
|
||||
LPALGETEFFECTI alGetEffecti;
|
||||
LPALGETEFFECTIV alGetEffectiv;
|
||||
LPALGETEFFECTF alGetEffectf;
|
||||
LPALGETEFFECTFV alGetEffectfv;
|
||||
LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots;
|
||||
LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots;
|
||||
LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot;
|
||||
LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti;
|
||||
LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv;
|
||||
LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf;
|
||||
LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv;
|
||||
LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti;
|
||||
LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv;
|
||||
LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf;
|
||||
LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv;
|
||||
LPALGENFILTERS alGenFilters;
|
||||
LPALDELETEFILTERS alDeleteFilters;
|
||||
LPALISFILTER alIsFilter;
|
||||
LPALFILTERI alFilteri;
|
||||
LPALFILTERIV alFilteriv;
|
||||
LPALFILTERF alFilterf;
|
||||
LPALFILTERFV alFilterfv;
|
||||
LPALGETFILTERI alGetFilteri;
|
||||
LPALGETFILTERIV alGetFilteriv;
|
||||
LPALGETFILTERF alGetFilterf;
|
||||
LPALGETFILTERFV alGetFilterfv;
|
||||
|
||||
}
|
||||
|
||||
using namespace re3_openal;
|
||||
|
||||
void EFXInit()
|
||||
{
|
||||
/* Define a macro to help load the function pointers. */
|
||||
#define LOAD_PROC(T, x) ((x) = (T)alGetProcAddress(#x))
|
||||
LOAD_PROC(LPALGENEFFECTS, alGenEffects);
|
||||
LOAD_PROC(LPALDELETEEFFECTS, alDeleteEffects);
|
||||
LOAD_PROC(LPALISEFFECT, alIsEffect);
|
||||
LOAD_PROC(LPALEFFECTI, alEffecti);
|
||||
LOAD_PROC(LPALEFFECTIV, alEffectiv);
|
||||
LOAD_PROC(LPALEFFECTF, alEffectf);
|
||||
LOAD_PROC(LPALEFFECTFV, alEffectfv);
|
||||
LOAD_PROC(LPALGETEFFECTI, alGetEffecti);
|
||||
LOAD_PROC(LPALGETEFFECTIV, alGetEffectiv);
|
||||
LOAD_PROC(LPALGETEFFECTF, alGetEffectf);
|
||||
LOAD_PROC(LPALGETEFFECTFV, alGetEffectfv);
|
||||
|
||||
LOAD_PROC(LPALGENFILTERS, alGenFilters);
|
||||
LOAD_PROC(LPALDELETEFILTERS, alDeleteFilters);
|
||||
LOAD_PROC(LPALISFILTER, alIsFilter);
|
||||
LOAD_PROC(LPALFILTERI, alFilteri);
|
||||
LOAD_PROC(LPALFILTERIV, alFilteriv);
|
||||
LOAD_PROC(LPALFILTERF, alFilterf);
|
||||
LOAD_PROC(LPALFILTERFV, alFilterfv);
|
||||
LOAD_PROC(LPALGETFILTERI, alGetFilteri);
|
||||
LOAD_PROC(LPALGETFILTERIV, alGetFilteriv);
|
||||
LOAD_PROC(LPALGETFILTERF, alGetFilterf);
|
||||
LOAD_PROC(LPALGETFILTERFV, alGetFilterfv);
|
||||
|
||||
LOAD_PROC(LPALGENAUXILIARYEFFECTSLOTS, alGenAuxiliaryEffectSlots);
|
||||
LOAD_PROC(LPALDELETEAUXILIARYEFFECTSLOTS, alDeleteAuxiliaryEffectSlots);
|
||||
LOAD_PROC(LPALISAUXILIARYEFFECTSLOT, alIsAuxiliaryEffectSlot);
|
||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTI, alAuxiliaryEffectSloti);
|
||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTIV, alAuxiliaryEffectSlotiv);
|
||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTF, alAuxiliaryEffectSlotf);
|
||||
LOAD_PROC(LPALAUXILIARYEFFECTSLOTFV, alAuxiliaryEffectSlotfv);
|
||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTI, alGetAuxiliaryEffectSloti);
|
||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTIV, alGetAuxiliaryEffectSlotiv);
|
||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTF, alGetAuxiliaryEffectSlotf);
|
||||
LOAD_PROC(LPALGETAUXILIARYEFFECTSLOTFV, alGetAuxiliaryEffectSlotfv);
|
||||
#undef LOAD_PROC
|
||||
}
|
||||
|
||||
void SetEffectsLevel(ALuint uiFilter, float level)
|
||||
{
|
||||
alFilteri(uiFilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
|
||||
alFilterf(uiFilter, AL_LOWPASS_GAIN, 1.0f);
|
||||
alFilterf(uiFilter, AL_LOWPASS_GAINHF, level);
|
||||
}
|
||||
|
||||
static inline float gain_to_mB(float gain)
|
||||
{
|
||||
return (gain > 1e-5f) ? (float)(log10f(gain) * 2000.0f) : -10000l;
|
||||
}
|
||||
|
||||
static inline float mB_to_gain(float millibels)
|
||||
{
|
||||
return (millibels > -10000.0f) ? powf(10.0f, millibels/2000.0f) : 0.0f;
|
||||
}
|
||||
|
||||
static inline float clampF(float val, float minval, float maxval)
|
||||
{
|
||||
if(val >= maxval) return maxval;
|
||||
if(val <= minval) return minval;
|
||||
return val;
|
||||
}
|
||||
|
||||
void EAX3_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
|
||||
{
|
||||
alEffecti (effect, AL_EFFECT_TYPE, AL_EFFECT_EAXREVERB);
|
||||
alEffectf (effect, AL_EAXREVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
|
||||
alEffectf (effect, AL_EAXREVERB_DIFFUSION, props->flEnvironmentDiffusion);
|
||||
alEffectf (effect, AL_EAXREVERB_GAIN, mB_to_gain((float)props->lRoom));
|
||||
alEffectf (effect, AL_EAXREVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
|
||||
alEffectf (effect, AL_EAXREVERB_GAINLF, mB_to_gain((float)props->lRoomLF));
|
||||
alEffectf (effect, AL_EAXREVERB_DECAY_TIME, props->flDecayTime);
|
||||
alEffectf (effect, AL_EAXREVERB_DECAY_HFRATIO, props->flDecayHFRatio);
|
||||
alEffectf (effect, AL_EAXREVERB_DECAY_LFRATIO, props->flDecayLFRatio);
|
||||
alEffectf (effect, AL_EAXREVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
|
||||
alEffectf (effect, AL_EAXREVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
|
||||
alEffectfv(effect, AL_EAXREVERB_REFLECTIONS_PAN, &props->vReflectionsPan.x);
|
||||
alEffectf (effect, AL_EAXREVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
|
||||
alEffectf (effect, AL_EAXREVERB_LATE_REVERB_DELAY, props->flReverbDelay);
|
||||
alEffectfv(effect, AL_EAXREVERB_LATE_REVERB_PAN, &props->vReverbPan.x);
|
||||
alEffectf (effect, AL_EAXREVERB_ECHO_TIME, props->flEchoTime);
|
||||
alEffectf (effect, AL_EAXREVERB_ECHO_DEPTH, props->flEchoDepth);
|
||||
alEffectf (effect, AL_EAXREVERB_MODULATION_TIME, props->flModulationTime);
|
||||
alEffectf (effect, AL_EAXREVERB_MODULATION_DEPTH, props->flModulationDepth);
|
||||
alEffectf (effect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
|
||||
alEffectf (effect, AL_EAXREVERB_HFREFERENCE, props->flHFReference);
|
||||
alEffectf (effect, AL_EAXREVERB_LFREFERENCE, props->flLFReference);
|
||||
alEffectf (effect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
|
||||
alEffecti (effect, AL_EAXREVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
|
||||
}
|
||||
|
||||
void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props)
|
||||
{
|
||||
alEffecti(effect, AL_EFFECT_TYPE, AL_EFFECT_REVERB);
|
||||
|
||||
alEffectf(effect, AL_REVERB_DENSITY, clampF(powf(props->flEnvironmentSize, 3.0f) / 16.0f, 0.0f, 1.0f));
|
||||
alEffectf(effect, AL_REVERB_DIFFUSION, props->flEnvironmentDiffusion);
|
||||
alEffectf(effect, AL_REVERB_GAIN, mB_to_gain((float)props->lRoom));
|
||||
alEffectf(effect, AL_REVERB_GAINHF, mB_to_gain((float)props->lRoomHF));
|
||||
alEffectf(effect, AL_REVERB_DECAY_TIME, props->flDecayTime);
|
||||
alEffectf(effect, AL_REVERB_DECAY_HFRATIO, props->flDecayHFRatio);
|
||||
alEffectf(effect, AL_REVERB_REFLECTIONS_GAIN, clampF(mB_to_gain((float)props->lReflections), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN));
|
||||
alEffectf(effect, AL_REVERB_REFLECTIONS_DELAY, props->flReflectionsDelay);
|
||||
alEffectf(effect, AL_REVERB_LATE_REVERB_GAIN, clampF(mB_to_gain((float)props->lReverb), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN));
|
||||
alEffectf(effect, AL_REVERB_LATE_REVERB_DELAY, props->flReverbDelay);
|
||||
alEffectf(effect, AL_REVERB_AIR_ABSORPTION_GAINHF, clampF(mB_to_gain(props->flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF));
|
||||
alEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, props->flRoomRolloffFactor);
|
||||
alEffecti(effect, AL_REVERB_DECAY_HFLIMIT, (props->ulFlags&EAXLISTENERFLAGS_DECAYHFLIMIT) ? AL_TRUE : AL_FALSE);
|
||||
}
|
||||
|
||||
void EAX3_SetReverbMix(ALuint filter, float mix)
|
||||
{
|
||||
//long vol=(long)linear_to_dB(mix);
|
||||
//DSPROPERTY_EAXBUFFER_ROOMHF,
|
||||
//DSPROPERTY_EAXBUFFER_ROOM,
|
||||
//DSPROPERTY_EAXBUFFER_REVERBMIX,
|
||||
|
||||
long mbvol = gain_to_mB(mix);
|
||||
float mb = mbvol;
|
||||
float mbhf = mbvol;
|
||||
|
||||
alFilteri(filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
|
||||
alFilterf(filter, AL_LOWPASS_GAIN, mB_to_gain(Min(mb, 0.0f)));
|
||||
alFilterf(filter, AL_LOWPASS_GAINHF, mB_to_gain(mbhf));
|
||||
}
|
||||
|
||||
#endif
|
||||
54
miami/audio/oal/oal_utils.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#include "eax.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
|
||||
void EFXInit();
|
||||
void EAX3_Set(ALuint effect, const EAXLISTENERPROPERTIES *props);
|
||||
void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props);
|
||||
void EAX3_SetReverbMix(ALuint filter, float mix);
|
||||
void SetEffectsLevel(ALuint uiFilter, float level);
|
||||
|
||||
namespace re3_openal {
|
||||
|
||||
extern LPALGENEFFECTS alGenEffects;
|
||||
extern LPALDELETEEFFECTS alDeleteEffects;
|
||||
extern LPALISEFFECT alIsEffect;
|
||||
extern LPALEFFECTI alEffecti;
|
||||
extern LPALEFFECTIV alEffectiv;
|
||||
extern LPALEFFECTF alEffectf;
|
||||
extern LPALEFFECTFV alEffectfv;
|
||||
extern LPALGETEFFECTI alGetEffecti;
|
||||
extern LPALGETEFFECTIV alGetEffectiv;
|
||||
extern LPALGETEFFECTF alGetEffectf;
|
||||
extern LPALGETEFFECTFV alGetEffectfv;
|
||||
extern LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots;
|
||||
extern LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots;
|
||||
extern LPALISAUXILIARYEFFECTSLOT alIsAuxiliaryEffectSlot;
|
||||
extern LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti;
|
||||
extern LPALAUXILIARYEFFECTSLOTIV alAuxiliaryEffectSlotiv;
|
||||
extern LPALAUXILIARYEFFECTSLOTF alAuxiliaryEffectSlotf;
|
||||
extern LPALAUXILIARYEFFECTSLOTFV alAuxiliaryEffectSlotfv;
|
||||
extern LPALGETAUXILIARYEFFECTSLOTI alGetAuxiliaryEffectSloti;
|
||||
extern LPALGETAUXILIARYEFFECTSLOTIV alGetAuxiliaryEffectSlotiv;
|
||||
extern LPALGETAUXILIARYEFFECTSLOTF alGetAuxiliaryEffectSlotf;
|
||||
extern LPALGETAUXILIARYEFFECTSLOTFV alGetAuxiliaryEffectSlotfv;
|
||||
extern LPALGENFILTERS alGenFilters;
|
||||
extern LPALDELETEFILTERS alDeleteFilters;
|
||||
extern LPALISFILTER alIsFilter;
|
||||
extern LPALFILTERI alFilteri;
|
||||
extern LPALFILTERIV alFilteriv;
|
||||
extern LPALFILTERF alFilterf;
|
||||
extern LPALFILTERFV alFilterfv;
|
||||
extern LPALGETFILTERI alGetFilteri;
|
||||
extern LPALGETFILTERIV alGetFilteriv;
|
||||
extern LPALGETFILTERF alGetFilterf;
|
||||
extern LPALGETFILTERFV alGetFilterfv;
|
||||
|
||||
}
|
||||
|
||||
using namespace re3_openal;
|
||||
|
||||
#endif
|
||||
1831
miami/audio/oal/stream.cpp
Normal file
192
miami/audio/oal/stream.h
Normal file
@@ -0,0 +1,192 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#include <AL/al.h>
|
||||
|
||||
#define NUM_STREAMBUFFERS 8
|
||||
|
||||
class IDecoder
|
||||
{
|
||||
public:
|
||||
virtual ~IDecoder() { }
|
||||
|
||||
virtual bool IsOpened() = 0;
|
||||
virtual void FileOpen() = 0;
|
||||
|
||||
virtual uint32 GetSampleSize() = 0;
|
||||
virtual uint32 GetSampleCount() = 0;
|
||||
virtual uint32 GetSampleRate() = 0;
|
||||
virtual uint32 GetChannels() = 0;
|
||||
|
||||
uint32 GetAvgSamplesPerSec()
|
||||
{
|
||||
return GetChannels() * GetSampleRate();
|
||||
}
|
||||
|
||||
uint32 ms2samples(uint32 ms)
|
||||
{
|
||||
return float(ms) / 1000.0f * float(GetSampleRate());
|
||||
}
|
||||
|
||||
uint32 samples2ms(uint32 sm)
|
||||
{
|
||||
return float(sm) * 1000.0f / float(GetSampleRate());
|
||||
}
|
||||
|
||||
uint32 GetBufferSamples()
|
||||
{
|
||||
//return (GetAvgSamplesPerSec() >> 2) - (GetSampleCount() % GetChannels());
|
||||
return (GetAvgSamplesPerSec() / 4); // 250ms
|
||||
}
|
||||
|
||||
uint32 GetBufferSize()
|
||||
{
|
||||
return GetBufferSamples() * GetSampleSize();
|
||||
}
|
||||
|
||||
virtual void Seek(uint32 milliseconds) = 0;
|
||||
virtual uint32 Tell() = 0;
|
||||
|
||||
uint32 GetLength()
|
||||
{
|
||||
FileOpen(); // abort deferred init, we need length now - game has to cache audio file sizes
|
||||
return float(GetSampleCount()) * 1000.0f / float(GetSampleRate());
|
||||
}
|
||||
|
||||
virtual uint32 Decode(void *buffer) = 0;
|
||||
};
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
template <typename T> class tsQueue
|
||||
{
|
||||
public:
|
||||
tsQueue() : count(0) { }
|
||||
|
||||
void push(const T &value)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
m_queue.push(value);
|
||||
count++;
|
||||
}
|
||||
|
||||
bool peekPop(T *retVal)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (count == 0)
|
||||
return false;
|
||||
|
||||
*retVal = m_queue.front();
|
||||
m_queue.pop();
|
||||
count--;
|
||||
return true;
|
||||
}
|
||||
|
||||
void swapNts(tsQueue<T> &replaceWith)
|
||||
{
|
||||
m_queue.swap(replaceWith.m_queue);
|
||||
replaceWith.count = count;
|
||||
}
|
||||
|
||||
/*
|
||||
void swapTs(tsQueue<T> &replaceWith)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
std::lock_guard<std::mutex> lock2(replaceWith.m_mutex);
|
||||
swapNts(replaceWith);
|
||||
}
|
||||
*/
|
||||
|
||||
bool emptyNts()
|
||||
{
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
bool emptyTs()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
return emptyNts();
|
||||
}
|
||||
*/
|
||||
|
||||
std::queue<T> m_queue;
|
||||
int count;
|
||||
mutable std::mutex m_mutex;
|
||||
};
|
||||
#endif
|
||||
class CStream
|
||||
{
|
||||
char m_aFilename[128];
|
||||
ALuint *m_pAlSources;
|
||||
ALuint (&m_alBuffers)[NUM_STREAMBUFFERS];
|
||||
|
||||
bool m_bPaused;
|
||||
bool m_bActive;
|
||||
|
||||
public:
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
std::mutex m_mutex;
|
||||
std::queue<std::pair<ALuint, ALuint>> m_fillBuffers; // left and right buffer
|
||||
tsQueue<std::pair<ALuint, ALuint>> m_queueBuffers;
|
||||
// std::condition_variable m_closeCv;
|
||||
bool m_bDoSeek;
|
||||
uint32 m_SeekPos;
|
||||
bool m_bIExist;
|
||||
#endif
|
||||
|
||||
void *m_pBuffer;
|
||||
|
||||
bool m_bReset;
|
||||
uint32 m_nVolume;
|
||||
uint8 m_nPan;
|
||||
uint32 m_nPosBeforeReset;
|
||||
int32 m_nLoopCount;
|
||||
|
||||
IDecoder *m_pSoundFile;
|
||||
|
||||
void BuffersShouldBeFilled(); // all
|
||||
bool BufferShouldBeFilledAndQueued(std::pair<ALuint, ALuint>*); // two (left-right)
|
||||
#ifdef MULTITHREADED_AUDIO
|
||||
void FlagAsToBeProcessed(bool close = false);
|
||||
bool QueueBuffers();
|
||||
#endif
|
||||
|
||||
bool HasSource();
|
||||
void SetPosition(int i, float x, float y, float z);
|
||||
void SetPitch(float pitch);
|
||||
void SetGain(float gain);
|
||||
void Pause();
|
||||
void SetPlay(bool state);
|
||||
|
||||
bool FillBuffer(ALuint *alBuffer);
|
||||
int32 FillBuffers();
|
||||
void ClearBuffers();
|
||||
//public:
|
||||
static void Initialise();
|
||||
static void Terminate();
|
||||
|
||||
CStream(ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS]);
|
||||
~CStream();
|
||||
void Delete();
|
||||
bool Open(const char *filename, uint32 overrideSampleRate = 32000);
|
||||
void Close();
|
||||
|
||||
bool IsOpened();
|
||||
bool IsPlaying();
|
||||
void SetPause (bool bPause);
|
||||
void SetVolume(uint32 nVol);
|
||||
void SetPan (uint8 nPan);
|
||||
void SetPosMS (uint32 nPos);
|
||||
uint32 GetPosMS();
|
||||
uint32 GetLengthMS();
|
||||
|
||||
bool Setup(bool imSureQueueIsEmpty = false, bool lock = true);
|
||||
void Start();
|
||||
void Stop();
|
||||
void Update(void);
|
||||
void SetLoopCount(int32);
|
||||
|
||||
void ProviderInit();
|
||||
void ProviderTerm();
|
||||
};
|
||||
|
||||
#endif
|
||||
3957
miami/audio/sampman.h
Normal file
1475
miami/audio/sampman_dc.cpp
Normal file
2599
miami/audio/sampman_miles.cpp
Normal file
403
miami/audio/sampman_null.cpp
Normal file
@@ -0,0 +1,403 @@
|
||||
#include "common.h"
|
||||
#if !defined(AUDIO_OAL) && !defined(AUDIO_MSS)
|
||||
#include "sampman.h"
|
||||
#include "AudioManager.h"
|
||||
|
||||
cSampleManager SampleManager;
|
||||
bool8 _bSampmanInitialised = FALSE;
|
||||
|
||||
uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||
uint32 nNumMP3s;
|
||||
|
||||
cSampleManager::cSampleManager(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
cSampleManager::~cSampleManager(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void cSampleManager::SetSpeakerConfig(int32 nConfig)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint32 cSampleManager::GetMaximumSupportedChannels(void)
|
||||
{
|
||||
return MAXCHANNELS;
|
||||
}
|
||||
|
||||
uint32 cSampleManager::GetNum3DProvidersAvailable()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void cSampleManager::SetNum3DProvidersAvailable(uint32 num)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
char *cSampleManager::Get3DProviderName(uint8 id)
|
||||
{
|
||||
static char name[64] = "NULL";
|
||||
return name;
|
||||
}
|
||||
|
||||
void cSampleManager::Set3DProviderName(uint8 id, char *name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int8 cSampleManager::GetCurrent3DProviderIndex(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool8
|
||||
cSampleManager::IsMP3RadioChannelAvailable(void)
|
||||
{
|
||||
return nNumMP3s != 0;
|
||||
}
|
||||
|
||||
|
||||
void cSampleManager::ReleaseDigitalHandle(void)
|
||||
{
|
||||
}
|
||||
|
||||
void cSampleManager::ReacquireDigitalHandle(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::Initialise(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::Terminate(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool8 cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char cSampleManager::GetCDAudioDriveLetter(void)
|
||||
{
|
||||
return '\0';
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::UpdateEffectsVolume(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetEffectsMasterVolume(uint8 nVolume)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetMusicMasterVolume(uint8 nVolume)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetMP3BoostVolume(uint8 nVolume)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetMusicFadeVolume(uint8 nVolume)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetMonoMode(bool8 nMode)
|
||||
{
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::LoadSampleBank(uint8 nBank)
|
||||
{
|
||||
ASSERT( nBank < MAX_SFX_BANKS );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::UnloadSampleBank(uint8 nBank)
|
||||
{
|
||||
ASSERT( nBank < MAX_SFX_BANKS );
|
||||
}
|
||||
|
||||
int8
|
||||
cSampleManager::IsSampleBankLoaded(uint8 nBank)
|
||||
{
|
||||
ASSERT( nBank < MAX_SFX_BANKS );
|
||||
|
||||
return LOADING_STATUS_NOT_LOADED;
|
||||
}
|
||||
|
||||
uint8
|
||||
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
|
||||
{
|
||||
ASSERT(nSlot < MISSION_AUDIO_COUNT);
|
||||
|
||||
return LOADING_STATUS_NOT_LOADED;
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
|
||||
{
|
||||
ASSERT(nSlot < MISSION_AUDIO_COUNT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint8
|
||||
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
||||
{
|
||||
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
||||
|
||||
return LOADING_STATUS_NOT_LOADED;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
cSampleManager::_GetPedCommentSlot(uint32 nComment)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::LoadPedComment(uint32 nComment)
|
||||
{
|
||||
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int32
|
||||
cSampleManager::GetBankContainingSound(uint32 offset)
|
||||
{
|
||||
return INVALID_SFX_BANK;
|
||||
}
|
||||
|
||||
uint32
|
||||
cSampleManager::GetSampleBaseFrequency(uint32 nSample)
|
||||
{
|
||||
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32
|
||||
cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
|
||||
{
|
||||
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32
|
||||
cSampleManager::GetSampleLoopEndOffset(uint32 nSample)
|
||||
{
|
||||
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32
|
||||
cSampleManager::GetSampleLength(uint32 nSample)
|
||||
{
|
||||
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool8 cSampleManager::UpdateReverb(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void
|
||||
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
|
||||
{
|
||||
ASSERT( nChannel >= MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
||||
{
|
||||
ASSERT( nChannel >= MAXCHANNELS );
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::StartChannel(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::StopChannel(uint32 nChannel)
|
||||
{
|
||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream, uint32_t)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::PauseStream(bool8 nPauseFlag, uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::StopStreamedFile(uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
||||
int32
|
||||
cSampleManager::GetStreamedFilePosition(uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
}
|
||||
|
||||
int32
|
||||
cSampleManager::GetStreamedFileLength(uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < TOTAL_STREAMED_SOUNDS );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::IsStreamPlaying(uint8 nStream)
|
||||
{
|
||||
ASSERT( nStream < MAX_STREAMS );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8
|
||||
cSampleManager::InitialiseSampleBanks(void)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
cSampleManager::SetStreamedFileLoopFlag(bool8 nLoopFlag, uint8 nChannel)
|
||||
{
|
||||
}
|
||||
|
||||
int8 cSampleManager::AutoDetect3DProviders()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
2082
miami/audio/sampman_oal.cpp
Normal file
282
miami/audio/soundlist.h
Normal file
@@ -0,0 +1,282 @@
|
||||
#pragma once
|
||||
|
||||
enum eSound
|
||||
{
|
||||
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
|
||||
SOUND_CAR_DOOR_CLOSE_BUMPER,
|
||||
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT,
|
||||
SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT,
|
||||
SOUND_CAR_DOOR_CLOSE_BACK_LEFT,
|
||||
SOUND_CAR_DOOR_CLOSE_BACK_RIGHT,
|
||||
SOUND_CAR_DOOR_OPEN_BONNET,
|
||||
SOUND_CAR_DOOR_OPEN_BUMPER,
|
||||
SOUND_CAR_DOOR_OPEN_FRONT_LEFT,
|
||||
SOUND_CAR_DOOR_OPEN_FRONT_RIGHT,
|
||||
SOUND_CAR_DOOR_OPEN_BACK_LEFT,
|
||||
SOUND_CAR_DOOR_OPEN_BACK_RIGHT,
|
||||
SOUND_CAR_WINDSHIELD_CRACK,
|
||||
SOUND_CAR_JUMP,
|
||||
SOUND_CAR_JUMP_2,
|
||||
SOUND_CAR_TYRE_POP,
|
||||
SOUND_16,
|
||||
SOUND_17,
|
||||
SOUND_CAR_ENGINE_START,
|
||||
SOUND_CAR_LIGHT_BREAK,
|
||||
SOUND_CAR_HYDRAULIC_1,
|
||||
SOUND_CAR_HYDRAULIC_2,
|
||||
SOUND_CAR_HYDRAULIC_3,
|
||||
SOUND_CAR_JERK,
|
||||
SOUND_CAR_SPLASH,
|
||||
SOUND_BOAT_SLOWDOWN,
|
||||
SOUND_TRAIN_DOOR_CLOSE,
|
||||
SOUND_TRAIN_DOOR_OPEN,
|
||||
SOUND_CAR_TANK_TURRET_ROTATE,
|
||||
SOUND_CAR_BOMB_TICK,
|
||||
SOUND_PLANE_ON_GROUND,
|
||||
SOUND_HELI_BLADE,
|
||||
SOUND_32,
|
||||
SOUND_STEP_START,
|
||||
SOUND_STEP_END,
|
||||
SOUND_FALL_LAND,
|
||||
SOUND_FALL_COLLAPSE,
|
||||
SOUND_FIGHT_37,
|
||||
SOUND_FIGHT_38,
|
||||
SOUND_FIGHT_39,
|
||||
SOUND_FIGHT_40,
|
||||
SOUND_FIGHT_41,
|
||||
SOUND_FIGHT_42,
|
||||
SOUND_FIGHT_43,
|
||||
SOUND_FIGHT_44,
|
||||
SOUND_FIGHT_45,
|
||||
SOUND_FIGHT_46,
|
||||
SOUND_FIGHT_47,
|
||||
SOUND_FIGHT_48,
|
||||
SOUND_49,
|
||||
SOUND_WEAPON_BAT_ATTACK,
|
||||
SOUND_WEAPON_KNIFE_ATTACK,
|
||||
SOUND_WEAPON_CHAINSAW_IDLE,
|
||||
SOUND_WEAPON_CHAINSAW_ATTACK,
|
||||
SOUND_WEAPON_CHAINSAW_MADECONTACT,
|
||||
SOUND_WEAPON_SHOT_FIRED,
|
||||
SOUND_WEAPON_RELOAD,
|
||||
SOUND_WEAPON_AK47_BULLET_ECHO,
|
||||
SOUND_WEAPON_FLAMETHROWER_FIRE,
|
||||
SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM,
|
||||
SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM,
|
||||
SOUND_WEAPON_HIT_PED,
|
||||
SOUND_WEAPON_HIT_VEHICLE,
|
||||
SOUND_GARAGE_NO_MONEY,
|
||||
SOUND_GARAGE_BAD_VEHICLE,
|
||||
SOUND_GARAGE_OPENING,
|
||||
SOUND_GARAGE_BOMB_ALREADY_SET,
|
||||
SOUND_GARAGE_BOMB1_SET,
|
||||
SOUND_GARAGE_BOMB2_SET,
|
||||
SOUND_GARAGE_BOMB3_SET,
|
||||
SOUND_70,
|
||||
SOUND_71,
|
||||
SOUND_GARAGE_VEHICLE_DECLINED,
|
||||
SOUND_GARAGE_VEHICLE_ACCEPTED,
|
||||
SOUND_GARAGE_DOOR_CLOSED,
|
||||
SOUND_GARAGE_DOOR_OPENED,
|
||||
SOUND_CRANE_PICKUP,
|
||||
SOUND_PICKUP_WEAPON_BOUGHT,
|
||||
SOUND_PICKUP_WEAPON,
|
||||
SOUND_PICKUP_HEALTH,
|
||||
SOUND_80,
|
||||
SOUND_81,
|
||||
SOUND_PICKUP_ADRENALINE,
|
||||
SOUND_PICKUP_ARMOUR,
|
||||
SOUND_PICKUP_BONUS,
|
||||
SOUND_PICKUP_MONEY,
|
||||
SOUND_PICKUP_HIDDEN_PACKAGE,
|
||||
SOUND_PICKUP_PACMAN_PILL,
|
||||
SOUND_PICKUP_PACMAN_PACKAGE,
|
||||
SOUND_PICKUP_FLOAT_PACKAGE,
|
||||
SOUND_BOMB_TIMED_ACTIVATED,
|
||||
SOUND_91,
|
||||
SOUND_BOMB_ONIGNITION_ACTIVATED,
|
||||
SOUND_BOMB_TICK,
|
||||
SOUND_RAMPAGE_START,
|
||||
SOUND_RAMPAGE_ONGOING,
|
||||
SOUND_RAMPAGE_PASSED,
|
||||
SOUND_RAMPAGE_FAILED,
|
||||
SOUND_RAMPAGE_KILL,
|
||||
SOUND_RAMPAGE_CAR_BLOWN,
|
||||
SOUND_EVIDENCE_PICKUP,
|
||||
SOUND_UNLOAD_GOLD,
|
||||
SOUND_PAGER,
|
||||
SOUND_PED_DEATH,
|
||||
SOUND_PED_DAMAGE,
|
||||
SOUND_PED_HIT,
|
||||
SOUND_PED_LAND,
|
||||
SOUND_PED_BULLET_HIT,
|
||||
SOUND_PED_BURNING,
|
||||
SOUND_PED_PLAYER_REACTTOCOP,
|
||||
SOUND_PED_ARREST_COP,
|
||||
SOUND_PED_MIAMIVICE_EXITING_CAR,
|
||||
SOUND_PED_COP_HELIPILOTPHRASE,
|
||||
SOUND_PED_PULLOUTWEAPON,
|
||||
SOUND_PED_HELI_PLAYER_FOUND,
|
||||
SOUND_PED_VCPA_PLAYER_FOUND,
|
||||
SOUND_PED_ON_FIRE,
|
||||
SOUND_PED_AIMING,
|
||||
SOUND_PED_HANDS_UP,
|
||||
SOUND_PED_HANDS_COWER,
|
||||
SOUND_PED_FLEE_SPRINT,
|
||||
SOUND_PED_CAR_JACKING,
|
||||
SOUND_PED_MUGGING,
|
||||
SOUND_PED_CAR_JACKED,
|
||||
SOUND_PED_ROBBED,
|
||||
SOUND_PED_ACCIDENTREACTION1,
|
||||
SOUND_PED_INNOCENT,
|
||||
SOUND_PED_PLAYER_AFTERSEX,
|
||||
SOUND_PED_PLAYER_BEFORESEX,
|
||||
SOUND_PED_COP_TARGETING, // also used for medics
|
||||
SOUND_PED_COP_MANYCOPSAROUND, // also used for medics
|
||||
SOUND_PED_GUNAIMEDAT2,
|
||||
SOUND_PED_COP_ALONE, // also used for medics
|
||||
SOUND_PED_GUNAIMEDAT3,
|
||||
SOUND_PED_COP_ASK_FOR_ID,
|
||||
SOUND_PED_COP_LITTLECOPSAROUND, // also used for medics
|
||||
SOUND_PED_PLAYER_FARFROMCOPS, // also used for medics
|
||||
SOUND_PED_TAXI_WAIT,
|
||||
SOUND_PED_ATTACK,
|
||||
SOUND_PED_DEFEND,
|
||||
SOUND_PED_HEALING,
|
||||
SOUND_PED_LEAVE_VEHICLE,
|
||||
SOUND_PED_EVADE,
|
||||
SOUND_PED_FLEE_RUN,
|
||||
SOUND_PED_CRASH_VEHICLE,
|
||||
SOUND_PED_CRASH_CAR,
|
||||
SOUND_PED_ANNOYED_DRIVER,
|
||||
SOUND_PED_147,
|
||||
SOUND_PED_SOLICIT,
|
||||
SOUND_PED_JEER,
|
||||
SOUND_PED_150,
|
||||
SOUND_PED_EXTINGUISHING_FIRE,
|
||||
SOUND_PED_WAIT_DOUBLEBACK,
|
||||
SOUND_PED_CHAT_SEXY_FEMALE,
|
||||
SOUND_PED_CHAT_SEXY_MALE,
|
||||
SOUND_PED_CHAT_EVENT,
|
||||
SOUND_PED_PED_COLLISION,
|
||||
SOUND_PED_CHAT,
|
||||
SOUND_PED_TAXI_CALL,
|
||||
SOUND_RACE_START_3,
|
||||
SOUND_RACE_START_2,
|
||||
SOUND_RACE_START_1,
|
||||
SOUND_RACE_START_GO,
|
||||
SOUND_SPLASH,
|
||||
SOUND_WATER_FALL,
|
||||
SOUND_SPLATTER,
|
||||
SOUND_CAR_PED_COLLISION,
|
||||
SOUND_CLOCK_TICK,
|
||||
SOUND_PART_MISSION_COMPLETE,
|
||||
SOUND_FRONTEND_MENU_STARTING, // same sound as SOUND_HUD
|
||||
|
||||
// TODO(Miami): What are 170-175??
|
||||
|
||||
SOUND_FRONTEND_RADIO_TURN_OFF = 176, // those 2 are same sound
|
||||
SOUND_FRONTEND_RADIO_TURN_ON,
|
||||
SOUND_FRONTEND_HURRICANE, // yes, frontend
|
||||
SOUND_HUD,
|
||||
SOUND_180,
|
||||
SOUND_181,
|
||||
SOUND_182,
|
||||
SOUND_LIGHTNING,
|
||||
SOUND_BULLETTRACE_1,
|
||||
SOUND_BULLETTRACE_2,
|
||||
SOUND_186, // makes same sound as 40
|
||||
SOUND_187, // makes same sound as 46
|
||||
SOUND_MELEE_ATTACK_START,
|
||||
SOUND_SKATING,
|
||||
SOUND_WEAPON_MINIGUN_ATTACK,
|
||||
SOUND_WEAPON_MINIGUN_2,
|
||||
SOUND_WEAPON_MINIGUN_3,
|
||||
SOUND_AMMUNATION_IMRAN_ARM_BOMB,
|
||||
SOUND_RADIO_CHANGE,
|
||||
SOUND_FRONTEND_HIGHLIGHT_OPTION,
|
||||
SOUND_FRONTEND_ENTER_OR_ADJUST,
|
||||
SOUND_FRONTEND_BACK,
|
||||
SOUND_FRONTEND_FAIL,
|
||||
SOUND_FRONTEND_AUDIO_TEST,
|
||||
SOUND_INJURED_PED_MALE_OUCH,
|
||||
SOUND_INJURED_PED_FEMALE,
|
||||
SOUND_SHIRT_WIND_FLAP,
|
||||
SOUND_SET_203,
|
||||
SOUND_TOTAL_SOUNDS = 204,
|
||||
SOUND_NO_SOUND = 205,
|
||||
};
|
||||
|
||||
|
||||
enum eScriptSounds {
|
||||
SCRIPT_SOUND_BANK_ALARM_LOOP = 0,
|
||||
SCRIPT_SOUND_PART_MISSION_COMPLETE,
|
||||
SCRIPT_SOUND_POLICE_CELL_DOOR_SLIDING_LOOP,
|
||||
SCRIPT_SOUND_POLICE_CELL_DOOR_CLUNK,
|
||||
SCRIPT_SOUND_GARAGE_DOOR_SLIDING_LOOP,
|
||||
SCRIPT_SOUND_GARAGE_DOOR_CLUNK,
|
||||
SCRIPT_SOUND_SNORING_LOOP,
|
||||
SCRIPT_SOUND_RACE_START_3,
|
||||
SCRIPT_SOUND_RACE_START_2,
|
||||
SCRIPT_SOUND_RACE_START_1,
|
||||
SCRIPT_SOUND_RACE_START_GO,
|
||||
SCRIPT_SOUND_SHOOTING_RANGE_TARGET_MOVING_LOOP,
|
||||
SCRIPT_SOUND_SHOOTING_RANGE_TARGET_HIT,
|
||||
SCRIPT_SOUND_AMMUNATION_BUY_WEAPON,
|
||||
SCRIPT_SOUND_AMMUNATION_BUY_WEAPON_DENIED,
|
||||
SCRIPT_SOUND_WMYCW_TICKET_SPEECH,
|
||||
SCRIPT_SOUND_IMRAN_ARM_BOMB,
|
||||
SCRIPT_SOUND_ANDY_SNIPER_SHOT,
|
||||
SCRIPT_SOUND_WILLIE_CARD_SWIPE,
|
||||
SCRIPT_SOUND_MALE_AMBULANCE_OUCH,
|
||||
SCRIPT_SOUND_FEMALE_AMBULANCE_OUCH,
|
||||
SCRIPT_SOUND_BUILDING_BAR_1,
|
||||
SCRIPT_SOUND_BUILDING_BAR_2,
|
||||
SCRIPT_SOUND_BUILDING_BAR_3,
|
||||
SCRIPT_SOUND_BUILDING_BAR_4,
|
||||
SCRIPT_SOUND_BUILDING_BIKER_BAR,
|
||||
SCRIPT_SOUND_BUILDING_CHURCH,
|
||||
SCRIPT_SOUND_BUILDING_CLUB,
|
||||
SCRIPT_SOUND_BUILDING_CUBA_1,
|
||||
SCRIPT_SOUND_BUILDING_CUBA_2,
|
||||
SCRIPT_SOUND_BUILDING_VOODOO,
|
||||
SCRIPT_SOUND_BUILDING_MUSIC_SHOP,
|
||||
SCRIPT_SOUND_BUILDING_STRIPCLUB_1,
|
||||
SCRIPT_SOUND_BUILDING_STRIPCLUB_2,
|
||||
SCRIPT_SOUND_BUILDING_SUPERSWEEP,
|
||||
SCRIPT_SOUND_SEAPLANE_LOW_FUEL,
|
||||
SCRIPT_SOUND_NEW_BUILDING_BAR_1,
|
||||
SCRIPT_SOUND_NEW_BUILDING_BAR_2,
|
||||
SCRIPT_SOUND_NEW_BUILDING_BAR_3,
|
||||
SCRIPT_SOUND_NEW_BUILDING_BAR_4,
|
||||
SCRIPT_SOUND_NEW_BUILDING_MALIBU_1,
|
||||
SCRIPT_SOUND_NEW_BUILDING_MALIBU_2,
|
||||
SCRIPT_SOUND_NEW_BUILDING_MALIBU_3,
|
||||
SCRIPT_SOUND_NEW_BUILDING_STRIP_1,
|
||||
SCRIPT_SOUND_NEW_BUILDING_STRIP_2,
|
||||
SCRIPT_SOUND_NEW_BUILDING_STRIP_3,
|
||||
SCRIPT_SOUND_NEW_BUILDING_CHURCH,
|
||||
SCRIPT_SOUND_NEW_BUILDING_FAN_1,
|
||||
SCRIPT_SOUND_NEW_BUILDING_FAN_2,
|
||||
SCRIPT_SOUND_NEW_BUILDING_INSECT_1,
|
||||
SCRIPT_SOUND_NEW_BUILDING_INSECT_2,
|
||||
SCRIPT_SOUND_NEW_WATERFALL,
|
||||
SCRIPT_SOUND_BULLET_HIT_GROUND_1,
|
||||
SCRIPT_SOUND_BULLET_HIT_GROUND_2,
|
||||
SCRIPT_SOUND_BULLET_HIT_GROUND_3,
|
||||
SCRIPT_SOUND_BULLET_HIT_WATER, // no sound
|
||||
SCRIPT_SOUND_PAYPHONE_RINGING,
|
||||
SCRIPT_SOUND_GLASS_BREAK_L,
|
||||
SCRIPT_SOUND_GLASS_BREAK_S,
|
||||
SCRIPT_SOUND_GLASS_CRACK,
|
||||
SCRIPT_SOUND_GLASS_LIGHT_BREAK,
|
||||
SCRIPT_SOUND_BOX_DESTROYED_1,
|
||||
SCRIPT_SOUND_BOX_DESTROYED_2,
|
||||
SCRIPT_SOUND_METAL_COLLISION,
|
||||
SCRIPT_SOUND_TIRE_COLLISION,
|
||||
SCRIPT_SOUND_HIT_BALL,
|
||||
SCRIPT_SOUND_GUNSHELL_DROP,
|
||||
SCRIPT_SOUND_GUNSHELL_DROP_SOFT,
|
||||
SCRIPT_SOUND_TOTAL,
|
||||
SCRIPT_SOUND_INVALID,
|
||||
};
|
||||
44
miami/buildings/Building.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "Building.h"
|
||||
#include "Streaming.h"
|
||||
#include "Pools.h"
|
||||
|
||||
void *CBuilding::operator new(size_t sz) throw() { return CPools::GetBuildingPool()->New(); }
|
||||
void CBuilding::operator delete(void *p, size_t sz) throw() { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
|
||||
|
||||
void
|
||||
CBuilding::ReplaceWithNewModel(int32 id)
|
||||
{
|
||||
DeleteRwObject();
|
||||
|
||||
if (CModelInfo::GetModelInfo(m_modelIndex)->GetNumRefs() == 0)
|
||||
CStreaming::RemoveModel(m_modelIndex);
|
||||
m_modelIndex = id;
|
||||
|
||||
if(bIsBIGBuilding)
|
||||
if(m_level == LEVEL_GENERIC || m_level == CGame::currLevel)
|
||||
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
|
||||
}
|
||||
|
||||
bool
|
||||
IsBuildingPointerValid(CBuilding* pBuilding)
|
||||
{
|
||||
if (!pBuilding)
|
||||
return false;
|
||||
if (pBuilding->GetIsATreadable()) {
|
||||
int index = CPools::GetTreadablePool()->GetJustIndex_NoFreeAssert((CTreadable*)pBuilding);
|
||||
#ifdef FIX_BUGS
|
||||
return index >= 0 && index < CPools::GetTreadablePool()->GetSize();
|
||||
#else
|
||||
return index >= 0 && index <= CPools::GetTreadablePool()->GetSize();
|
||||
#endif
|
||||
} else {
|
||||
int index = CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert(pBuilding);
|
||||
#ifdef FIX_BUGS
|
||||
return index >= 0 && index < CPools::GetBuildingPool()->GetSize();
|
||||
#else
|
||||
return index >= 0 && index <= CPools::GetBuildingPool()->GetSize();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
20
miami/buildings/Building.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "Entity.h"
|
||||
|
||||
class CBuilding : public CEntity
|
||||
{
|
||||
public:
|
||||
CBuilding(void) {
|
||||
m_type = ENTITY_TYPE_BUILDING;
|
||||
bUsesCollision = true;
|
||||
}
|
||||
static void *operator new(size_t) throw();
|
||||
static void operator delete(void*, size_t) throw();
|
||||
|
||||
void ReplaceWithNewModel(int32 id);
|
||||
|
||||
virtual bool GetIsATreadable(void) { return false; }
|
||||
};
|
||||
|
||||
bool IsBuildingPointerValid(CBuilding*);
|
||||
12
miami/buildings/Solid.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Entity.h"
|
||||
|
||||
class CSolid : public CEntity
|
||||
{
|
||||
public:
|
||||
CSolid(void) {
|
||||
m_type = ENTITY_TYPE_BUILDING;
|
||||
bUsesCollision = true;
|
||||
}
|
||||
};
|
||||
8
miami/buildings/Treadable.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "rpworld.h"
|
||||
#include "Treadable.h"
|
||||
#include "Pools.h"
|
||||
|
||||
void *CTreadable::operator new(size_t sz) throw() { return CPools::GetTreadablePool()->New(); }
|
||||
void CTreadable::operator delete(void *p, size_t sz) throw() { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
|
||||
12
miami/buildings/Treadable.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Building.h"
|
||||
|
||||
class CTreadable : public CBuilding
|
||||
{
|
||||
public:
|
||||
static void *operator new(size_t) throw();
|
||||
static void operator delete(void*, size_t) throw();
|
||||
|
||||
bool GetIsATreadable(void) { return true; }
|
||||
};
|
||||
21
miami/collision/ColBox.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "common.h"
|
||||
#include "ColBox.h"
|
||||
|
||||
void
|
||||
CColBox::Set(const CVector &min, const CVector &max, uint8 surf, uint8 piece)
|
||||
{
|
||||
this->min = min;
|
||||
this->max = max;
|
||||
this->surface = surf;
|
||||
this->piece = piece;
|
||||
}
|
||||
|
||||
CColBox&
|
||||
CColBox::operator=(const CColBox& other)
|
||||
{
|
||||
min = other.min;
|
||||
max = other.max;
|
||||
surface = other.surface;
|
||||
piece = other.piece;
|
||||
return *this;
|
||||
}
|
||||
22
miami/collision/ColBox.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "SurfaceTable.h"
|
||||
|
||||
struct CBox
|
||||
{
|
||||
CVector min;
|
||||
CVector max;
|
||||
CVector GetSize(void) { return max - min; }
|
||||
void Set(const CVector &min, const CVector &max) { this->min = min; this->max = max; }
|
||||
};
|
||||
|
||||
struct CColBox : public CBox
|
||||
{
|
||||
uint8 surface;
|
||||
uint8 piece;
|
||||
|
||||
void Set(const CVector &min, const CVector &max, uint8 surf, uint8 piece);
|
||||
using CBox::Set;
|
||||
|
||||
CColBox& operator=(const CColBox &other);
|
||||
};
|
||||
9
miami/collision/ColLine.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "common.h"
|
||||
#include "ColLine.h"
|
||||
|
||||
void
|
||||
CColLine::Set(const CVector &p0, const CVector &p1)
|
||||
{
|
||||
this->p0 = p0;
|
||||
this->p1 = p1;
|
||||
}
|
||||
14
miami/collision/ColLine.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
struct CColLine
|
||||
{
|
||||
// NB: this has to be compatible with two CVuVectors
|
||||
CVector p0;
|
||||
int pad0;
|
||||
CVector p1;
|
||||
int pad1;
|
||||
|
||||
CColLine(void) { };
|
||||
CColLine(const CVector &p0, const CVector &p1) { this->p0 = p0; this->p1 = p1; };
|
||||
void Set(const CVector &p0, const CVector &p1);
|
||||
};
|
||||
206
miami/collision/ColModel.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
#include "common.h"
|
||||
#include "ColModel.h"
|
||||
#include "Collision.h"
|
||||
#include "Game.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "Pools.h"
|
||||
|
||||
CColModel::CColModel(void)
|
||||
{
|
||||
numSpheres = 0;
|
||||
spheres = nil;
|
||||
numLines = 0;
|
||||
lines = nil;
|
||||
numBoxes = 0;
|
||||
boxes = nil;
|
||||
numTriangles = 0;
|
||||
vertices = nil;
|
||||
triangles = nil;
|
||||
trianglePlanes = nil;
|
||||
level = LEVEL_GENERIC; // generic col slot
|
||||
ownsCollisionVolumes = true;
|
||||
}
|
||||
|
||||
CColModel::~CColModel(void)
|
||||
{
|
||||
RemoveCollisionVolumes();
|
||||
}
|
||||
|
||||
void*
|
||||
CColModel::operator new(size_t) throw()
|
||||
{
|
||||
CColModel* node = CPools::GetColModelPool()->New();
|
||||
assert(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::operator delete(void *p, size_t) throw()
|
||||
{
|
||||
CPools::GetColModelPool()->Delete((CColModel*)p);
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::RemoveCollisionVolumes(void)
|
||||
{
|
||||
if(ownsCollisionVolumes){
|
||||
RwFree(spheres);
|
||||
RwFree(lines);
|
||||
RwFree(boxes);
|
||||
RwFree(vertices);
|
||||
RwFree(triangles);
|
||||
CCollision::RemoveTrianglePlanes(this);
|
||||
}
|
||||
numSpheres = 0;
|
||||
numLines = 0;
|
||||
numBoxes = 0;
|
||||
numTriangles = 0;
|
||||
spheres = nil;
|
||||
lines = nil;
|
||||
boxes = nil;
|
||||
vertices = nil;
|
||||
triangles = nil;
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::CalculateTrianglePlanes(void)
|
||||
{
|
||||
PUSH_MEMID(MEMID_COLLISION);
|
||||
|
||||
// HACK: allocate space for one more element to stuff the link pointer into
|
||||
trianglePlanes = (CColTrianglePlane*)RwMalloc(sizeof(CColTrianglePlane) * (numTriangles+1));
|
||||
REGISTER_MEMPTR(&trianglePlanes);
|
||||
for(int i = 0; i < numTriangles; i++)
|
||||
trianglePlanes[i].Set(vertices, triangles[i]);
|
||||
|
||||
POP_MEMID();
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::RemoveTrianglePlanes(void)
|
||||
{
|
||||
RwFree(trianglePlanes);
|
||||
trianglePlanes = nil;
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::SetLinkPtr(CLink<CColModel*> *lptr)
|
||||
{
|
||||
assert(trianglePlanes);
|
||||
*(CLink<CColModel*>**)ALIGNPTR(&trianglePlanes[numTriangles]) = lptr;
|
||||
}
|
||||
|
||||
CLink<CColModel*>*
|
||||
CColModel::GetLinkPtr(void)
|
||||
{
|
||||
assert(trianglePlanes);
|
||||
return *(CLink<CColModel*>**)ALIGNPTR(&trianglePlanes[numTriangles]);
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::GetTrianglePoint(CVector &v, int i) const
|
||||
{
|
||||
v = vertices[i].Get();
|
||||
}
|
||||
|
||||
CColModel&
|
||||
CColModel::operator=(const CColModel &other)
|
||||
{
|
||||
int i;
|
||||
int numVerts;
|
||||
|
||||
boundingSphere = other.boundingSphere;
|
||||
boundingBox = other.boundingBox;
|
||||
|
||||
// copy spheres
|
||||
if(other.numSpheres){
|
||||
if(numSpheres != other.numSpheres){
|
||||
numSpheres = other.numSpheres;
|
||||
if(spheres)
|
||||
RwFree(spheres);
|
||||
spheres = (CColSphere*)RwMalloc(numSpheres*sizeof(CColSphere));
|
||||
}
|
||||
for(i = 0; i < numSpheres; i++)
|
||||
spheres[i] = other.spheres[i];
|
||||
}else{
|
||||
numSpheres = 0;
|
||||
if(spheres)
|
||||
RwFree(spheres);
|
||||
spheres = nil;
|
||||
}
|
||||
|
||||
// copy lines
|
||||
if(other.numLines){
|
||||
if(numLines != other.numLines){
|
||||
numLines = other.numLines;
|
||||
if(lines)
|
||||
RwFree(lines);
|
||||
lines = (CColLine*)RwMalloc(numLines*sizeof(CColLine));
|
||||
}
|
||||
for(i = 0; i < numLines; i++)
|
||||
lines[i] = other.lines[i];
|
||||
}else{
|
||||
numLines = 0;
|
||||
if(lines)
|
||||
RwFree(lines);
|
||||
lines = nil;
|
||||
}
|
||||
|
||||
// copy boxes
|
||||
if(other.numBoxes){
|
||||
if(numBoxes != other.numBoxes){
|
||||
numBoxes = other.numBoxes;
|
||||
if(boxes)
|
||||
RwFree(boxes);
|
||||
boxes = (CColBox*)RwMalloc(numBoxes*sizeof(CColBox));
|
||||
}
|
||||
for(i = 0; i < numBoxes; i++)
|
||||
boxes[i] = other.boxes[i];
|
||||
}else{
|
||||
numBoxes = 0;
|
||||
if(boxes)
|
||||
RwFree(boxes);
|
||||
boxes = nil;
|
||||
}
|
||||
|
||||
// copy mesh
|
||||
if(other.numTriangles){
|
||||
// copy vertices
|
||||
numVerts = 0;
|
||||
for(i = 0; i < other.numTriangles; i++){
|
||||
if(other.triangles[i].a > numVerts)
|
||||
numVerts = other.triangles[i].a;
|
||||
if(other.triangles[i].b > numVerts)
|
||||
numVerts = other.triangles[i].b;
|
||||
if(other.triangles[i].c > numVerts)
|
||||
numVerts = other.triangles[i].c;
|
||||
}
|
||||
numVerts++;
|
||||
if(vertices)
|
||||
RwFree(vertices);
|
||||
if(numVerts){
|
||||
vertices = (CompressedVector*)RwMalloc(numVerts*sizeof(CompressedVector));
|
||||
for(i = 0; i < numVerts; i++)
|
||||
vertices[i] = other.vertices[i];
|
||||
}
|
||||
|
||||
// copy triangles
|
||||
if(numTriangles != other.numTriangles){
|
||||
numTriangles = other.numTriangles;
|
||||
if(triangles)
|
||||
RwFree(triangles);
|
||||
triangles = (CColTriangle*)RwMalloc(numTriangles*sizeof(CColTriangle));
|
||||
}
|
||||
for(i = 0; i < numTriangles; i++)
|
||||
triangles[i] = other.triangles[i];
|
||||
}else{
|
||||
numTriangles = 0;
|
||||
if(triangles)
|
||||
RwFree(triangles);
|
||||
triangles = nil;
|
||||
if(vertices)
|
||||
RwFree(vertices);
|
||||
vertices = nil;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
39
miami/collision/ColModel.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "templates.h"
|
||||
#include "ColBox.h"
|
||||
#include "ColSphere.h"
|
||||
#include "ColLine.h"
|
||||
#include "ColPoint.h"
|
||||
#include "ColTriangle.h"
|
||||
|
||||
struct CColModel
|
||||
{
|
||||
CSphere boundingSphere;
|
||||
CBox boundingBox;
|
||||
int16 numSpheres;
|
||||
int16 numBoxes;
|
||||
int16 numTriangles;
|
||||
int8 numLines;
|
||||
uint8 level; // colstore slot but probably still named level
|
||||
bool ownsCollisionVolumes;
|
||||
CColSphere *spheres;
|
||||
CColLine *lines;
|
||||
CColBox *boxes;
|
||||
CompressedVector *vertices;
|
||||
CColTriangle *triangles;
|
||||
CColTrianglePlane *trianglePlanes;
|
||||
|
||||
CColModel(void);
|
||||
~CColModel(void);
|
||||
void RemoveCollisionVolumes(void);
|
||||
void CalculateTrianglePlanes(void);
|
||||
void RemoveTrianglePlanes(void);
|
||||
CLink<CColModel*> *GetLinkPtr(void);
|
||||
void SetLinkPtr(CLink<CColModel*>*);
|
||||
void GetTrianglePoint(CVector &v, int i) const;
|
||||
|
||||
void *operator new(size_t) throw();
|
||||
void operator delete(void *p, size_t) throw();
|
||||
CColModel& operator=(const CColModel& other);
|
||||
};
|
||||
16
miami/collision/ColPoint.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "common.h"
|
||||
#include "ColPoint.h"
|
||||
|
||||
CColPoint&
|
||||
CColPoint::operator=(const CColPoint &other)
|
||||
{
|
||||
point = other.point;
|
||||
normal = other.normal;
|
||||
surfaceA = other.surfaceA;
|
||||
pieceA = other.pieceA;
|
||||
surfaceB = other.surfaceB;
|
||||
pieceB = other.pieceB;
|
||||
|
||||
// no depth?
|
||||
return *this;
|
||||
}
|
||||
34
miami/collision/ColPoint.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
struct CColPoint
|
||||
{
|
||||
CVector point;
|
||||
int pad1;
|
||||
// the surface normal on the surface of point
|
||||
CVector normal;
|
||||
int pad2;
|
||||
uint8 surfaceA;
|
||||
uint8 pieceA;
|
||||
uint8 surfaceB;
|
||||
uint8 pieceB;
|
||||
float depth;
|
||||
|
||||
const CVector &GetNormal() { return normal; }
|
||||
float GetDepth() { return depth; }
|
||||
void Set(float depth, uint8 surfA, uint8 pieceA, uint8 surfB, uint8 pieceB) {
|
||||
this->depth = depth;
|
||||
this->surfaceA = surfA;
|
||||
this->pieceA = pieceA;
|
||||
this->surfaceB = surfB;
|
||||
this->pieceB = pieceB;
|
||||
}
|
||||
void Set(uint8 surfA, uint8 pieceA, uint8 surfB, uint8 pieceB) {
|
||||
this->surfaceA = surfA;
|
||||
this->pieceA = pieceA;
|
||||
this->surfaceB = surfB;
|
||||
this->pieceB = pieceB;
|
||||
}
|
||||
|
||||
CColPoint &operator=(const CColPoint &other);
|
||||
};
|
||||
|
||||
27
miami/collision/ColSphere.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "common.h"
|
||||
#include "ColSphere.h"
|
||||
#include "General.h"
|
||||
|
||||
void
|
||||
CColSphere::Set(float radius, const CVector ¢er, uint8 surf, uint8 piece)
|
||||
{
|
||||
this->radius = radius;
|
||||
this->center = center;
|
||||
this->surface = surf;
|
||||
this->piece = piece;
|
||||
}
|
||||
|
||||
bool
|
||||
CColSphere::IntersectRay(CVector const& from, CVector const& dir, CVector &entry, CVector &exit)
|
||||
{
|
||||
CVector distToCenter = from - center;
|
||||
float distToTouchSqr = distToCenter.MagnitudeSqr() - sq(radius);
|
||||
float root1, root2;
|
||||
|
||||
if (!CGeneral::SolveQuadratic(1.0f, DotProduct(distToCenter, dir) * 2.f, distToTouchSqr, root1, root2))
|
||||
return false;
|
||||
|
||||
entry = from + dir * root1;
|
||||
exit = from + dir * root2;
|
||||
return true;
|
||||
}
|
||||
21
miami/collision/ColSphere.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "SurfaceTable.h"
|
||||
|
||||
struct CSphere
|
||||
{
|
||||
// NB: this has to be compatible with a CVuVector
|
||||
CVector center;
|
||||
float radius;
|
||||
void Set(float radius, const CVector ¢er) { this->center = center; this->radius = radius; }
|
||||
};
|
||||
|
||||
struct CColSphere : public CSphere
|
||||
{
|
||||
uint8 surface;
|
||||
uint8 piece;
|
||||
|
||||
void Set(float radius, const CVector ¢er, uint8 surf, uint8 piece);
|
||||
bool IntersectRay(CVector const &from, CVector const &dir, CVector &entry, CVector &exit);
|
||||
using CSphere::Set;
|
||||
};
|
||||
255
miami/collision/ColStore.cpp
Normal file
@@ -0,0 +1,255 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "templates.h"
|
||||
#include "General.h"
|
||||
#include "ModelInfo.h"
|
||||
#include "Streaming.h"
|
||||
#include "FileLoader.h"
|
||||
#include "Script.h"
|
||||
#include "Timer.h"
|
||||
#include "Camera.h"
|
||||
#include "Frontend.h"
|
||||
#include "Physical.h"
|
||||
#include "ColStore.h"
|
||||
#include "VarConsole.h"
|
||||
#include "Pools.h"
|
||||
|
||||
CPool<ColDef,ColDef> *CColStore::ms_pColPool;
|
||||
#ifndef MASTER
|
||||
bool bDispColInMem;
|
||||
#endif
|
||||
|
||||
void
|
||||
CColStore::Initialise(void)
|
||||
{
|
||||
if(ms_pColPool == nil)
|
||||
ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles");
|
||||
AddColSlot("generic"); // slot 0. not streamed
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Display collision in memory", &bDispColInMem, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::Shutdown(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < COLSTORESIZE; i++)
|
||||
RemoveColSlot(i);
|
||||
if(ms_pColPool)
|
||||
delete ms_pColPool;
|
||||
ms_pColPool = nil;
|
||||
}
|
||||
|
||||
int
|
||||
CColStore::AddColSlot(const char *name)
|
||||
{
|
||||
ColDef *def = ms_pColPool->New();
|
||||
assert(def);
|
||||
def->isLoaded = false;
|
||||
def->unused = 0;
|
||||
def->bounds.left = 1000000.0f;
|
||||
def->bounds.top = 1000000.0f;
|
||||
def->bounds.right = -1000000.0f;
|
||||
def->bounds.bottom = -1000000.0f;
|
||||
def->minIndex = INT16_MAX;
|
||||
def->maxIndex = INT16_MIN;
|
||||
strcpy(def->name, name);
|
||||
return ms_pColPool->GetJustIndex(def);
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::RemoveColSlot(int32 slot)
|
||||
{
|
||||
if(GetSlot(slot)){
|
||||
if(GetSlot(slot)->isLoaded)
|
||||
RemoveCol(slot);
|
||||
ms_pColPool->Delete(GetSlot(slot));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
CColStore::FindColSlot(const char *name)
|
||||
{
|
||||
ColDef *def;
|
||||
int size = ms_pColPool->GetSize();
|
||||
for(int i = 0; i < size; i++){
|
||||
def = GetSlot(i);
|
||||
if(def && !CGeneral::faststricmp(def->name, name))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
char*
|
||||
CColStore::GetColName(int32 slot)
|
||||
{
|
||||
return GetSlot(slot)->name;
|
||||
}
|
||||
|
||||
CRect&
|
||||
CColStore::GetBoundingBox(int32 slot)
|
||||
{
|
||||
return GetSlot(slot)->bounds;
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::IncludeModelIndex(int32 slot, int32 modelIndex)
|
||||
{
|
||||
ColDef *def = GetSlot(slot);
|
||||
if(modelIndex < def->minIndex)
|
||||
def->minIndex = modelIndex;
|
||||
if(modelIndex > def->maxIndex)
|
||||
def->maxIndex = modelIndex;
|
||||
}
|
||||
|
||||
bool
|
||||
CColStore::LoadCol(int32 slot, uint8 *buffer, int32 bufsize)
|
||||
{
|
||||
bool success;
|
||||
ColDef *def = GetSlot(slot);
|
||||
if(def->minIndex > def->maxIndex)
|
||||
success = CFileLoader::LoadCollisionFileFirstTime(buffer, bufsize, slot);
|
||||
else
|
||||
success = CFileLoader::LoadCollisionFile(buffer, bufsize, slot);
|
||||
if(success)
|
||||
def->isLoaded = true;
|
||||
else
|
||||
debug("Failed to load Collision\n");
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::RemoveCol(int32 slot)
|
||||
{
|
||||
int id;
|
||||
GetSlot(slot)->isLoaded = false;
|
||||
for(id = 0; id < MODELINFOSIZE; id++){
|
||||
CBaseModelInfo *mi = CModelInfo::GetModelInfo(id);
|
||||
if(mi){
|
||||
CColModel *col = mi->GetColModel();
|
||||
if(col && col->level == slot)
|
||||
col->RemoveCollisionVolumes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::LoadAllCollision(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 1; i < COLSTORESIZE; i++)
|
||||
if(GetSlot(i))
|
||||
CStreaming::RequestCol(i, 0);
|
||||
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::RemoveAllCollision(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 1; i < COLSTORESIZE; i++)
|
||||
if(GetSlot(i))
|
||||
if(CStreaming::CanRemoveCol(i))
|
||||
CStreaming::RemoveCol(i);
|
||||
}
|
||||
|
||||
static bool bLoadAtSecondPosition;
|
||||
static CVector2D secondPosition;
|
||||
|
||||
void
|
||||
CColStore::AddCollisionNeededAtPosn(const CVector2D &pos)
|
||||
{
|
||||
bLoadAtSecondPosition = true;
|
||||
secondPosition = pos;
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::LoadCollision(const CVector2D &pos)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(CStreaming::ms_disableStreaming)
|
||||
return;
|
||||
|
||||
for(i = 1; i < COLSTORESIZE; i++){
|
||||
if(GetSlot(i) == nil)
|
||||
continue;
|
||||
|
||||
bool wantThisOne = false;
|
||||
|
||||
if(GetBoundingBox(i).IsPointInside(pos) ||
|
||||
bLoadAtSecondPosition && GetBoundingBox(i).IsPointInside(secondPosition, -119.0f) ||
|
||||
strcmp(GetColName(i), "yacht") == 0){
|
||||
wantThisOne = true;
|
||||
}else{
|
||||
for (int j = 0; j < MAX_CLEANUP; j++) {
|
||||
CPhysical* pEntity = nil;
|
||||
cleanup_entity_struct* pCleanup = &CTheScripts::MissionCleanUp.m_sEntities[j];
|
||||
if (pCleanup->type == CLEANUP_CAR) {
|
||||
pEntity = CPools::GetVehiclePool()->GetAt(pCleanup->id);
|
||||
if (!pEntity || pEntity->GetStatus() == STATUS_WRECKED)
|
||||
continue;
|
||||
}
|
||||
else if (pCleanup->type == CLEANUP_CHAR) {
|
||||
pEntity = CPools::GetPedPool()->GetAt(pCleanup->id);
|
||||
if (!pEntity || ((CPed*)pEntity)->DyingOrDead())
|
||||
continue;
|
||||
}
|
||||
if (pEntity && !pEntity->bDontLoadCollision && !pEntity->bIsFrozen) {
|
||||
if (GetBoundingBox(i).IsPointInside(pEntity->GetPosition(), -80.0f))
|
||||
wantThisOne = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(wantThisOne)
|
||||
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
|
||||
else
|
||||
CStreaming::RemoveCol(i);
|
||||
}
|
||||
bLoadAtSecondPosition = false;
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::RequestCollision(const CVector2D &pos)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 1; i < COLSTORESIZE; i++)
|
||||
if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f))
|
||||
CStreaming::RequestCol(i, STREAMFLAGS_PRIORITY);
|
||||
}
|
||||
|
||||
void
|
||||
CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(CStreaming::ms_disableStreaming)
|
||||
return;
|
||||
|
||||
for(i = 1; i < COLSTORESIZE; i++)
|
||||
if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -110.0f) &&
|
||||
!CStreaming::HasColLoaded(i)){
|
||||
CStreaming::RequestCol(i, 0);
|
||||
if(TheCamera.GetScreenFadeStatus() == FADE_0)
|
||||
FrontEndMenuManager.MessageScreen("LOADCOL", false);
|
||||
CTimer::Suspend();
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
CTimer::Resume();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CColStore::HasCollisionLoaded(const CVector2D &pos)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 1; i < COLSTORESIZE; i++)
|
||||
if(GetSlot(i) && GetBoundingBox(i).IsPointInside(pos, -115.0f) &&
|
||||
!GetSlot(i)->isLoaded)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
43
miami/collision/ColStore.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "templates.h"
|
||||
|
||||
struct ColDef { // made up name
|
||||
int32 unused;
|
||||
bool isLoaded;
|
||||
CRect bounds;
|
||||
char name[20];
|
||||
int16 minIndex;
|
||||
int16 maxIndex;
|
||||
};
|
||||
|
||||
class CColStore
|
||||
{
|
||||
static CPool<ColDef,ColDef> *ms_pColPool;
|
||||
|
||||
public:
|
||||
static void Initialise(void);
|
||||
static void Shutdown(void);
|
||||
static int AddColSlot(const char *name);
|
||||
static void RemoveColSlot(int32 slot);
|
||||
static int FindColSlot(const char *name);
|
||||
static char *GetColName(int32 slot);
|
||||
static CRect &GetBoundingBox(int32 slot);
|
||||
static void IncludeModelIndex(int32 slot, int32 modelIndex);
|
||||
static bool LoadCol(int32 storeID, uint8 *buffer, int32 bufsize);
|
||||
static void RemoveCol(int32 slot);
|
||||
static void AddCollisionNeededAtPosn(const CVector2D &pos);
|
||||
static void LoadAllCollision(void);
|
||||
static void RemoveAllCollision(void);
|
||||
static void LoadCollision(const CVector2D &pos);
|
||||
static void RequestCollision(const CVector2D &pos);
|
||||
static void EnsureCollisionIsInMemory(const CVector2D &pos);
|
||||
static bool HasCollisionLoaded(const CVector2D &pos);
|
||||
|
||||
static ColDef *GetSlot(int slot) {
|
||||
assert(slot >= 0);
|
||||
assert(ms_pColPool);
|
||||
assert(slot < ms_pColPool->GetSize());
|
||||
return ms_pColPool->GetSlot(slot);
|
||||
}
|
||||
};
|
||||
32
miami/collision/ColTriangle.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "common.h"
|
||||
#include "ColTriangle.h"
|
||||
|
||||
#ifdef VU_COLLISION
|
||||
void
|
||||
CColTrianglePlane::Set(const CVector &va, const CVector &vb, const CVector &vc)
|
||||
{
|
||||
CVector norm = CrossProduct(vc-va, vb-va);
|
||||
norm.Normalise();
|
||||
float d = DotProduct(norm, va);
|
||||
normal.x = norm.x*4096.0f;
|
||||
normal.y = norm.y*4096.0f;
|
||||
normal.z = norm.z*4096.0f;
|
||||
dist = d*128.0f;
|
||||
}
|
||||
#else
|
||||
void
|
||||
CColTrianglePlane::Set(const CVector &va, const CVector &vb, const CVector &vc)
|
||||
{
|
||||
normal = CrossProduct(vc-va, vb-va);
|
||||
normal.Normalise();
|
||||
dist = DotProduct(normal, va);
|
||||
CVector an(Abs(normal.x), Abs(normal.y), Abs(normal.z));
|
||||
// find out largest component and its direction
|
||||
if(an.x > an.y && an.x > an.z)
|
||||
dir = normal.x < 0.0f ? DIR_X_NEG : DIR_X_POS;
|
||||
else if(an.y > an.z)
|
||||
dir = normal.y < 0.0f ? DIR_Y_NEG : DIR_Y_POS;
|
||||
else
|
||||
dir = normal.z < 0.0f ? DIR_Z_NEG : DIR_Z_POS;
|
||||
}
|
||||
#endif
|
||||
77
miami/collision/ColTriangle.h
Normal file
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#include "CompressedVector.h"
|
||||
|
||||
enum Direction {
|
||||
DIR_X_POS,
|
||||
DIR_X_NEG,
|
||||
DIR_Y_POS,
|
||||
DIR_Y_NEG,
|
||||
DIR_Z_POS,
|
||||
DIR_Z_NEG,
|
||||
};
|
||||
|
||||
struct CColTriangle
|
||||
{
|
||||
uint16 a;
|
||||
uint16 b;
|
||||
uint16 c;
|
||||
uint8 surface;
|
||||
|
||||
void Set(int a, int b, int c, uint8 surf)
|
||||
{
|
||||
this->a = a;
|
||||
this->b = b;
|
||||
this->c = c;
|
||||
this->surface = surf;
|
||||
}
|
||||
};
|
||||
|
||||
struct CColTrianglePlane
|
||||
{
|
||||
#ifdef VU_COLLISION
|
||||
CompressedVector normal;
|
||||
int16 dist;
|
||||
|
||||
void Set(const CVector &va, const CVector &vb, const CVector &vc);
|
||||
void Set(const CompressedVector *v, CColTriangle &tri) { Set(v[tri.a].Get(), v[tri.b].Get(), v[tri.c].Get()); }
|
||||
void GetNormal(CVector &n) const { n.x = normal.x/4096.0f; n.y = normal.y/4096.0f; n.z = normal.z/4096.0f; }
|
||||
float CalcPoint(const CVector &v) const { CVector n; GetNormal(n); return DotProduct(n, v) - dist/128.0f; };
|
||||
#ifdef GTA_PS2
|
||||
void Unpack(uint128 &qword) const {
|
||||
__asm__ volatile (
|
||||
"lh $8, 0(%1)\n"
|
||||
"lh $9, 2(%1)\n"
|
||||
"lh $10, 4(%1)\n"
|
||||
"lh $11, 6(%1)\n"
|
||||
"pextlw $10, $8\n"
|
||||
"pextlw $11, $9\n"
|
||||
"pextlw $2, $11, $10\n"
|
||||
"sq $2, %0\n"
|
||||
: "=m" (qword)
|
||||
: "r" (this)
|
||||
: "$8", "$9", "$10", "$11", "$2"
|
||||
);
|
||||
}
|
||||
#else
|
||||
void Unpack(int32 *qword) const {
|
||||
qword[0] = normal.x;
|
||||
qword[1] = normal.y;
|
||||
qword[2] = normal.z;
|
||||
qword[3] = dist;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
CVector normal;
|
||||
float dist;
|
||||
uint8 dir;
|
||||
|
||||
void Set(const CVector &va, const CVector &vb, const CVector &vc);
|
||||
void Set(const CompressedVector *v, CColTriangle &tri) { Set(v[tri.a].Get(), v[tri.b].Get(), v[tri.c].Get()); }
|
||||
void GetNormal(CVector &n) const { n = normal; }
|
||||
float GetNormalX() const { return normal.x; }
|
||||
float GetNormalY() const { return normal.y; }
|
||||
float GetNormalZ() const { return normal.z; }
|
||||
float CalcPoint(const CVector &v) const { return DotProduct(normal, v) - dist; };
|
||||
#endif
|
||||
};
|
||||