diff --git a/CMakeLists.txt b/CMakeLists.txt index f7bf567d23..79367c5f8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,15 +94,15 @@ function(add_lego_libraries NAME) set(SUFFIX "${ARG_SUFFIX}") add_library(tglrl${ARG_SUFFIX} STATIC - LEGO1/tgl/d3drm/camera.cpp + LEGO1/tgl/d3drm/renderer.cpp + LEGO1/tgl/d3drm/texture.cpp + LEGO1/tgl/d3drm/view.cpp LEGO1/tgl/d3drm/device.cpp LEGO1/tgl/d3drm/group.cpp + LEGO1/tgl/d3drm/camera.cpp LEGO1/tgl/d3drm/light.cpp - LEGO1/tgl/d3drm/mesh.cpp LEGO1/tgl/d3drm/meshbuilder.cpp - LEGO1/tgl/d3drm/renderer.cpp - LEGO1/tgl/d3drm/texture.cpp - LEGO1/tgl/d3drm/view.cpp + LEGO1/tgl/d3drm/mesh.cpp ) list(APPEND list_targets tglrl${ARG_SUFFIX}) set_property(TARGET tglrl${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "tglrl40$<$:d>${ARG_SUFFIX}") @@ -110,11 +110,9 @@ function(add_lego_libraries NAME) target_link_libraries(tglrl${ARG_SUFFIX} PRIVATE d3drm) add_library(realtime${ARG_SUFFIX} STATIC - LEGO1/realtime/matrix.cpp LEGO1/realtime/orientableroi.cpp LEGO1/realtime/realtime.cpp LEGO1/realtime/realtimeview.cpp - LEGO1/realtime/vector.cpp ) list(APPEND list_targets realtime${ARG_SUFFIX}) set_property(TARGET realtime${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "realtime$<$:d>${ARG_SUFFIX}") @@ -123,8 +121,8 @@ function(add_lego_libraries NAME) add_library(viewmanager${ARG_SUFFIX} STATIC LEGO1/viewmanager/viewlod.cpp - LEGO1/viewmanager/viewlodlist.cpp LEGO1/viewmanager/viewmanager.cpp + LEGO1/viewmanager/viewlodlist.cpp LEGO1/viewmanager/viewroi.cpp ) list(APPEND list_targets viewmanager${ARG_SUFFIX}) @@ -134,9 +132,9 @@ function(add_lego_libraries NAME) add_library(mxdirectx${ARG_SUFFIX} STATIC LEGO1/mxdirectx/mxdirect3d.cpp - LEGO1/mxdirectx/mxdirectdraw.cpp LEGO1/mxdirectx/mxdirectxinfo.cpp LEGO1/mxdirectx/legodxinfo.cpp + LEGO1/mxdirectx/mxdirectdraw.cpp ) list(APPEND list_targets mxdirectx${ARG_SUFFIX}) set_property(TARGET mxdirectx${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "MxDirectX$<$:d>${ARG_SUFFIX}") @@ -144,8 +142,8 @@ function(add_lego_libraries NAME) target_link_libraries(mxdirectx${ARG_SUFFIX} PRIVATE ddraw) add_library(roi${ARG_SUFFIX} STATIC - LEGO1/lego/sources/roi/legolod.cpp LEGO1/lego/sources/roi/legoroi.cpp + LEGO1/lego/sources/roi/legolod.cpp ) list(APPEND list_targets roi${ARG_SUFFIX}) set_property(TARGET roi${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "roi$<$:d>${ARG_SUFFIX}") @@ -154,8 +152,8 @@ function(add_lego_libraries NAME) add_library(geom${ARG_SUFFIX} STATIC LEGO1/lego/sources/geom/legoedge.cpp - LEGO1/lego/sources/geom/legounkown100db7f4.cpp LEGO1/lego/sources/geom/legoweedge.cpp + LEGO1/lego/sources/geom/legounkown100db7f4.cpp LEGO1/lego/sources/geom/legowegedge.cpp ) list(APPEND list_targets geom${ARG_SUFFIX}) @@ -164,11 +162,11 @@ function(add_lego_libraries NAME) target_link_libraries(geom${ARG_SUFFIX} PRIVATE) add_library(shape${ARG_SUFFIX} STATIC - LEGO1/lego/sources/shape/legocolor.cpp LEGO1/lego/sources/shape/legobox.cpp - LEGO1/lego/sources/shape/legomesh.cpp LEGO1/lego/sources/shape/legosphere.cpp LEGO1/lego/sources/shape/legovertex.cpp + LEGO1/lego/sources/shape/legomesh.cpp + LEGO1/lego/sources/shape/legocolor.cpp ) list(APPEND list_targets shape${ARG_SUFFIX}) set_property(TARGET shape${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "shape$<$:d>${ARG_SUFFIX}") @@ -183,10 +181,10 @@ function(add_lego_libraries NAME) target_include_directories(anim${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") add_library(misc${ARG_SUFFIX} STATIC - LEGO1/lego/sources/misc/legocontainer.cpp - LEGO1/lego/sources/misc/legoimage.cpp - LEGO1/lego/sources/misc/legostorage.cpp LEGO1/lego/sources/misc/legotexture.cpp + LEGO1/lego/sources/misc/legostorage.cpp + LEGO1/lego/sources/misc/legoimage.cpp + LEGO1/lego/sources/misc/legocontainer.cpp LEGO1/lego/sources/misc/legotree.cpp LEGO1/lego/sources/misc/legounknown.cpp ) @@ -196,8 +194,8 @@ function(add_lego_libraries NAME) target_link_libraries(misc${ARG_SUFFIX} PRIVATE) add_library(3dmanager${ARG_SUFFIX} STATIC - LEGO1/lego/sources/3dmanager/lego3dmanager.cpp LEGO1/lego/sources/3dmanager/lego3dview.cpp + LEGO1/lego/sources/3dmanager/lego3dmanager.cpp LEGO1/lego/sources/3dmanager/legoview1.cpp LEGO1/lego/sources/3dmanager/tglsurface.cpp ) @@ -207,86 +205,82 @@ function(add_lego_libraries NAME) target_link_libraries(3dmanager${ARG_SUFFIX} PRIVATE Vec::Vec) add_library(omni${ARG_SUFFIX} STATIC + LEGO1/omni/src/notify/mxnotificationmanager.cpp + LEGO1/omni/src/common/mxdebug.cpp + LEGO1/omni/src/common/mxmisc.cpp + LEGO1/omni/src/common/mxatom.cpp LEGO1/omni/src/action/mxdsaction.cpp - LEGO1/omni/src/action/mxdsanim.cpp - LEGO1/omni/src/action/mxdsevent.cpp - LEGO1/omni/src/action/mxdsmediaaction.cpp - LEGO1/omni/src/action/mxdsmultiaction.cpp - LEGO1/omni/src/action/mxdsobjectaction.cpp - LEGO1/omni/src/action/mxdsobject.cpp - LEGO1/omni/src/action/mxdsparallelaction.cpp - LEGO1/omni/src/action/mxdsselectaction.cpp - LEGO1/omni/src/action/mxdsserialaction.cpp - LEGO1/omni/src/action/mxdssound.cpp - LEGO1/omni/src/action/mxdsstill.cpp - LEGO1/omni/src/action/mxdsstreamingaction.cpp - LEGO1/omni/src/audio/mxaudiomanager.cpp - LEGO1/omni/src/audio/mxaudiopresenter.cpp - LEGO1/omni/src/audio/mxloopingmidipresenter.cpp - LEGO1/omni/src/audio/mxmidipresenter.cpp - LEGO1/omni/src/audio/mxmusicmanager.cpp - LEGO1/omni/src/audio/mxmusicpresenter.cpp + LEGO1/omni/src/common/mxtimer.cpp + LEGO1/omni/src/common/mxcore.cpp + LEGO1/omni/src/common/mxstring.cpp LEGO1/omni/src/audio/mxsoundmanager.cpp + LEGO1/omni/src/main/mxomni.cpp + LEGO1/omni/src/notify/mxactionnotificationparam.cpp + LEGO1/omni/src/main/mxomnicreateflags.cpp + LEGO1/omni/src/main/mxomnicreateparam.cpp + LEGO1/omni/src/common/mxobjectfactory.cpp LEGO1/omni/src/audio/mxsoundpresenter.cpp LEGO1/omni/src/audio/mxwavepresenter.cpp - LEGO1/omni/src/common/mxatom.cpp - LEGO1/omni/src/common/mxcompositepresenter.cpp - LEGO1/omni/src/common/mxcore.cpp - LEGO1/omni/src/common/mxdebug.cpp - LEGO1/omni/src/common/mxmediamanager.cpp - LEGO1/omni/src/common/mxmediapresenter.cpp - LEGO1/omni/src/common/mxmisc.cpp - LEGO1/omni/src/common/mxobjectfactory.cpp + LEGO1/omni/src/video/mxvideopresenter.cpp + LEGO1/omni/src/video/mxflcpresenter.cpp + LEGO1/omni/src/video/mxsmkpresenter.cpp + LEGO1/omni/src/video/mxloopingflcpresenter.cpp + LEGO1/omni/src/video/mxloopingsmkpresenter.cpp LEGO1/omni/src/common/mxpresenter.cpp - LEGO1/omni/src/common/mxstring.cpp - LEGO1/omni/src/common/mxticklemanager.cpp - LEGO1/omni/src/common/mxtimer.cpp + LEGO1/omni/src/common/mxmediapresenter.cpp + LEGO1/omni/src/common/mxcompositepresenter.cpp + LEGO1/omni/src/system/mxcriticalsection.cpp LEGO1/omni/src/common/mxutilities.cpp - LEGO1/omni/src/common/mxvariable.cpp LEGO1/omni/src/common/mxvariabletable.cpp - LEGO1/omni/src/entity/mxentity.cpp + LEGO1/omni/src/stream/mxdssubscriber.cpp + LEGO1/omni/src/common/mxmediamanager.cpp + LEGO1/omni/src/system/mxticklethread.cpp + LEGO1/omni/src/audio/mxaudiomanager.cpp + LEGO1/omni/src/system/mxautolock.cpp + LEGO1/omni/src/stream/mxstreamer.cpp + LEGO1/omni/src/video/mxstillpresenter.cpp + LEGO1/omni/src/video/mxdisplaysurface.cpp + LEGO1/omni/src/video/mxbitmap.cpp + LEGO1/omni/src/video/flic.cpp + LEGO1/omni/src/common/mxticklemanager.cpp + LEGO1/omni/src/stream/mxdschunk.cpp + LEGO1/omni/src/video/mxvideomanager.cpp + LEGO1/omni/src/video/mxvideoparamflags.cpp + LEGO1/omni/src/video/mxvideoparam.cpp + LEGO1/omni/src/video/mxpalette.cpp + LEGO1/omni/src/system/mxscheduler.cpp + LEGO1/omni/src/system/mxthread.cpp + LEGO1/omni/src/action/mxdsobject.cpp LEGO1/omni/src/event/mxeventmanager.cpp + LEGO1/omni/src/audio/mxmusicmanager.cpp + LEGO1/omni/src/stream/mxstreamcontroller.cpp + LEGO1/omni/src/audio/mxmusicpresenter.cpp + LEGO1/omni/src/audio/mxmidipresenter.cpp + LEGO1/omni/src/audio/mxloopingmidipresenter.cpp LEGO1/omni/src/event/mxeventpresenter.cpp - LEGO1/omni/src/main/mxomni.cpp - LEGO1/omni/src/main/mxomnicreateflags.cpp - LEGO1/omni/src/main/mxomnicreateparam.cpp - LEGO1/omni/src/notify/mxactionnotificationparam.cpp - LEGO1/omni/src/notify/mxnotificationmanager.cpp - LEGO1/omni/src/notify/mxnotificationparam.cpp - LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp - LEGO1/omni/src/stream/mxdiskstreamprovider.cpp + LEGO1/omni/src/stream/mxstreamchunk.cpp + LEGO1/omni/src/video/mxregioncursor.cpp + LEGO1/omni/src/video/mxregion.cpp + LEGO1/omni/src/video/mxsmk.cpp + LEGO1/omni/src/stream/mxramstreamcontroller.cpp LEGO1/omni/src/stream/mxdsbuffer.cpp - LEGO1/omni/src/stream/mxdschunk.cpp + LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp + LEGO1/omni/src/system/mxsemaphore.cpp + LEGO1/omni/src/action/mxdsobjectaction.cpp + LEGO1/omni/src/action/mxdsmediaaction.cpp + LEGO1/omni/src/action/mxdsanim.cpp + LEGO1/omni/src/action/mxdssound.cpp + LEGO1/omni/src/action/mxdsevent.cpp + LEGO1/omni/src/action/mxdsstill.cpp + LEGO1/omni/src/action/mxdsmultiaction.cpp + LEGO1/omni/src/action/mxdsserialaction.cpp + LEGO1/omni/src/action/mxdsparallelaction.cpp + LEGO1/omni/src/action/mxdsselectaction.cpp LEGO1/omni/src/stream/mxdsfile.cpp - LEGO1/omni/src/stream/mxdssubscriber.cpp LEGO1/omni/src/stream/mxio.cpp - LEGO1/omni/src/stream/mxramstreamcontroller.cpp + LEGO1/omni/src/action/mxdsstreamingaction.cpp LEGO1/omni/src/stream/mxramstreamprovider.cpp - LEGO1/omni/src/stream/mxstreamchunk.cpp - LEGO1/omni/src/stream/mxstreamcontroller.cpp - LEGO1/omni/src/stream/mxstreamer.cpp - LEGO1/omni/src/system/mxautolock.cpp - LEGO1/omni/src/system/mxcriticalsection.cpp - LEGO1/omni/src/system/mxscheduler.cpp - LEGO1/omni/src/system/mxsemaphore.cpp - LEGO1/omni/src/system/mxthread.cpp - LEGO1/omni/src/system/mxticklethread.cpp - LEGO1/omni/src/video/flic.cpp - LEGO1/omni/src/video/mxbitmap.cpp - LEGO1/omni/src/video/mxdisplaysurface.cpp - LEGO1/omni/src/video/mxflcpresenter.cpp - LEGO1/omni/src/video/mxloopingflcpresenter.cpp - LEGO1/omni/src/video/mxloopingsmkpresenter.cpp - LEGO1/omni/src/video/mxpalette.cpp - LEGO1/omni/src/video/mxregion.cpp - LEGO1/omni/src/video/mxregioncursor.cpp - LEGO1/omni/src/video/mxsmack.cpp - LEGO1/omni/src/video/mxsmkpresenter.cpp - LEGO1/omni/src/video/mxstillpresenter.cpp - LEGO1/omni/src/video/mxvideomanager.cpp - LEGO1/omni/src/video/mxvideoparam.cpp - LEGO1/omni/src/video/mxvideoparamflags.cpp - LEGO1/omni/src/video/mxvideopresenter.cpp + LEGO1/omni/src/stream/mxdiskstreamprovider.cpp ) list(APPEND list_targets omni${ARG_SUFFIX}) set_property(TARGET omni${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "omni$<$:d>${ARG_SUFFIX}") @@ -294,120 +288,121 @@ function(add_lego_libraries NAME) target_link_libraries(omni${ARG_SUFFIX} PRIVATE dsound winmm Smacker::Smacker) add_library(${NAME} SHARED - LEGO1/define.cpp - LEGO1/lego/legoomni/src/actors/act2actor.cpp - LEGO1/lego/legoomni/src/actors/act2genactor.cpp - LEGO1/lego/legoomni/src/actors/act3actors.cpp - LEGO1/lego/legoomni/src/actors/act3ammo.cpp - LEGO1/lego/legoomni/src/actors/ambulance.cpp - LEGO1/lego/legoomni/src/actors/bike.cpp + LEGO1/lego/legoomni/src/worlds/score.cpp + LEGO1/lego/legoomni/src/actors/helicopter.cpp + LEGO1/lego/legoomni/src/worlds/gasstation.cpp + LEGO1/lego/legoomni/src/audio/legocachsound.cpp + LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp + LEGO1/lego/legoomni/src/actors/skateboard.cpp + LEGO1/lego/legoomni/src/entity/legoentity.cpp + LEGO1/lego/legoomni/src/audio/lego3dsound.cpp + LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp + LEGO1/lego/legoomni/src/race/legoracers.cpp + LEGO1/lego/legoomni/src/race/legoraceactor.cpp + LEGO1/lego/legoomni/src/common/legostate.cpp LEGO1/lego/legoomni/src/actors/buildingentity.cpp LEGO1/lego/legoomni/src/actors/buildings.cpp - LEGO1/lego/legoomni/src/actors/bumpbouy.cpp - LEGO1/lego/legoomni/src/actors/doors.cpp - LEGO1/lego/legoomni/src/actors/dunebuggy.cpp - LEGO1/lego/legoomni/src/actors/helicopter.cpp - LEGO1/lego/legoomni/src/actors/isleactor.cpp + LEGO1/lego/legoomni/src/common/misc.cpp + LEGO1/lego/legoomni/src/race/legorace.cpp + LEGO1/lego/legoomni/src/race/jetskirace.cpp + LEGO1/lego/legoomni/src/race/carrace.cpp + LEGO1/lego/legoomni/src/actors/pizzeria.cpp + LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp + LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp + LEGO1/lego/legoomni/src/actors/act2genactor.cpp + LEGO1/lego/legoomni/src/actors/act2actor.cpp LEGO1/lego/legoomni/src/actors/islepathactor.cpp - LEGO1/lego/legoomni/src/actors/jetski.cpp - LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp - LEGO1/lego/legoomni/src/actors/motorcycle.cpp + LEGO1/lego/legoomni/src/paths/legopathstruct.cpp + LEGO1/lego/legoomni/src/paths/legoanimactor.cpp + LEGO1/lego/legoomni/src/entity/legoworld.cpp + LEGO1/lego/legoomni/src/build/legocarbuild.cpp + LEGO1/lego/legoomni/src/actors/ambulance.cpp + LEGO1/lego/legoomni/src/common/legoplantmanager.cpp + LEGO1/lego/legoomni/src/actors/bumpbouy.cpp + LEGO1/modeldb/modeldb.cpp LEGO1/lego/legoomni/src/actors/pizza.cpp - LEGO1/lego/legoomni/src/actors/pizzeria.cpp LEGO1/lego/legoomni/src/actors/racecar.cpp + LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp + LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp + LEGO1/lego/legoomni/src/paths/legoextraactor.cpp + LEGO1/lego/legoomni/src/actors/isleactor.cpp LEGO1/lego/legoomni/src/actors/radio.cpp - LEGO1/lego/legoomni/src/actors/skateboard.cpp - LEGO1/lego/legoomni/src/actors/towtrack.cpp - LEGO1/lego/legoomni/src/audio/lego3dsound.cpp - LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp - LEGO1/lego/legoomni/src/audio/legocachsound.cpp + LEGO1/lego/legoomni/src/entity/legoactor.cpp + LEGO1/lego/legoomni/src/paths/legopathactor.cpp + LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp + LEGO1/lego/legoomni/src/worlds/isle.cpp + LEGO1/lego/legoomni/src/actors/motorcycle.cpp + LEGO1/lego/legoomni/src/actors/act3ammo.cpp LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp - LEGO1/lego/legoomni/src/audio/legoloadcachesoundpresenter.cpp - LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp - LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp - LEGO1/lego/legoomni/src/build/legocarbuild.cpp - LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp - LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp - LEGO1/lego/legoomni/src/common/legoactors.cpp - LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp - LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp + LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp + LEGO1/lego/legoomni/src/common/legogamestate.cpp LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp - LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp - LEGO1/lego/legoomni/src/common/legocharactermanager.cpp LEGO1/lego/legoomni/src/common/legofullscreenmovie.cpp - LEGO1/lego/legoomni/src/common/legogamestate.cpp - LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp - LEGO1/lego/legoomni/src/common/legophoneme.cpp - LEGO1/lego/legoomni/src/common/legoplantmanager.cpp - LEGO1/lego/legoomni/src/common/legoplants.cpp - LEGO1/lego/legoomni/src/common/legostate.cpp - LEGO1/lego/legoomni/src/common/legotextureinfo.cpp LEGO1/lego/legoomni/src/common/legoutils.cpp - LEGO1/lego/legoomni/src/common/legovariables.cpp - LEGO1/lego/legoomni/src/common/misc.cpp - LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp + LEGO1/lego/legoomni/src/actors/act3actors.cpp + LEGO1/lego/legoomni/src/control/legometerpresenter.cpp + LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp + LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp + LEGO1/lego/legoomni/src/common/legophoneme.cpp + LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp + LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp + LEGO1/lego/legoomni/src/audio/lego3dwavepresenter.cpp + LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp - LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp - LEGO1/lego/legoomni/src/control/legometerpresenter.cpp - LEGO1/lego/legoomni/src/entity/act2brick.cpp + LEGO1/lego/legoomni/src/actors/towtrack.cpp LEGO1/lego/legoomni/src/entity/act2policestation.cpp - LEGO1/lego/legoomni/src/entity/legoactor.cpp - LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp - LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp - LEGO1/lego/legoomni/src/entity/legoentity.cpp + LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp + LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp + LEGO1/lego/legoomni/src/worlds/legoact2.cpp + LEGO1/lego/legoomni/src/common/legovariables.cpp + LEGO1/lego/legoomni/src/main/scripts.cpp LEGO1/lego/legoomni/src/entity/legoentitypresenter.cpp - LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp - LEGO1/lego/legoomni/src/entity/legolocations.cpp LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp - LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp - LEGO1/lego/legoomni/src/entity/legoworld.cpp - LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp - LEGO1/lego/legoomni/src/input/legoinputmanager.cpp - LEGO1/lego/legoomni/src/main/legomain.cpp - LEGO1/lego/legoomni/src/main/scripts.cpp - LEGO1/lego/legoomni/src/notify/legoeventnotificationparam.cpp - LEGO1/lego/legoomni/src/paths/legoanimactor.cpp - LEGO1/lego/legoomni/src/paths/legoextraactor.cpp - LEGO1/lego/legoomni/src/paths/legopathactor.cpp LEGO1/lego/legoomni/src/paths/legopathboundary.cpp - LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp - LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp - LEGO1/lego/legoomni/src/paths/legopathstruct.cpp - LEGO1/lego/legoomni/src/race/carrace.cpp - LEGO1/lego/legoomni/src/race/jetskirace.cpp - LEGO1/lego/legoomni/src/race/legorace.cpp - LEGO1/lego/legoomni/src/race/legoraceactor.cpp + LEGO1/lego/legoomni/src/main/legomain.cpp + LEGO1/lego/legoomni/src/input/legoinputmanager.cpp LEGO1/lego/legoomni/src/race/legoracemap.cpp - LEGO1/lego/legoomni/src/race/legoracers.cpp - LEGO1/lego/legoomni/src/race/legoracespecial.cpp - LEGO1/lego/legoomni/src/race/raceskel.cpp - LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp + LEGO1/lego/legoomni/src/worlds/jukebox.cpp LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp - LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp - LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp + LEGO1/lego/legoomni/src/worlds/police.cpp + LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp + LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp + LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp + LEGO1/lego/legoomni/src/common/legotextureinfo.cpp + LEGO1/lego/legoomni/src/actors/doors.cpp + LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp + LEGO1/lego/legoomni/src/actors/dunebuggy.cpp + LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp + LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp + LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp + LEGO1/lego/legoomni/src/worlds/infocenter.cpp + LEGO1/lego/legoomni/src/race/raceskel.cpp + LEGO1/lego/legoomni/src/worlds/act3.cpp LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp + LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp + LEGO1/lego/legoomni/src/worlds/hospital.cpp + LEGO1/lego/legoomni/src/actors/bike.cpp + LEGO1/lego/legoomni/src/entity/legoactorpresenter.cpp + LEGO1/lego/legoomni/src/worlds/registrationbook.cpp LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp - LEGO1/lego/legoomni/src/video/legopartpresenter.cpp - LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp - LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp + LEGO1/lego/legoomni/src/entity/act2brick.cpp LEGO1/lego/legoomni/src/video/legovideomanager.cpp - LEGO1/lego/legoomni/src/worlds/act3.cpp - LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp - LEGO1/lego/legoomni/src/worlds/gasstation.cpp + LEGO1/lego/legoomni/src/video/legopartpresenter.cpp + LEGO1/lego/legoomni/src/actors/jetski.cpp + LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp + LEGO1/lego/legoomni/src/race/legoracespecial.cpp LEGO1/lego/legoomni/src/worlds/historybook.cpp - LEGO1/lego/legoomni/src/worlds/hospital.cpp - LEGO1/lego/legoomni/src/worlds/infocenter.cpp - LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp - LEGO1/lego/legoomni/src/worlds/isle.cpp - LEGO1/lego/legoomni/src/worlds/jukebox.cpp - LEGO1/lego/legoomni/src/worlds/legoact2.cpp - LEGO1/lego/legoomni/src/worlds/police.cpp - LEGO1/lego/legoomni/src/worlds/registrationbook.cpp - LEGO1/lego/legoomni/src/worlds/score.cpp + LEGO1/lego/legoomni/src/common/legocharactermanager.cpp + LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp LEGO1/main.cpp - LEGO1/modeldb/modeldb.cpp + # We need to get rid of / refactor the below units into existing/other ones + LEGO1/lego/legoomni/src/entity/legolocations.cpp + LEGO1/lego/legoomni/src/notify/legoeventnotificationparam.cpp + LEGO1/lego/legoomni/src/common/legoactors.cpp + LEGO1/define.cpp + LEGO1/lego/legoomni/src/common/legoplants.cpp ) list(APPEND list_targets ${NAME}) @@ -430,20 +425,20 @@ function(add_lego_libraries NAME) # Link libraries target_link_libraries(${NAME} PRIVATE + dinput + misc${ARG_SUFFIX} + geom${ARG_SUFFIX} + mxdirectx${ARG_SUFFIX} + anim${ARG_SUFFIX} tglrl${ARG_SUFFIX} - viewmanager${ARG_SUFFIX} realtime${ARG_SUFFIX} - mxdirectx${ARG_SUFFIX} + viewmanager${ARG_SUFFIX} roi${ARG_SUFFIX} - geom${ARG_SUFFIX} - anim${ARG_SUFFIX} - Vec::Vec - dinput - dxguid - misc${ARG_SUFFIX} 3dmanager${ARG_SUFFIX} omni${ARG_SUFFIX} shape${ARG_SUFFIX} + Vec::Vec + dxguid ) foreach(tgt IN LISTS list_targets) diff --git a/LEGO1/lego/legoomni/include/act2actor.h b/LEGO1/lego/legoomni/include/act2actor.h index 68b8f59d52..324cf4b331 100644 --- a/LEGO1/lego/legoomni/include/act2actor.h +++ b/LEGO1/lego/legoomni/include/act2actor.h @@ -19,13 +19,23 @@ class Act2Actor : public LegoAnimActor { Act2Actor(); - void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 - void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override; // vtable+0x68 - void Animate(float p_time) override; // vtable+0x70 - MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94 - MxResult VTable0x9c() override; // vtable+0x9c - MxS32 VTable0xa0() override; // vtable+0xa0 + void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + + // FUNCTION: LEGO1 0x1001a180 + MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override + { + if (m_unk0x1f) { + return 0; + } + + return LegoAnimActor::VTable0x68(p_v1, p_v2, p_v3); + } // vtable+0x68 + + void Animate(float p_time) override; // vtable+0x70 + MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94 + MxResult VTable0x9c() override; // vtable+0x9c + MxS32 VTable0xa0() override; // vtable+0xa0 void FUN_10018980(); void FUN_10019250(MxFloat p_speed, MxFloat p_param2); diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index 57012215ed..174d74a7dd 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -10,6 +10,7 @@ class Act3Brickster; class Act3Cop; class Act3Shark; class Helicopter; +class MxQuaternionTransformer; // Macros confirmed by BETA10 #define MAX_PIZZAS 20 @@ -53,6 +54,9 @@ class Act3State : public LegoState { public: Act3State() { m_unk0x08 = 0; } + // FUNCTION: LEGO1 0x1000e2f0 + MxBool IsSerializable() override { return FALSE; } + // FUNCTION: LEGO1 0x1000e300 // FUNCTION: BETA10 0x10017e10 const char* ClassName() const override // vtable+0x0c @@ -67,9 +71,6 @@ class Act3State : public LegoState { return !strcmp(p_name, Act3State::ClassName()) || LegoState::IsA(p_name); } - // FUNCTION: LEGO1 0x1000e2f0 - MxBool IsSerializable() override { return FALSE; } - // SYNTHETIC: LEGO1 0x1000e3c0 // Act3State::`scalar deleting destructor' @@ -152,7 +153,7 @@ class Act3 : public LegoWorld { const Matrix4& p_destination, const Matrix4& p_startPosition, const Matrix4& p_endPosition, - const UnknownMx4DPointFloat& p_unk0x1f4 + const MxQuaternionTransformer& p_unk0x1f4 ); Act3State* m_state; // 0xf8 diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index e6d2a4aa59..0902818892 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -29,22 +29,28 @@ class AmbulanceMissionState : public LegoState { MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c + // FUNCTION: BETA10 0x10088770 MxS16 GetHighScore(MxU8 p_actorId) { switch (p_actorId) { case LegoActor::c_pepper: return m_peHighScore; + break; case LegoActor::c_mama: return m_maHighScore; + break; case LegoActor::c_papa: return m_paHighScore; + break; case LegoActor::c_nick: return m_niHighScore; + break; case LegoActor::c_laura: return m_laHighScore; - default: - return 0; + break; } + + return 0; } // FUNCTION: BETA10 0x100242d0 diff --git a/LEGO1/lego/legoomni/include/buildings.h b/LEGO1/lego/legoomni/include/buildings.h index 71201a48db..165bc87eab 100644 --- a/LEGO1/lego/legoomni/include/buildings.h +++ b/LEGO1/lego/legoomni/include/buildings.h @@ -5,152 +5,153 @@ class LegoEventNotificationParam; -// VTABLE: LEGO1 0x100d48a8 -// VTABLE: BETA10 0x101bd818 +// VTABLE: LEGO1 0x100d4b90 +// VTABLE: BETA10 0x101bd610 // SIZE 0x68 -class RaceStandsEntity : public BuildingEntity { - // FUNCTION: LEGO1 0x1000efa0 - // FUNCTION: BETA10 0x100a9820 +class InfoCenterEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ea00 + // FUNCTION: BETA10 0x100a9230 const char* ClassName() const override // vtable+0x0c { - // at LEGO1 0x100f0300, needs no annotation - return "RaceStandsEntity"; + // STRING: LEGO1 0x100f035c + return "InfoCenterEntity"; } - // FUNCTION: LEGO1 0x1000efb0 + // FUNCTION: LEGO1 0x1000ea10 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong HandleClick(LegoEventNotificationParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 - // SYNTHETIC: LEGO1 0x1000f9e0 - // RaceStandsEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000f7b0 + // InfoCenterEntity::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d4a18 -// VTABLE: BETA10 0x101bd7b0 +// VTABLE: LEGO1 0x100d5258 +// VTABLE: BETA10 0x101bd6e0 // SIZE 0x68 -class BeachHouseEntity : public BuildingEntity { +class GasStationEntity : public BuildingEntity { public: - // FUNCTION: LEGO1 0x1000ee80 - // FUNCTION: BETA10 0x100a96f0 + // FUNCTION: LEGO1 0x1000eb20 + // FUNCTION: BETA10 0x100a9490 const char* ClassName() const override // vtable+0x0c { - // STRING: LEGO1 0x100f0314 - return "BeachHouseEntity"; + // STRING: LEGO1 0x100f0348 + return "GasStationEntity"; } - // FUNCTION: LEGO1 0x1000ee90 + // FUNCTION: LEGO1 0x1000eb30 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); } MxLong HandleClick(LegoEventNotificationParam& p_param) override; - // SYNTHETIC: LEGO1 0x1000f970 - // BeachHouseEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000f890 + // GasStationEntity::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d4ab0 -// VTABLE: BETA10 0x101bd748 +// VTABLE: LEGO1 0x100d5068 +// VTABLE: BETA10 0x101bd678 // SIZE 0x68 -class PoliceEntity : public BuildingEntity { +class HospitalEntity : public BuildingEntity { public: - // FUNCTION: LEGO1 0x1000ed60 - // FUNCTION: BETA10 0x100a95c0 + // FUNCTION: LEGO1 0x1000ec40 + // FUNCTION: BETA10 0x100a9360 const char* ClassName() const override // vtable+0x0c { - // STRING: LEGO1 0x100f0328 - return "PoliceEntity"; + // STRING: LEGO1 0x100f0338 + return "HospitalEntity"; } - // FUNCTION: LEGO1 0x1000ed70 + // FUNCTION: LEGO1 0x1000ec50 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); } MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 - // SYNTHETIC: LEGO1 0x1000f900 - // PoliceEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000f820 + // HospitalEntity::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d4b90 -// VTABLE: BETA10 0x101bd610 +// VTABLE: LEGO1 0x100d4ab0 +// VTABLE: BETA10 0x101bd748 // SIZE 0x68 -class InfoCenterEntity : public BuildingEntity { +class PoliceEntity : public BuildingEntity { public: - // FUNCTION: LEGO1 0x1000ea00 - // FUNCTION: BETA10 0x100a9230 + // FUNCTION: LEGO1 0x1000ed60 + // FUNCTION: BETA10 0x100a95c0 const char* ClassName() const override // vtable+0x0c { - // STRING: LEGO1 0x100f035c - return "InfoCenterEntity"; + // STRING: LEGO1 0x100f0328 + return "PoliceEntity"; } - // FUNCTION: LEGO1 0x1000ea10 + // FUNCTION: LEGO1 0x1000ed70 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); } MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 - // SYNTHETIC: LEGO1 0x1000f7b0 - // InfoCenterEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000f900 + // PoliceEntity::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d5068 -// VTABLE: BETA10 0x101bd678 +// VTABLE: LEGO1 0x100d4a18 +// VTABLE: BETA10 0x101bd7b0 // SIZE 0x68 -class HospitalEntity : public BuildingEntity { +class BeachHouseEntity : public BuildingEntity { public: - // FUNCTION: LEGO1 0x1000ec40 - // FUNCTION: BETA10 0x100a9360 + // FUNCTION: LEGO1 0x1000ee80 + // FUNCTION: BETA10 0x100a96f0 const char* ClassName() const override // vtable+0x0c { - // STRING: LEGO1 0x100f0338 - return "HospitalEntity"; + // STRING: LEGO1 0x100f0314 + return "BeachHouseEntity"; } - // FUNCTION: LEGO1 0x1000ec50 + // FUNCTION: LEGO1 0x1000ee90 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; - // SYNTHETIC: LEGO1 0x1000f820 - // HospitalEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000f970 + // BeachHouseEntity::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d50c0 -// VTABLE: BETA10 0x101bd880 +// VTABLE: LEGO1 0x100d48a8 +// VTABLE: BETA10 0x101bd818 // SIZE 0x68 -class CaveEntity : public BuildingEntity { - // FUNCTION: LEGO1 0x1000f1e0 - // FUNCTION: BETA10 0x100a9950 +class RaceStandsEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000efa0 + // FUNCTION: BETA10 0x100a9820 const char* ClassName() const override // vtable+0x0c { // at LEGO1 0x100f0300, needs no annotation return "RaceStandsEntity"; } - // FUNCTION: LEGO1 0x1000f1f0 + // FUNCTION: LEGO1 0x1000efb0 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, CaveEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); } MxLong HandleClick(LegoEventNotificationParam& p_param) override; - // SYNTHETIC: LEGO1 0x1000fa50 - // CaveEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000f9e0 + // RaceStandsEntity::`scalar deleting destructor' }; // VTABLE: LEGO1 0x100d5200 @@ -177,29 +178,28 @@ class JailEntity : public BuildingEntity { // JailEntity::`scalar deleting destructor' }; -// VTABLE: LEGO1 0x100d5258 -// VTABLE: BETA10 0x101bd6e0 +// VTABLE: LEGO1 0x100d50c0 +// VTABLE: BETA10 0x101bd880 // SIZE 0x68 -class GasStationEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000eb20 - // FUNCTION: BETA10 0x100a9490 +class CaveEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000f1e0 + // FUNCTION: BETA10 0x100a9950 const char* ClassName() const override // vtable+0x0c { - // STRING: LEGO1 0x100f0348 - return "GasStationEntity"; + // at LEGO1 0x100f0300, needs no annotation + return "RaceStandsEntity"; } - // FUNCTION: LEGO1 0x1000eb30 + // FUNCTION: LEGO1 0x1000f1f0 MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); + return !strcmp(p_name, CaveEntity::ClassName()) || BuildingEntity::IsA(p_name); } MxLong HandleClick(LegoEventNotificationParam& p_param) override; - // SYNTHETIC: LEGO1 0x1000f890 - // GasStationEntity::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x1000fa50 + // CaveEntity::`scalar deleting destructor' }; #endif // BUILDINGS_H diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index 899a830aa2..ad1fe29f5a 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -17,6 +17,9 @@ class ElevatorBottom : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 + // FUNCTION: LEGO1 0x10017f10 + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + // FUNCTION: LEGO1 0x10017f20 // FUNCTION: BETA10 0x10028130 const char* ClassName() const override // vtable+0x0c @@ -33,12 +36,8 @@ class ElevatorBottom : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - - // FUNCTION: LEGO1 0x10017f10 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - - MxBool Escape() override; // vtable+0x64 - void Enable(MxBool p_enable) override; // vtable+0x68 + MxBool Escape() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 // SYNTHETIC: LEGO1 0x10018040 // ElevatorBottom::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 76b2d17cff..d3ed67dfae 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -14,11 +14,6 @@ class MxStillPresenter; // SIZE 0x24 class GasStationState : public LegoState { public: - // SIZE 0x04 - struct Unknown0x14 { - undefined4 m_unk0x00; // 0x00 - }; - GasStationState(); // FUNCTION: LEGO1 0x100061d0 @@ -47,7 +42,7 @@ class GasStationState : public LegoState { // TODO: Most likely getters/setters are not used according to BETA. GarageScript::Script m_actions[3]; // 0x08 - Unknown0x14 m_unk0x14; // 0x14 + undefined4 m_unk0x14; // 0x14 MxS16 m_pepperAction; // 0x18 MxS16 m_mamaAction; // 0x1a MxS16 m_papaAction; // 0x1c @@ -66,6 +61,9 @@ class GasStation : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxResult Tickle() override; // vtable+0x08 + // FUNCTION: LEGO1 0x10004770 + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + // FUNCTION: LEGO1 0x10004780 // FUNCTION: BETA10 0x10029d40 const char* ClassName() const override // vtable+0x0c @@ -82,7 +80,6 @@ class GasStation : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x5c() override; // vtable+0x5c MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 virtual MxLong HandleControl(LegoControlManagerNotificationParam& p_param); // vtable+0x6c diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 2f64238de3..8496faf94a 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -3,7 +3,7 @@ #include "islepathactor.h" #include "legostate.h" -#include "realtime/matrix.h" +#include "mxgeometry/mxquaternion.h" class Act3; @@ -14,6 +14,16 @@ class HelicopterState : public LegoState { public: HelicopterState() : m_unk0x08(0) {} + // FUNCTION: LEGO1 0x1000e0b0 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x1000e0c0 + MxBool Reset() override + { + m_unk0x08 = 0; + return TRUE; + } // vtable+0x18 + // FUNCTION: LEGO1 0x1000e0d0 // FUNCTION: BETA10 0x100a7cc0 const char* ClassName() const override // vtable+0x0c @@ -28,24 +38,9 @@ class HelicopterState : public LegoState { return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); } - // FUNCTION: LEGO1 0x1000e0b0 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - - // FUNCTION: LEGO1 0x1000e0c0 - MxBool Reset() override - { - m_unk0x08 = 0; - return TRUE; - } // vtable+0x18 - - void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; } - MxU32 GetUnkown8() { return m_unk0x08; } - // SYNTHETIC: LEGO1 0x1000e190 // HelicopterState::`scalar deleting destructor' - // TODO: Most likely getters/setters are not used according to BETA. - MxU32 m_unk0x08; // 0x08 }; @@ -93,12 +88,12 @@ class Helicopter : public IslePathActor { protected: void FUN_100042a0(const Matrix4& p_matrix); - MxMatrix m_unk0x160; // 0x160 - MxMatrix m_unk0x1a8; // 0x1a8 - float m_unk0x1f0; // 0x1f0 - UnknownMx4DPointFloat m_unk0x1f4; // 0x1f4 - HelicopterState* m_state; // 0x228 - MxAtomId m_script; // 0x22c + MxMatrix m_unk0x160; // 0x160 + MxMatrix m_unk0x1a8; // 0x1a8 + float m_unk0x1f0; // 0x1f0 + MxQuaternionTransformer m_unk0x1f4; // 0x1f4 + HelicopterState* m_state; // 0x228 + MxAtomId m_script; // 0x22c }; #endif // HELICOPTER_H diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 90ec3ea3be..b1a943cf4d 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -69,9 +69,9 @@ struct InfocenterMapEntry { // FUNCTION: LEGO1 0x1006ec80 InfocenterMapEntry() {} - MxStillPresenter* m_presenter; // 0x00 - undefined4 m_unk0x04; // 0x04 - MxRect32 m_area; // 0x08 + MxStillPresenter* m_destCtl; // 0x00 + undefined4 m_unk0x04; // 0x04 + MxRect32 m_area; // 0x08 }; // VTABLE: LEGO1 0x100d9338 @@ -161,9 +161,9 @@ class Infocenter : public LegoWorld { Cutscene m_currentCutscene; // 0x108 Radio m_radio; // 0x10c MxStillPresenter* m_unk0x11c; // 0x11c - InfocenterMapEntry m_mapAreas[7]; // 0x120 + InfocenterMapEntry m_glowInfo[7]; // 0x120 MxS16 m_unk0x1c8; // 0x1c8 - MxStillPresenter* m_frameHotBitmap; // 0x1cc + MxStillPresenter* m_frame; // 0x1cc MxS16 m_infoManDialogueTimer; // 0x1d0 MxS16 m_bookAnimationTimer; // 0x1d2 MxU16 m_unk0x1d4; // 0x1d4 diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index 56df85f41a..15896e7985 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -14,22 +14,7 @@ class MxNotificationParam; // SIZE 0x7c class IsleActor : public LegoActor { public: - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - - // FUNCTION: LEGO1 0x1000e660 - // FUNCTION: BETA10 0x100a8300 - const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f07dc - return "IsleActor"; - } - - // FUNCTION: LEGO1 0x1000e670 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, IsleActor::ClassName()) || LegoActor::IsA(p_name); - } - + MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 // FUNCTION: LEGO1 0x1000e5f0 @@ -53,6 +38,20 @@ class IsleActor : public LegoActor { // FUNCTION: LEGO1 0x1000e650 virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x80 + // FUNCTION: LEGO1 0x1000e660 + // FUNCTION: BETA10 0x100a8300 + const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f07dc + return "IsleActor"; + } + + // FUNCTION: LEGO1 0x1000e670 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, IsleActor::ClassName()) || LegoActor::IsA(p_name); + } + protected: LegoWorld* m_world; // 0x78 }; diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 1aa5616a98..70a5870272 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -86,6 +86,26 @@ class IslePathActor : public LegoPathActor { IslePathActor(); + // FUNCTION: LEGO1 0x10002e70 + virtual MxLong HandleClick() { return 0; } // vtable+0xcc + + // FUNCTION: LEGO1 0x10002df0 + virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0 + + // FUNCTION: LEGO1 0x10002e80 + virtual MxLong HandleControl(LegoControlManagerNotificationParam&) { return 0; } // vtable+0xd4 + + // FUNCTION: LEGO1 0x10002e90 + virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 + + // FUNCTION: LEGO1 0x10002e00 + virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0xdc + + virtual void Enter(); // vtable+0xe0 + virtual void Exit(); // vtable+0xe4 + virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags); // vtable+0xe8 + virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec + // FUNCTION: LEGO1 0x10002e10 ~IslePathActor() override { IslePathActor::Destroy(TRUE); } @@ -108,29 +128,6 @@ class IslePathActor : public LegoPathActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - // FUNCTION: LEGO1 0x10002e70 - virtual MxLong HandleClick() { return 0; } // vtable+0xcc - - // FUNCTION: LEGO1 0x10002df0 - virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0 - - // FUNCTION: LEGO1 0x10002e80 - virtual MxLong HandleControl(LegoControlManagerNotificationParam&) { return 0; } // vtable+0xd4 - - // FUNCTION: LEGO1 0x10002e90 - virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 - - // FUNCTION: LEGO1 0x10002e00 - virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0xdc - - virtual void Enter(); // vtable+0xe0 - virtual void Exit(); // vtable+0xe4 - virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags); // vtable+0xe8 - virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec - - // SYNTHETIC: LEGO1 0x10002ff0 - // IslePathActor::`scalar deleting destructor' - void FUN_1001b660(); void Reset() @@ -143,6 +140,9 @@ class IslePathActor : public LegoPathActor { static void RegisterSpawnLocations(); + // SYNTHETIC: LEGO1 0x10002ff0 + // IslePathActor::`scalar deleting destructor' + protected: LegoWorld* m_world; // 0x154 LegoPathActor* m_previousActor; // 0x158 diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index e880086f51..7542d85160 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -3,32 +3,6 @@ #include "legorace.h" -// VTABLE: LEGO1 0x100d4fa8 -// VTABLE: BETA10 0x101bd5d0 -// SIZE 0x2c -class JetskiRaceState : public RaceState { -public: - // FUNCTION: LEGO1 0x1000dc40 - // FUNCTION: BETA10 0x100a8f30 - const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00ac - // STRING: BETA10 0x101f1d0c - return "JetskiRaceState"; - } - - // FUNCTION: LEGO1 0x1000dc50 - // FUNCTION: BETA10 0x100a8f60 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); - } - - // SYNTHETIC: LEGO1 0x1000f680 - // SYNTHETIC: BETA10 0x100a9d10 - // JetskiRaceState::`scalar deleting destructor' -}; - // VTABLE: LEGO1 0x100d4fe8 // VTABLE: BETA10 0x101bd268 // SIZE 0x144 @@ -68,6 +42,32 @@ class JetskiRace : public LegoRace { static MxS32 g_unk0x100f0c78; }; +// VTABLE: LEGO1 0x100d4fa8 +// VTABLE: BETA10 0x101bd5d0 +// SIZE 0x2c +class JetskiRaceState : public RaceState { +public: + // FUNCTION: LEGO1 0x1000dc40 + // FUNCTION: BETA10 0x100a8f30 + const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00ac + // STRING: BETA10 0x101f1d0c + return "JetskiRaceState"; + } + + // FUNCTION: LEGO1 0x1000dc50 + // FUNCTION: BETA10 0x100a8f60 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); + } + + // SYNTHETIC: LEGO1 0x1000f680 + // SYNTHETIC: BETA10 0x100a9d10 + // JetskiRaceState::`scalar deleting destructor' +}; + // SYNTHETIC: LEGO1 0x1000f530 // SYNTHETIC: BETA10 0x100a9b70 // JetskiRace::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index b351250302..8196f45419 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -24,6 +24,9 @@ class JukeBoxState : public LegoState { JukeBoxState() : m_music(e_pasquell), m_active(FALSE) {} + // FUNCTION: LEGO1 0x1000f300 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + // FUNCTION: LEGO1 0x1000f310 // FUNCTION: BETA10 0x100389c0 const char* ClassName() const override // vtable+0x0c @@ -38,9 +41,6 @@ class JukeBoxState : public LegoState { return !strcmp(p_name, JukeBoxState::ClassName()) || LegoState::IsA(p_name); } - // FUNCTION: LEGO1 0x1000f300 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - // SYNTHETIC: LEGO1 0x1000f3d0 // JukeBoxState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 89da6c41c2..62c5f04e6f 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -22,6 +22,9 @@ class LegoAct2State : public LegoState { } ~LegoAct2State() override {} + // FUNCTION: LEGO1 0x1000df70 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + // FUNCTION: LEGO1 0x1000df80 // FUNCTION: BETA10 0x1003c7e0 const char* ClassName() const override // vtable+0x0c @@ -36,9 +39,6 @@ class LegoAct2State : public LegoState { return !strcmp(p_name, LegoAct2State::ClassName()) || LegoState::IsA(p_name); } - // FUNCTION: LEGO1 0x1000df70 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - // SYNTHETIC: LEGO1 0x1000e040 // LegoAct2State::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 7c29ee6b2b..47c399f945 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -3,6 +3,7 @@ #include "decomp.h" #include "legoentity.h" +#include "mxgeometry/mxmatrix.h" class LegoCacheSound; diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 56f6d0a795..5c7546e0fb 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -7,7 +7,7 @@ #include "legostate.h" #include "legotraninfolist.h" #include "mxcore.h" -#include "mxgeometry/mxgeometry3d.h" +#include "mxgeometry/mxquaternion.h" class LegoAnimPresenter; class LegoEntity; @@ -258,46 +258,46 @@ class LegoAnimationManager : public MxCore { void FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404); void FUN_10064b50(MxLong p_time); - LegoOmni::World m_worldId; // 0x08 - MxU16 m_animCount; // 0x0c - MxU16 m_unk0x0e; // 0x0e - MxU16 m_unk0x10; // 0x10 - AnimInfo* m_anims; // 0x14 - undefined2 m_unk0x18; // 0x18 - MxBool m_unk0x1a; // 0x1a - MxU32 m_unk0x1c; // 0x1c - LegoTranInfoList* m_tranInfoList; // 0x20 - LegoTranInfoList* m_tranInfoList2; // 0x24 - MxPresenter* m_unk0x28[2]; // 0x28 - MxLong m_unk0x30[2]; // 0x30 - MxBool m_unk0x38; // 0x38 - MxBool m_animRunning; // 0x39 - MxBool m_enableCamAnims; // 0x3a - Extra m_extras[40]; // 0x3c - MxU32 m_lastExtraCharacterId; // 0x3fc - MxBool m_unk0x400; // 0x400 - MxBool m_unk0x401; // 0x401 - MxBool m_unk0x402; // 0x402 - MxLong m_unk0x404; // 0x404 - MxLong m_unk0x408; // 0x408 - MxLong m_unk0x40c; // 0x40c - MxLong m_unk0x410; // 0x410 - MxU32 m_unk0x414; // 0x414 - MxU32 m_numAllowedExtras; // 0x418 - undefined4 m_unk0x41c; // 0x41c - AnimState* m_animState; // 0x420 - LegoROIList* m_unk0x424; // 0x424 - MxBool m_suspendedEnableCamAnims; // 0x428 - MxBool m_unk0x429; // 0x429 - MxBool m_unk0x42a; // 0x42a - MxBool m_suspended; // 0x42b - LegoTranInfo* m_unk0x42c; // 0x42c - MxBool m_unk0x430; // 0x430 - MxLong m_unk0x434; // 0x434 - MxLong m_unk0x438; // 0x438 - MxMatrix m_unk0x43c; // 0x43c - MxMatrix m_unk0x484; // 0x484 - UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc + LegoOmni::World m_worldId; // 0x08 + MxU16 m_animCount; // 0x0c + MxU16 m_unk0x0e; // 0x0e + MxU16 m_unk0x10; // 0x10 + AnimInfo* m_anims; // 0x14 + undefined2 m_unk0x18; // 0x18 + MxBool m_unk0x1a; // 0x1a + MxU32 m_unk0x1c; // 0x1c + LegoTranInfoList* m_tranInfoList; // 0x20 + LegoTranInfoList* m_tranInfoList2; // 0x24 + MxPresenter* m_unk0x28[2]; // 0x28 + MxLong m_unk0x30[2]; // 0x30 + MxBool m_unk0x38; // 0x38 + MxBool m_animRunning; // 0x39 + MxBool m_enableCamAnims; // 0x3a + Extra m_extras[40]; // 0x3c + MxU32 m_lastExtraCharacterId; // 0x3fc + MxBool m_unk0x400; // 0x400 + MxBool m_unk0x401; // 0x401 + MxBool m_unk0x402; // 0x402 + MxLong m_unk0x404; // 0x404 + MxLong m_unk0x408; // 0x408 + MxLong m_unk0x40c; // 0x40c + MxLong m_unk0x410; // 0x410 + MxU32 m_unk0x414; // 0x414 + MxU32 m_numAllowedExtras; // 0x418 + undefined4 m_unk0x41c; // 0x41c + AnimState* m_animState; // 0x420 + LegoROIList* m_unk0x424; // 0x424 + MxBool m_suspendedEnableCamAnims; // 0x428 + MxBool m_unk0x429; // 0x429 + MxBool m_unk0x42a; // 0x42a + MxBool m_suspended; // 0x42b + LegoTranInfo* m_unk0x42c; // 0x42c + MxBool m_unk0x430; // 0x430 + MxLong m_unk0x434; // 0x434 + MxLong m_unk0x438; // 0x438 + MxMatrix m_unk0x43c; // 0x43c + MxMatrix m_unk0x484; // 0x484 + MxQuaternionTransformer m_unk0x4cc; // 0x4cc }; // TEMPLATE: LEGO1 0x10061750 diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 30da04ff51..f31423c515 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -7,7 +7,6 @@ class LegoAnim; class LegoWorld; -class LegoAnimActor; class LegoPathBoundary; class MxMatrix; class Vector3; diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index 336f67deaf..6be5f567d5 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -4,6 +4,7 @@ #include "legogamestate.h" #include "legostate.h" #include "legoworld.h" +#include "mxgeometry/mxquaternion.h" class LegoCarBuildAnimPresenter; class LegoControlManagerNotificationParam; @@ -189,7 +190,7 @@ class LegoCarBuild : public LegoWorld { MxS32 m_unk0x250[2]; // 0x250 LegoCarBuildAnimPresenter* m_unk0x258; // 0x258 - UnknownMx4DPointFloat m_unk0x25c; // 0x25c + MxQuaternionTransformer m_unk0x25c; // 0x25c // These two are likely locations in pixel space MxS32 m_unk0x290[2]; // 0x290 diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index b96f2e669a..cf9c794991 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -67,7 +67,7 @@ class LegoCharacterManager { void ReleaseActor(const char* p_name); void ReleaseActor(LegoROI* p_roi); void ReleaseAutoROI(LegoROI* p_roi); - MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo); + MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_texture); LegoExtraActor* GetExtraActor(const char* p_name); LegoActorInfo* GetActorInfo(const char* p_name); LegoActorInfo* GetActorInfo(LegoROI* p_roi); diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index ae9aadab9a..eecf6867fa 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -86,6 +86,8 @@ class LegoEntity : public MxEntity { MxBool GetUnknown0x10IsSet(MxU8 p_flag) { return m_unk0x10 & p_flag; } MxBool GetFlagsIsSet(MxU8 p_flag) { return m_flags & p_flag; } MxU8 GetFlags() { return m_flags; } + + // FUNCTION: BETA10 0x10049db0 MxFloat GetWorldSpeed() { return m_worldSpeed; } // FUNCTION: BETA10 0x1000f2f0 diff --git a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h index 6f0e283a59..df2f872e9c 100644 --- a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h @@ -4,6 +4,8 @@ #include "legoloopinganimpresenter.h" #include "legoroimaplist.h" +class LegoAnimActor; + // VTABLE: LEGO1 0x100d9170 // SIZE 0xd8 class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { diff --git a/LEGO1/lego/legoomni/include/legomodelpresenter.h b/LEGO1/lego/legoomni/include/legomodelpresenter.h index 7f9886a981..21e47afd18 100644 --- a/LEGO1/lego/legoomni/include/legomodelpresenter.h +++ b/LEGO1/lego/legoomni/include/legomodelpresenter.h @@ -18,6 +18,9 @@ class LegoModelPresenter : public MxVideoPresenter { // FUNCTION: LEGO1 0x10067a10 ~LegoModelPresenter() override { Destroy(TRUE); } + // FUNCTION: LEGO1 0x1000cca0 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 + static void configureLegoModelPresenter(MxS32 p_modelPresenterConfig); // FUNCTION: BETA10 0x100a7180 @@ -42,7 +45,6 @@ class LegoModelPresenter : public MxVideoPresenter { void ReadyTickle() override; // vtable+0x18 void ParseExtra() override; // vtable+0x30 - void Destroy() override; // vtable+0x38 MxResult FUN_1007ff70(MxDSChunk& p_chunk, LegoEntity* p_entity, MxBool p_roiVisible, LegoWorld* p_world); diff --git a/LEGO1/lego/legoomni/include/legonamedpart.h b/LEGO1/lego/legoomni/include/legonamedpart.h index dcdee2f9f0..a03da68c0f 100644 --- a/LEGO1/lego/legoomni/include/legonamedpart.h +++ b/LEGO1/lego/legoomni/include/legonamedpart.h @@ -12,7 +12,18 @@ class LegoNamedPart { m_name = p_name; m_list = p_list; } - ~LegoNamedPart() { delete m_list; } + ~LegoNamedPart() + { + LegoLODListCursor cursor(m_list); + LegoLOD* lod; + + while (cursor.First(lod)) { + cursor.Detach(); + delete lod; + } + + delete m_list; + } const MxString* GetName() const { return &m_name; } LegoLODList* GetList() { return m_list; } diff --git a/LEGO1/lego/legoomni/include/legopartpresenter.h b/LEGO1/lego/legoomni/include/legopartpresenter.h index 76285f490e..c8874c0c1a 100644 --- a/LEGO1/lego/legoomni/include/legopartpresenter.h +++ b/LEGO1/lego/legoomni/include/legopartpresenter.h @@ -13,6 +13,9 @@ class LegoPartPresenter : public MxMediaPresenter { // FUNCTION: LEGO1 0x10067300 ~LegoPartPresenter() override { Destroy(TRUE); } + // FUNCTION: LEGO1 0x1000cf60 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 + // FUNCTION: BETA10 0x100a75d0 static const char* HandlerClassName() { @@ -35,7 +38,6 @@ class LegoPartPresenter : public MxMediaPresenter { void ReadyTickle() override; // vtable+0x18 MxResult AddToManager() override; // vtable+0x34 - void Destroy() override; // vtable+0x38 static void configureLegoPartPresenter(MxS32, MxS32); diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 35dbbbe862..343cd59829 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -3,7 +3,6 @@ #include "legoactor.h" #include "misc/legounknown.h" -#include "mxgeometry/mxmatrix.h" #include "mxtypes.h" struct LegoEdge; @@ -92,8 +91,8 @@ class LegoPathActor : public LegoActor { float p_srcScale, LegoUnknown100db7f4& p_destEdge, float p_destScale - ); // vtable+0x88 - virtual MxS32 VTable0x8c(float p_time, Matrix4& p_transform); // vtable+0x8c + ); // vtable+0x88 + virtual MxS32 VTable0x8c(float p_time, MxMatrix& p_transform); // vtable+0x8c // FUNCTION: LEGO1 0x10002d40 virtual MxU32 VTable0x90(float, Matrix4&) { return FALSE; } // vtable+0x90 diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 642d26cbb0..c508f3ed8f 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -34,6 +34,8 @@ class RaceState : public LegoState { } MxS16 GetUnknown0x02() { return m_unk0x02; } + + // FUNCTION: BETA10 0x10088970 MxS16 GetHighScore() { return m_score; } // FUNCTION: BETA10 0x100c96f0 @@ -110,6 +112,19 @@ class LegoRace : public LegoWorld { return "LegoRace"; } + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + + virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c + + // FUNCTION: LEGO1 0x10015b70 + virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x70 + + // FUNCTION: LEGO1 0x10015b80 + virtual MxLong HandleEndAction(MxEndActionNotificationParam&) { return 0; } // vtable+0x74 + + // FUNCTION: LEGO1 0x10015b90 + MxBool Escape() override { return FALSE; } // vtable+0x64 + // FUNCTION: LEGO1 0x10015ba0 // FUNCTION: BETA10 0x100a8940 const char* ClassName() const override // vtable+0x0c @@ -124,17 +139,6 @@ class LegoRace : public LegoWorld { return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - - // FUNCTION: LEGO1 0x1000dae0 - MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - - MxBool Escape() override; // vtable+0x64 - void Enable(MxBool p_enable) override; // vtable+0x68 - virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c - virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&); // vtable+0x70 - virtual MxLong HandleEndAction(MxEndActionNotificationParam&); // vtable+0x74 - // FUNCTION: LEGO1 0x1000dab0 virtual MxLong HandleType0Notification(MxNotificationParam&) { return 0; } // vtable+0x78 @@ -145,6 +149,11 @@ class LegoRace : public LegoWorld { m_maps[p_index] = p_map; } + // FUNCTION: LEGO1 0x1000dae0 + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + + void Enable(MxBool p_enable) override; // vtable+0x68 + // SYNTHETIC: LEGO1 0x10015cc0 // LegoRace::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legoraceactor.h b/LEGO1/lego/legoomni/include/legoraceactor.h index 9262f2583b..bc3d54dc79 100644 --- a/LEGO1/lego/legoomni/include/legoraceactor.h +++ b/LEGO1/lego/legoomni/include/legoraceactor.h @@ -34,9 +34,7 @@ class LegoRaceActor : public virtual LegoAnimActor { MxU32 VTable0x90(float p_time, Matrix4& p_matrix) override; // vtable+0x90 MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - // FUNCTION: LEGO1 0x10014aa0 - // FUNCTION: BETA10 0x100ca038 - virtual MxResult FUN_10014aa0() { return SUCCESS; } + virtual MxResult FUN_10014aa0(); // SYNTHETIC: LEGO1 0x10012c10 // LegoRaceActor::`vbase destructor' diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h index 3cc4df2e36..461b3a52fe 100644 --- a/LEGO1/lego/legoomni/include/legoracers.h +++ b/LEGO1/lego/legoomni/include/legoracers.h @@ -25,6 +25,66 @@ struct SkeletonKickPhase { MxU8 m_userState; // 0x0c }; +// VTABLE: LEGO1 0x100d5a08 LegoCarRaceActor +// VTABLE: LEGO1 0x100d5a28 LegoRaceActor +// VTABLE: LEGO1 0x100d5a30 LegoAnimActor +// VTABLE: LEGO1 0x100d5a40 LegoPathActor +// VTABLE: LEGO1 0x100d5b10 LegoRaceMap +// VTABLE: BETA10 0x101be8a0 LegoCarRaceActor +// VTABLE: BETA10 0x101be8c8 LegoRaceActor +// VTABLE: BETA10 0x101be8d0 LegoAnimActor +// VTABLE: BETA10 0x101be8e8 LegoPathActor +// VTABLE: BETA10 0x101be9d8 LegoRaceMap +// SIZE 0x1dc +class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { +public: + LegoJetski(); + ~LegoJetski() override; + + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + + // FUNCTION: LEGO1 0x10013e90 + // FUNCTION: BETA10 0x100cd1f0 + const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f053c + return "LegoJetski"; + } + + // FUNCTION: LEGO1 0x10013eb0 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, LegoJetski::ClassName()) || LegoJetskiRaceActor::IsA(p_name); + } + + void ParseAction(char* p_extra) override; // vtable+0x20 + void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 + + // FUNCTION: LEGO1 0x10014150 + MxU32 VTable0x6c(LegoPathBoundary* p_boundary, Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3) + override + { + return LegoJetskiRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3); + } // vtable+0x6c + + void Animate(float p_time) override; // vtable+0x70 + MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 + + // FUNCTION: LEGO1 0x100141d0 + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override + { + LegoJetskiRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); + } // vtable+0x98 + + // FUNCTION: LEGO1 0x10014210 + MxResult VTable0x9c() override { return LegoJetskiRaceActor::VTable0x9c(); } // vtable+0x9c + + virtual void FUN_100136f0(float p_worldSpeed); + + // SYNTHETIC: LEGO1 0x10013e30 + // LegoJetski::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d58a0 LegoRaceActor // VTABLE: LEGO1 0x100d58a8 LegoAnimActor // VTABLE: LEGO1 0x100d58b8 LegoPathActor @@ -59,18 +119,25 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { void ParseAction(char* p_extra) override; // vtable+0x20 void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - MxU32 VTable0x6c( - LegoPathBoundary* p_boundary, - Vector3& p_v1, - Vector3& p_v2, - float p_f1, - float p_f2, - Vector3& p_v3 - ) override; // vtable+0x6c + + // FUNCTION: LEGO1 0x10014500 + // FUNCTION: BETA10 0x100cd5e0 + MxU32 VTable0x6c(LegoPathBoundary* p_boundary, Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3) + override + { + return LegoCarRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3); + } // vtable+0x6c + void Animate(float p_time) override; // vtable+0x70 MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) - override; // vtable+0x98 + + // FUNCTION: LEGO1 0x10014560 + // FUNCTION: BETA10 0x100cd660 + void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override + { + LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); + } // vtable+0x98 + MxResult VTable0x9c() override; // vtable+0x9c virtual void SetMaxLinearVelocity(float p_maxLinearVelocity); @@ -100,60 +167,6 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { LegoPathBoundary* m_kick2B; // 0x7c }; -// VTABLE: LEGO1 0x100d5a08 LegoCarRaceActor -// VTABLE: LEGO1 0x100d5a28 LegoRaceActor -// VTABLE: LEGO1 0x100d5a30 LegoAnimActor -// VTABLE: LEGO1 0x100d5a40 LegoPathActor -// VTABLE: LEGO1 0x100d5b10 LegoRaceMap -// VTABLE: BETA10 0x101be8a0 LegoCarRaceActor -// VTABLE: BETA10 0x101be8c8 LegoRaceActor -// VTABLE: BETA10 0x101be8d0 LegoAnimActor -// VTABLE: BETA10 0x101be8e8 LegoPathActor -// VTABLE: BETA10 0x101be9d8 LegoRaceMap -// SIZE 0x1dc -class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { -public: - LegoJetski(); - ~LegoJetski() override; - - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - - // FUNCTION: LEGO1 0x10013e90 - // FUNCTION: BETA10 0x100cd1f0 - const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f053c - return "LegoJetski"; - } - - // FUNCTION: LEGO1 0x10013eb0 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, LegoJetski::ClassName()) || LegoJetskiRaceActor::IsA(p_name); - } - - void ParseAction(char* p_extra) override; // vtable+0x20 - void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 - MxU32 VTable0x6c( - LegoPathBoundary* p_boundary, - Vector3& p_v1, - Vector3& p_v2, - float p_f1, - float p_f2, - Vector3& p_v3 - ) override; // vtable+0x6c - void Animate(float p_time) override; // vtable+0x70 - MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 - void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) - override; // vtable+0x98 - MxResult VTable0x9c() override; // vtable+0x9c - - virtual void FUN_100136f0(float p_worldSpeed); - - // SYNTHETIC: LEGO1 0x10013e30 - // LegoJetski::`scalar deleting destructor' -}; - // GLOBAL: LEGO1 0x100d5890 // LegoRaceCar::`vbtable'{for `LegoCarRaceActor'} diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index b8b9c47fe3..09dc1fcf1a 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -84,22 +84,6 @@ class LegoState : public MxCore { // FUNCTION: LEGO1 0x10005f40 ~LegoState() override {} - // FUNCTION: LEGO1 0x100060d0 - // FUNCTION: BETA10 0x10017d20 - const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f01b8 - // STRING: BETA10 0x101dcdac - return "LegoState"; - } - - // FUNCTION: LEGO1 0x100060e0 - // FUNCTION: BETA10 0x100a9000 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); - } - // FUNCTION: LEGO1 0x10005f90 virtual MxBool IsSerializable() { return TRUE; } // vtable+0x14 @@ -116,6 +100,22 @@ class LegoState : public MxCore { return SUCCESS; } // vtable+0x1c + // FUNCTION: LEGO1 0x100060d0 + // FUNCTION: BETA10 0x10017d20 + const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f01b8 + // STRING: BETA10 0x101dcdac + return "LegoState"; + } + + // FUNCTION: LEGO1 0x100060e0 + // FUNCTION: BETA10 0x100a9000 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); + } + // SYNTHETIC: LEGO1 0x10006160 // LegoState::`scalar deleting destructor' }; diff --git a/LEGO1/lego/legoomni/include/legotextureinfo.h b/LEGO1/lego/legoomni/include/legotextureinfo.h index e7cd894b9d..c070bfecb7 100644 --- a/LEGO1/lego/legoomni/include/legotextureinfo.h +++ b/LEGO1/lego/legoomni/include/legotextureinfo.h @@ -19,7 +19,7 @@ class LegoTextureInfo { static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo); static BOOL GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_textureInfo); - LegoResult FUN_10066010(LegoU8* p_bits); + LegoResult FUN_10066010(const LegoU8* p_bits); // private: char* m_name; // 0x00 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 52ef3baf3d..9845e451d7 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -102,7 +102,7 @@ class LegoWorld : public LegoEntity { MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId); // FUNCTION: BETA10 0x1002b4f0 - LegoCameraController* GetCamera() { return m_cameraController; } + LegoCameraController* GetCameraController() { return m_cameraController; } LegoEntityList* GetEntityList() { return m_entityList; } LegoOmni::World GetWorldId() { return m_worldId; } diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 771d117862..b08e5310ab 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -148,6 +148,7 @@ class PizzaMissionState : public LegoState { // FUNCTION: BETA10 0x100ef850 MxU32 GetUnknown0xb0() { return m_unk0xb0; } + // FUNCTION: BETA10 0x10088850 MxS16 GetHighScore(MxU8 p_actorId) { return GetMission(p_actorId)->m_hiScore; } // SYNTHETIC: LEGO1 0x10039350 diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 0d1f9da556..36252f6f48 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -15,6 +15,16 @@ class ScoreState : public LegoState { public: ScoreState() : m_playCubeTutorial(TRUE) {} + // FUNCTION: LEGO1 0x1000de20 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x1000de30 + MxBool Reset() override + { + m_playCubeTutorial = TRUE; + return TRUE; + } // vtable+0x18 + // FUNCTION: LEGO1 0x1000de40 // FUNCTION: BETA10 0x100a7a70 const char* ClassName() const override // vtable+0x0c @@ -29,16 +39,6 @@ class ScoreState : public LegoState { return !strcmp(p_name, ScoreState::ClassName()) || LegoState::IsA(p_name); } - // FUNCTION: LEGO1 0x1000de20 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - - // FUNCTION: LEGO1 0x1000de30 - MxBool Reset() override - { - m_playCubeTutorial = TRUE; - return TRUE; - } // vtable+0x18 - MxBool GetTutorialFlag() { return m_playCubeTutorial; } void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; } @@ -59,6 +59,9 @@ class Score : public LegoWorld { ~Score() override; MxLong Notify(MxParam& p_param) override; // vtable+0x04 + // FUNCTION: LEGO1 0x100010b0 + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + // FUNCTION: LEGO1 0x100010c0 // FUNCTION: BETA10 0x100f4f20 const char* ClassName() const override // vtable+0x0c @@ -78,14 +81,13 @@ class Score : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x5c() override; // vtable+0x5c MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 void Paint(); MxLong FUN_10001510(MxEndActionNotificationParam& p_param); MxLong FUN_100016d0(LegoControlManagerNotificationParam& p_param); - void FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score); + void FillArea(MxS32 i_activity, MxS32 i_actor, MxS16 score); protected: void DeleteScript(); diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index e20e098f64..4bf7d84af0 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -30,22 +30,28 @@ class TowTrackMissionState : public LegoState { MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c + // FUNCTION: BETA10 0x10088890 MxS16 GetHighScore(MxU8 p_actorId) { switch (p_actorId) { case LegoActor::c_pepper: return m_peHighScore; + break; case LegoActor::c_mama: return m_maHighScore; + break; case LegoActor::c_papa: return m_paHighScore; + break; case LegoActor::c_nick: return m_niHighScore; + break; case LegoActor::c_laura: return m_laHighScore; - default: - return 0; + break; } + + return 0; } // FUNCTION: BETA10 0x100f8530 diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index 97d4dd4049..014f03a0f7 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -311,7 +311,7 @@ void Act2Actor::Animate(float p_time) local30 -= local60; local30.Unitize(); - MxFloat dotproduct = local18.Dot(&local30, &local18); + MxFloat dotproduct = local18.Dot(local30, local18); if (dotproduct >= 0.0) { const MxFloat* pepperWorldPosition = roiPepper->GetWorldPosition(); @@ -444,6 +444,8 @@ MxS32 Act2Actor::VTable0xa0() { undefined4 newLocation; + assert(!m_grec); + CurrentWorld(); MxU16 randomVal = rand() / (RAND_MAX / 2) + 1; @@ -613,9 +615,9 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param) col2 = col3; col2 -= m_unk0x4c->GetROI()->GetWorldPosition(); col2.Unitize(); - col0.EqualsCross(&col1, &col2); + col0.EqualsCross(col1, col2); col0.Unitize(); - col1.EqualsCross(&col2, &col0); + col1.EqualsCross(col2, col0); assert(!m_cameraFlag); @@ -867,13 +869,3 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param) return result; } - -// FUNCTION: LEGO1 0x1001a180 -MxS32 Act2Actor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) -{ - if (m_unk0x1f) { - return 0; - } - - return LegoAnimActor::VTable0x68(p_v1, p_v2, p_v3); -} diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index f5a5c5a49d..e34baf4c27 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -238,7 +238,7 @@ void Act3Cop::ParseAction(char* p_extra) for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { Mx4DPointFloat* edgeNormal = boundary->GetEdgeNormal(j); - if (point.Dot(edgeNormal, &point) + edgeNormal->index_operator(3) < -0.001) { + if (point.Dot(*edgeNormal, point) + edgeNormal->index_operator(3) < -0.001) { MxTrace("Bad Act3 cop destination %d\n", i); break; } @@ -246,8 +246,8 @@ void Act3Cop::ParseAction(char* p_extra) Mx4DPointFloat* boundary0x14 = boundary->GetUnknown0x14(); - if (point.Dot(&point, boundary0x14) + boundary0x14->index_operator(3) <= 0.001 && - point.Dot(&point, boundary0x14) + boundary0x14->index_operator(3) >= -0.001) { + if (point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) <= 0.001 && + point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) >= -0.001) { continue; } @@ -496,9 +496,9 @@ MxResult Act3Cop::FUN_10040360() v3 = v4; v3 -= vecUnk; v3.Unitize(); - v1.EqualsCross(&v2, &v3); + v1.EqualsCross(v2, v3); v1.Unitize(); - v2.EqualsCross(&v3, &v1); + v2.EqualsCross(v3, v1); VTable0x9c(); } @@ -628,9 +628,9 @@ void Act3Brickster::Animate(float p_time) localc = local20; localc -= m_pInfo->m_position; localc.Unitize(); - local14.EqualsCross(&local28, &localc); + local14.EqualsCross(local28, localc); local14.Unitize(); - local28.EqualsCross(&localc, &local14); + local28.EqualsCross(localc, local14); assert(!m_cameraFlag); @@ -675,9 +675,9 @@ void Act3Brickster::Animate(float p_time) local80 -= m_unk0x3c; local80.Unitize(); - local88.EqualsCross(&local9c, &local80); + local88.EqualsCross(local9c, local80); local88.Unitize(); - local9c.EqualsCross(&local80, &local88); + local9c.EqualsCross(local80, local88); assert(!m_cameraFlag); @@ -991,9 +991,9 @@ MxResult Act3Brickster::FUN_100417c0() v3 = v4; v3 -= vecUnk; v3.Unitize(); - v1.EqualsCross(&v2, &v3); + v1.EqualsCross(v2, v3); v1.Unitize(); - v2.EqualsCross(&v3, &v1); + v2.EqualsCross(v3, v1); VTable0x9c(); @@ -1087,7 +1087,7 @@ MxS32 Act3Brickster::FUN_10042300() local18 = local64[local1c]; local18 -= local38; - if (maxE == NULL || (local18.Dot(&local94, &local18) < 0.0f && local78 < local98)) { + if (maxE == NULL || (local18.Dot(local94, local18) < 0.0f && local78 < local98)) { maxE = e; m_boundary = boundaries[i]; local78 = local98; diff --git a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp index ed98b7c653..2eaae38562 100644 --- a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp @@ -227,12 +227,12 @@ MxResult Act3Ammo::FUN_10053db0(float p_param1, const Matrix4& p_param2) local14[1] = local14[2] = 0.0f; local14[0] = 1.0f; - local3c.EqualsCross(&localc, &local14); + local3c.EqualsCross(localc, local14); if (local3c.Unitize() != 0) { local14[0] = local14[1] = 0.0f; local14[2] = 1.0f; - local3c.EqualsCross(&localc, &local14); + local3c.EqualsCross(localc, local14); if (local3c.Unitize() != 0) { assert(0); @@ -240,7 +240,7 @@ MxResult Act3Ammo::FUN_10053db0(float p_param1, const Matrix4& p_param2) } } - local14.EqualsCross(&local3c, &localc); + local14.EqualsCross(local3c, localc); return SUCCESS; } @@ -340,17 +340,17 @@ void Act3Ammo::Animate(float p_time) local184 = *m_boundary->GetUnknown0x14(); local17c[0] = 1.0f; local17c[1] = local17c[2] = 0.0f; - local174.EqualsCross(&local17c, &local184); + local174.EqualsCross(local17c, local184); local174.Unitize(); - local17c.EqualsCross(&local184, &local174); + local17c.EqualsCross(local184, local174); } else { local17c = *m_boundary->GetUnknown0x14(); local184[0] = 1.0f; local184[1] = local184[2] = 0.0f; - local174.EqualsCross(&local17c, &local184); + local174.EqualsCross(local17c, local184); local174.Unitize(); - local184.EqualsCross(&local174, &local17c); + local184.EqualsCross(local174, local17c); } } diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 8d88e6bfc8..7751a828e5 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -21,11 +21,16 @@ DECOMP_SIZE_ASSERT(Helicopter, 0x230) DECOMP_SIZE_ASSERT(HelicopterState, 0x0c) +DECOMP_SIZE_ASSERT(Vector2, 0x08) +DECOMP_SIZE_ASSERT(Vector3, 0x08) +DECOMP_SIZE_ASSERT(Vector4, 0x08) DECOMP_SIZE_ASSERT(Mx3DPointFloat, 0x14) DECOMP_SIZE_ASSERT(Mx4DPointFloat, 0x18) +DECOMP_SIZE_ASSERT(Matrix4, 0x08) DECOMP_SIZE_ASSERT(MxMatrix, 0x48) // FUNCTION: LEGO1 0x10001e60 +// FUNCTION: BETA10 0x1002a0d0 Helicopter::Helicopter() { m_maxLinearVel = 60; @@ -39,6 +44,7 @@ Helicopter::~Helicopter() } // FUNCTION: LEGO1 0x100032c0 +// FUNCTION: BETA10 0x1002a16d MxResult Helicopter::Create(MxDSAction& p_dsAction) { MxResult result = IslePathActor::Create(p_dsAction); @@ -48,6 +54,8 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction) ((Act3*) m_world)->SetHelicopter(this); } + assert(m_world); + if (m_world != NULL) { m_world->Add(this); } @@ -57,6 +65,7 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x10003320 +// FUNCTION: BETA10 0x1002a240 void Helicopter::CreateState() { m_state = (HelicopterState*) GameState()->GetState("HelicopterState"); @@ -66,8 +75,11 @@ void Helicopter::CreateState() } // FUNCTION: LEGO1 0x10003360 +// FUNCTION: BETA10 0x1002a29a void Helicopter::Exit() { + assert(UserActor() == this); + if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { SpawnPlayer( LegoGameState::e_unk40, @@ -90,7 +102,7 @@ void Helicopter::Exit() } } - m_state->SetUnknown8(0); + m_state->m_unk0x08 = 0; RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterDashboard_Bitmap); RemoveFromCurrentWorld(m_script, IsleScript::c_HelicopterArms_Ctl); RemoveFromCurrentWorld(m_script, IsleScript::c_Helicopter_TakeOff_Ctl); @@ -106,6 +118,7 @@ void Helicopter::Exit() } // FUNCTION: LEGO1 0x10003480 +// FUNCTION: BETA10 0x1002a3db MxLong Helicopter::HandleClick() { if (!FUN_1003ef60()) { @@ -114,6 +127,7 @@ MxLong Helicopter::HandleClick() if (!m_world) { m_world = CurrentWorld(); + assert(m_world); } AnimationManager()->FUN_1005f6d0(FALSE); @@ -159,6 +173,8 @@ MxLong Helicopter::HandleClick() MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) { MxLong result = 0; + + assert(m_world); MxAtomId script; switch (GameState()->GetCurrentAct()) { @@ -195,9 +211,10 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) break; } - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + assert(act1State); if (m_state->m_unk0x08 == 0) { - state->m_unk0x018 = 4; + act1State->m_unk0x018 = 4; m_state->m_unk0x08 = 1; m_world->RemoveActor(this); InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterTakeOff_Anim, NULL); @@ -234,11 +251,11 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) assert(m_pathController); - if (m_world && m_world->GetCamera()) { + if (m_world && m_world->GetCameraController()) { Mx3DPointFloat location, direction, lookat; - location = m_world->GetCamera()->GetWorldLocation(); - direction = m_world->GetCamera()->GetWorldDirection(); + location = m_world->GetCameraController()->GetWorldLocation(); + direction = m_world->GetCameraController()->GetWorldDirection(); lookat = direction; lookat *= 3.0f; @@ -246,9 +263,9 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) Mx3DPointFloat v68, va4, up; Mx3DPointFloat v90(0, 1, 0); - v68 = m_world->GetCamera()->GetWorldUp(); - va4.EqualsCross(&v68, &direction); - up.EqualsCross(&va4, &v90); + v68 = m_world->GetCameraController()->GetWorldUp(); + va4.EqualsCross(v68, direction); + up.EqualsCross(va4, v90); if (isPizza) { if (((Act3*) m_world)->ShootPizza(m_pathController, location, direction, up) != SUCCESS) { @@ -291,14 +308,17 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) } // FUNCTION: LEGO1 0x10003c20 +// FUNCTION: BETA10 0x1002ab4c MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) { - MxU32 ret = 0; + MxLong result = 0; - switch (m_state->GetUnkown8()) { + switch (m_state->m_unk0x08) { case 1: { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { - ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4); + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + assert(act1State); + act1State->m_unk0x018 = 4; SpawnPlayer( LegoGameState::e_unk42, TRUE, @@ -313,25 +333,17 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) ); } - m_state->SetUnknown8(2); + m_state->m_unk0x08 = 2; MxMatrix matrix; matrix.SetIdentity(); - - float s = sin(0.5235987901687622); // PI / 6, 30 deg - float c = cos(0.5235987901687622); // PI / 6, 30 deg - - float matrixCopy[4][4]; - memcpy(matrixCopy, matrix.GetData(), sizeof(matrixCopy)); - for (MxS32 i = 0; i < 4; i++) { - matrix.GetData()[i][1] = matrixCopy[i][1] * c - matrixCopy[i][2] * s; - matrix.GetData()[i][2] = matrixCopy[i][2] * c + matrixCopy[i][1] * s; - } - + matrix.RotateX(0.5235987901687622); // PI / 6, 30 deg Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]); - m_world->GetCamera()->SetWorldTransform(at, dir, up); + + assert(m_world && m_world->GetCameraController()); + m_world->GetCameraController()->SetWorldTransform(at, dir, up); FUN_10010c30(); - ret = 1; + result = 1; break; } case 3: { @@ -340,10 +352,14 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) Vector3 at(matrix[3]), dir(matrix[2]), up(matrix[1]); at[1] = 1.25; - m_world->GetCamera()->SetWorldTransform(at, dir, up); + + assert(m_world && m_world->GetCameraController()); + m_world->GetCameraController()->SetWorldTransform(at, dir, up); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { - ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + assert(act1State); + act1State->m_unk0x018 = 0; SpawnPlayer( LegoGameState::e_unk41, TRUE, @@ -358,13 +374,13 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) ); } - m_state->SetUnknown8(0); - ret = 1; + m_state->m_unk0x08 = 0; + result = 1; break; } } - return ret; + return result; } // FUNCTION: LEGO1 0x10003e90 @@ -403,14 +419,14 @@ void Helicopter::Animate(float p_time) Vector3 v3(m_unk0x1a8[3]); mat.SetIdentity(); - m_unk0x1f4.BETA_1004aaa0(mat, f2); + m_unk0x1f4.InterpolateToMatrix(mat, f2); v2 = v3; v2 -= v1; v2 *= f2; v2 += v1; - m_world->GetCamera()->FUN_100123e0(mat, 0); + m_world->GetCameraController()->FUN_100123e0(mat, 0); } else { if (m_state->m_unk0x08 == 4) { @@ -420,7 +436,7 @@ void Helicopter::Animate(float p_time) ((Act3*) m_world)->FUN_10073430(); } - LegoPathActor::m_actorState = c_disabled; + SetActorState(c_disabled); } } else { @@ -441,7 +457,7 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix) Vector3 vec5(m_unk0x1a8[2]); // EDI Vector3 vec6(m_unk0x1a8[3]); // locala0 // esp+0x28 - m_world->GetCamera()->FUN_100123b0(local48); + m_world->GetCameraController()->FUN_100123b0(local48); m_unk0x1a8.SetIdentity(); local90 = p_matrix; @@ -453,9 +469,9 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix) vec5[0] = vec5[2] = 0.0f; vec5[1] = -1.0f; - vec3.EqualsCross(&vec4, &vec5); + vec3.EqualsCross(vec4, vec5); vec3.Unitize(); - vec4.EqualsCross(&vec5, &vec3); + vec4.EqualsCross(vec5, vec3); vec6 = vec2; local90 = m_unk0x1a8; @@ -466,9 +482,8 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix) m_unk0x1f0 = Timer()->GetTime(); - m_unk0x1f4.BETA_1004a9f0(local48); - m_unk0x1f4.FUN_10004620(local90); - m_unk0x1f4.FUN_10004520(); + m_unk0x1f4.SetStartEnd(local48, local90); + m_unk0x1f4.NormalizeDirection(); } // FUNCTION: LEGO1 0x10004640 diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index f1d1394935..4ae6272aa8 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -133,7 +133,7 @@ void IslePathActor::Exit() for (j = 0; j < m_boundary->GetNumEdges(); j++) { Mx4DPointFloat& normal = *m_boundary->GetEdgeNormal(j); - if (local20.Dot(&normal, &local20) + normal[3] < -0.001) { + if (local20.Dot(normal, local20) + normal[3] < -0.001) { break; } } @@ -645,7 +645,7 @@ void IslePathActor::FUN_1001b660() Vector3 up(transform[2]); up *= -1.0f; - position.EqualsCross(&direction, &up); + position.EqualsCross(direction, up); m_roi->FUN_100a58f0(transform); m_roi->VTable0x14(); } diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 75eababcf6..7fd07808f2 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -624,6 +624,7 @@ MxResult PizzaMissionState::Serialize(LegoFile* p_file) } // FUNCTION: LEGO1 0x10039510 +// FUNCTION: BETA10 0x100eed45 PizzaMissionState::Mission* PizzaMissionState::GetMission(MxU8 p_actorId) { for (MxS16 i = 0; i < 5; i++) { diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 8e38cb01ff..61f6fc1595 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -358,7 +358,7 @@ void LegoCarBuild::VTable0x70() m_unk0x2a0 = sqrt((MxDouble) DISTSQRD2(m_unk0x290, m_unk0x298)); - m_unk0x25c.BETA_1004a9b0(m_unk0x178, m_unk0x208); + m_unk0x25c.SetStartEnd(m_unk0x178, m_unk0x208); } // FUNCTION: LEGO1 0x10023130 @@ -406,7 +406,7 @@ void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y) MxFloat local1c = sqrt((double) (NORMSQRD2(local20))) / m_unk0x2a0; - m_unk0x25c.BETA_1004aaa0(local78, local1c); + m_unk0x25c.InterpolateToMatrix(local78, local1c); local78[3][0] = m_unk0x178[3][0] + local18[0]; local78[3][1] = m_unk0x178[3][1] + local18[1]; @@ -1203,7 +1203,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) assert(destWorld); m_buildState->m_animationState = LegoVehicleBuildState::e_exiting; - if (m_unk0x258->AllPartsPlaced()) { + if (!m_unk0x258->AllPartsPlaced()) { FUN_100243a0(); } else { @@ -1211,8 +1211,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) } } else { - MxNotificationParam param; - NotificationManager()->Send(this, param); + NotificationManager()->Send(this, MxNotificationParam()); } break; case 2: @@ -1239,9 +1238,8 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param) FUN_10024ef0(); } else { - MxNotificationParam p; // In BETA10, NotificationManager->Send() also takes __FILE__ and __LINE__ arguments - NotificationManager()->Send(this, p); + NotificationManager()->Send(this, MxNotificationParam()); } break; } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index 156e5d94b3..2489b1ec04 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -550,7 +550,7 @@ void LegoCarBuildAnimPresenter::RotateAroundYAxis(MxFloat p_angle) Mx4DPointFloat newRotation; additionalRotation.NormalizeQuaternion(); - newRotation.EqualsHamiltonProduct(¤tRotation, &additionalRotation); + newRotation.EqualsHamiltonProduct(currentRotation, additionalRotation); if (newRotation[3] < 0.9999) { rotationKey->FUN_100739a0(TRUE); diff --git a/LEGO1/lego/legoomni/src/common/legoactors.cpp b/LEGO1/lego/legoomni/src/common/legoactors.cpp index acab09e163..7bf105202e 100644 --- a/LEGO1/lego/legoomni/src/common/legoactors.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactors.cpp @@ -8,88 +8,88 @@ DECOMP_SIZE_ASSERT(LegoActorLOD, 0x58) // GLOBAL: LEGO1 0x100da3b0 LegoActorLOD g_actorLODs[] = { - {"top", "top", 0, 0.000267, 0.780808, -0.01906, 0.951612, -0.461166, -0.002794, -0.299442, 0.4617, - 1.56441, 0.261321, 0, 0, 0, 0, 0, 1, 0, 1, 0}, - {"body", "body", LegoActorLOD::c_flag1, - 0.00158332, 0.401828, -0.00048697, - 0.408071, -0.287507, 0.150419, - -0.147452, 0.289219, 0.649774, - 0.14258, -0.00089, 0.436353, - 0.007277, 0, 0, - 1, 0, 1, - 0}, - {"infohat", "infohat", LegoActorLOD::c_flag2, - 0, -0.00938, -0.01955, - 0.35, -0.231822, -0.140237, - -0.320954, 0.234149, 0.076968, - 0.249083, 0.000191, 1.519793, - 0.001767, 0, 0, - 1, 0, 1, - 0}, + {"top", "top", 0, 0.000267f, 0.780808f, -0.01906f, 0.951612f, -0.461166f, -0.002794f, -0.299442f, 0.4617f, + 1.56441f, 0.261321f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, + {"body", "body", LegoActorLOD::c_flag1, + 0.00158332f, 0.401828f, -0.00048697f, + 0.408071f, -0.287507f, 0.150419f, + -0.147452f, 0.289219f, 0.649774f, + 0.14258f, -0.00089f, 0.436353f, + 0.007277f, 0.0f, 0.0f, + 1.0f, 0.0f, 1.0f, + 0.0f}, + {"infohat", "infohat", LegoActorLOD::c_flag2, + 0.0f, -0.00938f, -0.01955f, + 0.35f, -0.231822f, -0.140237f, + -0.320954f, 0.234149f, 0.076968f, + 0.249083f, 0.000191f, 1.519793f, + 0.001767f, 0.0f, 0.0f, + 1.0f, 0.0f, 1.0f, + 0.0f}, {"infogron", "infogron", LegoActorLOD::c_flag2, - 0, 0.11477, 0.00042, - 0.26, -0.285558, -0.134391, - -0.142231, 0.285507, 0.152986, - 0.143071, -0.00089, 0.436353, - 0.007277, 0, 0, - 1, 0, 1, - 0}, - {"head", "head", LegoActorLOD::c_flag1, - 0, -0.03006, 0, - 0.3, -0.189506, -0.209665, - -0.189824, 0.189532, 0.228822, - 0.194945, -0.00105, 1.293115, - 0.001781, 0, 0, - 1, 0, 1, - 0}, - {"arm-lft", "arm-lft", LegoActorLOD::c_flag2, - -0.06815, -0.0973747, 0.0154655, - 0.237, -0.137931, -0.282775, - -0.105316, 0.000989, 0.100221, - 0.140759, -0.225678, 0.963312, - 0.023286, -0.003031, -0.017187, - 0.999848, 0.173622, 0.984658, - 0.017453}, - {"arm-rt", "arm-rt", LegoActorLOD::c_flag2, - 0.0680946, -0.097152, 0.0152722, - 0.237, 0.00141, -0.289604, - -0.100831, 0.138786, 0.09291, - 0.145437, 0.223494, 0.963583, - 0.018302, 0, 0, - 1, -0.173648, 0.984808, - 0}, - {"claw-lft", "claw-lft", LegoActorLOD::c_flag2, - 0.000773381, -0.101422, -0.0237761, - 0.15, -0.089838, -0.246208, - -0.117735, 0.091275, 0.000263, - 0.07215, -0.341869, 0.700355, - 0.092779, 0.000001, 0.000003, - 1, 0.190812, 0.981627, - -0.000003}, - {"claw-rt", "claw-lft", LegoActorLOD::c_flag2, - 0.000773381, -0.101422, -0.0237761, - 0.15, -0.095016, -0.245349, - -0.117979, 0.086528, 0.00067, - 0.069743, 0.343317, 0.69924, - 0.096123, 0.00606, -0.034369, - 0.999391, -0.190704, 0.981027, - 0.034894}, - {"leg-lft", "leg", LegoActorLOD::c_flag2, - 0.00433584, -0.177404, -0.0313928, - 0.33, -0.129782, -0.440428, - -0.184207, 0.13817, 0.118415, - 0.122607, -0.156339, 0.436087, - 0.006822, 0, 0, - 1, 0, 1, - 0}, - {"leg-rt", "leg", LegoActorLOD::c_flag2, - 0.00433584, -0.177404, -0.0313928, - 0.33, -0.132864, -0.437138, - -0.183944, 0.134614, 0.12043, - 0.121888, 0.151154, 0.436296, - 0.007373, 0, 0, - 1, 0, 1, - 0} + 0.0f, 0.11477f, 0.00042f, + 0.26f, -0.285558f, -0.134391f, + -0.142231f, 0.285507f, 0.152986f, + 0.143071f, -0.00089f, 0.436353f, + 0.007277f, 0.0f, 0.0f, + 1.0f, 0.0f, 1.0f, + 0.0f}, + {"head", "head", LegoActorLOD::c_flag1, + 0.0f, -0.03006f, 0.0f, + 0.3f, -0.189506f, -0.209665f, + -0.189824f, 0.189532f, 0.228822f, + 0.194945f, -0.00105f, 1.293115f, + 0.001781f, 0.0f, 0.0f, + 1.0f, 0.0f, 1.0f, + 0.0f}, + {"arm-lft", "arm-lft", LegoActorLOD::c_flag2, + -0.06815f, -0.0973747f, 0.0154655f, + 0.237f, -0.137931f, -0.282775f, + -0.105316f, 0.000989f, 0.100221f, + 0.140759f, -0.225678f, 0.963312f, + 0.023286f, -0.003031f, -0.017187f, + 0.999848f, 0.173622f, 0.984658f, + 0.017453f}, + {"arm-rt", "arm-rt", LegoActorLOD::c_flag2, + 0.0680946f, -0.097152f, 0.0152722f, + 0.237f, 0.00141f, -0.289604f, + -0.100831f, 0.138786f, 0.09291f, + 0.145437f, 0.223494f, 0.963583f, + 0.018302f, 0.0f, 0.0f, + 1.0f, -0.173648f, 0.984808f, + 0.0f}, + {"claw-lft", "claw-lft", LegoActorLOD::c_flag2, + 0.000773381f, -0.101422f, -0.0237761f, + 0.15f, -0.089838f, -0.246208f, + -0.117735f, 0.091275f, 0.000263f, + 0.07215f, -0.341869f, 0.700355f, + 0.092779f, 0.000001f, 0.000003f, + 1.0f, 0.190812f, 0.981627f, + -0.000003f}, + {"claw-rt", "claw-lft", LegoActorLOD::c_flag2, + 0.000773381f, -0.101422f, -0.0237761f, + 0.15f, -0.095016f, -0.245349f, + -0.117979f, 0.086528f, 0.00067f, + 0.069743f, 0.343317f, 0.69924f, + 0.096123f, 0.00606f, -0.034369f, + 0.999391f, -0.190704f, 0.981027f, + 0.034894f}, + {"leg-lft", "leg", LegoActorLOD::c_flag2, + 0.00433584f, -0.177404f, -0.0313928f, + 0.33f, -0.129782f, -0.440428f, + -0.184207f, 0.13817f, 0.118415f, + 0.122607f, -0.156339f, 0.436087f, + 0.006822f, 0.0f, 0.0f, + 1.0f, 0.0f, 1.0f, + 0.0f}, + {"leg-rt", "leg", LegoActorLOD::c_flag2, + 0.00433584f, -0.177404f, -0.0313928f, + 0.33f, -0.132864f, -0.437138f, + -0.183944f, 0.134614f, 0.12043f, + 0.121888f, 0.151154f, 0.436296f, + 0.007373f, 0.0f, 0.0f, + 1.0f, 0.0f, 1.0f, + 0.0f} }; // GLOBAL: LEGO1 0x100da778 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 783b1eeeeb..aa1a6b4097 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1596,7 +1596,7 @@ MxU16 LegoAnimationManager::FUN_10062110( if (GetViewManager()->IsBoundingBoxInFrustum(p_roi->GetWorldBoundingBox())) { Mx3DPointFloat direction(p_roi->GetWorldDirection()); - if (direction.Dot(&direction, &p_direction) > 0.707) { + if (direction.Dot(direction, p_direction) > 0.707) { Mx3DPointFloat position(p_roi->GetWorldPosition()); position -= p_position; @@ -2342,11 +2342,11 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_ { const char** cycles = g_cycles[g_characters[p_characterId].m_unk0x16]; const char* vehicleWC; + LegoLocomotionAnimPresenter* presenter; if (g_characters[p_characterId].m_vehicleId >= 0 && g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x04 && (vehicleWC = cycles[10]) != NULL) { - LegoLocomotionAnimPresenter* presenter = - (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); if (presenter != NULL) { presenter->FUN_1006d680(p_actor, 1.7f); @@ -2359,8 +2359,7 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_ else { vehicleWC = cycles[p_mood]; if (vehicleWC != NULL) { - LegoLocomotionAnimPresenter* presenter = - (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); if (presenter != NULL) { presenter->FUN_1006d680(p_actor, 0.7f); @@ -2373,8 +2372,7 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_ vehicleWC = cycles[p_mood + 4]; if (vehicleWC != NULL) { - LegoLocomotionAnimPresenter* presenter = - (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); if (presenter != NULL) { presenter->FUN_1006d680(p_actor, 4.0f); @@ -2387,8 +2385,7 @@ MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_ vehicleWC = cycles[p_mood + 7]; if (vehicleWC != NULL) { - LegoLocomotionAnimPresenter* presenter = - (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + presenter = (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); if (presenter != NULL) { presenter->FUN_1006d680(p_actor, 0.0f); @@ -2481,6 +2478,8 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn Vector3* v1 = p_edge->CWVertex(*p_boundary); Vector3* v2 = p_edge->CCWVertex(*p_boundary); + assert(v1 && v2); + p1 = *v2; p1 -= *v1; p1 *= p_destScale; @@ -2493,7 +2492,12 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn boundingBox.Min() -= vec; boundingBox.Max() = p1; boundingBox.Max() += vec; - return GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE; + + if (GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE) { + return TRUE; + } + + return FALSE; } // FUNCTION: LEGO1 0x10064120 @@ -2525,7 +2529,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx for (i = 0; i < numEdges; i++) { e = (LegoUnknown100db7f4*) boundary->GetEdges()[i]; e->FUN_1002ddc0(*boundary, vec); - float dot = vec.Dot(&direction, &vec); + float dot = vec.Dot(direction, vec); if (dot > local4c) { local50 = e; @@ -2793,8 +2797,8 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x LegoLocation* location = NavController()->GetLocation(p_tranInfo->m_location); if (location != NULL) { CalcLocalTransform(location->m_position, location->m_direction, location->m_up, m_unk0x484); - m_unk0x4cc.BETA_1004a9b0(m_unk0x43c, m_unk0x484); - m_unk0x4cc.FUN_10004520(); + m_unk0x4cc.SetStartEnd(m_unk0x43c, m_unk0x484); + m_unk0x4cc.NormalizeDirection(); } else { p_tranInfo->m_flags &= ~LegoTranInfo::c_bit1; @@ -2828,7 +2832,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) sub[1] = (m_unk0x484[3][1] - m_unk0x43c[3][1]) * und; sub[2] = (m_unk0x484[3][2] - m_unk0x43c[3][2]) * und; - m_unk0x4cc.BETA_1004aaa0(mat, (float) (p_time - m_unk0x434) / 1000.0f); + m_unk0x4cc.InterpolateToMatrix(mat, (float) (p_time - m_unk0x434) / 1000.0f); VPV3(mat[3], m_unk0x43c[3], sub); mat[3][3] = 1.0f; diff --git a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp index c66dd26952..bc31bb2ccd 100644 --- a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp +++ b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp @@ -121,9 +121,9 @@ void LegoBackgroundColor::SetLightColor(float p_r, float p_g, float p_b) { if (!VideoManager()->GetVideoParam().Flags().GetF2bit0()) { // TODO: Computed constants based on what? - p_r *= 4.3478260869565215; - p_g *= 1.5873015873015872; - p_b *= 1.1764705882352942; + p_r *= 1. / 0.23; + p_g *= 1. / 0.63; + p_b *= 1. / 0.85; if (p_r > 1.0) { p_r = 1.0; diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 9e1ddf6272..53544ef95c 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -809,7 +809,7 @@ MxResult LegoBuildingManager::FUN_10030630() for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { Mx4DPointFloat* normal = boundary->GetEdgeNormal(j); - if (position.Dot(normal, &position) + (*normal).index_operator(3) < -0.001) { + if (position.Dot(*normal, position) + (*normal).index_operator(3) < -0.001) { MxTrace( "Building %d shot location (%g, %g, %g) is not in boundary %s.\n", i, @@ -826,8 +826,8 @@ MxResult LegoBuildingManager::FUN_10030630() if (g_buildingInfo[i].m_boundary != NULL) { Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUnknown0x14(); - if (position.Dot(&position, &unk0x14) + unk0x14.index_operator(3) > 0.001 || - position.Dot(&position, &unk0x14) + unk0x14.index_operator(3) < -0.001) { + if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 || + position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) { g_buildingInfo[i].m_y = -((position[0] * unk0x14.index_operator(0) + unk0x14.index_operator(3) + diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index f0ab9f53bb..295b90d785 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -16,6 +16,7 @@ #include "roi/legolod.h" #include "viewmanager/viewmanager.h" +#include #include DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) @@ -52,10 +53,11 @@ MxU32 g_unk0x100fc4f0 = 0; LegoActorInfo g_actorInfo[66]; // FUNCTION: LEGO1 0x10082a20 +// FUNCTION: BETA10 0x10073c60 LegoCharacterManager::LegoCharacterManager() { m_characters = new LegoCharacterMap(); - Init(); + Init(); // DECOMP: inlined here in BETA10 m_customizeAnimFile = new CustomizeAnimFileVariable("CUSTOMIZE_ANIM_FILE"); VariableTable()->SetVariable(m_customizeAnimFile); @@ -228,8 +230,9 @@ const char* LegoCharacterManager::GetActorName(MxS32 p_index) if (p_index < sizeOfArray(g_actorInfo)) { return g_actorInfo[p_index].m_name; } - - return NULL; + else { + return NULL; + } } // FUNCTION: LEGO1 0x100834f0 @@ -244,9 +247,9 @@ MxU32 LegoCharacterManager::GetNumActors() LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEntity) { LegoCharacter* character = NULL; - LegoCharacterMap::iterator it = m_characters->find(const_cast(p_name)); + LegoCharacterMap::const_iterator it = m_characters->find(const_cast(p_name)); - if (it != m_characters->end()) { + if (!(it == m_characters->end())) { character = (*it).second; character->AddRef(); } @@ -254,13 +257,9 @@ LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEn if (character == NULL) { LegoROI* roi = CreateActorROI(p_name); - if (roi == NULL) { - goto done; - } - - roi->SetVisibility(FALSE); - if (roi != NULL) { + roi->SetVisibility(FALSE); + character = new LegoCharacter(roi); char* name = new char[strlen(p_name) + 1]; @@ -276,7 +275,6 @@ LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEn VideoManager()->Get3DManager()->Add(*character->m_roi); } -done: if (character != NULL) { if (p_createEntity && character->m_roi->GetEntity() == NULL) { LegoExtraActor* actor = new LegoExtraActor(); @@ -289,15 +287,15 @@ LegoROI* LegoCharacterManager::GetActorROI(const char* p_name, MxBool p_createEn return character->m_roi; } - - return NULL; + else { + return NULL; + } } // FUNCTION: LEGO1 0x10083b20 // FUNCTION: BETA10 0x10074608 MxBool LegoCharacterManager::Exists(const char* p_name) { - LegoCharacter* character = NULL; LegoCharacterMap::iterator it = m_characters->find(const_cast(p_name)); if (it != m_characters->end()) { @@ -454,6 +452,7 @@ void LegoCharacterManager::RemoveROI(LegoROI* p_roi) } // FUNCTION: LEGO1 0x10084030 +// FUNCTION: BETA10 0x10074e4f LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key) { MxBool success = FALSE; @@ -601,7 +600,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key) // FUNCTION: LEGO1 0x100849a0 // FUNCTION: BETA10 0x10075b51 -MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_textureInfo) +MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_texture) { LegoResult result = SUCCESS; LegoROI* head = FindChildROI(p_roi, g_actorLODs[c_headLOD].m_name); @@ -610,24 +609,30 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex char lodName[256]; ViewLODList* lodList = GetViewLODListManager()->Lookup(g_actorLODs[c_headLOD].m_parentName); + assert(lodList); + MxS32 lodSize = lodList->Size(); sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++); ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize); + assert(dupLodList); Tgl::Renderer* renderer = VideoManager()->GetRenderer(); - if (p_textureInfo == NULL) { + if (p_texture == NULL) { LegoActorInfo* info = GetActorInfo(p_roi->GetName()); + assert(info); + LegoActorInfo::Part& part = info->m_parts[c_headPart]; - p_textureInfo = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); + p_texture = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]); + assert(p_texture); } for (MxS32 i = 0; i < lodSize; i++) { LegoLOD* lod = (LegoLOD*) (*lodList)[i]; LegoLOD* clone = lod->Clone(renderer); - if (p_textureInfo != NULL) { - clone->FUN_100aad70(p_textureInfo); + if (p_texture != NULL) { + clone->FUN_100aad70(p_texture); } dupLodList->PushBack(clone); @@ -672,6 +677,7 @@ LegoExtraActor* LegoCharacterManager::GetExtraActor(const char* p_name) } // FUNCTION: LEGO1 0x10084c60 +// FUNCTION: BETA10 0x10075ede LegoActorInfo* LegoCharacterManager::GetActorInfo(const char* p_name) { MxU32 i; @@ -685,11 +691,13 @@ LegoActorInfo* LegoCharacterManager::GetActorInfo(const char* p_name) if (i < sizeOfArray(g_actorInfo)) { return &g_actorInfo[i]; } - - return NULL; + else { + return NULL; + } } // FUNCTION: LEGO1 0x10084cb0 +// FUNCTION: BETA10 0x10075f66 LegoActorInfo* LegoCharacterManager::GetActorInfo(LegoROI* p_roi) { MxU32 i; @@ -703,21 +711,24 @@ LegoActorInfo* LegoCharacterManager::GetActorInfo(LegoROI* p_roi) if (i < sizeOfArray(g_actorInfo)) { return &g_actorInfo[i]; } - - return NULL; + else { + return NULL; + } } // FUNCTION: LEGO1 0x10084cf0 // FUNCTION: BETA10 0x10075fe2 LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) { - const CompoundObject* comp = p_roi->GetComp(); - #ifdef COMPAT_MODE - for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { + CompoundObject::const_iterator it; #else - for (CompoundObject::iterator it = comp->begin(); !(it == comp->end()); it++) { + CompoundObject::iterator it; #endif + + const CompoundObject* comp = p_roi->GetComp(); + + for (it = comp->begin(); it != comp->end(); it++) { LegoROI* roi = (LegoROI*) *it; if (!strcmpi(p_name, roi->GetName())) { @@ -911,11 +922,13 @@ MxU32 LegoCharacterManager::GetAnimationId(LegoROI* p_roi) if (info != NULL) { return info->m_move + g_characterAnimationId; } - - return 0; + else { + return 0; + } } // FUNCTION: LEGO1 0x10085140 +// FUNCTION: BETA10 0x10076855 MxU32 LegoCharacterManager::GetSoundId(LegoROI* p_roi, MxBool p_und) { LegoActorInfo* info = GetActorInfo(p_roi); @@ -927,8 +940,9 @@ MxU32 LegoCharacterManager::GetSoundId(LegoROI* p_roi, MxBool p_und) if (info != NULL) { return info->m_sound + g_unk0x100fc4d8; } - - return 0; + else { + return 0; + } } // FUNCTION: LEGO1 0x10085180 @@ -940,8 +954,9 @@ MxU8 LegoCharacterManager::GetMood(LegoROI* p_roi) if (info != NULL) { return info->m_mood; } - - return 0; + else { + return 0; + } } // FUNCTION: LEGO1 0x100851a0 diff --git a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp index b5c4f52183..06bf77462e 100644 --- a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp +++ b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp @@ -1,5 +1,36 @@ #include "legoobjectfactory.h" +// Headers need to be included in a certain order to match the original binary. +// Some of the following headers were probably not directly included, +// but were included from one of the higher level classes. We should attempt +// to reverse engineer the inclusion "graph" at some point. Until then, to maintain +// correct order in the binary, we include them in the order we want here. +// clang-format off +#include "mxpresenter.h" +#include "legoentity.h" +#include "legopathactor.h" +// The below header inclusions should be sound. +#include "legoloopinganimpresenter.h" +#include "mxcompositemediapresenter.h" +#include "legoactorpresenter.h" +#include "legomodelpresenter.h" +#include "legotexturepresenter.h" +#include "legopartpresenter.h" +#include "legoactioncontrolpresenter.h" +#include "lego3dwavepresenter.h" +#include "jetskirace.h" +#include "carrace.h" +#include "score.h" +#include "legoact2.h" +#include "helicopter.h" +#include "act2policestation.h" +#include "act3.h" +#include "doors.h" +#include "pizzeria.h" +#include "buildings.h" +#include "jukebox.h" +// clang-format on + #include "act2actor.h" #include "act2brick.h" #include "act2genactor.h" diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 22b5cc807f..2e7b0491bf 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -145,7 +145,7 @@ MxResult LegoPlantManager::FUN_10026410() for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { Mx4DPointFloat* normal = boundary->GetEdgeNormal(j); - if (position.Dot(normal, &position) + (*normal).index_operator(3) < -0.001) { + if (position.Dot(*normal, position) + (*normal).index_operator(3) < -0.001) { MxTrace( "Plant %d shot location (%g, %g, %g) is not in boundary %s.\n", i, @@ -162,8 +162,8 @@ MxResult LegoPlantManager::FUN_10026410() if (g_plantInfo[i].m_boundary != NULL) { Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUnknown0x14(); - if (position.Dot(&position, &unk0x14) + unk0x14.index_operator(3) > 0.001 || - position.Dot(&position, &unk0x14) + unk0x14.index_operator(3) < -0.001) { + if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 || + position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) { g_plantInfo[i].m_y = -((position[0] * unk0x14.index_operator(0) + unk0x14.index_operator(3) + diff --git a/LEGO1/lego/legoomni/src/common/legoplants.cpp b/LEGO1/lego/legoomni/src/common/legoplants.cpp index daa892ec46..f58245f58a 100644 --- a/LEGO1/lego/legoomni/src/common/legoplants.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplants.cpp @@ -15,19 +15,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_20", 1, - -7e1, - 8, - -8.40763, + -70.0f, + 8.0f, + -8.40763f, NULL, - -73.75, - 8, - -8.4375, - 1, - 0, - 0, - 0, - 1, - 0}, + -73.75f, + 8.0f, + -8.4375f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -39,19 +39,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_20", 3, - -15.45, - 0, - -41.32, + -15.45f, + 0.0f, + -41.32f, NULL, - -16.8125, - 0, - -41.2, - 1, - 0, - 0, - 0, - 1, - 0}, + -16.8125f, + 0.0f, + -41.2f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -63,19 +63,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_24", 1, - -69.7176, - 7, - -25.25, + -69.7176f, + 7.0f, + -25.25f, NULL, - -71, - 7, - -25, - 1, - 0, - 0, - 0, - 1, - 0}, + -71.0f, + 7.0f, + -25.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -87,19 +87,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_27", 1, - 82.75, - 4, - 29.24163, + 82.75f, + 4.0f, + 29.24163f, NULL, - 82.6125, - 4, - 27.625, - 1, - 0, - 0, - 0, - 1, - 0}, + 82.6125f, + 4.0f, + 27.625f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -111,19 +111,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int18", 3, - 28.15, - 2, - 29.27804, + 28.15f, + 2.0f, + 29.27804f, NULL, - 29.8125, - 2, - 27.6875, - 1, - 0, - 0, - 0, - 1, - 0}, + 29.8125f, + 2.0f, + 27.6875f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -135,19 +135,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int48", 0, - 85.16238, - 9, - -0.83761, + 85.16238f, + 9.0f, + -0.83761f, NULL, - 86.125, - 8.80447, - 0.3125, - 1, - 0, - 0, - 0, - 1, - 0}, + 86.125f, + 8.80447f, + 0.3125f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -159,19 +159,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int18", 3, - 24.31819, - 2, - 29.04404, + 24.31819f, + 2.0f, + 29.04404f, NULL, - 22.8125, - 2, - 27.6875, - 1, - 0, - 0, - 0, - 1, - 0}, + 22.8125f, + 2.0f, + 27.6875f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -183,19 +183,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int56", 4, - -64.125, - 14, - 27.5, + -64.125f, + 14.0f, + 27.5f, NULL, - -61.6875, - 14, - 28, - 1, - 0, - 0, - 0, - 1, - 0}, + -61.6875f, + 14.0f, + 28.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -207,19 +207,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int67", 3, - -23.3197, - 1, - 29.00803, + -23.3197f, + 1.0f, + 29.00803f, NULL, - -21.9375, - 1, - 27.6875, - 1, - 0, - 0, - 0, - 1, - 0}, + -21.9375f, + 1.0f, + 27.6875f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -231,19 +231,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_79", 3, - 9.15, - 0, - -18.1854, + 9.15f, + 0.0f, + -18.1854f, NULL, - 9.15, - 0, - -19.9375, - 1, - 0, - 0, - 0, - 1, - 0}, + 9.15f, + 0.0f, + -19.9375f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -255,19 +255,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_79", 1, - 9.15, - 0, - -14.5695, + 9.15f, + 0.0f, + -14.5695f, NULL, - 9.15, - 0, - -12.9375, - 1, - 0, - 0, - 0, - 1, - 0}, + 9.15f, + 0.0f, + -12.9375f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -279,19 +279,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_151", 1, - -75.7186, - 4, - 44.60529, + -75.7186f, + 4.0f, + 44.60529f, NULL, - -74.9375, - 4, - 44.3875, - 1, - 0, - 0, - 0, - 1, - 0}, + -74.9375f, + 4.0f, + 44.3875f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -303,19 +303,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int53", 6, - -22.375, - 0, - -81.875, + -22.375f, + 0.0f, + -81.875f, NULL, - -21.625, - 0, - -83, - 1, - 0, - 0, - 0, - 1, - 0}, + -21.625f, + 0.0f, + -83.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -327,19 +327,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_47", 1, - 42.8125, - 0, - -48.125, + 42.8125f, + 0.0f, + -48.125f, NULL, - 47.75, - -0.299, - -58.125, - 0.6751, - -0.1071, - 0.7299, - 0, - 1, - 0}, + 47.75f, + -0.299f, + -58.125f, + 0.6751f, + -0.1071f, + 0.7299f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -351,19 +351,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_155", 1, - -39, - 0, - 40.8125, + -39.0f, + 0.0f, + 40.8125f, NULL, - -41, - 0, - 39.5, - 1, - 0, - 0, - 0, - 1, - 0}, + -41.0f, + 0.0f, + 39.5f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -375,19 +375,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg03_05", 3, - -35.125, - 0, - 3.875, + -35.125f, + 0.0f, + 3.875f, NULL, - -35, - 0, - 0, - 1, - 0, - 0, - 0, - 1, - 0}, + -35.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, @@ -399,19 +399,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_128", 3, - -59.3624, - 14, - 22.86249, + -59.3624f, + 14.0f, + 22.86249f, NULL, - -58.375, - 14, - 21.98749, - 1, - 0, - 0, - 0, - 1, - 0}, + -58.375f, + 14.0f, + 21.98749f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, @@ -423,19 +423,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int48", 4, - 87.9875, - 9, - -1.125, + 87.9875f, + 9.0f, + -1.125f, NULL, - 87.3, - 8.609336, - 1.125, - 1, - 0, - 0, - 0, - 1, - 0}, + 87.3f, + 8.609336f, + 1.125f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, @@ -447,19 +447,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_18", 1, - -69.6875, - 8, - -3.5, + -69.6875f, + 8.0f, + -3.5f, NULL, - -73.8, - 8, - -5.3, - 1, - 0, - 0, - 0, - 1, - 0}, + -73.8f, + 8.0f, + -5.3f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, @@ -471,19 +471,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_85", 1, - -26.45, - 0, - -48.5, + -26.45f, + 0.0f, + -48.5f, NULL, - -25.45, - 0, - -46.5, - 1, - 0, - 0, - 0, - 1, - 0}, + -25.45f, + 0.0f, + -46.5f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -495,19 +495,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_123", 3, - -60.625, - 14, - 22.9375, + -60.625f, + 14.0f, + 22.9375f, NULL, - -6e1, - 14, - 24, - 1, - 0, - 0, - 0, - 1, - 0}, + -60.0f, + 14.0f, + 24.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -519,19 +519,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_131", 1, - -63.7755, - 14, - 26.70394, + -63.7755f, + 14.0f, + 26.70394f, NULL, - -65, - 14, - 26, - 1, - 0, - 0, - 0, - 1, - 0}, + -65.0f, + 14.0f, + 26.0f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -543,19 +543,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_61", 3, - 70.1875, - 1, - -78.3125, + 70.1875f, + 1.0f, + -78.3125f, NULL, - 72.6875, - 1, - -80.3125, - 1, - 0, - 0, - 0, - 1, - 0}, + 72.6875f, + 1.0f, + -80.3125f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -567,19 +567,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_33", 1, - -64.1875, - 7, - -45.25, + -64.1875f, + 7.0f, + -45.25f, NULL, - -64.1875, - 7, - -43.4375, - 1, - 0, - 0, - 0, - 1, - 0}, + -64.1875f, + 7.0f, + -43.4375f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -591,19 +591,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_59", 1, - -47.8124, - 1.8634, - -58.2624, + -47.8124f, + 1.8634f, + -58.2624f, NULL, - -47.8124, - 1.875, - -60.2624, - 0.174, - 0, - 0.985, - 0, - 1, - 0}, + -47.8124f, + 1.875f, + -60.2624f, + 0.174f, + 0.0f, + 0.985f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -615,19 +615,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_32", 1, - 25.5, - 0, - 9, + 25.5f, + 0.0f, + 9.0f, NULL, - 22.8125, - 0, - 9, - 0, - 0, - 1, - 0, - 1, - 0}, + 22.8125f, + 0.0f, + 9.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -639,19 +639,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int25", 0, - 27.1875, - 0, - -16.3125, + 27.1875f, + 0.0f, + -16.3125f, NULL, - 29.8125, - 0, - -14.3125, - 1, - 0, - 0, - 0, - 1, - 0}, + 29.8125f, + 0.0f, + -14.3125f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -663,19 +663,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_01", 1, - -19.625, - 0, - -17.9375, + -19.625f, + 0.0f, + -17.9375f, NULL, - -19.625, - 0, - -2e1, - 0, - 0, - 1, - 0, - 1, - 0}, + -19.625f, + 0.0f, + -20.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -687,19 +687,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_95", 3, - 34.125, - 0, - 3.5125, + 34.125f, + 0.0f, + 3.5125f, NULL, - 32.9375, - 0, - 2.95, - -1, - 0, - 0, - 0, - 1, - 0}, + 32.9375f, + 0.0f, + 2.95f, + -1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -711,19 +711,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int25", 1, - 25.6875, - 0, - -16.4375, + 25.6875f, + 0.0f, + -16.4375f, NULL, - 22.8125, - 0, - -12.9375, - 0, - 0, - 1, - 0, - 1, - 0}, + 22.8125f, + 0.0f, + -12.9375f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -735,19 +735,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int26", 1, - 24.25, - 0, - -44.5, + 24.25f, + 0.0f, + -44.5f, NULL, - 22.8125, - 0, - -43.0625, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + 22.8125f, + 0.0f, + -43.0625f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -759,19 +759,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int26", 6, - 28.25, - 0, - -47.3125, + 28.25f, + 0.0f, + -47.3125f, NULL, - 29.8125, - 0, - -45.875, - 0, - 0, - 1, - 0, - 1, - 0}, + 29.8125f, + 0.0f, + -45.875f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -783,19 +783,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int10", 1, - -69.125, - 7, - -29.125, + -69.125f, + 7.0f, + -29.125f, NULL, - -70.5625, - 7, - -29.875, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + -70.5625f, + 7.0f, + -29.875f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -807,19 +807,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_61", 3, - 70.75, - 1, - -76.5625, + 70.75f, + 1.0f, + -76.5625f, NULL, - 73.5, - 1, - -78.25, - 0, - 0, - 1, - 0, - 1, - 0}, + 73.5f, + 1.0f, + -78.25f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -831,19 +831,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int04", 5, - -94.4, - 4, - -15.3125, + -94.4f, + 4.0f, + -15.3125f, NULL, - -94.875, - 4, - -13.3125, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + -94.875f, + 4.0f, + -13.3125f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -855,19 +855,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_79", 1, - 9.15, - 0, - -14.5695, + 9.15f, + 0.0f, + -14.5695f, NULL, - 9.15, - 0, - -11.5625, - 0, - 0, - 1, - 0, - 1, - 0}, + 9.15f, + 0.0f, + -11.5625f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -879,19 +879,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_58", 3, - 66.2125, - 0, - -17.5625, + 66.2125f, + 0.0f, + -17.5625f, NULL, - 65.33261, - 0.11868, - -19.8125, - 0, - 0, - 1, - 0, - 1, - 0}, + 65.33261f, + 0.11868f, + -19.8125f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -903,19 +903,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int34", 4, - 0.375, - 0, - -44.8875, + 0.375f, + 0.0f, + -44.8875f, NULL, - -1.3125, - 0, - -43.075, - 0, - 0, - 1, - 0, - 1, - 0}, + -1.3125f, + 0.0f, + -43.075f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -927,19 +927,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_32", 1, - 25.5, - 0, - 9.8, + 25.5f, + 0.0f, + 9.8f, NULL, - 22.8125, - 0, - 10.4875, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + 22.8125f, + 0.0f, + 10.4875f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -951,19 +951,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int22", 6, - 28.92499, - 0, - 6.45, + 28.92499f, + 0.0f, + 6.45f, NULL, - 29.8, - 0, - 8.0125, - 0, - 0, - 1, - 0, - 1, - 0}, + 29.8f, + 0.0f, + 8.0125f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -975,19 +975,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_28", 1, - 85.5, - 4, - 22.25, + 85.5f, + 4.0f, + 22.25f, NULL, - 82.5625, - 4, - 26.25, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + 82.5625f, + 4.0f, + 26.25f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -999,19 +999,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_176", 0, - 73.875, - 1, - -82.9375, + 73.875f, + 1.0f, + -82.9375f, NULL, - 74.75, - 1, - -81.25, - 1, - 0, - 0, - 0, - 1, - 0}, + 74.75f, + 1.0f, + -81.25f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1023,19 +1023,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_35", 3, - 26.25, - 0, - -12.45, + 26.25f, + 0.0f, + -12.45f, NULL, - 22.8125, - 0, - -11.575, - 1, - 0, - 0, - 0, - 1, - 0}, + 22.8125f, + 0.0f, + -11.575f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1047,19 +1047,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_79", 3, - 9.15, - 0, - -18.1854, + 9.15f, + 0.0f, + -18.1854f, NULL, - 9.0875, - 0, - -21.3125, - 0, - 0, - 1, - 0, - 1, - 0}, + 9.0875f, + 0.0f, + -21.3125f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1071,19 +1071,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_01", 3, - -19.75, - 0, - -15.3125, + -19.75f, + 0.0f, + -15.3125f, NULL, - -19.75, - 0, - -12.875, - 0, - 0, - 1, - 0, - 1, - 0}, + -19.75f, + 0.0f, + -12.875f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1095,19 +1095,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_56", 3, - 72.8125, - 0, - -25.9375, + 72.8125f, + 0.0f, + -25.9375f, NULL, - 70.6875, - 0, - -26.5625, - -0.9848, - 0, - 1.1736, - 0, - 1, - 0}, + 70.6875f, + 0.0f, + -26.5625f, + -0.9848f, + 0.0f, + 1.1736f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1119,19 +1119,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int67", 0, - -26.9375, - 1, - 29.075, + -26.9375f, + 1.0f, + 29.075f, NULL, - -28.9375, - 1, - 27.7, - 1, - 0, - 0, - 0, - 1, - 0}, + -28.9375f, + 1.0f, + 27.7f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1143,19 +1143,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int51", 3, - -2.125, - 0, - -17.6875, + -2.125f, + 0.0f, + -17.6875f, NULL, - -3.25, - 0, - -19.75, - 0, - 0, - 1, - 0, - 1, - 0}, + -3.25f, + 0.0f, + -19.75f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1167,19 +1167,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_57", 1, - -23.875, - 0, - -54.9375, + -23.875f, + 0.0f, + -54.9375f, NULL, - -25.1875, - 0, - -52.625, - 0, - 0, - 1, - 0, - 1, - 0}, + -25.1875f, + 0.0f, + -52.625f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, @@ -1191,19 +1191,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int04", 5, - -94, - 4, - -15.3125, + -94.0f, + 4.0f, + -15.3125f, NULL, - -95.9375, - 4, - -14.25, - 0, - 0, - 1, - 0, - 1, - 0}, + -95.9375f, + 4.0f, + -14.25f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1215,19 +1215,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_36", 3, - 18.6875, - 0, - -14.6375, + 18.6875f, + 0.0f, + -14.6375f, NULL, - 18.75, - 0, - -10.95, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + 18.75f, + 0.0f, + -10.95f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1239,19 +1239,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_30", 1, - 25.1375, - 2, - 25.5, + 25.1375f, + 2.0f, + 25.5f, NULL, - 21.8875, - 1.84509, - 25.5, - 0, - 0, - 1, - 0, - 1, - 0}, + 21.8875f, + 1.84509f, + 25.5f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1263,19 +1263,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_30", 3, - 27.45, - 2, - 25.5, + 27.45f, + 2.0f, + 25.5f, NULL, - 30.95, - 2, - 25.5, - 0, - 0, - 1, - 0, - 1, - 0}, + 30.95f, + 2.0f, + 25.5f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1287,19 +1287,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_78", 1, - 64.35749, - 0, - 10.95579, + 64.35749f, + 0.0f, + 10.95579f, NULL, - 66.67, - 0.256506, - 10.95579, - 0, - 0, - -1, - 0, - 1, - 0}, + 66.67f, + 0.256506f, + 10.95579f, + 0.0f, + 0.0f, + -1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1311,19 +1311,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_38", 1, - 9.625, - 0, - -45.375, + 9.625f, + 0.0f, + -45.375f, NULL, - 9.625, - 0, - -4e1, - 0.5, - 0, - 0.866, - 0, - 1, - 0}, + 9.625f, + 0.0f, + -40.0f, + 0.5f, + 0.0f, + 0.866f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1335,19 +1335,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_76", 3, - 65, - 0, - 7.0125, + 65.0f, + 0.0f, + 7.0125f, NULL, - 62, - 0, - 2.825, - 0, - 0, - 1, - 0, - 1, - 0}, + 62.0f, + 0.0f, + 2.825f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1359,19 +1359,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_35", 1, - 27.4375, - 0, - -8.125, + 27.4375f, + 0.0f, + -8.125f, NULL, - 33.375, - 0, - -8.125, - 0.342, - 0, - 0.94, - 0, - 1, - 0}, + 33.375f, + 0.0f, + -8.125f, + 0.342f, + 0.0f, + 0.94f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1383,19 +1383,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_23", 3, - 18.825, - 1.7575, - 30.125, + 18.825f, + 1.7575f, + 30.125f, NULL, - 18.825, - 1, - 25.5, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + 18.825f, + 1.0f, + 25.5f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1407,19 +1407,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_130", 1, - -67.5, - 14, - 23.25, + -67.5f, + 14.0f, + 23.25f, NULL, - -63.6875, - 14, - 21.4375, - 0, - 0, - 1, - 0, - 1, - 0}, + -63.6875f, + 14.0f, + 21.4375f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1431,19 +1431,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_13", 3, - -92.75, - 4, - 2.5, + -92.75f, + 4.0f, + 2.5f, NULL, - -95.625, - 4, - 2.5, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + -95.625f, + 4.0f, + 2.5f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1455,19 +1455,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_09", 1, - -8e1, - 4, - -52.6875, + -80.0f, + 4.0f, + -52.6875f, NULL, - -8e1, - 4, - -55.875, - 0, - 0, - 1, - 0, - 1, - 0}, + -80.0f, + 4.0f, + -55.875f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1479,19 +1479,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_53", 1, - -8.75, - 0, - -45.5, + -8.75f, + 0.0f, + -45.5f, NULL, - -8.75, - 0, - -40.75, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + -8.75f, + 0.0f, + -40.75f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1503,19 +1503,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_37", 3, - 27.5, - 0, - -32, + 27.5f, + 0.0f, + -32.0f, NULL, - 35.625, - 0, - -32, - 0, - 0, - 1, - 0, - 1, - 0}, + 35.625f, + 0.0f, + -32.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1527,19 +1527,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_127", 1, - -62.25, - 14, - 26.6875, + -62.25f, + 14.0f, + 26.6875f, NULL, - -61, - 14, - 26.8125, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + -61.0f, + 14.0f, + 26.8125f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1551,19 +1551,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_01", 1, - -16, - 0, - -18.575, + -16.0f, + 0.0f, + -18.575f, NULL, - -16, - 0, - -22.45, - 0, - 0, - 1, - 0, - 1, - 0}, + -16.0f, + 0.0f, + -22.45f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1575,19 +1575,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_17", 1, - -76.4325, - 8, - 5.875, + -76.4325f, + 8.0f, + 5.875f, NULL, - -78, - 8, - 2.375, - 0, - 0, - 1, - 0, - 1, - 0}, + -78.0f, + 8.0f, + 2.375f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1599,19 +1599,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_38", 1, - -77.1875, - 7, - -36.9375, + -77.1875f, + 7.0f, + -36.9375f, NULL, - -72, - 7, - -36.5, - 0, - 0, - 1, - 0, - 1, - 0}, + -72.0f, + 7.0f, + -36.5f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1623,19 +1623,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg02_82", 1, - 97, - 0, - -42.125, + 97.0f, + 0.0f, + -42.125f, NULL, - 98.1875, - 0, - -41.3125, - 0.707, - 0, - 0.707, - 0, - 1, - 0}, + 98.1875f, + 0.0f, + -41.3125f, + 0.707f, + 0.0f, + 0.707f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, @@ -1647,19 +1647,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_15", 3, - 96.5, - 4, - 18.75, + 96.5f, + 4.0f, + 18.75f, NULL, - 97.5, - 4, - 18.25, - 0, - 0, - 1, - 0, - 1, - 0}, + 97.5f, + 4.0f, + 18.25f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -1671,19 +1671,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, + 0.0f, + 0.0f, + 0.0f, NULL, - -67.5, - 14, - 23.25, - 0, - 0, - 1, - 0, - 1, - 0}, + -67.5f, + 14.0f, + 23.25f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -1695,19 +1695,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "int48", 4, - 87.9875, - 9, - -1.125, + 87.9875f, + 9.0f, + -1.125f, NULL, - 88.75, - 8.75, - 0.875, - 0.259, - 0, - 0.966, - 0, - 1, - 0}, + 88.75f, + 8.75f, + 0.875f, + 0.259f, + 0.0f, + 0.966f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -1719,19 +1719,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_01", 3, - -48.625, - 7, - -23.1875, + -48.625f, + 7.0f, + -23.1875f, NULL, - -50.4375, - 7, - -25, - 0, - 0, - 1, - 0, - 1, - 0}, + -50.4375f, + 7.0f, + -25.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -1743,19 +1743,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_01", 0, - -48.625, - 7, - -23.1875, + -48.625f, + 7.0f, + -23.1875f, NULL, - -49.125, - 7, - -25.8, - 0, - 0, - 1, - 0, - 1, - 0}, + -49.125f, + 7.0f, + -25.8f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -1767,19 +1767,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg01_01", 3, - -48.625, - 7, - -23.1875, + -48.625f, + 7.0f, + -23.1875f, NULL, - -51.25, - 7, - -23.75, - 0, - 0, - 1, - 0, - 1, - 0}, + -51.25f, + 7.0f, + -23.75f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, @@ -1791,19 +1791,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "edg00_129", 1, - -56.75, - 14, - 26.625, + -56.75f, + 14.0f, + 26.625f, NULL, - -58, - 14, - 26.75, - 0, - 0, - 1, - 0, - 1, - 0}, + -58.0f, + 14.0f, + 26.75f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_imain, LegoPlantInfo::e_flower, @@ -1815,19 +1815,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, + 0.0f, + 0.0f, + 0.0f, NULL, - -4.33403, - -2.18029, - -1.53595, - 0, - 0, - 1, - 0, - 1, - 0}, + -4.33403f, + -2.18029f, + -1.53595f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_imain, LegoPlantInfo::e_flower, @@ -1839,19 +1839,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, + 0.0f, + 0.0f, + 0.0f, NULL, - 1.280536, - -2.18024, - -1.57823, - 0, - 0, - -1, - 0, - 1, - 0}, + 1.280536f, + -2.18024f, + -1.57823f, + 0.0f, + 0.0f, + -1.0f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_ielev, LegoPlantInfo::e_flower, @@ -1863,19 +1863,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, + 0.0f, + 0.0f, + 0.0f, NULL, - -1.52465, - -0.52473, - -11.1617, - -0.0175, - 0, - -0.9998, - 0, - 1, - 0}, + -1.52465f, + -0.52473f, + -11.1617f, + -0.0175f, + 0.0f, + -0.9998f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_ielev, LegoPlantInfo::e_flower, @@ -1887,19 +1887,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, + 0.0f, + 0.0f, + 0.0f, NULL, - 1.439563, - -0.52554, - -11.1846, - 0.866, - 0, - -0.5, - 0, - 1, - 0}, + 1.439563f, + -0.52554f, + -11.1846f, + 0.866f, + 0.0f, + -0.5f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_iisle, LegoPlantInfo::e_flower, @@ -1911,19 +1911,19 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, + 0.0f, + 0.0f, + 0.0f, NULL, - -1.82829, - -0.52554, - -11.7741, - 0.866, - 0, - -0.5, - 0, - 1, - 0}, + -1.82829f, + -0.52554f, + -11.7741f, + 0.866f, + 0.0f, + -0.5f, + 0.0f, + 1.0f, + 0.0f}, {NULL, LegoPlantInfo::c_iisle, LegoPlantInfo::e_flower, @@ -1935,17 +1935,17 @@ LegoPlantInfo g_plantInfoInit[81] = { -1, "", 1, - 0, - 0, - 0, - NULL, - 1.801479, - -0.52473, - -11.75, - -0.0175, - 0, - -0.9998, - 0, - 1, - 0} + 0.0f, + 0.0f, + 0.0f, + NULL, + 1.801479f, + -0.52473f, + -11.75f, + -0.0175f, + 0.0f, + -0.9998f, + 0.0f, + 1.0f, + 0.0f} }; diff --git a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp index ea00ad5f14..51678ed814 100644 --- a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp +++ b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -71,7 +71,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text desc.ddpfPixelFormat.dwRGBBitCount = 8; MxS32 i; - LegoU8* bits; + const LegoU8* bits; MxU8* surface; if (pDirectDraw->CreateSurface(&desc, &textureInfo->m_surface, NULL) != DD_OK) { @@ -186,7 +186,7 @@ BOOL LegoTextureInfo::GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_text } // FUNCTION: LEGO1 0x10066010 -LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits) +LegoResult LegoTextureInfo::FUN_10066010(const LegoU8* p_bits) { if (m_surface != NULL && m_texture != NULL) { DDSURFACEDESC desc; @@ -195,7 +195,7 @@ LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits) if (m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) { MxU8* surface = (MxU8*) desc.lpSurface; - LegoU8* bits = p_bits; + const LegoU8* bits = p_bits; if (desc.dwWidth == desc.lPitch) { memcpy(desc.lpSurface, p_bits, desc.dwWidth * desc.dwHeight); diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 86730b7fbe..e1a61a38d8 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -381,7 +381,7 @@ void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender // FUNCTION: LEGO1 0x1003eab0 void SetCameraControllerFromIsle() { - InputManager()->SetCamera(FindWorld(*g_isleScript, IsleScript::c__Isle)->GetCamera()); + InputManager()->SetCamera(FindWorld(*g_isleScript, IsleScript::c__Isle)->GetCameraController()); } // FUNCTION: LEGO1 0x1003eae0 @@ -709,7 +709,7 @@ void WriteDefaultTexture(LegoFile* p_file, const char* p_name) } else { MxU8* surface = (MxU8*) desc.lpSurface; - LegoU8* bits = image->GetBits(); + const LegoU8* bits = image->GetBits(); for (MxS32 i = 0; i < desc.dwHeight; i++) { memcpy(surface, bits, desc.dwWidth); diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index 566468e5c5..aa0911604c 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -54,7 +54,8 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14 // FUNCTION: LEGO1 0x1004bac0 MxResult MxTransitionManager::Tickle() { - if (m_animationSpeed + m_systemTime > timeGetTime()) { + MxULong time = m_animationSpeed + m_systemTime; + if (time > timeGetTime()) { return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 413b517142..16787149e8 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -127,7 +127,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) if (p_roi) { const char* name = p_roi->GetName(); - for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 1; i++) { + for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 2; i++) { if (!strcmpi(name, g_actorNames[i])) { m_type = e_actor; m_actorId = i; diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 731fa70c84..d697907ea2 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -42,21 +42,21 @@ void LegoEntity::ResetWorldTransform(MxBool p_cameraFlag) { LegoWorld* world = CurrentWorld(); - if (world != NULL && world->GetCamera() != NULL) { + if (world != NULL && world->GetCameraController() != NULL) { m_cameraFlag = p_cameraFlag; if (m_cameraFlag) { - world->GetCamera()->SetEntity(this); - world->GetCamera()->SetWorldTransform( + world->GetCameraController()->SetEntity(this); + world->GetCameraController()->SetWorldTransform( Mx3DPointFloat(0.0F, 1.25F, 0.0F), Mx3DPointFloat(0.0F, 0.0F, 1.0F), Mx3DPointFloat(0.0F, 1.0F, 0.0F) ); } else { - if (world->GetCamera()->GetEntity() == this) { - world->GetCamera()->SetEntity(NULL); - world->GetCamera()->SetWorldTransform( + if (world->GetCameraController()->GetEntity() == this) { + world->GetCameraController()->SetEntity(NULL); + world->GetCameraController()->SetWorldTransform( Mx3DPointFloat(0.0F, 0.0F, 0.0F), Mx3DPointFloat(0.0F, 0.0F, 1.0F), Mx3DPointFloat(0.0F, 1.0F, 0.0F) @@ -72,10 +72,10 @@ void LegoEntity::SetWorldTransform(const Vector3& p_location, const Vector3& p_d { LegoWorld* world = CurrentWorld(); - if (world != NULL && world->GetCamera() != NULL) { + if (world != NULL && world->GetCameraController() != NULL) { m_cameraFlag = TRUE; - world->GetCamera()->SetEntity(this); - world->GetCamera()->SetWorldTransform(p_location, p_direction, p_up); + world->GetCameraController()->SetEntity(this); + world->GetCameraController()->SetWorldTransform(p_location, p_direction, p_up); } } @@ -193,8 +193,8 @@ void LegoEntity::FUN_10010c30() { LegoWorld* world = CurrentWorld(); - if (m_cameraFlag && world && world->GetCamera() && m_roi) { - world->GetCamera()->FUN_100123e0(m_roi->GetLocal2World(), 1); + if (m_cameraFlag && world && world->GetCameraController() && m_roi) { + world->GetCameraController()->FUN_100123e0(m_roi->GetLocal2World(), 1); } } diff --git a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp index 09dac5d688..a410407818 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp @@ -90,7 +90,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_ LERP3(a, *v1, *v2, m_unk0xe4); m_destEdge->FUN_1002ddc0(*m_boundary, bbb); - c.EqualsCross(&bbb, m_boundary->GetUnknown0x14()); + c.EqualsCross(bbb, *m_boundary->GetUnknown0x14()); c.Unitize(); Mx3DPointFloat worldDirection(m_roi->GetWorldDirection()); diff --git a/LEGO1/lego/legoomni/src/entity/legolocations.cpp b/LEGO1/lego/legoomni/src/entity/legolocations.cpp index 393f4b680f..5926704f87 100644 --- a/LEGO1/lego/legoomni/src/entity/legolocations.cpp +++ b/LEGO1/lego/legoomni/src/entity/legolocations.cpp @@ -7,1038 +7,1052 @@ DECOMP_SIZE_ASSERT(LegoLocation::Boundary, 0x18) LegoLocation g_locations[] = { {0, "look at origin from z=-8", - 0, - 1.25, - -8, - 0, - 0, - 1, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 0.0f, + 1.25f, + -8.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {1, "LCAMBA1", - 0.852546, - 1.25, - -17.078703, - 0.990515, - 0, - -0.137405, - 0, - 1, - 0, - {"EDG02_13", 2, 0.75, 0, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + 0.852546f, + 1.25f, + -17.078703f, + 0.990515f, + 0.0f, + -0.137405f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_13", 2, 0.75f, 0, 0.25f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 40}, {2, "LCAMBA2", - 3.505301, - 1.25, - -27.955006, - -0.002102, - 0, - 0.999998, - 0, - 1, - 0, - {"EDG02_37", 2, 0.75, 0, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + 3.505301f, + 1.25f, + -27.955006f, + -0.002102f, + 0.0f, + 0.999998f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_37", 2, 0.75f, 0, 0.25f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 20}, {3, "LCAMBA3", - -7.472569, - 1.25, - -16.129034, - 1, - 0, - 0.000926, - 0, - 1, - 0, - {"EDG02_26", 0, 0.75, 2, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + -7.472569f, + 1.25f, + -16.129034f, + 1.0f, + 0.0f, + 0.000926f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_26", 0, 0.75f, 2, 0.25f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 20}, {4, "LCAMBA4", - 38.55205, - 1.25, - -16.129, - -0.999997, - 0, - 0.002449, - 0, - 1, - 0, - {"EDG00_146", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + 38.55205f, + 1.25f, + -16.129f, + -0.999997f, + 0.0f, + 0.002449f, + 0.0f, + 1.0f, + 0.0f, + {"EDG00_146", 0, 0.5f, 2, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 30}, {5, "LCAMCA1", - -36.778473, - -1.996432, - 30.392212, - 0.001013, - 0, - -0.999999, - 0, - 1, - 0, - {"INT01", 2, 0.5, 6, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -36.778473f, + -1.996432f, + 30.392212f, + 0.001013f, + 0.0f, + -0.999999f, + 0.0f, + 1.0f, + 0.0f, + {"INT01", 2, 0.5f, 6, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {6, "LCAMCA2", - -36.774277, - -1.996432, - 24.695135, - -0.305789, - 0.001457, - 0.952098, - 0.000446, - 0.999999, - -0.001387, - {"EDG00_104", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -36.774277f, + -1.996432f, + 24.695135f, + -0.305789f, + 0.001457f, + 0.952098f, + 0.000446f, + 0.999999f, + -0.001387f, + {"EDG00_104", 0, 0.5f, 2, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {7, "LCAMCA3", - -36.888363, - 0.5625, - 33.169434, - -0.091475, - -0.001896, - 0.995806, - -0.000173, - 0.999998, - 0.001888, - {"EDG02_58", 2, 0.25, 0, 0.75, 1}, - {NULL, 0, 0, 0, 0, 0}, + -36.888363f, + 0.5625f, + 33.169434f, + -0.091475f, + -0.001896f, + 0.995806f, + -0.000173f, + 0.999998f, + 0.001888f, + {"EDG02_58", 2, 0.25f, 0, 0.75f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {8, "LCAMGS1", - 27.647768, - 1.25, - -4.07201, - 0, - 0, - 1, - 0, - 1, - 0, - {"EDG02_40", 2, 0.25, 0, 0.25, 1}, - {NULL, 0, 0, 0, 0, 0}, + 27.647768f, + 1.25f, + -4.07201f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_40", 2, 0.25f, 0, 0.25f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 70}, {9, "LCAMGS2", - 25.153421, - 1.25, - 6.101026, - 0, - 0, - -1, - 0, - 1, - 0, - {"INT19", 1, 0.75, 0, 0.75, 1}, - {NULL, 0, 0, 0, 0, 0}, + 25.153421f, + 1.25f, + 6.101026f, + 0.0f, + 0.0f, + -1.0f, + 0.0f, + 1.0f, + 0.0f, + {"INT19", 1, 0.75f, 0, 0.75f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {10, "LCAMGS3", - 29.506308, - 1.25, - -1.23529, - -1, - 0, - 0, - 0, - 1, - 0, - {"EDG00_74", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + 29.506308f, + 1.25f, + -1.23529f, + -1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + {"EDG00_74", 0, 0.5f, 2, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {11, "LCAMHO1", - 84.22306, - 4.78298, - 29.150623, - 0.779248, - 0, - -0.626715, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 84.22306f, + 4.78298f, + 29.150623f, + 0.779248f, + 0.0f, + -0.626715f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 50}, {12, "LCAMHO2", - 90.92687, - 4.78298, - 23.340658, - -0.983254, - 0, - 0.182241, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 90.92687f, + 4.78298f, + 23.340658f, + -0.983254f, + 0.0f, + 0.182241f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {13, "LCAMHO3", - 87.66666, - 4.829471, - 20.905437, - 0.841755, - -0.006868, - 0.539817, - 0.005781, - 0.999976, - 0.003708, - {"EDG02_27", 1, 0.89, 2, 0.89, 0}, - {NULL, 0, 0, 0, 0, 0}, + 87.66666f, + 4.829471f, + 20.905437f, + 0.841755f, + -0.006868f, + 0.539817f, + 0.005781f, + 0.999976f, + 0.003708f, + {"EDG02_27", 1, 0.89f, 2, 0.89f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {14, "LCAMHO4", - 86.33506, - 4.814447, - 20.489912, - 0.948965, - 0.035898, - 0.313331, - -0.034088, - 0.999355, - -0.011255, - {"EDG02_27", 1, 0.89, 2, 0.89, 0}, - {NULL, 0, 0, 0, 0, 0}, + 86.33506f, + 4.814447f, + 20.489912f, + 0.948965f, + 0.035898f, + 0.313331f, + -0.034088f, + 0.999355f, + -0.011255f, + {"EDG02_27", 1, 0.89f, 2, 0.89f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {15, "LCAMIC1", - 80.11602, - 10.193289, - -17.946644, - 0.664706, - 0, - 0.747105, - 0, - 1, - 0, - {"EDG00_69", 2, 0.5, 0, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + 80.11602f, + 10.193289f, + -17.946644f, + 0.664706f, + 0.0f, + 0.747105f, + 0.0f, + 1.0f, + 0.0f, + {"EDG00_69", 2, 0.5f, 0, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {16, "LCAMIC2", - 86.31804, - 10.193289, - -11.24872, - -0.936663, - 0, - -0.350231, - 0, - 1, - 0, - {"EDG02_66", 2, 0.5, 0, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + 86.31804f, + 10.193289f, + -11.24872f, + -0.936663f, + 0.0f, + -0.350231f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_66", 2, 0.5f, 0, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {17, "LCAMIC3", - 86.82608, - 10.193289, - -4.398705, - 0.466761, - 0, - -0.884383, - 0, - 1, - 0, - {"EDG02_68", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + 86.82608f, + 10.193289f, + -4.398705f, + 0.466761f, + 0.0f, + -0.884383f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_68", 0, 0.5f, 2, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 20}, {18, "LCAMJA1", - 95.05279, - 1.318484, - -46.451622, - 0.93196, - 0.006837, - 0.362497, - -0.006372, - 0.999977, - -0.002478, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 95.05279f, + 1.318484f, + -46.451622f, + 0.93196f, + 0.006837f, + 0.362497f, + -0.006372f, + 0.999977f, + -0.002478f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {19, "LCAMJA2", - 97.214066, - 1.318484, - -49.035267, - -0.892783, - -0.012109, - 0.450324, - -0.010811, - 0.999927, - 0.005453, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 97.214066f, + 1.318484f, + -49.035267f, + -0.892783f, + -0.012109f, + 0.450324f, + -0.010811f, + 0.999927f, + 0.005453f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {20, "LCAMJA3", - 94.12146, - 1.25, - -48.242523, - -1, - 0, - -0.000415, - 0, - 1, - 0, - {"INT33", 1, 0.9, 3, 0.9, 0}, - {NULL, 0, 0, 0, 0, 0}, + 94.12146f, + 1.25f, + -48.242523f, + -1.0f, + 0.0f, + -0.000415f, + 0.0f, + 1.0f, + 0.0f, + {"INT33", 1, 0.9f, 3, 0.9f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {21, "LCAMJA4", - 95.58649, - 1.17483, - -43.42485, - 0.137268, - 0.010506, - -0.990478, - -0.001442, - 0.999945, - 0.010407, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 95.58649f, + 1.17483f, + -43.42485f, + 0.137268f, + 0.010506f, + -0.990478f, + -0.001442f, + 0.999945f, + 0.010407f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {22, "LCAMJA5", - 91.586105, - 1.17483, - -48.882996, - 0.702508, - 0.010117, - 0.711604, - -0.007107, - 0.999949, - -0.007199, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 91.586105f, + 1.17483f, + -48.882996f, + 0.702508f, + 0.010117f, + 0.711604f, + -0.007107f, + 0.999949f, + -0.007199f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {23, "LCAMJS1", - 9.885858, - 0.154871, - -54.080086, - 0.573803, - -0.001138, - -0.818993, - 0.000653, - 0.999999, - -0.000932, - {"INT26", 0, 0.5, 3, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + 9.885858f, + 0.154871f, + -54.080086f, + 0.573803f, + -0.001138f, + -0.818993f, + 0.000653f, + 0.999999f, + -0.000932f, + {"INT26", 0, 0.5f, 3, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {24, "LCAMJS2", - 14.753909, - 0.125, - -55.5238, - -0.789437, - 0, - -0.613832, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 14.753909f, + 0.125f, + -55.5238f, + -0.789437f, + 0.0f, + -0.613832f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {25, "LCAMJS3", - 12.373611, - 0.925977, - -64.69941, - 0.114162, - 0, - 0.993462, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 12.373611f, + 0.925977f, + -64.69941f, + 0.114162f, + 0.0f, + 0.993462f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {26, "LCAMJS4", - 27.136557, - 1.125, - -41.8613, - -0.187784, - -0.001389, - -0.982209, - -0.000261, - 0.999999, - -0.001364, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 27.136557f, + 1.125f, + -41.8613f, + -0.187784f, + -0.001389f, + -0.982209f, + -0.000261f, + 0.999999f, + -0.001364f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {27, "LCAMMT1", - -63.277508, - 15.25, - 23.717245, - -0.985194, - 0, - 0.171445, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -63.277508f, + 15.25f, + 23.717245f, + -0.985194f, + 0.0f, + 0.171445f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 50}, {28, "LCAMMT2", - -58.28056, - 15.25, - 22.75, - 0.829409, - 0, - -0.558642, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -58.28056f, + 15.25f, + 22.75f, + 0.829409f, + 0.0f, + -0.558642f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {29, "LCAMPK1", - 39.875, - 1.25, - -1, - 0.587492, - 0, - -0.80923, - 0, - 1, - 0, - {"EDG00_83", 0, 0.9, 2, 0.9, 0}, - {NULL, 0, 0, 0, 0, 0}, + 39.875f, + 1.25f, + -1.0f, + 0.587492f, + 0.0f, + -0.80923f, + 0.0f, + 1.0f, + 0.0f, + {"EDG00_83", 0, 0.9f, 2, 0.9f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 50}, {30, "LCAMPK2", - 63.75, - 1.25, - 15.5625, - -0.968277, - 0, - -0.249878, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 63.75f, + 1.25f, + 15.5625f, + -0.968277f, + 0.0f, + -0.249878f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {31, "LCAMPK4", - 49.5625, - 1.25, - 0, - -0.480011, - 0, - -0.877262, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 49.5625f, + 1.25f, + 0.0f, + -0.480011f, + 0.0f, + -0.877262f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {32, "LCAMPO1", - -24.38507, - 1.25, - -55.71749, - -1, - 0, - 0.000066, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -24.38507f, + 1.25f, + -55.71749f, + -1.0f, + 0.0f, + 0.000066f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 20}, {33, "LCAMPO2", - -41.35899, - 1.790912, - -56.728477, - 0.967347, - 0, - 0.253455, - 0, - 1, - 0, - {"EDG00_191", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -41.35899f, + 1.790912f, + -56.728477f, + 0.967347f, + 0.0f, + 0.253455f, + 0.0f, + 1.0f, + 0.0f, + {"EDG00_191", 0, 0.5f, 2, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {34, "LCAMPS1", - 63.1466, - 2.25, - -81.58665, - 0.860361, - 0, - -0.509685, - 0, - 1, - 0, - {"EDG02_40", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + 63.1466f, + 2.25f, + -81.58665f, + 0.860361f, + 0.0f, + -0.509685f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_40", 0, 0.5f, 2, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {35, "LCAMPS2", - 70.99095, - 2.25, - -87.82898, - -0.746009, - 0, - 0.665936, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 70.99095f, + 2.25f, + -87.82898f, + -0.746009f, + 0.0f, + 0.665936f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {36, "LCAMPS3", - 73.92391, - 2.25, - -71.65845, - -0.480404, - 0, - -0.877047, - 0, - 1, - 0, - {"EDG02_66", 1, 0.15, 2, 0.15, 0}, - {NULL, 0, 0, 0, 0, 0}, + 73.92391f, + 2.25f, + -71.65845f, + -0.480404f, + 0.0f, + -0.877047f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_66", 1, 0.15f, 2, 0.15f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {37, "LCAMPS4", - 61.471172, - 1.829919, - -74.37842, - 0.812146, - 0, - -0.583455, - 0, - 1, - 0, - {"EDG02_40", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + 61.471172f, + 1.829919f, + -74.37842f, + 0.812146f, + 0.0f, + -0.583455f, + 0.0f, + 1.0f, + 0.0f, + {"EDG02_40", 0, 0.5f, 2, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {38, "LCAMPZ1", - -19.517637, - 1.25, - -44.645412, - -0.582251, - 0, - 0.813009, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -19.517637f, + 1.25f, + -44.645412f, + -0.582251f, + 0.0f, + 0.813009f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 80}, {39, "LCAMPZ2", - -21.870003, - 1.25, - -41.47747, - 0.310142, - 0, - 0.95069, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -21.870003f, + 1.25f, + -41.47747f, + 0.310142f, + 0.0f, + 0.95069f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 90}, {40, "LCAMPZ3", - -21.860731, - 1.25, - -41.47234, - 0.877738, - 0, - -0.479141, - 0, - 1, - 0, - {"EDG00_24", 0, 0.9, 2, 0.9, 1}, - {NULL, 0, 0, 0, 0, 0}, + -21.860731f, + 1.25f, + -41.47234f, + 0.877738f, + 0.0f, + -0.479141f, + 0.0f, + 1.0f, + 0.0f, + {"EDG00_24", 0, 0.9f, 2, 0.9f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {41, "LCAMPZ4", - -20.492962, - 1.25, - -43.951485, - 0, - 0, - 1, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -20.492962f, + 1.25f, + -43.951485f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {42, "LCAMPZ5", - -11.0625, - 1.25, - -45.75, - -0.998358, - 0, - -0.057283, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -11.0625f, + 1.25f, + -45.75f, + -0.998358f, + 0.0f, + -0.057283f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 50}, {43, "LCAMPZ6", - -14.837131, - 1.25, - -41.580185, - -0.485221, - 0, - 0.874392, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -14.837131f, + 1.25f, + -41.580185f, + -0.485221f, + 0.0f, + 0.874392f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {44, "LCAMPZ7", - -22.17942, - 1.25, - -41.132347, - 0.697186, - 0, - 0.716891, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -22.17942f, + 1.25f, + -41.132347f, + 0.697186f, + 0.0f, + 0.716891f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {45, "LCAMRA1", - -68.90462, - 10.238018, - -15.521397, - -0.150999, - -0.051266, - -0.987204, - -0.007751, - 0.998685, - -0.050677, - {"EDG00_03", 1, 0.5, 3, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -68.90462f, + 10.238018f, + -15.521397f, + -0.150999f, + -0.051266f, + -0.987204f, + -0.007751f, + 0.998685f, + -0.050677f, + {"EDG00_03", 1, 0.5f, 3, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {46, "LCAMRA2", - -67.931305, - 7.883309, - -28.911201, - -0.596641, - -0.000131, - 0.802509, - -0.000078, - 1, - 0.000105, - {"EDG01_17", 0, 0.5, 3, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -67.931305f, + 7.883309f, + -28.911201f, + -0.596641f, + -0.000131f, + 0.802509f, + -0.000078f, + 1.0f, + 0.000105f, + {"EDG01_17", 0, 0.5f, 3, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {47, "LCAMRA3", - -57.06778, - 7.883309, - -45.567757, - -0.982252, - -0.000114, - 0.187564, - -0.000112, - 1, - 0.000021, - {"EDG01_40", 2, 0.5, 0, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -57.06778f, + 7.883309f, + -45.567757f, + -0.982252f, + -0.000114f, + 0.187564f, + -0.000112f, + 1.0f, + 0.000021f, + {"EDG01_40", 2, 0.5f, 0, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {48, "LCAMRA4", - -72.23135, - 7.912604, - -45.26192, - 0.993571, - -0.036148, - -0.10728, - 0.035939, - 0.999346, - -0.00388, - {"EDG01_27", 0, 0.5, 2, 0.5, 1}, - {NULL, 0, 0, 0, 0, 0}, + -72.23135f, + 7.912604f, + -45.26192f, + 0.993571f, + -0.036148f, + -0.10728f, + 0.035939f, + 0.999346f, + -0.00388f, + {"EDG01_27", 0, 0.5f, 2, 0.5f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {49, "LCAMRA5", - -84.27638, - 4.683791, - -52.99282, - 0.976109, - -0.025475, - -0.215783, - 0.024875, - 0.999675, - -0.005499, - {"EDG01_08", 2, 0.7, 0, 0.7, 1}, - {NULL, 0, 0, 0, 0, 0}, + -84.27638f, + 4.683791f, + -52.99282f, + 0.976109f, + -0.025475f, + -0.215783f, + 0.024875f, + 0.999675f, + -0.005499f, + {"EDG01_08", 2, 0.7f, 0, 0.7f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 25}, {50, "LCAMRA6", - -86.96998, - 5.265254, - -16.33013, - -0.999696, - 0.000378, - -0.024655, - 0.000378, - 1, - 0.000009, - {"EDG01_13", 1, 0.2, 0, 0.2, 1}, - {NULL, 0, 0, 0, 0, 0}, + -86.96998f, + 5.265254f, + -16.33013f, + -0.999696f, + 0.000378f, + -0.024655f, + 0.000378f, + 1.0f, + 0.000009f, + {"EDG01_13", 1, 0.2f, 0, 0.2f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {51, "LCAMRT1", - -11.308265, - 1.25, - 9.629765, - 1, - 0, - 0, - 0, - 1, - 0, - {"EDG03_10", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + -11.308265f, + 1.25f, + 9.629765f, + 1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + {"EDG03_10", 0, 0.5f, 2, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 80}, {52, "LCAMRT2", - -2.950222, - 1.25, - 12.345603, - 0.816763, - 0, - -0.576974, - 0, - 1, - 0, - {"EDG03_10", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + -2.950222f, + 1.25f, + 12.345603f, + 0.816763f, + 0.0f, + -0.576974f, + 0.0f, + 1.0f, + 0.0f, + {"EDG03_10", 0, 0.5f, 2, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {53, "LCAMRT3", - -0.87654, - 1.25, - 11.844613, - 0.006162, - 0, - -0.999981, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -0.87654f, + 1.25f, + 11.844613f, + 0.006162f, + 0.0f, + -0.999981f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, {54, "LCAMRT4", - 0.4375, - 1.25, - 7, - -0.748454, - 0, - -0.663187, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 0.4375f, + 1.25f, + 7.0f, + -0.748454f, + 0.0f, + -0.663187f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {55, "LCAMRT5", - -27.213715, - 1.25, - 13.280918, - -0.670318, - 0, - -0.742074, - 0, - 1, - 0, - {"EDG03_05", 1, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + -27.213715f, + 1.25f, + 13.280918f, + -0.670318f, + 0.0f, + -0.742074f, + 0.0f, + 1.0f, + 0.0f, + {"EDG03_05", 1, 0.5f, 2, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {56, "LCAMRT6", - -21.811115, - 1.25, - 9.006517, - 0.97496, - 0, - 0.222379, - 0, - 1, - 0, - {"EDG03_10", 0, 0.5, 2, 0.5, 0}, - {NULL, 0, 0, 0, 0, 0}, + -21.811115f, + 1.25f, + 9.006517f, + 0.97496f, + 0.0f, + 0.222379f, + 0.0f, + 1.0f, + 0.0f, + {"EDG03_10", 0, 0.5f, 2, 0.5f, 0}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 60}, {57, "LCAMST1", - -40.1615, - 2.02756, - -56.701893, - -0.958601, - 0, - -0.284751, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -40.1615f, + 2.02756f, + -56.701893f, + -0.958601f, + 0.0f, + -0.284751f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 20}, {58, "LCAMST2", - -48.750553, - 2.703701, - -55.472034, - -0.032008, - 0, - -0.999488, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -48.750553f, + 2.703701f, + -55.472034f, + -0.032008f, + 0.0f, + -0.999488f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {59, "LCAMZG1", - 31.694365, - 1.25, - -2.814015, - -0.650445, - 0, - 0.759553, - 0, - 1, - 0, - {"INT22", 0, 0.4, 2, 0.4, 1}, - {NULL, 0, 0, 0, 0, 0}, + 31.694365f, + 1.25f, + -2.814015f, + -0.650445f, + 0.0f, + 0.759553f, + 0.0f, + 1.0f, + 0.0f, + {"INT22", 0, 0.4f, 2, 0.4f, 1}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {60, "LCAMZI1", - 93.37283, - 10.1875, - -10.382307, - 0, - 0, - 1, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 93.37283f, + 10.1875f, + -10.382307f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {61, "LCAMZI2", - 93.37283, - 19.4375, - -10.382307, - 0, - 0, - 1, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 93.37283f, + 19.4375f, + -10.382307f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {62, "LCAMZIE", - 93.375, - 19.4375, - -10.375, - 0.967075, - -0.254493, - 0, - 0.254493, - 0.967075, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 93.375f, + 19.4375f, + -10.375f, + 0.967075f, + -0.254493f, + 0.0f, + 0.254493f, + 0.967075f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {63, "LCAMZIN", - 93.37283, - 19.4375, - -10.382307, - 0, - -0.254006, - 0.967203, - 0, - 0.967203, - 0.254006, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 93.37283f, + 19.4375f, + -10.382307f, + 0.0f, + -0.254006f, + 0.967203f, + 0.0f, + 0.967203f, + 0.254006f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {64, "LCAMZIS", - 93.37283, - 19.4375, - -10.382307, - 0, - -0.254982, - -0.966946, - 0, - 0.966946, - -0.254982, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 93.37283f, + 19.4375f, + -10.382307f, + 0.0f, + -0.254982f, + -0.966946f, + 0.0f, + 0.966946f, + -0.254982f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {65, "LCAMZIW", - 93.375, - 19.4375, - -10.375, - -0.967075, - -0.254493, - 0, - -0.254493, - 0.967075, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 93.375f, + 19.4375f, + -10.375f, + -0.967075f, + -0.254493f, + 0.0f, + -0.254493f, + 0.967075f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {66, "LCAMZP1", - 73.70144, - 2.25, - -88.91317, - -0.911398, - 0, - 0.411526, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + 73.70144f, + 2.25f, + -88.91317f, + -0.911398f, + 0.0f, + 0.411526f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {67, "LCAMRT7", - -1.170637, - 1.25, - 5.082029, - -1, - 0, - -0.000599, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -1.170637f, + 1.25f, + 5.082029f, + -1.0f, + 0.0f, + -0.000599f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 0}, {68, "LCAMJS5", - -1.734375, - -0.625, - -61.8125, - -0.454574, - 0, - -0.890709, - 0, - 1, - 0, - {NULL, 0, 0, 0, 0, 0}, - {NULL, 0, 0, 0, 0, 0}, + -1.734375f, + -0.625f, + -61.8125f, + -0.454574f, + 0.0f, + -0.890709f, + 0.0f, + 1.0f, + 0.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, FALSE, 100}, - {69, "overhead", 0, 135, 0, 0, -1, 0, 0, 0, 1, {NULL, 0, 0, 0, 0, 0}, {NULL, 0, 0, 0, 0, 0}, FALSE, 0} + {69, + "overhead", + 0.0f, + 135.0f, + 0.0f, + 0.0f, + -1.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + {NULL, 0, 0.0f, 0, 0.0f, FALSE}, + FALSE, + 0} }; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index ddf7960d4d..58b2793594 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -30,6 +30,11 @@ DECOMP_SIZE_ASSERT(LegoNavController, 0x70) +// MSVC 4.20 didn't define a macro for this key +#ifndef VK_OEM_MINUS +#define VK_OEM_MINUS 0xBD +#endif + ////////////////////////////////////////////////////////////////////// #ifndef M_PI @@ -109,7 +114,7 @@ char g_debugPassword[] = "OGEL"; char* g_currentInput = g_debugPassword; // GLOBAL: LEGO1 0x100f66cc -MxS32 g_unk0x100f66cc = -1; +MxS32 g_nextCharacter = -1; // GLOBAL: LEGO1 0x100f66d0 MxBool g_enableMusic = TRUE; @@ -542,8 +547,8 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und) if (povPosition >= 0) { LegoWorld* world = CurrentWorld(); - if (world && world->GetCamera()) { - world->GetCamera()->FUN_10012320(DTOR(povPosition)); + if (world && world->GetCameraController()) { + world->GetCameraController()->FUN_10012320(DTOR(povPosition)); p_und = TRUE; } } @@ -582,29 +587,33 @@ MxResult LegoNavController::ProcessKeyboardInput() m_unk0x6c = TRUE; MxS32 hMax; - if ((keyFlags & LegoInputManager::c_leftOrRight) == LegoInputManager::c_left) { + switch (keyFlags & LegoInputManager::c_leftOrRight) { + case LegoInputManager::c_left: hMax = 0; - } - else if ((keyFlags & LegoInputManager::c_leftOrRight) == LegoInputManager::c_right) { + break; + case LegoInputManager::c_right: hMax = m_hMax; - } - else { + break; + default: m_targetRotationalVel = 0.0; m_rotationalAccel = m_maxRotationalDeccel; bool1 = TRUE; + break; } MxS32 vMax; - if ((keyFlags & LegoInputManager::c_upOrDown) == LegoInputManager::c_up) { + switch (keyFlags & LegoInputManager::c_upOrDown) { + case LegoInputManager::c_up: vMax = 0; - } - else if ((keyFlags & LegoInputManager::c_upOrDown) == LegoInputManager::c_down) { + break; + case LegoInputManager::c_down: vMax = m_vMax; - } - else { + break; + default: m_targetLinearVel = 0.0; m_linearAccel = m_maxLinearDeccel; bool2 = TRUE; + break; } MxFloat val = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 4.0f; @@ -693,29 +702,29 @@ MxLong LegoNavController::Notify(MxParam& p_param) } break; } - case 'k': - case 'm': { // Keys need to be uppercased to trigger this code, but seems dysfunctional - if (g_unk0x100f66cc == -1) { - g_unk0x100f66cc = 0; + case VK_ADD: + case VK_SUBTRACT: { // Cycles through characters and puts them in front of you + if (g_nextCharacter == -1) { + g_nextCharacter = 0; } else { - CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_unk0x100f66cc)); + CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_nextCharacter)); - if (key == 'k') { - g_unk0x100f66cc++; - if (g_unk0x100f66cc >= CharacterManager()->GetNumActors()) { - g_unk0x100f66cc = 0; + if (key == VK_ADD) { + g_nextCharacter++; + if (g_nextCharacter >= CharacterManager()->GetNumActors()) { + g_nextCharacter = 0; } } else { - g_unk0x100f66cc--; - if (g_unk0x100f66cc < 0) { - g_unk0x100f66cc = CharacterManager()->GetNumActors() - 1; + g_nextCharacter--; + if (g_nextCharacter < 0) { + g_nextCharacter = CharacterManager()->GetNumActors() - 1; } } } - LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_unk0x100f66cc), TRUE); + LegoROI* roi = CharacterManager()->GetActorROI(CharacterManager()->GetActorName(g_nextCharacter), TRUE); if (roi != NULL) { MxMatrix mat; ViewROI* viewRoi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); @@ -728,7 +737,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) } break; } - case '{': { // Saves the game. Can't actually be triggered + case VK_F12: { // Saves the game InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state && state->HasRegistered()) { GameState()->Save(0); @@ -994,7 +1003,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) case 'X': RealtimeView::SetUserMaxLOD(3.6); break; - case 'j': { + case VK_MULTIPLY: { MxU8 newActor = GameState()->GetActorId() + 1; if (newActor > LegoActor::c_laura) { @@ -1004,10 +1013,10 @@ MxLong LegoNavController::Notify(MxParam& p_param) GameState()->SetActorId(newActor); break; } - case 'o': + case VK_DIVIDE: GameState()->SetActorId(LegoActor::c_brickster); break; - case 'z': + case VK_F11: if (GameState()->m_isDirty) { GameState()->m_isDirty = FALSE; } @@ -1015,7 +1024,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) GameState()->m_isDirty = TRUE; } break; - case 0xbd: + case VK_OEM_MINUS: g_unk0x100f66bc = LegoAnimationManager::e_unk1; break; } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index ee1445133d..e00d436562 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -554,15 +554,15 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) MxPresenter* presenter; while (cursor.Next(presenter)) { - MxDSAction* action = presenter->GetAction(); - if (!strcmp(action->GetObjectName(), p_name)) { + if (!strcmp(presenter->GetAction()->GetObjectName(), p_name)) { return presenter; } } return NULL; } - else if (!strcmp(p_class, "MxEntity")) { + + if (!strcmp(p_class, "MxEntity")) { LegoEntityListCursor cursor(m_entityList); LegoEntity* entity; @@ -579,7 +579,8 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) return NULL; } - else if (!strcmp(p_class, "LegoAnimPresenter")) { + + if (!strcmp(p_class, "LegoAnimPresenter")) { MxPresenterListCursor cursor(&m_animPresenters); MxPresenter* presenter; @@ -591,20 +592,18 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name) return NULL; } - else { - for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { - if ((*it)->IsA(p_class) && (*it)->IsA("MxPresenter")) { - MxPresenter* presenter = (MxPresenter*) *it; - MxDSAction* action = presenter->GetAction(); - if (!strcmp(action->GetObjectName(), p_name)) { - return *it; - } + for (MxCoreSet::iterator i = m_set0xa8.begin(); i != m_set0xa8.end(); i++) { + if ((*i)->IsA(p_class) && (*i)->IsA("MxPresenter")) { + assert(((MxPresenter*) (*i))->GetAction()); + + if (!strcmp(((MxPresenter*) (*i))->GetAction()->GetObjectName(), p_name)) { + return *i; } } - - return NULL; } + + return NULL; } // FUNCTION: LEGO1 0x10021790 @@ -783,7 +782,7 @@ MxResult LegoWorld::Tickle() ReadyWorld(); return TRUE; case e_two: - if (PresentersPending()) { + if (PresentersPending() == TRUE) { break; } default: diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 31c4eabdd8..3aa0208c27 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -466,7 +466,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); p_param.SetROI(roi); - if (roi && roi->GetVisibility()) { + if (roi && roi->GetVisibility() == TRUE) { for (OrientableROI* parent = roi->GetParentROI(); parent; parent = parent->GetParentROI()) { roi = (LegoROI*) parent; } diff --git a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp index 66cc40e5a5..182945d56e 100644 --- a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp @@ -183,6 +183,7 @@ void LegoAnimActor::ClearMaps() } // FUNCTION: LEGO1 0x1001c870 +// FUNCTION: BETA10 0x1003e7e4 void LegoAnimActor::SetWorldSpeed(MxFloat p_worldSpeed) { if (p_worldSpeed < 0) { diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 23d98359f1..ee83769ed7 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -138,7 +138,7 @@ MxResult LegoExtraActor::FUN_1002aae0() Vector3 positionRef(m_unk0xec[3]); dirRef *= -1.0f; - rightRef.EqualsCross(&upRef, &dirRef); + rightRef.EqualsCross(upRef, dirRef); if (m_boundary == m_destEdge->m_faceA) { m_boundary = (LegoPathBoundary*) m_destEdge->m_faceB; @@ -191,9 +191,10 @@ inline void LegoExtraActor::FUN_1002ad8a() } // FUNCTION: LEGO1 0x1002aba0 +// FUNCTION: BETA10 0x1008114a MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) { - if (p_actor->GetActorState() != c_initial || m_actorState != c_initial) { + if (p_actor->GetActorState() != c_initial || GetActorState() != c_initial) { return FAILURE; } @@ -222,7 +223,7 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) for (MxS32 i = 0; i < m_boundary->GetNumEdges(); i++) { Mx4DPointFloat* normal = m_boundary->GetEdgeNormal(i); - if (positionRef.Dot(normal, &positionRef) + (*normal)[3] < -0.001) { + if (positionRef.Dot(*normal, positionRef) + normal->index_operator(3) < -0.001) { b = TRUE; break; } @@ -232,41 +233,34 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) m_roi->FUN_100a58f0(matrix2); m_roi->VTable0x14(); FUN_1002ad8a(); + assert(m_roi); + assert(SoundManager()->GetCacheSoundManager()); SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE); m_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration(); - m_prevWorldSpeed = m_worldSpeed; + m_prevWorldSpeed = GetWorldSpeed(); VTable0xc4(); SetWorldSpeed(0); m_whichAnim = 1; - m_actorState = c_one | c_noCollide; + SetActorState(c_one | c_noCollide); } } if (b) { - LegoROI* roi = m_roi; + LegoROI* roi = GetROI(); + assert(roi); SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE); VTable0xc4(); - m_actorState = c_two | c_noCollide; + SetActorState(c_two | c_noCollide); Mx3DPointFloat dir = p_actor->GetWorldDirection(); MxMatrix matrix3 = MxMatrix(roi->GetLocal2World()); Vector3 positionRef(matrix3[3]); positionRef += g_unk0x10104c18; roi->FUN_100a58f0(matrix3); -#ifdef COMPAT_MODE - float dotX, dotZ; - { - Mx3DPointFloat tmp(1.0f, 0, 0); - dotX = dir.Dot(&dir, &tmp); - Mx3DPointFloat tmp2(0, 0, 1.0f); - dotZ = dir.Dot(&dir, &tmp2); - } -#else - float dotX = dir.Dot(&dir, &Mx3DPointFloat(1.0f, 0, 0)); - float dotZ = dir.Dot(&dir, &Mx3DPointFloat(0, 0, 1.0f)); -#endif + float dotX = dir.Dot(dir, Mx3DPointFloat(1.0f, 0, 0)); + float dotZ = dir.Dot(dir, Mx3DPointFloat(0, 0, 1.0f)); - if (abs(dotZ) < abs(dotX)) { + if (fabs(dotZ) < fabs(dotX)) { m_axis = dotX > 0.0 ? e_posz : e_negz; } else { @@ -463,9 +457,9 @@ MxU32 LegoExtraActor::VTable0x6c( Mx3DPointFloat local54(p_v1); local54 -= local60; - float local1c = p_v2.Dot(&p_v2, &p_v2); - float local24 = p_v2.Dot(&p_v2, &local54) * 2.0f; - float local20 = local54.Dot(&local54, &local54); + float local1c = p_v2.Dot(p_v2, p_v2); + float local24 = p_v2.Dot(p_v2, local54) * 2.0f; + float local20 = local54.Dot(local54, local54); if (m_unk0x15 != 0 && local20 < 10.0f) { return 0; diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 9841b1c650..6c367f191b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -16,6 +16,7 @@ #include "mxutilities.h" #include "mxvariabletable.h" +#include #include DECOMP_SIZE_ASSERT(LegoPathActor, 0x154) @@ -142,11 +143,11 @@ MxResult LegoPathActor::VTable0x88( dir *= -1.0f; } - right.EqualsCross(&up, &dir); + right.EqualsCross(up, dir); m_roi->UpdateTransformationRelativeToParent(matrix); if (!m_cameraFlag || !m_userNavFlag) { - p5.EqualsCross(p_boundary->GetUnknown0x14(), &p3); + p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3); p5.Unitize(); if (VTable0x80(p1, p4, p2, p5) == SUCCESS) { @@ -208,11 +209,11 @@ MxResult LegoPathActor::VTable0x84( dir *= -1.0f; } - right.EqualsCross(&up, &dir); + right.EqualsCross(up, dir); m_roi->UpdateTransformationRelativeToParent(matrix); if (!m_cameraFlag || !m_userNavFlag) { - p5.EqualsCross(p_boundary->GetUnknown0x14(), &p3); + p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3); p5.Unitize(); if (VTable0x80(p_p1, p_p4, p2, p5) == SUCCESS) { @@ -233,7 +234,7 @@ MxResult LegoPathActor::VTable0x84( // FUNCTION: LEGO1 0x1002e100 // FUNCTION: BETA10 0x100b0520 -MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) +MxS32 LegoPathActor::VTable0x8c(float p_time, MxMatrix& p_transform) { if (m_userNavFlag && m_actorState == c_initial) { m_lastTime = p_time; @@ -243,22 +244,27 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) p4 = Vector3(m_roi->GetWorldPosition()); LegoNavController* nav = NavController(); + assert(nav); + m_worldSpeed = nav->GetLinearVel(); if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUnknown0x14())) { Mx3DPointFloat p6; p6 = p2; + MxS32 result = 0; m_unk0xe9 = m_boundary->Intersect(m_roi->GetWorldBoundingSphere().Radius(), p4, p2, p3, m_destEdge); if (m_unk0xe9 == -1) { + MxTrace("Intersect returned -1\n"); return -1; } - - if (m_unk0xe9 != 0) { - p2 = p3; + else { + if (m_unk0xe9 != 0) { + p2 = p3; + } } - MxS32 result = VTable0x68(p4, p2, p3); + result = VTable0x68(p4, p2, p3); if (result > 0) { p2 = p4; @@ -308,12 +314,18 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) dir = p1; up = *m_boundary->GetUnknown0x14(); - right.EqualsCross(&up, &dir); - right.Unitize(); - dir.EqualsCross(&right, &up); + right.EqualsCross(up, dir); + + MxS32 res = right.Unitize(); + assert(res == 0); + + dir.EqualsCross(right, up); pos = p2; return result; } + else { + return -1; + } } else if (p_time >= 0 && m_worldSpeed > 0) { float f = (m_BADuration - m_unk0x7c) / m_worldSpeed + m_lastTime; @@ -332,13 +344,16 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) m_lastTime = f; p_transform.SetIdentity(); + LegoResult r; if (m_userNavFlag) { - m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 0); + r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 0); } else { - m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 1); + r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 1); } + assert(r == 0); // SUCCESS + Vector3 pos1(p_transform[3]); Vector3 pos2(m_unk0xec[3]); Mx3DPointFloat p1; @@ -350,16 +365,17 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) else { m_boundary->FUN_100575b0(pos2, pos1, this); pos2 = pos1; + } - if (m_unk0xe9 != 0) { - VTable0x9c(); - } - - return 0; + if (m_unk0xe9 != 0) { + VTable0x9c(); } } + else { + return -1; + } - return -1; + return 0; } // FUNCTION: LEGO1 0x1002e740 @@ -414,7 +430,7 @@ void LegoPathActor::Animate(float p_time) LegoWorld* world = CurrentWorld(); if (world) { - world->GetCamera()->FUN_10012290(DTOR(m_unk0x14c)); + world->GetCameraController()->FUN_10012290(DTOR(m_unk0x14c)); } } } @@ -636,7 +652,7 @@ MxResult LegoPathActor::VTable0x9c() LERP3(local34, v1, v2, m_unk0xe4); m_destEdge->FUN_1002ddc0(*m_boundary, local78); - local48.EqualsCross(m_boundary->GetUnknown0x14(), &local78); + local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78); local48.Unitize(); } @@ -646,10 +662,10 @@ MxResult LegoPathActor::VTable0x9c() upRef = *m_boundary->GetUnknown0x14(); - rightRef.EqualsCross(&upRef, &dirRef); + rightRef.EqualsCross(upRef, dirRef); rightRef.Unitize(); - dirRef.EqualsCross(&rightRef, &upRef); + dirRef.EqualsCross(rightRef, upRef); dirRef.Unitize(); Mx3DPointFloat localc0(m_unk0xec[3]); diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 87f1cbdc8f..8f832630b1 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -54,11 +54,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa v = p_point1; v -= *ccwV; - float dot1 = v.Dot(&v, m_unk0x50); + float dot1 = v.Dot(v, *m_unk0x50); v = p_point2; v -= *ccwV; - float dot2 = v.Dot(&v, m_unk0x50); + float dot2 = v.Dot(v, *m_unk0x50); if (dot2 > dot1) { for (MxS32 i = 0; i < m_numTriggers; i++) { @@ -197,7 +197,7 @@ MxU32 LegoPathBoundary::Intersect( for (MxS32 i = 0; i < m_numEdges; i++) { LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) m_edges[i]; - if (p_point2.Dot(&m_edgeNormals[i], &p_point2) + m_edgeNormals[i][3] <= -1e-07) { + if (p_point2.Dot(m_edgeNormals[i], p_point2) + m_edgeNormals[i][3] <= -1e-07) { if (local10 == 0) { local10 = 1; vec = p_point2; @@ -212,9 +212,9 @@ MxU32 LegoPathBoundary::Intersect( vec /= len; } - float dot = vec.Dot(&vec, &m_edgeNormals[i]); + float dot = vec.Dot(vec, m_edgeNormals[i]); if (dot != 0.0f) { - float local34 = (-m_edgeNormals[i][3] - p_point1.Dot(&p_point1, &m_edgeNormals[i])) / dot; + float local34 = (-m_edgeNormals[i][3] - p_point1.Dot(p_point1, m_edgeNormals[i])) / dot; if (local34 >= -0.001 && local34 <= len && (e == NULL || local34 < localc)) { e = edge; @@ -242,7 +242,7 @@ MxU32 LegoPathBoundary::Intersect( e->FUN_1002ddc0(*this, local70); - float local58 = local50.Dot(&local50, &local70); + float local58 = local50.Dot(local50, local70); LegoUnknown100db7f4* local54 = NULL; if (local58 < 0.0f) { @@ -252,7 +252,7 @@ MxU32 LegoPathBoundary::Intersect( local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(*this)) { local88->FUN_1002ddc0(*this, local84); - if (local84.Dot(&local84, &local70) <= 0.9) { + if (local84.Dot(local84, local70) <= 0.9) { break; } @@ -260,7 +260,7 @@ MxU32 LegoPathBoundary::Intersect( Mx3DPointFloat locala4(p_point3); locala4 -= *local90; - float local8c = locala4.Dot(&locala4, &local84); + float local8c = locala4.Dot(locala4, local84); if (local8c > local58 && local8c < local88->m_unk0x3c) { local54 = local88; @@ -279,7 +279,7 @@ MxU32 LegoPathBoundary::Intersect( locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(*this)) { locala8->FUN_1002ddc0(*this, localbc); - if (localbc.Dot(&localbc, &local70) <= 0.9) { + if (localbc.Dot(localbc, local70) <= 0.9) { break; } @@ -287,7 +287,7 @@ MxU32 LegoPathBoundary::Intersect( Mx3DPointFloat locald8(p_point3); locald8 -= *localc4; - float localc0 = locald8.Dot(&locald8, &localbc); + float localc0 = locald8.Dot(locald8, localbc); if (localc0 < local58 && localc0 >= 0.0f) { local54 = locala8; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index a36a9a5371..f168b0502e 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -256,7 +256,7 @@ MxResult LegoPathController::PlaceActor( for (j = 0; j < b.GetNumEdges(); j++) { Mx4DPointFloat normal(*b.GetEdgeNormal(j)); - if (p_position.Dot(&p_position, &normal) + normal[3] < 0.0f) { + if (p_position.Dot(p_position, normal) + normal[3] < 0.0f) { break; } } @@ -282,7 +282,7 @@ MxResult LegoPathController::PlaceActor( Mx3DPointFloat vec; if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(*boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && - vec.Dot(&vec, &p_direction) < 0.0f) { + vec.Dot(vec, p_direction) < 0.0f) { edge = (LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary); } @@ -949,7 +949,7 @@ MxS32 LegoPathController::FUN_1004a240( p_v1 *= p_f1; p_v1 += *p_edge->CWVertex(*p_boundary); p_edge->FUN_1002ddc0(*p_boundary, vec); - p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec); + p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec); return 0; } @@ -974,14 +974,14 @@ MxResult LegoPathController::FUN_1004a380( LegoPathBoundary* b = &m_boundaries[i]; Mx4DPointFloat* unk0x14 = b->GetUnknown0x14(); - float local28 = p_param3[0].Dot(&p_param3[0], unk0x14); + float local28 = p_param3[0].Dot(p_param3[0], *unk0x14); if (local28 < 0.001 && local28 > -0.001) { continue; } - float local2c = p_param3[1].Dot(&p_param3[1], unk0x14); - float local34 = p_param3[2].Dot(&p_param3[2], unk0x14) + unk0x14->index_operator(3); + float local2c = p_param3[1].Dot(p_param3[1], *unk0x14); + float local34 = p_param3[2].Dot(p_param3[2], *unk0x14) + unk0x14->index_operator(3); float local3c = local2c * local2c - local34 * local28 * 4.0f; if (local3c < -0.001) { @@ -1022,7 +1022,7 @@ MxResult LegoPathController::FUN_1004a380( for (j = b->GetNumEdges() - 1; j >= 0; j--) { Mx4DPointFloat* local60 = b->GetEdgeNormal(j); - if (local24.Dot(local60, &local24) + local60->index_operator(3) < -0.001) { + if (local24.Dot(*local60, local24) + local60->index_operator(3) < -0.001) { break; } } @@ -1031,7 +1031,7 @@ MxResult LegoPathController::FUN_1004a380( Mx3DPointFloat local74(p_param1); local74 -= local24; - if (local74.Dot(&local74, unk0x14) >= 0.0f) { + if (local74.Dot(local74, *unk0x14) >= 0.0f) { p_param5 = local38; p_boundary = b; local8 = FALSE; diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index c9a878adca..de895ad5c3 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -35,24 +35,6 @@ LegoRace::LegoRace() NotificationManager()->Register(this); } -// FUNCTION: LEGO1 0x10015b70 -MxLong LegoRace::HandlePathStruct(LegoPathStructNotificationParam&) -{ - return 0; -} - -// FUNCTION: LEGO1 0x10015b80 -MxLong LegoRace::HandleEndAction(MxEndActionNotificationParam&) -{ - return 0; -} - -// FUNCTION: LEGO1 0x10015b90 -MxBool LegoRace::Escape() -{ - return FALSE; -} - // FUNCTION: LEGO1 0x10015ce0 // FUNCTION: BETA10 0x100c7a71 MxResult LegoRace::Create(MxDSAction& p_dsAction) @@ -165,6 +147,7 @@ MxResult RaceState::Serialize(LegoFile* p_file) } // FUNCTION: LEGO1 0x10016280 +// FUNCTION: BETA10 0x100c7dfd RaceState::Entry* RaceState::GetState(MxU8 p_id) { for (MxS16 i = 0;; i++) { diff --git a/LEGO1/lego/legoomni/src/race/legoraceactor.cpp b/LEGO1/lego/legoomni/src/race/legoraceactor.cpp index a8a7fccdc9..92c99d4fe7 100644 --- a/LEGO1/lego/legoomni/src/race/legoraceactor.cpp +++ b/LEGO1/lego/legoomni/src/race/legoraceactor.cpp @@ -116,3 +116,10 @@ MxResult LegoRaceActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) return SUCCESS; } + +// FUNCTION: LEGO1 0x10014aa0 +// FUNCTION: BETA10 0x100ca038 +MxResult LegoRaceActor::FUN_10014aa0() +{ + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 5ebfab2e3e..f16a488c3a 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -167,11 +167,6 @@ undefined4 g_hitValerieSoundsIndex = 0; // GLOBAL: LEGO1 0x100f0bb4 MxLong g_unk0x100f0bb4 = 0; -// Initialized at LEGO1 0x10012db0 -// GLOBAL: LEGO1 0x10102af0 -// GLOBAL: BETA10 0x102114c0 -Mx3DPointFloat g_unk0x10102af0 = Mx3DPointFloat(0.0f, 2.0f, 0.0f); - // FUNCTION: LEGO1 0x10012950 LegoRaceCar::LegoRaceCar() { @@ -197,6 +192,11 @@ MxLong LegoRaceCar::Notify(MxParam& p_param) return LegoRaceMap::Notify(p_param); } +// Initialized at LEGO1 0x10012db0 +// GLOBAL: LEGO1 0x10102af0 +// GLOBAL: BETA10 0x102114c0 +Mx3DPointFloat g_unk0x10102af0 = Mx3DPointFloat(0.0f, 2.0f, 0.0f); + // FUNCTION: LEGO1 0x10012de0 void LegoRaceCar::FUN_10012de0() { @@ -340,8 +340,8 @@ void LegoRaceCar::FUN_10012ff0(float p_param) // Possible bug in the original code: The first argument is not initialized a->GetAnimTreePtr()->GetCamAnim()->FUN_1009f490(deltaTime, transformationMatrix); - if (r->GetCamera()) { - r->GetCamera()->FUN_100123e0(transformationMatrix, 0); + if (r->GetCameraController()) { + r->GetCameraController()->FUN_100123e0(transformationMatrix, 0); } m_roi->FUN_100a58f0(transformationMatrix); @@ -727,49 +727,3 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool) return SUCCESS; } - -// FUNCTION: LEGO1 0x10014150 -MxU32 LegoJetski::VTable0x6c( - LegoPathBoundary* p_boundary, - Vector3& p_v1, - Vector3& p_v2, - float p_f1, - float p_f2, - Vector3& p_v3 -) -{ - return LegoJetskiRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3); -} - -// FUNCTION: LEGO1 0x100141d0 -void LegoJetski::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) -{ - LegoJetskiRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); -} - -// FUNCTION: LEGO1 0x10014210 -MxResult LegoJetski::VTable0x9c() -{ - return LegoJetskiRaceActor::VTable0x9c(); -} - -// FUNCTION: LEGO1 0x10014500 -// FUNCTION: BETA10 0x100cd5e0 -MxU32 LegoRaceCar::VTable0x6c( - LegoPathBoundary* p_boundary, - Vector3& p_v1, - Vector3& p_v2, - float p_f1, - float p_f2, - Vector3& p_v3 -) -{ - return LegoCarRaceActor::VTable0x6c(p_boundary, p_v1, p_v2, p_f1, p_f2, p_v3); -} - -// FUNCTION: LEGO1 0x10014560 -// FUNCTION: BETA10 0x100cd660 -void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) -{ - LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4); -} diff --git a/LEGO1/lego/legoomni/src/race/legoracespecial.cpp b/LEGO1/lego/legoomni/src/race/legoracespecial.cpp index ef95047155..d15a561ff5 100644 --- a/LEGO1/lego/legoomni/src/race/legoracespecial.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracespecial.cpp @@ -166,7 +166,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); - crossProduct.EqualsCross(m_boundary->GetUnknown0x14(), &destEdgeUnknownVector); + crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector); crossProduct.Unitize(); Mx3DPointFloat worldDirection(Vector3(m_roi->GetWorldDirection())); @@ -260,8 +260,8 @@ MxResult LegoCarRaceActor::VTable0x9c() d->FUN_1002ddc0(*b, point2); m_destEdge->FUN_1002ddc0(*m_boundary, point3); - point4.EqualsCross(&point2, m_boundary->GetUnknown0x14()); - point5.EqualsCross(m_boundary->GetUnknown0x14(), &point3); + point4.EqualsCross(point2, *m_boundary->GetUnknown0x14()); + point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3); point4.Unitize(); point5.Unitize(); diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 05fbb6ec9f..6c698bcf2b 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -634,7 +634,7 @@ void LegoAnimPresenter::PutFrame() FUN_1006b9a0(m_anim, time, m_unk0x78); - if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) { + if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) { for (MxS32 i = 0; i < m_unk0x94; i++) { if (m_unk0x8c[i] != NULL) { MxMatrix mat(m_unk0x8c[i]->GetLocal2World()); @@ -650,11 +650,11 @@ void LegoAnimPresenter::PutFrame() up = und; - up -= m_currentWorld->GetCamera()->GetWorldLocation(); + up -= m_currentWorld->GetCameraController()->GetWorldLocation(); dir /= dirsqr; - pos.EqualsCross(&dir, &up); + pos.EqualsCross(dir, up); pos.Unitize(); - up.EqualsCross(&pos, &dir); + up.EqualsCross(pos, dir); pos *= possqr; dir *= dirsqr; up *= upsqr; @@ -716,7 +716,7 @@ MxResult LegoAnimPresenter::FUN_1006b140(LegoROI* p_roi) for (i = 1; i <= m_roiMapSize; i++) { if (m_roiMap[i] == p_roi) { - if (local5c[i].Unknown(local58) != SUCCESS) { + if (local5c[i].BETA_1005a590(local58) != SUCCESS) { goto done; } @@ -930,8 +930,8 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p MxMatrix transform(mat); p_anim->GetCamAnim()->FUN_1009f490(p_time, transform); - if (m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) { - m_currentWorld->GetCamera()->FUN_100123e0(transform, 0); + if (m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) { + m_currentWorld->GetCameraController()->FUN_100123e0(transform, 0); } } diff --git a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp index 7fa8d7babf..93b4720d60 100644 --- a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp @@ -50,7 +50,7 @@ void LegoLoopingAnimPresenter::PutFrame() FUN_1006b9a0(m_anim, time, m_unk0x78); - if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCamera() != NULL) { + if (m_unk0x8c != NULL && m_currentWorld != NULL && m_currentWorld->GetCameraController() != NULL) { for (MxS32 i = 0; i < m_unk0x94; i++) { if (m_unk0x8c[i] != NULL) { MxMatrix mat(m_unk0x8c[i]->GetLocal2World()); @@ -66,11 +66,11 @@ void LegoLoopingAnimPresenter::PutFrame() up = und; - up -= m_currentWorld->GetCamera()->GetWorldLocation(); + up -= m_currentWorld->GetCameraController()->GetWorldLocation(); dir /= dirsqr; - pos.EqualsCross(&dir, &up); + pos.EqualsCross(dir, up); pos.Unitize(); - up.EqualsCross(&pos, &dir); + up.EqualsCross(pos, dir); pos *= possqr; dir *= dirsqr; up *= upsqr; diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index f1525a6349..a3040d37e9 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -24,12 +24,6 @@ DECOMP_SIZE_ASSERT(LegoModelPresenter, 0x6c) // GLOBAL: LEGO1 0x100f7ae0 MxS32 g_modelPresenterConfig = 1; -// FUNCTION: LEGO1 0x1000cca0 -void LegoModelPresenter::Destroy() -{ - Destroy(FALSE); -} - // FUNCTION: LEGO1 0x1007f660 void LegoModelPresenter::configureLegoModelPresenter(MxS32 p_modelPresenterConfig) { diff --git a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp index 87e15745b6..60f33d89e2 100644 --- a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp @@ -20,12 +20,6 @@ MxS32 g_partPresenterConfig1 = 1; // GLOBAL: LEGO1 0x100f7aa4 MxS32 g_partPresenterConfig2 = 100; -// FUNCTION: LEGO1 0x1000cf60 -void LegoPartPresenter::Destroy() -{ - Destroy(FALSE); -} - // FUNCTION: LEGO1 0x1007c990 void LegoPartPresenter::configureLegoPartPresenter(MxS32 p_partPresenterConfig1, MxS32 p_partPresenterConfig2) { diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index fcaada4927..3d7f75a0eb 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -8,12 +8,12 @@ #include "mxdirectx/mxdirect3d.h" #include "mxdirectx/mxstopwatch.h" #include "mxdisplaysurface.h" +#include "mxgeometry/mxmatrix.h" #include "mxmisc.h" #include "mxpalette.h" #include "mxregion.h" #include "mxtimer.h" #include "mxtransitionmanager.h" -#include "realtime/matrix.h" #include "realtime/realtime.h" #include "roi/legoroi.h" #include "tgl/d3drm/impl.h" diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 48c687558f..0043e4b601 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -799,7 +799,7 @@ void Act3::DebugCopter( const Matrix4& p_destination, const Matrix4& p_startPosition, const Matrix4& p_endPosition, - const UnknownMx4DPointFloat& p_unk0x1f4 + const MxQuaternionTransformer& p_unk0x1f4 ) { DebugPrintf("Copter matrix...\n\n"); @@ -831,10 +831,10 @@ void Act3::DebugCopter( Mx4DPointFloat unk0x00, unk0x18; - if (p_unk0x1f4.GetUnknown0x30() != 0) { + if (p_unk0x1f4.GetFlags() != 0) { // TODO: Match - unk0x00 = p_unk0x1f4.GetUnknown0x00(); - unk0x18 = p_unk0x1f4.GetUnknown0x18(); + unk0x00 = p_unk0x1f4.GetStartQuat(); + unk0x18 = p_unk0x1f4.GetEndQuat(); DebugPrintf("Source quaternion..."); // STRING: LEGO1 0x100f7864 diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 43d03cc7e8..77e7da0677 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -48,12 +48,6 @@ GasStation::GasStation() NotificationManager()->Register(this); } -// FUNCTION: LEGO1 0x10004770 -MxBool GasStation::VTable0x5c() -{ - return TRUE; -} - // FUNCTION: LEGO1 0x100048c0 GasStation::~GasStation() { @@ -69,6 +63,7 @@ GasStation::~GasStation() } // FUNCTION: LEGO1 0x10004990 +// FUNCTION: BETA10 0x100286c0 MxResult GasStation::Create(MxDSAction& p_dsAction) { MxResult result = LegoWorld::Create(p_dsAction); @@ -82,13 +77,13 @@ MxResult GasStation::Create(MxDSAction& p_dsAction) m_state = (GasStationState*) GameState()->GetState("GasStationState"); if (!m_state) { m_state = (GasStationState*) GameState()->CreateState("GasStationState"); - m_state->m_unk0x14.m_unk0x00 = 1; + m_state->m_unk0x14 = 1; } - else if (m_state->m_unk0x14.m_unk0x00 == 4) { - m_state->m_unk0x14.m_unk0x00 = 4; + else if (m_state->m_unk0x14 == 4) { + m_state->m_unk0x14 = 4; } else { - m_state->m_unk0x14.m_unk0x00 = 3; + m_state->m_unk0x14 = 3; } GameState()->m_currentArea = LegoGameState::e_garage; @@ -122,6 +117,7 @@ MxLong GasStation::Notify(MxParam& p_param) result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: + assert(m_destLocation != LegoGameState::e_undefined); GameState()->SwitchArea(m_destLocation); break; } @@ -131,6 +127,7 @@ MxLong GasStation::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x10004b30 +// FUNCTION: BETA10 0x10028a5e void GasStation::ReadyWorld() { PlayMusic(JukeboxScript::c_JBMusic2); @@ -142,22 +139,22 @@ void GasStation::ReadyWorld() case LegoActor::c_pepper: switch (m_state->m_pepperAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs002nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs003nu_RunAnim); m_unk0x106 = 1; break; case 2: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs004nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; PlayAction(GarageScript::c_wgs008nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; @@ -167,23 +164,21 @@ void GasStation::ReadyWorld() if (m_state->m_pepperAction < 5) { m_state->m_pepperAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; case LegoActor::c_mama: switch (m_state->m_mamaAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs006nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs007nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; PlayAction(GarageScript::c_wgs008nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; @@ -193,75 +188,69 @@ void GasStation::ReadyWorld() if (m_state->m_mamaAction < 5) { m_state->m_mamaAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case LegoActor::c_papa: - switch (m_state->m_papaAction) { + case LegoActor::c_nick: + switch (m_state->m_nickAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs012nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs009nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs014nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs010nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; - PlayAction(GarageScript::c_wgs017nu_RunAnim); + m_state->m_unk0x14 = 6; + PlayAction(GarageScript::c_wgs008nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; break; } - if (m_state->m_papaAction < 5) { - m_state->m_papaAction++; + if (m_state->m_nickAction < 5) { + m_state->m_nickAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case LegoActor::c_nick: - switch (m_state->m_nickAction) { + case LegoActor::c_papa: + switch (m_state->m_papaAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs009nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs012nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs010nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs014nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; - PlayAction(GarageScript::c_wgs008nu_RunAnim); + m_state->m_unk0x14 = 6; + PlayAction(GarageScript::c_wgs017nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; break; } - if (m_state->m_nickAction < 5) { - m_state->m_nickAction++; + if (m_state->m_papaAction < 5) { + m_state->m_papaAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; case LegoActor::c_laura: switch (m_state->m_lauraAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs020nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs021nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; PlayAction(GarageScript::c_wgs022nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; @@ -271,13 +260,12 @@ void GasStation::ReadyWorld() if (m_state->m_lauraAction < 5) { m_state->m_lauraAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; default: - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; } + + FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } // FUNCTION: LEGO1 0x10005590 @@ -315,10 +303,10 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) m_state->StopAction((GarageScript::Script) action->GetObjectId()); m_unk0x106 = 0; - switch (m_state->m_unk0x14.m_unk0x00) { + switch (m_state->m_unk0x14) { case 5: g_unk0x100f0160 = 0; - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; m_unk0x115 = TRUE; PlayAction(GarageScript::c_wgs023nu_RunAnim); m_unk0x106 = 1; @@ -329,17 +317,17 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) m_unk0x115 = TRUE; if (m_unk0x104 == 3) { - m_state->m_unk0x14.m_unk0x00 = 8; + m_state->m_unk0x14 = 8; PlayAction(GarageScript::c_wgs029nu_RunAnim); m_unk0x106 = 1; } else { - m_state->m_unk0x14.m_unk0x00 = 7; + m_state->m_unk0x14 = 7; m_unk0x114 = TRUE; } break; case 8: - m_state->m_unk0x14.m_unk0x00 = 2; + m_state->m_unk0x14 = 2; ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; m_destLocation = LegoGameState::e_unk28; m_radio.Stop(); @@ -378,8 +366,8 @@ MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param m_unk0x104 = 3; m_unk0x114 = FALSE; - if (m_state->m_unk0x14.m_unk0x00 == 7) { - m_state->m_unk0x14.m_unk0x00 = 8; + if (m_state->m_unk0x14 == 7) { + m_state->m_unk0x14 = 8; PlayAction(GarageScript::c_wgs029nu_RunAnim); m_unk0x106 = 1; } @@ -405,7 +393,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.GetClickedObjectId()) { case GarageScript::c_LeftArrow_Ctl: case GarageScript::c_RightArrow_Ctl: - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_garadoor; m_state->StopActions(); @@ -414,7 +402,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case GarageScript::c_Info_Ctl: - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_infomain; m_state->StopActions(); @@ -423,7 +411,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case GarageScript::c_Buggy_Ctl: - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_dunecarbuild; m_state->StopActions(); @@ -478,7 +466,7 @@ MxResult GasStation::Tickle() else if (m_unk0x104 != 0) { m_unk0x104 = 0; MxDSAction action; - m_state->m_unk0x14.m_unk0x00 = 9; + m_state->m_unk0x14 = 9; PlayAction(GarageScript::c_wgs031nu_RunAnim); m_unk0x106 = 1; } @@ -501,7 +489,7 @@ MxBool GasStation::Escape() { m_radio.Stop(); m_state->StopActions(); - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_infomain; return TRUE; } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 55f0abc877..d7fea12f9d 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -132,12 +132,12 @@ Infocenter::Infocenter() m_selectedCharacter = e_noCharacter; m_unk0x11c = NULL; m_infocenterState = NULL; - m_frameHotBitmap = NULL; + m_frame = NULL; m_destLocation = LegoGameState::e_undefined; m_currentInfomainScript = InfomainScript::c_noneInfomain; m_currentCutscene = e_noIntro; - memset(&m_mapAreas, 0, sizeof(m_mapAreas)); + memset(&m_glowInfo, 0, sizeof(m_glowInfo)); m_unk0x1c8 = -1; SetAppCursor(e_cursorBusy); @@ -612,6 +612,7 @@ void Infocenter::ReadyWorld() } // FUNCTION: LEGO1 0x1006f9a0 +// FUNCTION: BETA10 0x1002ef2f void Infocenter::InitializeBitmaps() { m_radio.Initialize(TRUE); @@ -632,56 +633,64 @@ void Infocenter::InitializeBitmaps() ((MxPresenter*) Find(m_atomId, InfomainScript::c_Laura_Ctl))->Enable(TRUE); ((MxPresenter*) Find(m_atomId, InfomainScript::c_Radio_Ctl))->Enable(TRUE); - m_mapAreas[0].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap"); - m_mapAreas[0].m_area.SetLeft(391); - m_mapAreas[0].m_area.SetTop(182); - m_mapAreas[0].m_area.SetRight(427); - m_mapAreas[0].m_area.SetBottom(230); - m_mapAreas[0].m_unk0x04 = 3; - - m_mapAreas[1].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap"); - m_mapAreas[1].m_area.SetLeft(304); - m_mapAreas[1].m_area.SetTop(225); - m_mapAreas[1].m_area.SetRight(350); - m_mapAreas[1].m_area.SetBottom(268); - m_mapAreas[1].m_unk0x04 = 10; - - m_mapAreas[2].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap"); - m_mapAreas[2].m_area.SetLeft(301); - m_mapAreas[2].m_area.SetTop(133); - m_mapAreas[2].m_area.SetRight(347); - m_mapAreas[2].m_area.SetBottom(181); - m_mapAreas[2].m_unk0x04 = 11; - - m_mapAreas[3].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap"); - m_mapAreas[3].m_area.SetLeft(289); - m_mapAreas[3].m_area.SetTop(182); - m_mapAreas[3].m_area.SetRight(335); - m_mapAreas[3].m_area.SetBottom(225); - m_mapAreas[3].m_unk0x04 = 12; - - m_mapAreas[4].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap"); - m_mapAreas[4].m_area.SetLeft(350); - m_mapAreas[4].m_area.SetTop(161); - m_mapAreas[4].m_area.SetRight(391); - m_mapAreas[4].m_area.SetBottom(209); - m_mapAreas[4].m_unk0x04 = 13; - - m_mapAreas[5].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap"); - m_mapAreas[5].m_area.SetLeft(392); - m_mapAreas[5].m_area.SetTop(130); - m_mapAreas[5].m_area.SetRight(438); - m_mapAreas[5].m_area.SetBottom(176); - m_mapAreas[5].m_unk0x04 = 14; - - m_mapAreas[6].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap"); - m_mapAreas[6].m_area.SetLeft(396); - m_mapAreas[6].m_area.SetTop(229); - m_mapAreas[6].m_area.SetRight(442); - m_mapAreas[6].m_area.SetBottom(272); - m_mapAreas[6].m_unk0x04 = 15; - - m_frameHotBitmap = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap"); + m_glowInfo[0].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap"); + assert(m_glowInfo[0].m_destCtl); + m_glowInfo[0].m_area.SetLeft(391); + m_glowInfo[0].m_area.SetTop(182); + m_glowInfo[0].m_area.SetRight(427); + m_glowInfo[0].m_area.SetBottom(230); + m_glowInfo[0].m_unk0x04 = 3; + + m_glowInfo[1].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap"); + assert(m_glowInfo[1].m_destCtl); + m_glowInfo[1].m_area.SetLeft(304); + m_glowInfo[1].m_area.SetTop(225); + m_glowInfo[1].m_area.SetRight(350); + m_glowInfo[1].m_area.SetBottom(268); + m_glowInfo[1].m_unk0x04 = 10; + + m_glowInfo[2].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap"); + assert(m_glowInfo[1].m_destCtl); // DECOMP: intentional typo + m_glowInfo[2].m_area.SetLeft(301); + m_glowInfo[2].m_area.SetTop(133); + m_glowInfo[2].m_area.SetRight(347); + m_glowInfo[2].m_area.SetBottom(181); + m_glowInfo[2].m_unk0x04 = 11; + + m_glowInfo[3].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap"); + assert(m_glowInfo[3].m_destCtl); + m_glowInfo[3].m_area.SetLeft(289); + m_glowInfo[3].m_area.SetTop(182); + m_glowInfo[3].m_area.SetRight(335); + m_glowInfo[3].m_area.SetBottom(225); + m_glowInfo[3].m_unk0x04 = 12; + + m_glowInfo[4].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap"); + assert(m_glowInfo[4].m_destCtl); + m_glowInfo[4].m_area.SetLeft(350); + m_glowInfo[4].m_area.SetTop(161); + m_glowInfo[4].m_area.SetRight(391); + m_glowInfo[4].m_area.SetBottom(209); + m_glowInfo[4].m_unk0x04 = 13; + + m_glowInfo[5].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap"); + assert(m_glowInfo[5].m_destCtl); + m_glowInfo[5].m_area.SetLeft(392); + m_glowInfo[5].m_area.SetTop(130); + m_glowInfo[5].m_area.SetRight(438); + m_glowInfo[5].m_area.SetBottom(176); + m_glowInfo[5].m_unk0x04 = 14; + + m_glowInfo[6].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap"); + assert(m_glowInfo[6].m_destCtl); + m_glowInfo[6].m_area.SetLeft(396); + m_glowInfo[6].m_area.SetTop(229); + m_glowInfo[6].m_area.SetRight(442); + m_glowInfo[6].m_area.SetBottom(272); + m_glowInfo[6].m_unk0x04 = 15; + + m_frame = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap"); + assert(m_frame); UpdateFrameHot(TRUE); } @@ -831,7 +840,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) if (m_unk0x1c8 != -1) { m_infoManDialogueTimer = 0; - switch (m_mapAreas[m_unk0x1c8].m_unk0x04) { + switch (m_glowInfo[m_unk0x1c8].m_unk0x04) { case 3: GameState()->SetActor(m_selectedCharacter); @@ -1304,11 +1313,11 @@ MxBool Infocenter::VTable0x5c() void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y) { MxS16 i; - for (i = 0; i < (MxS32) (sizeof(m_mapAreas) / sizeof(m_mapAreas[0])); i++) { - MxS32 right = m_mapAreas[i].m_area.GetRight(); - MxS32 bottom = m_mapAreas[i].m_area.GetBottom(); - MxS32 left = m_mapAreas[i].m_area.GetLeft(); - MxS32 top = m_mapAreas[i].m_area.GetTop(); + for (i = 0; i < (MxS32) (sizeof(m_glowInfo) / sizeof(m_glowInfo[0])); i++) { + MxS32 right = m_glowInfo[i].m_area.GetRight(); + MxS32 bottom = m_glowInfo[i].m_area.GetBottom(); + MxS32 left = m_glowInfo[i].m_area.GetLeft(); + MxS32 top = m_glowInfo[i].m_area.GetTop(); if (left <= p_x && p_x <= right && top <= p_y && p_y <= bottom) { break; @@ -1321,12 +1330,12 @@ void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y) if (i != m_unk0x1c8) { if (m_unk0x1c8 != -1) { - m_mapAreas[m_unk0x1c8].m_presenter->Enable(FALSE); + m_glowInfo[m_unk0x1c8].m_destCtl->Enable(FALSE); } m_unk0x1c8 = i; if (i != -1) { - m_mapAreas[i].m_presenter->Enable(TRUE); + m_glowInfo[i].m_destCtl->Enable(TRUE); } } } @@ -1362,18 +1371,18 @@ void Infocenter::UpdateFrameHot(MxBool p_display) return; } - MxS32 originalDisplayZ = m_frameHotBitmap->GetDisplayZ(); + MxS32 originalDisplayZ = m_frame->GetDisplayZ(); - m_frameHotBitmap->SetDisplayZ(1000); + m_frame->SetDisplayZ(1000); VideoManager()->SortPresenterList(); - m_frameHotBitmap->Enable(TRUE); - m_frameHotBitmap->SetPosition(x, y); - m_frameHotBitmap->SetDisplayZ(originalDisplayZ); + m_frame->Enable(TRUE); + m_frame->SetPosition(x, y); + m_frame->SetDisplayZ(originalDisplayZ); } else { - if (m_frameHotBitmap) { - m_frameHotBitmap->Enable(FALSE); + if (m_frame) { + m_frame->Enable(FALSE); } } } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 71a7c590a2..e9d00302a7 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -327,7 +327,7 @@ MxLong LegoAct2::Notify(MxParam& p_param) local90 *= 1.25f; locala4 += local90; locala4[1] += 0.25; - local30.EqualsCross(&localac, &local28); + local30.EqualsCross(localac, local28); local30.Unitize(); Mx3DPointFloat locald4(local2world[2]); @@ -1155,7 +1155,7 @@ MxResult LegoAct2::FUN_10052560( Vector3 secondColumn(matrix[1]); Vector3 thirdColumn(matrix[2]); - firstColumn.EqualsCross(&secondColumn, &thirdColumn); + firstColumn.EqualsCross(secondColumn, thirdColumn); firstColumn.Unitize(); MxMatrix* pmatrix = NULL; diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index e58d57aa05..d1547fb80c 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -32,12 +32,6 @@ Score::Score() NotificationManager()->Register(this); } -// FUNCTION: LEGO1 0x100010b0 -MxBool Score::VTable0x5c() -{ - return TRUE; -} - // FUNCTION: LEGO1 0x10001200 Score::~Score() { @@ -260,7 +254,8 @@ void Score::Paint() memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); - if (cube->m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) { + HRESULT result = cube->m_surface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR, NULL); + if (result == DD_OK) { if (desc.lPitch != desc.dwWidth) { cube->m_surface->Unlock(desc.lpSurface); return; @@ -296,7 +291,7 @@ void Score::Paint() // FUNCTION: LEGO1 0x10001d20 // FUNCTION: BETA10 0x100f4a52 -void Score::FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score) +void Score::FillArea(MxS32 i_activity, MxS32 i_actor, MxS16 score) { MxS32 local3c[] = {0x2b00, 0x5700, 0x8000, 0xab00, 0xd600}; MxS32 local14[] = {0x2a, 0x27, 0x29, 0x29, 0x2a}; @@ -304,6 +299,10 @@ void Score::FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score) MxS32 local28[] = {0x25, 0x29, 0x27, 0x28, 0x28}; MxS32 colors[] = {0x11, 0x0f, 0x08, 0x05}; + assert(i_activity >= 0 && i_activity < 5); + assert(i_actor >= 0 && i_actor < 5); + assert(score >= 0 && score < 4); + MxU8* ptr = m_surface + local3c[i_actor] + local50[i_activity]; MxS32 color = colors[score]; MxS32 size = local28[i_activity]; diff --git a/LEGO1/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 4ee2dc69f3..562601a5c1 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -1,6 +1,7 @@ #include "legoanim.h" #include "mxgeometry/mxmatrix.h" +#include "mxgeometry/mxquaternion.h" #include @@ -231,10 +232,10 @@ LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix) local54 -= localb8; if (local54.Unitize() == 0) { - local5c.EqualsCross(&local68, &local54); + local5c.EqualsCross(local68, local54); if (local5c.Unitize() == 0) { - local68.EqualsCross(&local54, &local5c); + local68.EqualsCross(local54, local5c); localcc = p_matrix[3]; localcc += localb0[3]; @@ -851,7 +852,7 @@ inline void LegoAnimNodeData::GetTranslation( break; case 2: Mx4DPointFloat a; - UnknownMx4DPointFloat b; + MxQuaternionTransformer b; if (p_rotationKeys[i].TestBit1() || p_rotationKeys[i + 1].TestBit1()) { a[0] = p_rotationKeys[i].GetX(); @@ -878,9 +879,9 @@ inline void LegoAnimNodeData::GetTranslation( c[3] = p_rotationKeys[i + 1].GetAngle(); } - b.BETA_10180b80(a); - b.BETA_10180bc0(c); - b.BETA_1004aaa0( + b.SetStart(a); + b.SetEnd(c); + b.InterpolateToMatrix( p_matrix, (p_time - p_rotationKeys[i].GetTime()) / (p_rotationKeys[i + 1].GetTime() - p_rotationKeys[i].GetTime()) ); @@ -1163,7 +1164,7 @@ undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index) return m_modelList[p_index].m_unk0x04; } - return NULL; + return 0; } // FUNCTION: LEGO1 0x100a0f60 diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 6de4fd174f..61e2214c5d 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -139,10 +139,10 @@ LegoS32 LegoWEGEdge::VTable0x04() Mx3DPointFloat local58; Vector3 local64(&m_edgeNormals[i][0]); edge->FUN_1002ddc0(*this, local58); - local64.EqualsCross(&local58, &m_unk0x14); + local64.EqualsCross(local58, m_unk0x14); - m_edgeNormals[i][3] = -local64.Dot(m_edges[i]->m_pointA, &local64); - if (m_edgeNormals[i][3] + m_unk0x30.Dot(&m_unk0x30, &local64) < 0.0f) { + m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64); + if (m_edgeNormals[i][3] + m_unk0x30.Dot(m_unk0x30, local64) < 0.0f) { m_edgeNormals[i] *= -1.0f; } @@ -178,12 +178,12 @@ LegoS32 LegoWEGEdge::VTable0x04() localb8 -= *vTrig1; local80 -= *vTrig1; - float locala4 = localb8.Dot(m_unk0x50, &localb8); + float locala4 = localb8.Dot(*m_unk0x50, localb8); if (local98 < locala4) { local98 = locala4; } - locala4 = local80.Dot(m_unk0x50, &local80); + locala4 = local80.Dot(*m_unk0x50, local80); if (locala4 < local9c) { local9c = locala4; } @@ -244,7 +244,7 @@ LegoS32 LegoWEGEdge::FUN_1009aea0() local50 = *local8[i - 2]; local50 -= *local8[i - 1]; - local24.EqualsCross(&local50, &local3c); + local24.EqualsCross(local50, local3c); local28 = local24.LenSquared(); if (local28 < 0.00001f) { @@ -255,7 +255,7 @@ LegoS32 LegoWEGEdge::FUN_1009aea0() local24 /= local58; if (localc) { - float local54 = local24.Dot(&m_unk0x14, &local24); + float local54 = local24.Dot(m_unk0x14, local24); if (local54 < 0.98) { delete[] local8; return -2; @@ -265,7 +265,7 @@ LegoS32 LegoWEGEdge::FUN_1009aea0() m_unk0x14[0] = local24[0]; m_unk0x14[1] = local24[1]; m_unk0x14[2] = local24[2]; - m_unk0x14[3] = -local8[i]->Dot(local8[i], &local24); + m_unk0x14[3] = -local8[i]->Dot(*local8[i], local24); localc = TRUE; } } diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 77567bfe93..350e31b7fe 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -4,6 +4,7 @@ #include "decomp.h" #include "legoweedge.h" #include "mxgeometry/mxgeometry3d.h" +#include "mxgeometry/mxgeometry4d.h" class LegoPathStruct; diff --git a/LEGO1/lego/sources/misc/legocontainer.h b/LEGO1/lego/sources/misc/legocontainer.h index 0fbcb3d544..72db33329f 100644 --- a/LEGO1/lego/sources/misc/legocontainer.h +++ b/LEGO1/lego/sources/misc/legocontainer.h @@ -57,7 +57,6 @@ class LegoContainer { } } - // FUNCTION: BETA10 0x1007bc00 T* Get(const char* p_name) { T* value = NULL; @@ -197,4 +196,7 @@ class LegoTextureContainer : public LegoContainer { // _Tree,map >::_Kfn,LegoContainerInfoComparator,allocator >::_Nil // clang-format on +// TEMPLATE: BETA10 0x1007bc00 +// LegoContainer::Get + #endif // LEGOCONTAINER_H diff --git a/LEGO1/lego/sources/misc/legostorage.h b/LEGO1/lego/sources/misc/legostorage.h index 5de7230325..553983fdd8 100644 --- a/LEGO1/lego/sources/misc/legostorage.h +++ b/LEGO1/lego/sources/misc/legostorage.h @@ -138,7 +138,7 @@ class LegoFile : public LegoStorage { const char* data = p_str.GetData(); LegoU32 fullLength = strlen(data); - LegoU16 limitedLength = fullLength; + LegoU16 limitedLength = (LegoU16) fullLength; Write(&limitedLength, sizeof(limitedLength)); Write((char*) data, (LegoS16) fullLength); diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index 12947446d2..d1af890d94 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -1,5 +1,7 @@ #include "legounknown.h" +#include "mxgeometry/mxmatrix.h" + DECOMP_SIZE_ASSERT(LegoUnknown, 0x50) // FUNCTION: LEGO1 0x1009a0f0 @@ -29,7 +31,7 @@ void LegoUnknown::FUN_1009a140(const Vector3& p_point1, Vector3& p_point2, Vecto // FUNCTION: LEGO1 0x1009a1e0 // FUNCTION: BETA10 0x10182d61 -LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, LegoU32 p_und) +LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, MxMatrix& p_mat, Vector3& p_v, LegoU32 p_und) { Vector3 v1(p_mat[3]); Vector3 v2(p_mat[0]); @@ -68,11 +70,11 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L return FAILURE; } - v2.EqualsCross(&p_v, &v4); + v2.EqualsCross(p_v, v4); if (v2.Unitize() != 0) { return FAILURE; } - v3.EqualsCross(&v4, &v2); + v3.EqualsCross(v4, v2); return SUCCESS; } diff --git a/LEGO1/lego/sources/misc/legounknown.h b/LEGO1/lego/sources/misc/legounknown.h index cc7a467bb0..5659feb713 100644 --- a/LEGO1/lego/sources/misc/legounknown.h +++ b/LEGO1/lego/sources/misc/legounknown.h @@ -4,7 +4,7 @@ #include "legotypes.h" #include "mxgeometry/mxgeometry3d.h" -class Matrix4; +class MxMatrix; // SIZE 0x50 class LegoUnknown { @@ -13,7 +13,7 @@ class LegoUnknown { ~LegoUnknown(); void FUN_1009a140(const Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4); - LegoResult FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, LegoU32 p_und); + LegoResult FUN_1009a1e0(float p_f1, MxMatrix& p_mat, Vector3& p_v, LegoU32 p_und); private: Mx3DPointFloat m_unk0x00[4]; // 0x00 diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 50a2611371..2c0bc7dee0 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -4,6 +4,7 @@ #include "legolod.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" +#include "mxgeometry/mxgeometry4d.h" #include "realtime/realtime.h" #include "shape/legobox.h" #include "shape/legosphere.h" @@ -626,13 +627,13 @@ LegoU32 LegoROI::FUN_100a9410( local38 *= 0.5f; local70 = localc0; - localc0.SetMatrixProduct(&local70, (float*) m_local2world.GetData()); + localc0.SetMatrixProduct(local70, (float*) m_local2world.GetData()); local70 = local9c; - local9c.SetMatrixProduct(&local70, (float*) m_local2world.GetData()); + local9c.SetMatrixProduct(local70, (float*) m_local2world.GetData()); local70 = local168; - local168.SetMatrixProduct(&local70, (float*) m_local2world.GetData()); + local168.SetMatrixProduct(local70, (float*) m_local2world.GetData()); p_v3 = m_local2world[3]; @@ -641,22 +642,22 @@ LegoU32 LegoROI::FUN_100a9410( local150[i] = m_local2world[i % 3]; if (i > 2) { - local150[i][3] = -local58.Dot(&local58, &local150[i]); + local150[i][3] = -local58.Dot(local58, local150[i]); } else { - local150[i][3] = -locala8.Dot(&locala8, &local150[i]); + local150[i][3] = -locala8.Dot(locala8, local150[i]); } - if (local150[i][3] + local38.Dot(&local38, &local150[i]) < 0.0f) { + if (local150[i][3] + local38.Dot(local38, local150[i]) < 0.0f) { local150[i] *= -1.0f; } } for (i = 0; i < 6; i++) { - float local50 = p_v2.Dot(&p_v2, &local150[i]); + float local50 = p_v2.Dot(p_v2, local150[i]); if (local50 >= 0.01 || local50 < -0.01) { - local50 = -((local150[i][3] + local4c.Dot(&local4c, &local150[i])) / local50); + local50 = -((local150[i][3] + local4c.Dot(local4c, local150[i])) / local50); if (local50 >= 0.0f && local50 <= p_f1) { Mx3DPointFloat local17c(p_v2); @@ -666,7 +667,7 @@ LegoU32 LegoROI::FUN_100a9410( LegoS32 j; for (j = 0; j < 6; j++) { if (i != j && i - j != 3 && j - i != 3) { - if (local150[j][3] + local17c.Dot(&local17c, &local150[j]) < 0.0f) { + if (local150[j][3] + local17c.Dot(local17c, local150[j]) < 0.0f) { break; } } @@ -684,9 +685,9 @@ LegoU32 LegoROI::FUN_100a9410( v1 -= GetWorldBoundingSphere().Center(); float local10 = GetWorldBoundingSphere().Radius(); - float local8 = p_v2.Dot(&p_v2, &p_v2); - float localc = p_v2.Dot(&p_v2, &v1) * 2.0f; - float local14 = v1.Dot(&v1, &v1) - (local10 * local10); + float local8 = p_v2.Dot(p_v2, p_v2); + float localc = p_v2.Dot(p_v2, v1) * 2.0f; + float local14 = v1.Dot(v1, v1) - (local10 * local10); if (local8 >= 0.001 || local8 <= -0.001) { float local1c = -1.0f; diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 34f6941cb4..d420ffc0ac 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -639,6 +639,15 @@ // GLOBAL: LEGO1 0x101028da // __OP_POWjmptab +// GLOBAL: LEGO1 0x1010292a +// __OP_LOG10jmptab + +// GLOBAL: LEGO1 0x1010294a +// __OP_LOGjmptab + +// GLOBAL: LEGO1 0x1010296a +// __OP_EXPjmptab + // GLOBAL: LEGO1 0x101095f8 // __crtheap @@ -675,6 +684,9 @@ // LIBRARY: BETA10 0x100f9a50 // _sin +// LIBRARY: BETA10 0x100f9a5a +// _cos + // LIBRARY: BETA10 0x100f95d0 // _sqrt diff --git a/LEGO1/library_smack.h b/LEGO1/library_smack.h index 8571011f82..0967aeabd0 100644 --- a/LEGO1/library_smack.h +++ b/LEGO1/library_smack.h @@ -12,6 +12,13 @@ // LIBRARY: BETA10 0x1015fe83 // _SmackDoFrameToBuffer +// LIBRARY: LEGO1 0x100cea58 +// LIBRARY: BETA10 0x10160e58 +// _SmackDoFrameToVESA + +// LIBRARY: LEGO1 0x100cfd90 +// _SmackDoPCM + // LIBRARY: LEGO1 0x100d052c // LIBRARY: BETA10 0x1016292c // _SmackGetSizeDeltas @@ -20,4 +27,7 @@ // LIBRARY: BETA10 0x10162943 // _SmackGetRect +// LIBRARY: LEGO1 0x100d0654 +// _SmackRemapTables + #endif diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index d7c19b7604..578d31b229 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -2,8 +2,7 @@ #define MXGEOMETRY3D_H #include "decomp.h" -#include "realtime/matrix.h" -#include "realtime/vector.h" +#include "realtime/vector3d.inl.h" // VTABLE: LEGO1 0x100d4488 // VTABLE: BETA10 0x101b84d0 @@ -53,199 +52,4 @@ class Mx3DPointFloat : public Vector3 { float m_elements[3]; // 0x08 }; -// VTABLE: LEGO1 0x100d41e8 -// VTABLE: BETA10 0x101bab78 -// SIZE 0x18 -class Mx4DPointFloat : public Vector4 { -public: - // FUNCTION: LEGO1 0x10048290 - // FUNCTION: BETA10 0x100484c0 - Mx4DPointFloat() : Vector4(m_elements) {} - - // FUNCTION: BETA10 0x10073bb0 - Mx4DPointFloat(float p_x, float p_y, float p_z, float p_a) : Vector4(m_elements) - { - m_elements[0] = p_x; - m_elements[1] = p_y; - m_elements[2] = p_z; - m_elements[3] = p_a; - } - - Mx4DPointFloat(const Mx4DPointFloat& p_other) : Vector4(m_elements) { EqualsImpl(p_other.m_data); } - - // FUNCTION: LEGO1 0x10003200 - virtual void operator=(const Vector4& p_impl) { EqualsImpl(p_impl.m_data); } // vtable+0x98 - - // FUNCTION: BETA10 0x1004af10 - float& operator[](int idx) { return m_data[idx]; } - - // According to the PDB, BETA10 will not link this one if it is never used - // const float& operator[](int idx) const { return m_data[idx]; } - - // only used by a couple of BETA10 functions for some unknown reason - // FUNCTION: BETA10 0x1001c950 - float& index_operator(int idx) { return m_data[idx]; } - - // SYNTHETIC: LEGO1 0x10064b20 - // SYNTHETIC: BETA10 0x10070420 - // ??4Mx4DPointFloat@@QAEAAV0@ABV0@@Z - -private: - float m_elements[4]; // 0x08 -}; - -// SIZE 0x34 -class UnknownMx4DPointFloat { -public: - enum { - c_bit1 = 0x01, - c_bit2 = 0x02 - }; - - UnknownMx4DPointFloat() : m_unk0x30(0) {} - - // FUNCTION: BETA10 0x1004a9b0 - void BETA_1004a9b0(Matrix4& p_m1, Matrix4& p_m2) - { - BETA_1004a9f0(p_m1); - FUN_10004620(p_m2); - } - - // FUNCTION: BETA10 0x1004a9f0 - void BETA_1004a9f0(Matrix4& p_m) - { - p_m.ToQuaternion(m_unk0x00); - m_unk0x30 |= c_bit1; - } - - // FUNCTION: LEGO1 0x10004620 - // FUNCTION: BETA10 0x1004aa30 - void FUN_10004620(Matrix4& p_m) - { - p_m.ToQuaternion(m_unk0x18); - m_unk0x30 |= c_bit2; - } - - // FUNCTION: BETA10 0x10180b80 - void BETA_10180b80(Vector4& p_v) - { - m_unk0x00 = p_v; - m_unk0x30 |= c_bit1; - } - - // FUNCTION: BETA10 0x10180bc0 - void BETA_10180bc0(Vector4& p_v) - { - m_unk0x18 = p_v; - m_unk0x30 |= c_bit2; - } - - const Vector4& GetUnknown0x00() const { return m_unk0x00; } - const Vector4& GetUnknown0x18() const { return m_unk0x18; } - undefined4 GetUnknown0x30() const { return m_unk0x30; } - - inline int BETA_1004aaa0(Matrix4& p_matrix, float p_f); - inline long FUN_10004520(); - -private: - inline int FUN_100040a0(Vector4& p_v, float p_f); - - Mx4DPointFloat m_unk0x00; // 0x00 - Mx4DPointFloat m_unk0x18; // 0x18 - undefined4 m_unk0x30; // 0x30 -}; - -// FUNCTION: BETA10 0x1004aaa0 -inline int UnknownMx4DPointFloat::BETA_1004aaa0(Matrix4& p_matrix, float p_f) -{ - float data[4]; - Vector4 v(data); - - if (FUN_100040a0(v, p_f) == 0) { - return p_matrix.FromQuaternion(v); - } - else { - return -1; - } -} - -// FUNCTION: LEGO1 0x10004520 -inline long UnknownMx4DPointFloat::FUN_10004520() -{ - if (!m_unk0x30) { - return -1; - } - - Mx4DPointFloat v1; - Mx4DPointFloat v2; - - v1 = m_unk0x00; - v1 += m_unk0x18; - - v2 = m_unk0x00; - v2 -= m_unk0x18; - - if (v1.Dot(&v1, &v1) < v2.Dot(&v2, &v2)) { - m_unk0x18 *= -1.0f; - } - - return 0; -} - -// FUNCTION: LEGO1 0x100040a0 -// FUNCTION: BETA10 0x1004ab10 -inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) -{ - if (m_unk0x30 == c_bit1) { - p_v = m_unk0x00; - p_v[3] = (1.0 - p_f) * acos((double) p_v[3]) * 2.0; - return p_v.NormalizeQuaternion(); - } - else if (m_unk0x30 == c_bit2) { - p_v = m_unk0x18; - p_v[3] = p_f * acos((double) p_v[3]) * 2.0; - return p_v.NormalizeQuaternion(); - } - else if (m_unk0x30 == (c_bit1 | c_bit2)) { - int i; - double d1 = p_v.Dot(&m_unk0x00, &m_unk0x18); - double a; - double b; - - if (d1 + 1.0 > 0.00001) { - if (1.0 - d1 > 0.00001) { - double d2 = acos(d1); - double denominator = sin(d2); - a = sin((1.0 - p_f) * d2) / denominator; - b = sin(p_f * d2) / denominator; - } - else { - a = 1.0 - p_f; - b = p_f; - } - - for (i = 0; i < 4; i++) { - p_v[i] = m_unk0x00[i] * a + m_unk0x18[i] * b; - } - } - else { - p_v[0] = -m_unk0x00[1]; - p_v[1] = m_unk0x00[0]; - p_v[2] = -m_unk0x00[3]; - p_v[3] = m_unk0x00[2]; - a = sin((1.0 - p_f) * 1.570796326794895); - b = sin(p_f * 1.570796326794895); - - for (i = 0; i < 3; i++) { - p_v[i] = m_unk0x00[i] * a + p_v[i] * b; - } - } - - return 0; - } - else { - return -1; - } -} - #endif // MXGEOMETRY3D_H diff --git a/LEGO1/mxgeometry/mxgeometry4d.h b/LEGO1/mxgeometry/mxgeometry4d.h new file mode 100644 index 0000000000..4ebeeb5a53 --- /dev/null +++ b/LEGO1/mxgeometry/mxgeometry4d.h @@ -0,0 +1,48 @@ +#ifndef MXGEOMETRY4D_H +#define MXGEOMETRY4D_H + +#include "decomp.h" +#include "realtime/vector4d.inl.h" + +// VTABLE: LEGO1 0x100d41e8 +// VTABLE: BETA10 0x101bab78 +// SIZE 0x18 +class Mx4DPointFloat : public Vector4 { +public: + // FUNCTION: LEGO1 0x10048290 + // FUNCTION: BETA10 0x100484c0 + Mx4DPointFloat() : Vector4(m_elements) {} + + // FUNCTION: BETA10 0x10073bb0 + Mx4DPointFloat(float p_x, float p_y, float p_z, float p_a) : Vector4(m_elements) + { + m_elements[0] = p_x; + m_elements[1] = p_y; + m_elements[2] = p_z; + m_elements[3] = p_a; + } + + Mx4DPointFloat(const Mx4DPointFloat& p_other) : Vector4(m_elements) { EqualsImpl(p_other.m_data); } + + // FUNCTION: LEGO1 0x10003200 + virtual void operator=(const Vector4& p_impl) { EqualsImpl(p_impl.m_data); } // vtable+0x98 + + // FUNCTION: BETA10 0x1004af10 + float& operator[](int idx) { return m_data[idx]; } + + // According to the PDB, BETA10 will not link this one if it is never used + // const float& operator[](int idx) const { return m_data[idx]; } + + // only used by a couple of BETA10 functions for some unknown reason + // FUNCTION: BETA10 0x1001c950 + float& index_operator(int idx) { return m_data[idx]; } + + // SYNTHETIC: LEGO1 0x10064b20 + // SYNTHETIC: BETA10 0x10070420 + // ??4Mx4DPointFloat@@QAEAAV0@ABV0@@Z + +private: + float m_elements[4]; // 0x08 +}; + +#endif // MXGEOMETRY4D_H diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index 9f1aa59fe3..a31a5d4efb 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -1,7 +1,7 @@ #ifndef MXMATRIX_H #define MXMATRIX_H -#include "realtime/matrix.h" +#include "realtime/matrix4d.inl.h" // VTABLE: LEGO1 0x100d4300 // VTABLE: BETA10 0x101b82e0 @@ -35,4 +35,9 @@ class MxMatrix : public Matrix4 { float m_elements[4][4]; // 0x08 }; +// Must be included here (not before MxMatrix) for correct ordering in binary. +// FromQuaternion and ToQuaternion in Matrix4 depend on Vector4. +// There's a chance they included mxgeometry4d.h after including this somewhere. +#include "realtime/vector4d.inl.h" + #endif // MXMATRIX_H diff --git a/LEGO1/mxgeometry/mxquaternion.h b/LEGO1/mxgeometry/mxquaternion.h new file mode 100644 index 0000000000..a5fb006b9c --- /dev/null +++ b/LEGO1/mxgeometry/mxquaternion.h @@ -0,0 +1,165 @@ +#ifndef MXQUATERNION_H +#define MXQUATERNION_H + +#include "mxgeometry4d.h" + +// SIZE 0x34 +class MxQuaternionTransformer { +public: + enum { + c_startSet = 0x01, + c_endSet = 0x02 + }; + + MxQuaternionTransformer() : m_flags(0) {} + + inline long NormalizeDirection(); + inline void SetStartEnd(Matrix4& p_m1, Matrix4& p_m2); + inline void SetStart(Matrix4& p_m); + inline void SetEnd(Matrix4& p_m); + inline void SetStart(Vector4& p_v); + inline void SetEnd(Vector4& p_v); + inline int InterpolateToMatrix(Matrix4& p_matrix, float p_f); + + const Vector4& GetStartQuat() const { return m_startQuat; } + const Vector4& GetEndQuat() const { return m_endQuat; } + undefined4 GetFlags() const { return m_flags; } + +private: + inline int Interpolate(Vector4& p_v, float p_f); + + Mx4DPointFloat m_startQuat; // 0x00 + Mx4DPointFloat m_endQuat; // 0x18 + MxU32 m_flags; // 0x30 +}; + +// FUNCTION: LEGO1 0x10004520 +long MxQuaternionTransformer::NormalizeDirection() +{ + if (!m_flags) { + return -1; + } + + Mx4DPointFloat v1; + Mx4DPointFloat v2; + + v1 = m_startQuat; + v1 += m_endQuat; + + v2 = m_startQuat; + v2 -= m_endQuat; + + if (v1.Dot(v1, v1) < v2.Dot(v2, v2)) { + m_endQuat *= -1.0f; + } + + return 0; +} + +// FUNCTION: BETA10 0x1004a9b0 +void MxQuaternionTransformer::SetStartEnd(Matrix4& p_m1, Matrix4& p_m2) +{ + SetStart(p_m1); + SetEnd(p_m2); +} + +// FUNCTION: BETA10 0x1004a9f0 +void MxQuaternionTransformer::SetStart(Matrix4& p_m) +{ + p_m.ToQuaternion(m_startQuat); + m_flags |= c_startSet; +} + +// FUNCTION: LEGO1 0x10004620 +// FUNCTION: BETA10 0x1004aa30 +void MxQuaternionTransformer::SetEnd(Matrix4& p_m) +{ + p_m.ToQuaternion(m_endQuat); + m_flags |= c_endSet; +} + +// FUNCTION: BETA10 0x10180b80 +void MxQuaternionTransformer::SetStart(Vector4& p_v) +{ + m_startQuat = p_v; + m_flags |= c_startSet; +} + +// FUNCTION: BETA10 0x10180bc0 +void MxQuaternionTransformer::SetEnd(Vector4& p_v) +{ + m_endQuat = p_v; + m_flags |= c_endSet; +} + +// FUNCTION: BETA10 0x1004aaa0 +int MxQuaternionTransformer::InterpolateToMatrix(Matrix4& p_matrix, float p_f) +{ + float data[4]; + Vector4 v(data); + + if (Interpolate(v, p_f) == 0) { + return p_matrix.FromQuaternion(v); + } + + return -1; +} + +// FUNCTION: LEGO1 0x100040a0 +// FUNCTION: BETA10 0x1004ab10 +int MxQuaternionTransformer::Interpolate(Vector4& p_v, float p_f) +{ + if (m_flags == c_startSet) { + p_v = m_startQuat; + p_v[3] = (float) ((1.0 - p_f) * acos((double) p_v[3]) * 2.0); + return p_v.NormalizeQuaternion(); + } + + if (m_flags == c_endSet) { + p_v = m_endQuat; + p_v[3] = (float) (p_f * acos((double) p_v[3]) * 2.0); + return p_v.NormalizeQuaternion(); + } + + if (m_flags == (c_startSet | c_endSet)) { + int i; + double d1 = p_v.Dot(m_startQuat, m_endQuat); + double a; + double b; + + if (d1 + 1.0 > 0.00001) { + if (1.0 - d1 > 0.00001) { + double d2 = acos(d1); + double denominator = sin(d2); + a = sin((1.0 - p_f) * d2) / denominator; + b = sin(p_f * d2) / denominator; + } + else { + a = 1.0 - p_f; + b = p_f; + } + + for (i = 0; i < 4; i++) { + p_v[i] = (float) (m_startQuat[i] * a + m_endQuat[i] * b); + } + } + else { + p_v[0] = -m_startQuat[1]; + p_v[1] = m_startQuat[0]; + p_v[2] = -m_startQuat[3]; + p_v[3] = m_startQuat[2]; + a = sin((1.0 - p_f) * 1.570796326794895); + b = sin(p_f * 1.570796326794895); + + for (i = 0; i < 3; i++) { + p_v[i] = (float) (m_startQuat[i] * a + p_v[i] * b); + } + } + + return 0; + } + + return -1; +} + +#endif // MXQUATERNION_H diff --git a/LEGO1/omni/include/mxaudiopresenter.h b/LEGO1/omni/include/mxaudiopresenter.h index ec73e3366d..67c8cf940c 100644 --- a/LEGO1/omni/include/mxaudiopresenter.h +++ b/LEGO1/omni/include/mxaudiopresenter.h @@ -10,6 +10,12 @@ class MxAudioPresenter : public MxMediaPresenter { public: MxAudioPresenter() { m_volume = 100; } + // FUNCTION: LEGO1 0x1000d260 + virtual MxS32 GetVolume() { return m_volume; } // vtable+0x5c + + // FUNCTION: LEGO1 0x1000d270 + virtual void SetVolume(MxS32 p_volume) { m_volume = p_volume; } // vtable+0x60 + // FUNCTION: BETA10 0x1008cba0 static const char* HandlerClassName() { @@ -30,12 +36,6 @@ class MxAudioPresenter : public MxMediaPresenter { return !strcmp(p_name, MxAudioPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); } - // FUNCTION: LEGO1 0x1000d260 - virtual MxS32 GetVolume() { return m_volume; } // vtable+0x5c - - // FUNCTION: LEGO1 0x1000d270 - virtual void SetVolume(MxS32 p_volume) { m_volume = p_volume; } // vtable+0x60 - protected: MxS32 m_volume; // 0x50 }; diff --git a/LEGO1/omni/include/mxbitmap.h b/LEGO1/omni/include/mxbitmap.h index 5df4c8baba..da42e3c32a 100644 --- a/LEGO1/omni/include/mxbitmap.h +++ b/LEGO1/omni/include/mxbitmap.h @@ -90,7 +90,7 @@ class MxBitmap : public MxCore { // DECOMP: This could be a free function. It is static here because it has no // reference to "this". In the beta it is called in two places: // 1. GetBmiHeightAbs - // 2. MxSmack::LoadFrame + // 2. MxSmk::LoadFrame // FUNCTION: BETA10 0x1002c690 static MxLong HeightAbs(MxLong p_value) { return p_value > 0 ? p_value : -p_value; } diff --git a/LEGO1/omni/include/mxdiskstreamcontroller.h b/LEGO1/omni/include/mxdiskstreamcontroller.h index d2950e490a..6bf7c41858 100644 --- a/LEGO1/omni/include/mxdiskstreamcontroller.h +++ b/LEGO1/omni/include/mxdiskstreamcontroller.h @@ -97,4 +97,7 @@ class MxDiskStreamController : public MxStreamController { // TEMPLATE: BETA10 0x10150e60 // MxUtilityList::PushBack +// TEMPLATE: BETA10 0x10150ff0 +// MxUtilityList::PushBack + #endif // MXDISKSTREAMCONTROLLER_H diff --git a/LEGO1/omni/include/mxdsbuffer.h b/LEGO1/omni/include/mxdsbuffer.h index 2e48e88769..a988ca57c9 100644 --- a/LEGO1/omni/include/mxdsbuffer.h +++ b/LEGO1/omni/include/mxdsbuffer.h @@ -68,7 +68,7 @@ class MxDSBuffer : public MxCore { // FUNCTION: BETA10 0x10148c60 MxU8* GetBuffer() { return m_pBuffer; } - MxU8** GetBufferRef() { return &m_pBuffer; } + // FUNCTION: BETA10 0x10164240 undefined4 GetUnknown14() { return m_unk0x14; } // FUNCTION: BETA10 0x10156420 @@ -85,7 +85,10 @@ class MxDSBuffer : public MxCore { void SetUnknown14(undefined4 p_unk0x14) { m_unk0x14 = p_unk0x14; } void SetUnknown1c(undefined4 p_unk0x1c) { m_unk0x1c = p_unk0x1c; } + + // FUNCTION: BETA10 0x10164260 void SetMode(Type p_mode) { m_mode = p_mode; } + void SetUnk30(MxDSStreamingAction* p_unk0x30) { m_unk0x30 = p_unk0x30; } // SYNTHETIC: LEGO1 0x100c6510 diff --git a/LEGO1/omni/include/mxdschunk.h b/LEGO1/omni/include/mxdschunk.h index af41394a19..d3fa7e5a8f 100644 --- a/LEGO1/omni/include/mxdschunk.h +++ b/LEGO1/omni/include/mxdschunk.h @@ -35,10 +35,12 @@ class MxDSChunk : public MxCore { } static MxU32 GetHeaderSize(); - static MxU32* IntoType(MxU8* p_buffer) { return (MxU32*) p_buffer; } - static MxU32* IntoLength(MxU8* p_buffer) { return (MxU32*) (p_buffer + 4); } - static MxU32 Size(MxU32 p_dataSize) { return (p_dataSize & 1) + p_dataSize + 8; } - static MxU8* End(MxU8* p_buffer) { return p_buffer + Size(*IntoLength(p_buffer)); } + + // FUNCTION: BETA10 0x101641f0 + static MxU32 Size(MxU8* p_buffer) { return (*(MxU32*) (p_buffer + 4) & 1) + *(MxU32*) (p_buffer + 4) + 8; } + + // FUNCTION: BETA10 0x10164220 + static MxU8* End(MxU8* p_buffer) { return p_buffer + Size(p_buffer); } void SetChunkFlags(MxU16 p_flags) { m_flags = p_flags; } void SetObjectId(undefined4 p_objectid) { m_objectId = p_objectid; } diff --git a/LEGO1/omni/include/mxdsstreamingaction.h b/LEGO1/omni/include/mxdsstreamingaction.h index dc1c88154a..96be50e522 100644 --- a/LEGO1/omni/include/mxdsstreamingaction.h +++ b/LEGO1/omni/include/mxdsstreamingaction.h @@ -6,6 +6,7 @@ class MxDSBuffer; // VTABLE: LEGO1 0x100dd088 +// VTABLE: BETA10 0x101c2850 // SIZE 0xb4 class MxDSStreamingAction : public MxDSAction { public: @@ -14,40 +15,53 @@ class MxDSStreamingAction : public MxDSAction { ~MxDSStreamingAction() override; MxDSStreamingAction* CopyFrom(MxDSStreamingAction& p_dsStreamingAction); - MxDSStreamingAction& operator=(MxDSAction& p_dsAction) - { - MxDSAction::operator=(p_dsAction); - return *this; - } - MxDSStreamingAction& operator=(MxDSStreamingAction& p_dsStreamingAction) - { - MxDSAction::operator=(p_dsStreamingAction); - return *this; - } - - MxBool HasId(MxU32 p_objectId) override; // vtable+34; - - MxResult Init(); + + MxBool HasId(MxU32 p_objectId) override; // vtable+0x34; + + void Init(); void SetInternalAction(MxDSAction* p_dsAction); void FUN_100cd2d0(); + // FUNCTION: BETA10 0x10156530 MxU32 GetUnknown94() { return m_unk0x94; } + + // FUNCTION: BETA10 0x10156380 MxS32 GetUnknown9c() { return m_unk0x9c; } + + // FUNCTION: BETA10 0x10156630 MxDSBuffer* GetUnknowna0() { return m_unk0xa0; } + + // FUNCTION: BETA10 0x101563d0 MxDSBuffer* GetUnknowna4() { return m_unk0xa4; } + + // FUNCTION: BETA10 0x10159190 MxLong GetUnknowna8() { return m_unk0xa8; } + MxDSAction* GetInternalAction() { return m_internalAction; } + + // FUNCTION: BETA10 0x10156580 MxU32 GetBufferOffset() { return m_bufferOffset; } + + // FUNCTION: BETA10 0x10156550 void SetUnknown94(MxU32 p_unk0x94) { m_unk0x94 = p_unk0x94; } + + // FUNCTION: BETA10 0x101563a0 void SetUnknown9c(MxS32 p_unk0x9c) { m_unk0x9c = p_unk0x9c; } + + // FUNCTION: BETA10 0x10156470 void SetUnknowna0(MxDSBuffer* p_unk0xa0) { m_unk0xa0 = p_unk0xa0; } + + // FUNCTION: BETA10 0x101563f0 void SetUnknowna4(MxDSBuffer* p_unk0xa4) { m_unk0xa4 = p_unk0xa4; } + + // FUNCTION: BETA10 0x10151150 void SetBufferOffset(MxU32 p_bufferOffset) { m_bufferOffset = p_bufferOffset; } // FUNCTION: BETA10 0x10156650 void ClearUnknowna0() { m_unk0xa0 = NULL; } // SYNTHETIC: LEGO1 0x100cd0b0 + // SYNTHETIC: BETA10 0x101565f0 // MxDSStreamingAction::`scalar deleting destructor' private: diff --git a/LEGO1/omni/include/mxio.h b/LEGO1/omni/include/mxio.h index 64461d6a33..08fa831e84 100644 --- a/LEGO1/omni/include/mxio.h +++ b/LEGO1/omni/include/mxio.h @@ -29,6 +29,7 @@ class MXIOINFO { MxU16 Advance(MxU16); MxU16 Descend(MMCKINFO*, const MMCKINFO*, MxU16); MxU16 Ascend(MMCKINFO*, MxU16); + MxU16 CreateChunk(MMCKINFO* p_chunkInfo, MxU16 p_create); // NOTE: In MXIOINFO, the `hmmio` member of MMIOINFO is used like // an HFILE (int) instead of an HMMIO (WORD). diff --git a/LEGO1/omni/include/mxmediapresenter.h b/LEGO1/omni/include/mxmediapresenter.h index 40bb096193..3cfee4bd85 100644 --- a/LEGO1/omni/include/mxmediapresenter.h +++ b/LEGO1/omni/include/mxmediapresenter.h @@ -16,6 +16,9 @@ class MxMediaPresenter : public MxPresenter { // FUNCTION: LEGO1 0x1000c550 ~MxMediaPresenter() override { Destroy(TRUE); } + // FUNCTION: LEGO1 0x1000c5b0 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 + MxResult Tickle() override; // vtable+0x08 // FUNCTION: BETA10 0x10054f50 @@ -42,9 +45,6 @@ class MxMediaPresenter : public MxPresenter { void RepeatingTickle() override; // vtable+0x24 void DoneTickle() override; // vtable+0x2c - // FUNCTION: LEGO1 0x1000c5b0 - void Destroy() override { Destroy(FALSE); } // vtable+0x38 - MxResult StartAction(MxStreamController*, MxDSAction*) override; // vtable+0x3c void EndAction() override; // vtable+0x40 void Enable(MxBool p_enable) override; // vtable+0x54 diff --git a/LEGO1/omni/include/mxpresenter.h b/LEGO1/omni/include/mxpresenter.h index 3358c832f3..3af93fd00f 100644 --- a/LEGO1/omni/include/mxpresenter.h +++ b/LEGO1/omni/include/mxpresenter.h @@ -28,31 +28,8 @@ class MxPresenter : public MxCore { MxPresenter() { Init(); } - // FUNCTION: LEGO1 0x1000bf00 - ~MxPresenter() override {} // vtable+0x00 - MxResult Tickle() override; // vtable+0x08 - // FUNCTION: BETA10 0x1004d9e0 - static const char* HandlerClassName() - { - // STRING: LEGO1 0x100f0740 - return "MxPresenter"; - } - - // FUNCTION: LEGO1 0x1000bfe0 - // FUNCTION: BETA10 0x1004d9b0 - const char* ClassName() const override // vtable+0x0c - { - return HandlerClassName(); - } - - // FUNCTION: LEGO1 0x1000bff0 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, MxPresenter::ClassName()) || MxCore::IsA(p_name); - } - // FUNCTION: LEGO1 0x1000be30 virtual void VTable0x14() {} // vtable+0x14 @@ -88,6 +65,9 @@ class MxPresenter : public MxCore { } public: + // FUNCTION: LEGO1 0x1000bf00 + ~MxPresenter() override {} // vtable+0x00 + // FUNCTION: LEGO1 0x1000bf70 virtual MxResult AddToManager() { return SUCCESS; } // vtable+0x34 @@ -115,6 +95,26 @@ class MxPresenter : public MxCore { virtual void Enable(MxBool p_enable); // vtable+0x54 + // FUNCTION: BETA10 0x1004d9e0 + static const char* HandlerClassName() + { + // STRING: LEGO1 0x100f0740 + return "MxPresenter"; + } + + // FUNCTION: LEGO1 0x1000bfe0 + // FUNCTION: BETA10 0x1004d9b0 + const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + + // FUNCTION: LEGO1 0x1000bff0 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, MxPresenter::ClassName()) || MxCore::IsA(p_name); + } + MxEntity* CreateEntity(const char* p_defaultName); void SendToCompositePresenter(MxOmni* p_omni); MxBool IsEnabled(); diff --git a/LEGO1/omni/include/mxsmack.h b/LEGO1/omni/include/mxsmk.h similarity index 85% rename from LEGO1/omni/include/mxsmack.h rename to LEGO1/omni/include/mxsmk.h index e7fdf3ce2b..ec611f978d 100644 --- a/LEGO1/omni/include/mxsmack.h +++ b/LEGO1/omni/include/mxsmk.h @@ -1,5 +1,5 @@ -#ifndef MXSMACK_H -#define MXSMACK_H +#ifndef MXSMK_H +#define MXSMK_H #include "decomp.h" #include "mxrectlist.h" @@ -28,7 +28,7 @@ extern "C" } // SIZE 0x6b8 -struct MxSmack { +struct MxSmk { SmackTag m_smackTag; // 0x00 undefined m_unk0x390[784]; // 0x390 MxU32* m_frameSizes; // 0x6a0 @@ -38,12 +38,12 @@ struct MxSmack { MxU32 m_maxFrameSize; // 0x6b0 MxU8* m_unk0x6b4; // 0x6b4 - static MxResult LoadHeader(MxU8* p_data, MxSmack* p_mxSmack); - static void Destroy(MxSmack* p_mxSmack); + static MxResult LoadHeader(MxU8* p_data, MxSmk* p_mxSmk); + static void Destroy(MxSmk* p_mxSmk); static MxResult LoadFrame( MxBITMAPINFO* p_bitmapInfo, MxU8* p_bitmapData, - MxSmack* p_mxSmack, + MxSmk* p_mxSmk, MxU8* p_chunkData, MxBool p_paletteChanged, MxRectList* p_list @@ -51,4 +51,4 @@ struct MxSmack { static MxBool GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect32* p_rect); }; -#endif // MXSMACK_H +#endif // MXSMK_H diff --git a/LEGO1/omni/include/mxsmkpresenter.h b/LEGO1/omni/include/mxsmkpresenter.h index 01b6744df1..53f7831fbe 100644 --- a/LEGO1/omni/include/mxsmkpresenter.h +++ b/LEGO1/omni/include/mxsmkpresenter.h @@ -2,7 +2,7 @@ #define MXSMKPRESENTER_H #include "decomp.h" -#include "mxsmack.h" +#include "mxsmk.h" #include "mxvideopresenter.h" // VTABLE: LEGO1 0x100dc348 @@ -48,7 +48,7 @@ class MxSmkPresenter : public MxVideoPresenter { void Destroy(MxBool p_fromDestructor); protected: - MxSmack m_mxSmack; // 0x64 + MxSmk m_mxSmk; // 0x64 MxU32 m_currentFrame; // 0x71c }; diff --git a/LEGO1/omni/include/mxsoundpresenter.h b/LEGO1/omni/include/mxsoundpresenter.h index e2d80e3dfd..041b8a17d3 100644 --- a/LEGO1/omni/include/mxsoundpresenter.h +++ b/LEGO1/omni/include/mxsoundpresenter.h @@ -10,6 +10,9 @@ class MxSoundPresenter : public MxAudioPresenter { // FUNCTION: LEGO1 0x1000d430 ~MxSoundPresenter() override { Destroy(TRUE); } + // FUNCTION: LEGO1 0x1000d490 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 + // FUNCTION: BETA10 0x1008ca70 static const char* HandlerClassName() { @@ -32,9 +35,6 @@ class MxSoundPresenter : public MxAudioPresenter { MxResult AddToManager() override; // vtable+0x34 - // FUNCTION: LEGO1 0x1000d490 - void Destroy() override { Destroy(FALSE); } // vtable+0x38 - // SYNTHETIC: LEGO1 0x1000d5c0 // MxSoundPresenter::`scalar deleting destructor' diff --git a/LEGO1/omni/include/mxstreamcontroller.h b/LEGO1/omni/include/mxstreamcontroller.h index d0328908ee..907b99f86e 100644 --- a/LEGO1/omni/include/mxstreamcontroller.h +++ b/LEGO1/omni/include/mxstreamcontroller.h @@ -74,14 +74,14 @@ class MxStreamController : public MxCore { MxStreamProvider* GetProvider() { return m_provider; } MxDSObjectList& GetUnk0x3c() { return m_unk0x3c; } MxDSObjectList& GetUnk0x54() { return m_unk0x54; } - MxDSSubscriberList& GetSubscriberList() { return m_subscriberList; } + MxDSSubscriberList& GetSubscriberList() { return m_subscribers; } protected: MxCriticalSection m_criticalSection; // 0x08 MxAtomId m_atom; // 0x24 MxStreamProvider* m_provider; // 0x28 undefined4* m_unk0x2c; // 0x2c - MxDSSubscriberList m_subscriberList; // 0x30 + MxDSSubscriberList m_subscribers; // 0x30 MxDSObjectList m_unk0x3c; // 0x3c MxNextActionDataStartList m_nextActionList; // 0x48 MxDSObjectList m_unk0x54; // 0x54 @@ -138,4 +138,10 @@ class MxStreamController : public MxCore { // TEMPLATE: LEGO1 0x100c1bc0 // list >::insert +// TEMPLATE: BETA10 0x10150b90 +// MxUtilityList::PushBack + +// TEMPLATE: BETA10 0x10150cf0 +// MxUtilityList::Remove + #endif // MXSTREAMCONTROLLER_H diff --git a/LEGO1/omni/include/mxutilitylist.h b/LEGO1/omni/include/mxutilitylist.h index eec3958ef2..7a00f92a4a 100644 --- a/LEGO1/omni/include/mxutilitylist.h +++ b/LEGO1/omni/include/mxutilitylist.h @@ -21,6 +21,7 @@ class MxUtilityList : public list { // Note: does not take a reference void PushBack(T p_obj) { this->push_back(p_obj); } + void Remove(T p_obj) { this->remove(p_obj); } }; #endif // MXUTILITYLIST_H diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 30d6535468..907ddc0e54 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -14,43 +14,6 @@ class MxVideoPresenter : public MxMediaPresenter { public: MxVideoPresenter() { Init(); } - // FUNCTION: LEGO1 0x1000c740 - ~MxVideoPresenter() override { Destroy(TRUE); } // vtable+0x00 - - // FUNCTION: BETA10 0x100551b0 - static const char* HandlerClassName() - { - // STRING: LEGO1 0x100f0760 - return "MxVideoPresenter"; - } - - // FUNCTION: LEGO1 0x1000c820 - // FUNCTION: BETA10 0x10055180 - const char* ClassName() const override // vtable+0x0c - { - return HandlerClassName(); - } - - // FUNCTION: LEGO1 0x1000c830 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, MxVideoPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); - } - - void ReadyTickle() override; // vtable+0x18 - void StartingTickle() override; // vtable+0x1c - void StreamingTickle() override; // vtable+0x20 - void RepeatingTickle() override; // vtable+0x24 - void FreezingTickle() override; // vtable+0x28 - MxResult AddToManager() override; // vtable+0x34 - - // FUNCTION: LEGO1 0x1000c7a0 - void Destroy() override { Destroy(FALSE); } // vtable+0x38 - - void EndAction() override; // vtable+0x40 - MxResult PutData() override; // vtable+0x4c - MxBool IsHit(MxS32 p_x, MxS32 p_y) override; // vtable+0x50 - // FUNCTION: LEGO1 0x1000c700 // FUNCTION: BETA10 0x10054a80 virtual void LoadHeader(MxStreamChunk* p_chunk) {} // vtable+0x5c @@ -72,6 +35,12 @@ class MxVideoPresenter : public MxMediaPresenter { virtual undefined VTable0x74(); // vtable+0x74 + // FUNCTION: LEGO1 0x1000c740 + ~MxVideoPresenter() override { Destroy(TRUE); } // vtable+0x00 + + // FUNCTION: LEGO1 0x1000c7a0 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 + // FUNCTION: LEGO1 0x1000c7b0 virtual LPDIRECTDRAWSURFACE VTable0x78() { return m_unk0x58; } // vtable+0x78 @@ -84,6 +53,36 @@ class MxVideoPresenter : public MxMediaPresenter { // FUNCTION: LEGO1 0x1000c800 virtual MxS32 GetHeight() { return m_alpha ? m_alpha->m_height : m_frameBitmap->GetBmiHeightAbs(); } // vtable+0x84 + // FUNCTION: BETA10 0x100551b0 + static const char* HandlerClassName() + { + // STRING: LEGO1 0x100f0760 + return "MxVideoPresenter"; + } + + // FUNCTION: LEGO1 0x1000c820 + // FUNCTION: BETA10 0x10055180 + const char* ClassName() const override // vtable+0x0c + { + return HandlerClassName(); + } + + // FUNCTION: LEGO1 0x1000c830 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, MxVideoPresenter::ClassName()) || MxMediaPresenter::IsA(p_name); + } + + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void RepeatingTickle() override; // vtable+0x24 + void FreezingTickle() override; // vtable+0x28 + MxResult AddToManager() override; // vtable+0x34 + void EndAction() override; // vtable+0x40 + MxResult PutData() override; // vtable+0x4c + MxBool IsHit(MxS32 p_x, MxS32 p_y) override; // vtable+0x50 + // VTABLE: LEGO1 0x100dc2bc // SIZE 0x0c struct AlphaMask { diff --git a/LEGO1/omni/include/mxwavepresenter.h b/LEGO1/omni/include/mxwavepresenter.h index d0fedb059a..cf64b90f7f 100644 --- a/LEGO1/omni/include/mxwavepresenter.h +++ b/LEGO1/omni/include/mxwavepresenter.h @@ -15,6 +15,15 @@ class MxWavePresenter : public MxSoundPresenter { // FUNCTION: LEGO1 0x1000d640 ~MxWavePresenter() override { Destroy(TRUE); } // vtable+0x00 + // FUNCTION: LEGO1 0x1000d6a0 + void Destroy() override { Destroy(FALSE); } // vtable+0x38 + + virtual void Pause(); // vtable+0x64 + virtual void Resume(); // vtable+0x68 + + // FUNCTION: LEGO1 0x1000d6b0 + virtual MxBool IsPaused() { return m_paused; } // vtable+0x6c + // FUNCTION: BETA10 0x1008cd00 static const char* HandlerClassName() { @@ -35,26 +44,17 @@ class MxWavePresenter : public MxSoundPresenter { return !strcmp(p_name, MxWavePresenter::ClassName()) || MxSoundPresenter::IsA(p_name); } - void ReadyTickle() override; // vtable+0x18 - void StartingTickle() override; // vtable+0x1c - void StreamingTickle() override; // vtable+0x20 - void DoneTickle() override; // vtable+0x2c - void ParseExtra() override; // vtable+0x30 - MxResult AddToManager() override; // vtable+0x34 - - // FUNCTION: LEGO1 0x1000d6a0 - void Destroy() override { Destroy(FALSE); } // vtable+0x38 - + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 void EndAction() override; // vtable+0x40 MxResult PutData() override; // vtable+0x4c void Enable(MxBool p_enable) override; // vtable+0x54 void LoopChunk(MxStreamChunk* p_chunk) override; // vtable+0x58 void SetVolume(MxS32 p_volume) override; // vtable+0x60 - virtual void Pause(); // vtable+0x64 - virtual void Resume(); // vtable+0x68 - - // FUNCTION: LEGO1 0x1000d6b0 - virtual MxBool IsPaused() { return m_paused; } // vtable+0x6c // SIZE 0x18 struct WaveFormat { diff --git a/LEGO1/omni/src/action/mxdsstreamingaction.cpp b/LEGO1/omni/src/action/mxdsstreamingaction.cpp index 8575989798..939cd5e388 100644 --- a/LEGO1/omni/src/action/mxdsstreamingaction.cpp +++ b/LEGO1/omni/src/action/mxdsstreamingaction.cpp @@ -5,25 +5,25 @@ DECOMP_SIZE_ASSERT(MxDSStreamingAction, 0xb4) // FUNCTION: LEGO1 0x100cd010 +// FUNCTION: BETA10 0x1015f380 MxDSStreamingAction::MxDSStreamingAction(MxDSAction& p_dsAction, MxU32 p_offset) { Init(); - *this = p_dsAction; - this->m_unk0x94 = p_offset; - this->m_bufferOffset = p_offset; + MxDSAction::operator=(p_dsAction); + m_unk0x94 = p_offset; + m_bufferOffset = p_offset; } // FUNCTION: LEGO1 0x100cd090 +// FUNCTION: BETA10 0x101565a0 MxBool MxDSStreamingAction::HasId(MxU32 p_objectId) { - if (this->m_internalAction) { - return this->m_internalAction->HasId(p_objectId); - } - return FALSE; + return m_internalAction ? m_internalAction->HasId(p_objectId) : FALSE; } // FUNCTION: LEGO1 0x100cd0d0 +// FUNCTION: BETA10 0x101564a0 MxDSStreamingAction::MxDSStreamingAction(MxDSStreamingAction& p_dsStreamingAction) { Init(); @@ -31,68 +31,71 @@ MxDSStreamingAction::MxDSStreamingAction(MxDSStreamingAction& p_dsStreamingActio } // FUNCTION: LEGO1 0x100cd150 +// FUNCTION: BETA10 0x1015f41d MxDSStreamingAction::~MxDSStreamingAction() { - if (this->m_unk0xa0) { - delete this->m_unk0xa0; + if (m_unk0xa0) { + delete m_unk0xa0; } - if (this->m_unk0xa4) { - delete this->m_unk0xa4; + if (m_unk0xa4) { + delete m_unk0xa4; } - if (this->m_internalAction) { - delete this->m_internalAction; + if (m_internalAction) { + delete m_internalAction; } } // FUNCTION: LEGO1 0x100cd1e0 -MxResult MxDSStreamingAction::Init() +// FUNCTION: BETA10 0x1015f53c +void MxDSStreamingAction::Init() { - this->m_unk0x94 = 0; - this->m_bufferOffset = 0; - this->m_unk0x9c = 0; - this->m_unk0xa0 = NULL; - this->m_unk0xa4 = NULL; - this->m_unk0xa8 = 0; - this->m_unk0xac = 2; - this->m_internalAction = NULL; - return SUCCESS; + m_unk0x94 = 0; + m_bufferOffset = 0; + m_unk0x9c = 0; + m_unk0xa0 = NULL; + m_unk0xa4 = NULL; + m_unk0xa8 = 0; + m_unk0xac = 2; + m_internalAction = NULL; } // FUNCTION: LEGO1 0x100cd220 +// FUNCTION: BETA10 0x1015f5b9 MxDSStreamingAction* MxDSStreamingAction::CopyFrom(MxDSStreamingAction& p_dsStreamingAction) { - *this = p_dsStreamingAction; - this->m_unk0x94 = p_dsStreamingAction.m_unk0x94; - this->m_bufferOffset = p_dsStreamingAction.m_bufferOffset; - this->m_unk0x9c = p_dsStreamingAction.m_unk0x9c; - this->m_unk0xa0 = NULL; - this->m_unk0xa4 = NULL; - this->m_unk0xac = p_dsStreamingAction.m_unk0xac; - this->m_unk0xa8 = p_dsStreamingAction.m_unk0xa8; + MxDSAction::operator=(p_dsStreamingAction); + m_unk0x94 = p_dsStreamingAction.m_unk0x94; + m_bufferOffset = p_dsStreamingAction.m_bufferOffset; + m_unk0x9c = p_dsStreamingAction.m_unk0x9c; + m_unk0xa0 = NULL; + m_unk0xa4 = NULL; + m_unk0xac = p_dsStreamingAction.m_unk0xac; + m_unk0xa8 = p_dsStreamingAction.m_unk0xa8; SetInternalAction(p_dsStreamingAction.m_internalAction ? p_dsStreamingAction.m_internalAction->Clone() : NULL); return this; } // FUNCTION: LEGO1 0x100cd2a0 +// FUNCTION: BETA10 0x1015f698 void MxDSStreamingAction::SetInternalAction(MxDSAction* p_dsAction) { - if (this->m_internalAction) { - delete this->m_internalAction; + if (m_internalAction) { + delete m_internalAction; } - this->m_internalAction = p_dsAction; + m_internalAction = p_dsAction; } // FUNCTION: LEGO1 0x100cd2d0 void MxDSStreamingAction::FUN_100cd2d0() { - if (this->m_duration == -1) { + if (m_duration == -1) { return; } - MxLong duration = this->m_duration / this->m_loopCount; - this->m_loopCount--; + MxLong duration = m_duration / m_loopCount; + m_loopCount--; - this->m_duration -= duration; - this->m_unk0xa8 += duration; + m_duration -= duration; + m_unk0xa8 += duration; } diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index ea6e5978fa..a2084656b6 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -41,17 +41,15 @@ void MxPresenter::Init() } // FUNCTION: LEGO1 0x100b4d80 +// FUNCTION: BETA10 0x1012e120 MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action) { AUTOLOCK(m_criticalSection); - this->m_action = p_action; + m_action = p_action; + m_location = MxPoint32(m_action->GetLocation()[0], m_action->GetLocation()[1]); + m_displayZ = m_action->GetLocation()[2]; - const Mx3DPointFloat& location = this->m_action->GetLocation(); - MxS32 previousTickleState = this->m_currentTickleState; - - this->m_location = MxPoint32(this->m_action->GetLocation()[0], this->m_action->GetLocation()[1]); - this->m_displayZ = this->m_action->GetLocation()[2]; ProgressTickleState(e_ready); return SUCCESS; @@ -60,22 +58,22 @@ MxResult MxPresenter::StartAction(MxStreamController*, MxDSAction* p_action) // FUNCTION: LEGO1 0x100b4e40 void MxPresenter::EndAction() { - if (this->m_action == NULL) { + if (m_action == NULL) { return; } AUTOLOCK(m_criticalSection); - if (!this->m_compositePresenter) { + if (!m_compositePresenter) { MxOmni::GetInstance()->NotifyCurrentEntity( - MxEndActionNotificationParam(c_notificationEndAction, NULL, this->m_action, TRUE) + MxEndActionNotificationParam(c_notificationEndAction, NULL, m_action, TRUE) ); } - this->m_action = NULL; + m_action = NULL; MxS32 previousTickleState = 1 << m_currentTickleState; - this->m_previousTickleStates |= previousTickleState; - this->m_currentTickleState = e_idle; + m_previousTickleStates |= previousTickleState; + m_currentTickleState = e_idle; } // FUNCTION: LEGO1 0x100b4fc0 @@ -129,39 +127,39 @@ MxResult MxPresenter::Tickle() { AUTOLOCK(m_criticalSection); - switch (this->m_currentTickleState) { + switch (m_currentTickleState) { case e_ready: - this->ReadyTickle(); + ReadyTickle(); if (m_currentTickleState != e_starting) { break; } case e_starting: - this->StartingTickle(); + StartingTickle(); if (m_currentTickleState != e_streaming) { break; } case e_streaming: - this->StreamingTickle(); + StreamingTickle(); if (m_currentTickleState != e_repeating) { break; } case e_repeating: - this->RepeatingTickle(); + RepeatingTickle(); if (m_currentTickleState != e_freezing) { break; } case e_freezing: - this->FreezingTickle(); + FreezingTickle(); if (m_currentTickleState != e_done) { break; } case e_done: - this->DoneTickle(); + DoneTickle(); default: break; } @@ -172,14 +170,14 @@ MxResult MxPresenter::Tickle() // FUNCTION: LEGO1 0x100b52d0 void MxPresenter::Enable(MxBool p_enable) { - if (this->m_action && this->IsEnabled() != p_enable) { - MxU32 flags = this->m_action->GetFlags(); + if (m_action && IsEnabled() != p_enable) { + MxU32 flags = m_action->GetFlags(); if (p_enable) { - this->m_action->SetFlags(flags | MxDSAction::c_enabled); + m_action->SetFlags(flags | MxDSAction::c_enabled); } else { - this->m_action->SetFlags(flags & ~MxDSAction::c_enabled); + m_action->SetFlags(flags & ~MxDSAction::c_enabled); } } } @@ -266,5 +264,5 @@ MxEntity* MxPresenter::CreateEntity(const char* p_defaultName) // FUNCTION: BETA10 0x1012ebaf MxBool MxPresenter::IsEnabled() { - return this->m_action && this->m_action->GetFlags() & MxDSAction::c_enabled; + return m_action && m_action->GetFlags() & MxDSAction::c_enabled; } diff --git a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp index 3553ca05a2..40ae8ae99b 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp @@ -8,6 +8,8 @@ #include "mxomni.h" #include "mxticklemanager.h" +#include + DECOMP_SIZE_ASSERT(MxDiskStreamController, 0xc8); // FUNCTION: LEGO1 0x100c7120 @@ -17,6 +19,7 @@ MxDiskStreamController::MxDiskStreamController() } // FUNCTION: LEGO1 0x100c7530 +// FUNCTION: BETA10 0x10153a2d MxDiskStreamController::~MxDiskStreamController() { AUTOLOCK(m_criticalSection); @@ -35,6 +38,8 @@ MxDiskStreamController::~MxDiskStreamController() #endif } + assert(m_subscribers.size() == 0); + MxDSObject* object; while (m_unk0x3c.PopFront(object)) { delete object; @@ -65,28 +70,32 @@ MxDiskStreamController::~MxDiskStreamController() } // FUNCTION: LEGO1 0x100c7790 +// FUNCTION: BETA10 0x10153ea8 MxResult MxDiskStreamController::Open(const char* p_filename) { AUTOLOCK(m_criticalSection); MxResult result = MxStreamController::Open(p_filename); - if (result == SUCCESS) { - m_provider = new MxDiskStreamProvider(); - if (m_provider == NULL) { - result = FAILURE; - } - else { - result = m_provider->SetResourceToGet(this); - if (result != SUCCESS) { - delete m_provider; - m_provider = NULL; - } - else { - TickleManager()->RegisterClient(this, 10); - } - } + if (result != SUCCESS) { + goto done; + } + + m_provider = new MxDiskStreamProvider(); + if (m_provider == NULL) { + result = FAILURE; + goto done; + } + + result = m_provider->SetResourceToGet(this); + if (result != SUCCESS) { + delete m_provider; + m_provider = NULL; + goto done; } + TickleManager()->RegisterClient(this, 10); + +done: return result; } @@ -97,6 +106,7 @@ MxResult MxDiskStreamController::VTable0x18(undefined4, undefined4) } // FUNCTION: LEGO1 0x100c7890 +// FUNCTION: BETA10 0x101543bb MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action) { AUTOLOCK(m_criticalSection); @@ -104,7 +114,7 @@ MxResult MxDiskStreamController::FUN_100c7890(MxDSStreamingAction* p_action) return FAILURE; } - m_list0x80.push_back(p_action); + m_list0x80.PushBack(p_action); FUN_100c7970(); return SUCCESS; } @@ -122,6 +132,7 @@ void MxDiskStreamController::FUN_100c7970() } // FUNCTION: LEGO1 0x100c7980 +// FUNCTION: BETA10 0x10154848 void MxDiskStreamController::FUN_100c7980() { MxDSBuffer* buffer; @@ -159,24 +170,33 @@ void MxDiskStreamController::FUN_100c7980() } // FUNCTION: LEGO1 0x100c7ac0 +// FUNCTION: BETA10 0x10154abb MxDSStreamingAction* MxDiskStreamController::VTable0x28() { AUTOLOCK(m_criticalSection); MxDSObject* oldAction; - MxDSStreamingAction* result = NULL; + + assert(m_provider); + MxDSStreamingAction* request = NULL; MxU32 filesize = m_provider->GetFileSize(); - if (m_unk0x3c.PopFront(oldAction)) { - result = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction); - if (result) { - MxU32 offset = result->GetBufferOffset() + filesize; - ((MxDSStreamingAction*) oldAction)->SetUnknown94(offset); - ((MxDSStreamingAction*) oldAction)->SetBufferOffset(offset); - m_unk0x3c.push_back(oldAction); - } + if (!m_unk0x3c.PopFront(oldAction)) { + goto done; } - return result; + request = new MxDSStreamingAction((MxDSStreamingAction&) *oldAction); + assert(request); + + if (!request) { + goto done; + } + + ((MxDSStreamingAction*) oldAction)->SetUnknown94(request->GetBufferOffset() + filesize); + ((MxDSStreamingAction*) oldAction)->SetBufferOffset(((MxDSStreamingAction*) oldAction)->GetUnknown94()); + m_unk0x3c.PushBack(oldAction); + +done: + return request; } // FUNCTION: LEGO1 0x100c7c00 @@ -277,15 +297,17 @@ MxDSStreamingAction* MxDiskStreamController::FUN_100c7db0() } // FUNCTION: LEGO1 0x100c7f40 +// FUNCTION: BETA10 0x101553e0 void MxDiskStreamController::FUN_100c7f40(MxDSStreamingAction* p_streamingaction) { AUTOLOCK(m_criticalSection); if (p_streamingaction) { - m_list0x64.push_back(p_streamingaction); + m_list0x64.PushBack(p_streamingaction); } } // FUNCTION: LEGO1 0x100c7ff0 +// FUNCTION: BETA10 0x10155471 MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); @@ -389,7 +411,7 @@ MxResult MxDiskStreamController::FUN_100c8360(MxDSStreamingAction* p_action) action2->SetObjectId(p_action->GetObjectId()); } - m_list0x90.push_back(action2); + m_list0x90.PushBack(action2); } } @@ -405,6 +427,7 @@ void MxDiskStreamController::InsertToList74(MxDSBuffer* p_buffer) } // FUNCTION: LEGO1 0x100c8540 +// FUNCTION: BETA10 0x10155a05 void MxDiskStreamController::FUN_100c8540() { AUTOLOCK(m_criticalSection); @@ -429,6 +452,7 @@ void MxDiskStreamController::FUN_100c8540() } // FUNCTION: LEGO1 0x100c8640 +// FUNCTION: BETA10 0x10155ba0 MxResult MxDiskStreamController::Tickle() { if (m_unk0xc4) { @@ -461,7 +485,6 @@ void MxDiskStreamController::FUN_100c8720() while (!m_list0xb8.empty()) { action = (MxDSStreamingAction*) m_list0xb8.front(); m_list0xb8.pop_front(); - FUN_100c7cb0(action); } } diff --git a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp index eb6cbc546c..8be19a463d 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamprovider.cpp @@ -201,7 +201,7 @@ MxResult MxDiskStreamProvider::FUN_100d1780(MxDSStreamingAction* p_action) { AUTOLOCK(m_criticalSection); - m_list.push_back(p_action); + m_list.PushBack(p_action); } m_unk0x35 = TRUE; @@ -286,6 +286,7 @@ MxBool MxDiskStreamProvider::FUN_100d1af0(MxDSStreamingAction* p_action) } // FUNCTION: LEGO1 0x100d1b20 +// FUNCTION: BETA10 0x10163712 MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action) { MxDSBuffer* buffer = new MxDSBuffer(); @@ -294,91 +295,74 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action) return FAILURE; } - MxU32 size = p_action->GetUnknowna0()->GetWriteOffset() - p_action->GetUnknown94() + p_action->GetBufferOffset() + - (p_action->GetUnknowna4() ? p_action->GetUnknowna4()->GetWriteOffset() : 0); + MxU32 size = (p_action->GetUnknowna4() ? p_action->GetUnknowna4()->GetWriteOffset() : 0) + + p_action->GetUnknowna0()->GetWriteOffset() - (p_action->GetUnknown94() - p_action->GetBufferOffset()); if (buffer->AllocateBuffer(size, MxDSBuffer::e_allocate) != SUCCESS) { - if (!buffer) { - return FAILURE; - } - delete buffer; return FAILURE; } - MxDSBuffer* buffer2 = p_action->GetUnknowna4(); - MxU8** pdata; MxU8* data; - if (buffer2 == NULL) { - pdata = buffer->GetBufferRef(); + if (p_action->GetUnknowna4()) { + buffer->FUN_100c7090(p_action->GetUnknowna4()); + data = buffer->GetBuffer() + p_action->GetUnknowna4()->GetWriteOffset(); - memcpy( - data = *pdata, - p_action->GetUnknowna0()->GetBuffer() - p_action->GetBufferOffset() + p_action->GetUnknown94(), - size - ); + memcpy(data, p_action->GetUnknowna0()->GetBuffer(), p_action->GetUnknowna0()->GetWriteOffset()); + + delete p_action->GetUnknowna4(); } else { - buffer->FUN_100c7090(buffer2); - pdata = buffer->GetBufferRef(); + data = buffer->GetBuffer(); memcpy( - data = (p_action->GetUnknowna4()->GetWriteOffset() + *pdata), - p_action->GetUnknowna0()->GetBuffer(), - p_action->GetUnknowna0()->GetWriteOffset() + data, + p_action->GetUnknowna0()->GetBuffer() + (p_action->GetUnknown94() - p_action->GetBufferOffset()), + size ); - - delete p_action->GetUnknowna4(); } p_action->SetUnknowna4(buffer); +#define IntoType(p) ((MxU32*) (p)) + while (data) { - if (*MxDSChunk::IntoType(data) != FOURCC('M', 'x', 'O', 'b')) { - if (*MxStreamChunk::IntoTime(data) > p_action->GetUnknown9c()) { - *MxDSChunk::IntoType(data) = FOURCC('p', 'a', 'd', ' '); + if (*IntoType(data) != FOURCC('M', 'x', 'O', 'b') && + *MxStreamChunk::IntoTime(data) > p_action->GetUnknown9c()) { + *IntoType(data) = FOURCC('p', 'a', 'd', ' '); + + // DECOMP: prefer order that matches retail versus beta + *(MxU32*) (data + 4) = buffer->GetBuffer() + buffer->GetWriteOffset() - data - 8; + memset(data + 8, 0, *(MxU32*) (data + 4)); + size = ReadData(buffer->GetBuffer(), buffer->GetWriteOffset()); + + buffer = new MxDSBuffer(); + if (buffer == NULL || buffer->AllocateBuffer(size, MxDSBuffer::e_allocate) != SUCCESS) { + delete buffer; + return FAILURE; + } - memcpy(data + 8, *pdata, buffer->GetWriteOffset() + *pdata - data - 8); - size = ReadData(*pdata, buffer->GetWriteOffset()); + memcpy(buffer->GetBuffer(), p_action->GetUnknowna4()->GetBuffer(), size); + p_action->GetUnknowna4()->SetMode(MxDSBuffer::e_allocate); + delete p_action->GetUnknowna4(); - MxDSBuffer* buffer3 = new MxDSBuffer(); - if (!buffer3) { - return FAILURE; - } + buffer->SetMode(MxDSBuffer::e_unknown); + p_action->SetUnknowna4(buffer); + MxU32 unk0x14 = p_action->GetUnknowna0()->GetUnknown14(); - if (buffer3->AllocateBuffer(size, MxDSBuffer::e_allocate) == SUCCESS) { - memcpy(buffer3->GetBuffer(), p_action->GetUnknowna4()->GetBuffer(), size); - p_action->GetUnknowna4()->SetMode(MxDSBuffer::e_allocate); - delete p_action->GetUnknowna4(); - - buffer3->SetMode(MxDSBuffer::e_unknown); - p_action->SetUnknowna4(buffer3); - MxDSBuffer* buffer4 = p_action->GetUnknowna0(); - MxU32 unk0x14 = buffer4->GetUnknown14(); - MxU8* data2 = buffer4->GetBuffer(); - - while (TRUE) { - if (*MxStreamChunk::IntoTime(data2) > p_action->GetUnknown9c()) { - break; - } - - data += MxDSChunk::Size(*MxDSChunk::IntoLength(data)); - unk0x14 += MxDSChunk::Size(*MxDSChunk::IntoLength(data)); - } - - p_action->SetUnknown94(unk0x14); - p_action->SetBufferOffset(p_action->GetUnknowna0()->GetUnknown14()); - delete p_action->GetUnknowna0(); - p_action->SetUnknowna0(NULL); - ((MxDiskStreamController*) m_pLookup)->FUN_100c7890(p_action); - return SUCCESS; - } - else { - delete buffer3; - return FAILURE; - } + for (data = p_action->GetUnknowna0()->GetBuffer(); + *MxStreamChunk::IntoTime(data) <= p_action->GetUnknown9c(); + data = MxDSChunk::End(data)) { + unk0x14 += MxDSChunk::Size(data); } + + p_action->SetUnknown94(unk0x14); + p_action->SetBufferOffset(p_action->GetUnknowna0()->GetUnknown14()); + delete p_action->GetUnknowna0(); + p_action->ClearUnknowna0(); + ((MxDiskStreamController*) m_pLookup)->FUN_100c7890(p_action); + return SUCCESS; } data = buffer->FUN_100c6fa0(data); @@ -388,6 +372,8 @@ MxResult MxDiskStreamProvider::FUN_100d1b20(MxDSStreamingAction* p_action) p_action->SetBufferOffset(GetFileSize() + p_action->GetBufferOffset()); FUN_100d1780(p_action); return SUCCESS; + +#undef IntoType } // FUNCTION: LEGO1 0x100d1e90 diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index 0e424dfa45..4b7386b2d3 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -491,6 +491,7 @@ MxU8* MxDSBuffer::FUN_100c6fa0(MxU8* p_data) } // FUNCTION: LEGO1 0x100c7090 +// FUNCTION: BETA10 0x1015842d MxResult MxDSBuffer::FUN_100c7090(MxDSBuffer* p_buf) { MxResult result = FAILURE; diff --git a/LEGO1/omni/src/stream/mxio.cpp b/LEGO1/omni/src/stream/mxio.cpp index 3b7c9b6dee..2e922c2fc2 100644 --- a/LEGO1/omni/src/stream/mxio.cpp +++ b/LEGO1/omni/src/stream/mxio.cpp @@ -38,7 +38,7 @@ MXIOINFO::~MXIOINFO() MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags) { OFSTRUCT unused; - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; m_info.lDiskOffset = m_info.lBufOffset = 0; @@ -84,7 +84,7 @@ MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags) // FUNCTION: BETA10 0x1015e30b MxU16 MXIOINFO::Close(MxLong p_unused) { - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; if (RAW_M_FILE) { result = Flush(0); @@ -317,7 +317,7 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin) // FUNCTION: BETA10 0x1015e9ad MxU16 MXIOINFO::SetBuffer(char* p_buf, MxLong p_len, MxLong p_unused) { - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; result = Flush(0); if (m_info.dwFlags & MMIO_ALLOCBUF) { @@ -337,7 +337,7 @@ MxU16 MXIOINFO::SetBuffer(char* p_buf, MxLong p_len, MxLong p_unused) // FUNCTION: BETA10 0x1015ea3e MxU16 MXIOINFO::Flush(MxU16 p_unused) { - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; MxLong bytesWritten; // if buffer is dirty @@ -389,7 +389,7 @@ MxU16 MXIOINFO::Flush(MxU16 p_unused) // FUNCTION: BETA10 0x1015eb8f MxU16 MXIOINFO::Advance(MxU16 p_option) { - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; MxULong rwmode = m_info.dwFlags & MMIO_RWMODE; if (m_info.pchBuffer) { @@ -463,7 +463,7 @@ MxU16 MXIOINFO::Advance(MxU16 p_option) // FUNCTION: BETA10 0x1015edef MxU16 MXIOINFO::Descend(MMCKINFO* p_chunkInfo, const MMCKINFO* p_parentInfo, MxU16 p_descend) { - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; MxULong ofs; BOOL readOk; @@ -554,7 +554,7 @@ MxU16 MXIOINFO::Ascend(MMCKINFO* p_chunkInfo, MxU16 p_ascend) { MxLong ofs; MxULong size; - MxU16 result = 0; + MxU16 result = MMSYSERR_NOERROR; if (p_chunkInfo == NULL) { return MMIOERR_BASE; @@ -605,10 +605,50 @@ MxU16 MXIOINFO::Ascend(MMCKINFO* p_chunkInfo, MxU16 p_ascend) } // Seek past the end of the chunk (plus optional pad byte if size is odd) - if (result == 0 && + if (result == MMSYSERR_NOERROR && Seek((p_chunkInfo->cksize & 1) + p_chunkInfo->cksize + p_chunkInfo->dwDataOffset, SEEK_SET) == -1) { result = MMIOERR_CANNOTSEEK; } return result; } + +// FUNCTION: BETA10 0x1015f28b +MxU16 MXIOINFO::CreateChunk(MMCKINFO* p_chunkInfo, MxU16 p_create) +{ + MxU16 result = MMSYSERR_NOERROR; + + if (p_chunkInfo == NULL) { + return MMIOERR_BASE; + } + + if (p_create == MMIO_CREATERIFF) { + p_chunkInfo->ckid = FOURCC_RIFF; + } + if (p_create == MMIO_CREATELIST) { + p_chunkInfo->ckid = FOURCC_LIST; + } + + p_chunkInfo->dwDataOffset = Seek(0, SEEK_CUR); + if (p_chunkInfo->dwDataOffset == -1) { + result = MMIOERR_CANNOTSEEK; + } + else { + p_chunkInfo->dwDataOffset += 8; + } + + MxU32 size; + if (p_chunkInfo->ckid == FOURCC_RIFF || p_chunkInfo->ckid == FOURCC_LIST) { + size = 12; + } + else { + size = 8; + } + + if (Write(p_chunkInfo, size) != size) { + result = MMIOERR_CANNOTWRITE; + } + + p_chunkInfo->dwFlags = MMIO_DIRTY; + return result; +} diff --git a/LEGO1/omni/src/stream/mxramstreamprovider.cpp b/LEGO1/omni/src/stream/mxramstreamprovider.cpp index 2b0625045a..ddc254704f 100644 --- a/LEGO1/omni/src/stream/mxramstreamprovider.cpp +++ b/LEGO1/omni/src/stream/mxramstreamprovider.cpp @@ -102,62 +102,63 @@ MxResult MxRAMStreamProvider::SetResourceToGet(MxStreamController* p_resource) } // FUNCTION: LEGO1 0x100d0d80 +// FUNCTION: BETA10 0x1016492f MxU32 ReadData(MxU8* p_buffer, MxU32 p_size) { MxU32 id; MxU8* data = p_buffer; - MxU8* end = p_buffer + p_size; MxU8* data2; - if (p_buffer < end) { - do { - if (*MxDSChunk::IntoType(data) == FOURCC('M', 'x', 'O', 'b')) { - data2 = data; - data += 8; - - MxDSObject* obj = DeserializeDSObjectDispatch(data, -1); - id = obj->GetObjectId(); - delete obj; - - data = MxDSChunk::End(data2); - while (data < end) { - if (*MxDSChunk::IntoType(data) == FOURCC('M', 'x', 'C', 'h')) { - MxU8* data3 = data; - MxU32* psize = MxDSChunk::IntoLength(data); - data += MxDSChunk::Size(*psize); - - if ((*MxDSChunk::IntoType(data2) == FOURCC('M', 'x', 'C', 'h')) && - (*MxStreamChunk::IntoFlags(data2) & DS_CHUNK_SPLIT)) { - if (*MxStreamChunk::IntoObjectId(data2) == *MxStreamChunk::IntoObjectId(data3) && - (*MxStreamChunk::IntoFlags(data3) & DS_CHUNK_SPLIT) && - *MxStreamChunk::IntoTime(data2) == *MxStreamChunk::IntoTime(data3)) { - MxDSBuffer::Append(data2, data3); - continue; - } - else { - *MxStreamChunk::IntoFlags(data2) &= ~DS_CHUNK_SPLIT; - } +#define IntoType(p) ((MxU32*) (p)) + + while (data < p_buffer + p_size) { + if (*IntoType(data) == FOURCC('M', 'x', 'O', 'b')) { + data2 = data; + data = data2 + 8; + + MxDSObject* obj = DeserializeDSObjectDispatch(data, -1); + id = obj->GetObjectId(); + delete obj; + + data = MxDSChunk::End(data2); + while (data < p_buffer + p_size) { + if (*IntoType(data) == FOURCC('M', 'x', 'C', 'h')) { + MxU8* data3 = data; + data = MxDSChunk::End(data3); + + if ((*IntoType(data2) == FOURCC('M', 'x', 'C', 'h')) && + (*MxStreamChunk::IntoFlags(data2) & DS_CHUNK_SPLIT)) { + if (*MxStreamChunk::IntoObjectId(data2) == *MxStreamChunk::IntoObjectId(data3) && + (*MxStreamChunk::IntoFlags(data3) & DS_CHUNK_SPLIT) && + *MxStreamChunk::IntoTime(data2) == *MxStreamChunk::IntoTime(data3)) { + MxDSBuffer::Append(data2, data3); + continue; } - - data2 += MxDSChunk::Size(*MxDSChunk::IntoLength(data2)); - memcpy(data2, data3, MxDSChunk::Size(*psize)); - - if (*MxStreamChunk::IntoObjectId(data2) == id && - (*MxStreamChunk::IntoFlags(data2) & DS_CHUNK_END_OF_STREAM)) { - break; + else { + *MxStreamChunk::IntoFlags(data2) &= ~DS_CHUNK_SPLIT; } } - else { - data++; + + data2 = MxDSChunk::End(data2); + memcpy(data2, data3, MxDSChunk::Size(data3)); + + if (*MxStreamChunk::IntoObjectId(data2) == id && + (*MxStreamChunk::IntoFlags(data2) & DS_CHUNK_END_OF_STREAM)) { + break; } } + else { + data++; + } } - else { - data++; - } - } while (data < end); + } + else { + data++; + } } *MxStreamChunk::IntoFlags(data2) &= ~DS_CHUNK_SPLIT; - return MxDSChunk::End(data2) - p_buffer; + return MxDSChunk::Size(data2) + (MxU32) (data2 - p_buffer); + +#undef IntoType } diff --git a/LEGO1/omni/src/stream/mxstreamchunk.cpp b/LEGO1/omni/src/stream/mxstreamchunk.cpp index 24c134452b..7944b2f2e0 100644 --- a/LEGO1/omni/src/stream/mxstreamchunk.cpp +++ b/LEGO1/omni/src/stream/mxstreamchunk.cpp @@ -96,6 +96,7 @@ MxU32* MxStreamChunk::IntoObjectId(MxU8* p_buffer) } // FUNCTION: LEGO1 0x100c31a0 +// FUNCTION: BETA10 0x10151626 MxLong* MxStreamChunk::IntoTime(MxU8* p_buffer) { return (MxLong*) (p_buffer + 0x0e); diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index af0dd84b91..958fa3719f 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -32,7 +32,7 @@ MxStreamController::~MxStreamController() AUTOLOCK(m_criticalSection); MxDSSubscriber* subscriber; - while (m_subscriberList.PopFront(subscriber)) { + while (m_subscribers.PopFront(subscriber)) { delete subscriber; } @@ -72,20 +72,22 @@ MxResult MxStreamController::Open(const char* p_filename) AUTOLOCK(m_criticalSection); MakeSourceName(sourceName, p_filename); - this->m_atom = MxAtomId(sourceName, e_lowerCase2); + m_atom = MxAtomId(sourceName, e_lowerCase2); return SUCCESS; } // FUNCTION: LEGO1 0x100c15d0 +// FUNCTION: BETA10 0x1014e730 void MxStreamController::AddSubscriber(MxDSSubscriber* p_subscriber) { - m_subscriberList.push_back(p_subscriber); + m_subscribers.PushBack(p_subscriber); } // FUNCTION: LEGO1 0x100c1620 +// FUNCTION: BETA10 0x1014e7b4 void MxStreamController::RemoveSubscriber(MxDSSubscriber* p_subscriber) { - m_subscriberList.remove(p_subscriber); + m_subscribers.Remove(p_subscriber); } // FUNCTION: LEGO1 0x100c1690 @@ -114,11 +116,13 @@ MxResult MxStreamController::VTable0x20(MxDSAction* p_action) } // FUNCTION: LEGO1 0x100c1740 +// FUNCTION: BETA10 0x1014e922 MxResult MxStreamController::VTable0x24(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); VTable0x30(p_action); m_action0x60 = (MxDSAction*) m_unk0x54.FindAndErase(p_action); + if (m_action0x60 == NULL) { return FAILURE; } @@ -130,6 +134,7 @@ MxResult MxStreamController::VTable0x24(MxDSAction* p_action) } // FUNCTION: LEGO1 0x100c1800 +// FUNCTION: BETA10 0x1014ea36 MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val) { MxNextActionDataStart* dataActionStart = @@ -138,11 +143,12 @@ MxResult MxStreamController::FUN_100c1800(MxDSAction* p_action, MxU32 p_val) return FAILURE; } - m_nextActionList.push_back(dataActionStart); + m_nextActionList.PushBack(dataActionStart); return SUCCESS; } // FUNCTION: LEGO1 0x100c1a00 +// FUNCTION: BETA10 0x1014eb04 MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) { if (p_action->GetUnknown24() == -1) { @@ -167,7 +173,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) } if (newUnknown24 == -1) { - for (MxDSSubscriberList::iterator it = m_subscriberList.begin(); it != m_subscriberList.end(); it++) { + for (MxDSSubscriberList::iterator it = m_subscribers.begin(); it != m_subscribers.end(); it++) { MxDSSubscriber* subscriber = *it; if (subscriber->GetObjectId() == p_action->GetObjectId()) { @@ -198,36 +204,43 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) MxLong time = Timer()->GetTime(); streamingAction->SetUnknown90(time); - m_unk0x3c.push_back(streamingAction); + m_unk0x3c.PushBack(streamingAction); return SUCCESS; } // FUNCTION: LEGO1 0x100c1c10 +// FUNCTION: BETA10 0x1014ed8c MxResult MxStreamController::VTable0x2c(MxDSAction* p_action, MxU32 p_bufferval) { AUTOLOCK(m_criticalSection); + if (FUN_100c1a00(p_action, p_bufferval) != SUCCESS) { return FAILURE; } + return FUN_100c1800(p_action, (p_bufferval / m_provider->GetFileSize()) * m_provider->GetFileSize()); } // FUNCTION: LEGO1 0x100c1ce0 +// FUNCTION: BETA10 0x1014eeb5 MxResult MxStreamController::VTable0x30(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); MxResult result = FAILURE; MxDSObject* action = m_unk0x3c.FindAndErase(p_action); + if (action != NULL) { MxNextActionDataStart* data = m_nextActionList.FindAndErase(action->GetObjectId(), action->GetUnknown24()); delete action; delete data; result = SUCCESS; } + return result; } // FUNCTION: LEGO1 0x100c1da0 +// FUNCTION: BETA10 0x1014efdc MxResult MxStreamController::InsertActionToList54(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); @@ -237,16 +250,18 @@ MxResult MxStreamController::InsertActionToList54(MxDSAction* p_action) return FAILURE; } else { - m_unk0x54.push_back(action); + m_unk0x54.PushBack(action); return SUCCESS; } } // FUNCTION: LEGO1 0x100c1e70 +// FUNCTION: BETA10 0x1014f0a1 MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) { AUTOLOCK(m_criticalSection); MxPresenter* result = NULL; + if (p_action.GetObjectId() != -1) { MxDSObject* action = m_unk0x3c.Find(&p_action); if (action != NULL) { @@ -258,6 +273,7 @@ MxPresenter* MxStreamController::FUN_100c1e70(MxDSAction& p_action) } // FUNCTION: LEGO1 0x100c1f00 +// FUNCTION: BETA10 0x1014f162 MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) { AUTOLOCK(m_criticalSection); @@ -272,7 +288,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) chunk->SetChunkFlags(DS_CHUNK_BIT3); chunk->SetObjectId(objectId); - if (chunk->SendChunk(m_subscriberList, FALSE, p_action->GetUnknown24()) != SUCCESS) { + if (chunk->SendChunk(m_subscribers, FALSE, p_action->GetUnknown24()) != SUCCESS) { delete chunk; } @@ -292,6 +308,7 @@ MxResult MxStreamController::FUN_100c1f00(MxDSAction* p_action) } // FUNCTION: LEGO1 0x100c20b0 +// FUNCTION: BETA10 0x1014f37d MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingAction(MxDSStreamingAction* p_action) { return m_nextActionList.Find(p_action->GetObjectId(), p_action->GetUnknown24()); @@ -301,7 +318,7 @@ MxNextActionDataStart* MxStreamController::FindNextActionDataStartFromStreamingA // FUNCTION: BETA10 0x1014f3b5 MxBool MxStreamController::IsStoped(MxDSObject* p_obj) { - MxDSSubscriber* subscriber = m_subscriberList.Find(p_obj); + MxDSSubscriber* subscriber = m_subscribers.Find(p_obj); if (subscriber) { MxTrace( diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index d08322ce70..685c59be92 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -13,6 +13,8 @@ DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac); +#define RGB555_CREATE(R, G, B) (((R) << 10) | (G) << 5 | (B) << 0) + // GLOBAL: LEGO1 0x1010215c MxU32 g_unk0x1010215c = 0; @@ -976,8 +978,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( if (p_transparent) { for (MxS32 y = 0; y < heightAbs; y++) { for (MxS32 x = 0; x < widthNormal; x++) { - if (*bitmapSrcPtr == NULL) { - *surfaceData = 31775; + if (*bitmapSrcPtr == 0) { + *surfaceData = RGB555_CREATE(0x1f, 0, 0x1f); } else { *surfaceData = m_16bitPal[*bitmapSrcPtr]; @@ -992,7 +994,7 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( } DDCOLORKEY key; - key.dwColorSpaceLowValue = key.dwColorSpaceHighValue = 31775; + key.dwColorSpaceLowValue = key.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f); surface->SetColorKey(DDCKEY_SRCBLT, &key); } else { @@ -1098,7 +1100,7 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() for (MxS32 y = 0; y < 16; y++) { if ((y > 10 || x) && (x > 10 || y) && x + y != 10) { if (x + y > 10) { - *surface2 = 31775; + *surface2 = RGB555_CREATE(0x1f, 0, 0x1f); } else { *surface2 = -1; @@ -1114,8 +1116,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() newSurface->Unlock(ddsd.lpSurface); DDCOLORKEY colorkey; - colorkey.dwColorSpaceHighValue = 31775; - colorkey.dwColorSpaceLowValue = 31775; + colorkey.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f); + colorkey.dwColorSpaceLowValue = RGB555_CREATE(0x1f, 0, 0x1f); newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey); return newSurface; diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index ca04324337..72f663e06e 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -41,10 +41,10 @@ void MxLoopingSmkPresenter::Destroy(MxBool p_fromDestructor) // FUNCTION: LEGO1 0x100b4a00 void MxLoopingSmkPresenter::VTable0x88() { - if (m_mxSmack.m_smackTag.Frames == m_currentFrame) { + if (m_mxSmk.m_smackTag.Frames == m_currentFrame) { m_currentFrame = 0; // TODO: struct incorrect, Palette at wrong offset? - memset(&m_mxSmack.m_smackTag.Palette[4], 0, sizeof(m_mxSmack.m_smackTag.Palette)); + memset(&m_mxSmk.m_smackTag.Palette[4], 0, sizeof(m_mxSmk.m_smackTag.Palette)); } } diff --git a/LEGO1/omni/src/video/mxsmack.cpp b/LEGO1/omni/src/video/mxsmk.cpp similarity index 74% rename from LEGO1/omni/src/video/mxsmack.cpp rename to LEGO1/omni/src/video/mxsmk.cpp index d0a9480c9b..0f2bdd77d5 100644 --- a/LEGO1/omni/src/video/mxsmack.cpp +++ b/LEGO1/omni/src/video/mxsmk.cpp @@ -1,15 +1,15 @@ -#include "mxsmack.h" +#include "mxsmk.h" #include "mxbitmap.h" #include DECOMP_SIZE_ASSERT(SmackTag, 0x390); -DECOMP_SIZE_ASSERT(MxSmack, 0x6b8); +DECOMP_SIZE_ASSERT(MxSmk, 0x6b8); // FUNCTION: LEGO1 0x100c5a90 // FUNCTION: BETA10 0x10151e70 -MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) +MxResult MxSmk::LoadHeader(MxU8* p_data, MxSmk* p_mxSmk) { // Macros for readability // If bit0 of SmackerType is set, there is an extra frame ("ring frame") @@ -29,15 +29,15 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) MxU32 size; MxS32 width; - if (!p_data || !p_mxSmack) { + if (!p_data || !p_mxSmk) { return FAILURE; } - SmackTag* smackTag = &p_mxSmack->m_smackTag; - p_mxSmack->m_frameTypes = NULL; - p_mxSmack->m_frameSizes = NULL; - p_mxSmack->m_huffmanTrees = NULL; - p_mxSmack->m_huffmanTables = NULL; + SmackTag* smackTag = &p_mxSmk->m_smackTag; + p_mxSmk->m_frameTypes = NULL; + p_mxSmk->m_frameSizes = NULL; + p_mxSmk->m_huffmanTrees = NULL; + p_mxSmk->m_huffmanTables = NULL; memcpy(smackTag, p_data, SmackHeaderSize(smackTag)); p_data += SmackHeaderSize(smackTag); @@ -52,11 +52,11 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) memcpy(frameSizes, p_data, FRAME_COUNT(smackTag) * sizeof(MxU32)); p_data += FRAME_COUNT(smackTag) * sizeof(MxU32); - p_mxSmack->m_maxFrameSize = 0; + p_mxSmk->m_maxFrameSize = 0; for (i = 0; i < FRAME_COUNT(smackTag); i++) { - if (p_mxSmack->m_maxFrameSize < frameSizes[i]) { - p_mxSmack->m_maxFrameSize = frameSizes[i]; + if (p_mxSmk->m_maxFrameSize < frameSizes[i]) { + p_mxSmk->m_maxFrameSize = frameSizes[i]; } } @@ -82,17 +82,17 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) p_data += smackTag->tablesize; sizetables = SmackGetSizeTables(); - p_mxSmack->m_huffmanTables = + p_mxSmk->m_huffmanTables = new MxU8[smackTag->codesize + smackTag->detailsize + smackTag->typesize + smackTag->absize + sizetables]; - if (!p_mxSmack->m_huffmanTables) { + if (!p_mxSmk->m_huffmanTables) { result = FAILURE; goto done; } SmackDoTables( huffmanTrees, - p_mxSmack->m_huffmanTables, + p_mxSmk->m_huffmanTables, smackTag->codesize, smackTag->absize, smackTag->detailsize, @@ -100,11 +100,11 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) ); size = SmackGetSizeDeltas(smackTag->Width, smackTag->Height) + 32; - p_mxSmack->m_unk0x6b4 = new MxU8[size]; - memset(p_mxSmack->m_unk0x6b4, 0, size); + p_mxSmk->m_unk0x6b4 = new MxU8[size]; + memset(p_mxSmk->m_unk0x6b4, 0, size); - width = p_mxSmack->m_smackTag.Width; - data = (MxU32*) p_mxSmack->m_unk0x6b4; + width = p_mxSmk->m_smackTag.Width; + data = (MxU32*) p_mxSmk->m_unk0x6b4; *data = 1; data++; @@ -128,9 +128,9 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) *data = smackTag->Height; done: - p_mxSmack->m_frameTypes = frameTypes; - p_mxSmack->m_frameSizes = frameSizes; - p_mxSmack->m_huffmanTrees = huffmanTrees; + p_mxSmk->m_frameTypes = frameTypes; + p_mxSmk->m_frameSizes = frameSizes; + p_mxSmk->m_huffmanTrees = huffmanTrees; return result; #undef FRAME_COUNT @@ -138,38 +138,38 @@ MxResult MxSmack::LoadHeader(MxU8* p_data, MxSmack* p_mxSmack) // FUNCTION: LEGO1 0x100c5d40 // FUNCTION: BETA10 0x10152298 -void MxSmack::Destroy(MxSmack* p_mxSmack) +void MxSmk::Destroy(MxSmk* p_mxSmk) { - if (p_mxSmack->m_frameSizes) { - delete[] p_mxSmack->m_frameSizes; + if (p_mxSmk->m_frameSizes) { + delete[] p_mxSmk->m_frameSizes; } - if (p_mxSmack->m_frameTypes) { - delete[] p_mxSmack->m_frameTypes; + if (p_mxSmk->m_frameTypes) { + delete[] p_mxSmk->m_frameTypes; } - if (p_mxSmack->m_huffmanTrees) { - delete[] p_mxSmack->m_huffmanTrees; + if (p_mxSmk->m_huffmanTrees) { + delete[] p_mxSmk->m_huffmanTrees; } - if (p_mxSmack->m_huffmanTables) { - delete[] p_mxSmack->m_huffmanTables; + if (p_mxSmk->m_huffmanTables) { + delete[] p_mxSmk->m_huffmanTables; } - if (p_mxSmack->m_unk0x6b4) { - delete[] p_mxSmack->m_unk0x6b4; + if (p_mxSmk->m_unk0x6b4) { + delete[] p_mxSmk->m_unk0x6b4; } } // FUNCTION: LEGO1 0x100c5db0 // FUNCTION: BETA10 0x10152391 -MxResult MxSmack::LoadFrame( +MxResult MxSmk::LoadFrame( MxBITMAPINFO* p_bitmapInfo, MxU8* p_bitmapData, - MxSmack* p_mxSmack, + MxSmk* p_mxSmk, MxU8* p_chunkData, MxBool p_paletteChanged, MxRectList* p_list ) { p_bitmapInfo->m_bmiHeader.biHeight = -MxBitmap::HeightAbs(p_bitmapInfo->m_bmiHeader.biHeight); - *(MxU8**) (p_mxSmack->m_unk0x6b4 + 4) = p_bitmapData; + *(MxU8**) (p_mxSmk->m_unk0x6b4 + 4) = p_bitmapData; // Reference: https://wiki.multimedia.cx/index.php/Smacker#Palette_Chunk if (p_paletteChanged) { @@ -179,7 +179,7 @@ MxResult MxSmack::LoadFrame( MxU8* intoPalette = palette; MxU16 paletteIndex = 0; // TODO: struct incorrect, Palette at wrong offset? - MxU8* currentPalette = &p_mxSmack->m_smackTag.Palette[4]; + MxU8* currentPalette = &p_mxSmk->m_smackTag.Palette[4]; do { if (*intoChunk & 0x80) { @@ -217,13 +217,13 @@ MxResult MxSmack::LoadFrame( p_chunkData += *p_chunkData * 4; } - SmackDoFrameToBuffer(p_chunkData, p_mxSmack->m_huffmanTables, p_mxSmack->m_unk0x6b4); + SmackDoFrameToBuffer(p_chunkData, p_mxSmk->m_huffmanTables, p_mxSmk->m_unk0x6b4); MxU16 und = 1; u32 smackRect[4]; MxRect32 rect; - while (GetRect(p_mxSmack->m_unk0x6b4, &und, smackRect, &rect)) { + while (GetRect(p_mxSmk->m_unk0x6b4, &und, smackRect, &rect)) { MxRect32* newRect = new MxRect32(rect); p_list->Append(newRect); } @@ -233,7 +233,7 @@ MxResult MxSmack::LoadFrame( // FUNCTION: LEGO1 0x100c6050 // FUNCTION: BETA10 0x10152739 -MxBool MxSmack::GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect32* p_rect) +MxBool MxSmk::GetRect(MxU8* p_unk0x6b4, MxU16* p_und, u32* p_smackRect, MxRect32* p_rect) { u32 left, bottom, top, right; diff --git a/LEGO1/omni/src/video/mxsmkpresenter.cpp b/LEGO1/omni/src/video/mxsmkpresenter.cpp index 6e38c43d65..5bbddbe98b 100644 --- a/LEGO1/omni/src/video/mxsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxsmkpresenter.cpp @@ -24,7 +24,7 @@ MxSmkPresenter::~MxSmkPresenter() void MxSmkPresenter::Init() { m_currentFrame = 0; - memset(&m_mxSmack, 0, sizeof(m_mxSmack)); + memset(&m_mxSmk, 0, sizeof(m_mxSmk)); SetBit1(FALSE); SetBit2(FALSE); } @@ -34,7 +34,7 @@ void MxSmkPresenter::Destroy(MxBool p_fromDestructor) { m_criticalSection.Enter(); - MxSmack::Destroy(&m_mxSmack); + MxSmk::Destroy(&m_mxSmk); Init(); m_criticalSection.Leave(); @@ -47,7 +47,7 @@ void MxSmkPresenter::Destroy(MxBool p_fromDestructor) // FUNCTION: LEGO1 0x100b3940 void MxSmkPresenter::LoadHeader(MxStreamChunk* p_chunk) { - MxSmack::LoadHeader(p_chunk->GetData(), &m_mxSmack); + MxSmk::LoadHeader(p_chunk->GetData(), &m_mxSmk); } // FUNCTION: LEGO1 0x100b3960 @@ -58,7 +58,7 @@ void MxSmkPresenter::CreateBitmap() } m_frameBitmap = new MxBitmap; - m_frameBitmap->SetSize(m_mxSmack.m_smackTag.Width, m_mxSmack.m_smackTag.Height, NULL, FALSE); + m_frameBitmap->SetSize(m_mxSmk.m_smackTag.Width, m_mxSmk.m_smackTag.Height, NULL, FALSE); } // FUNCTION: LEGO1 0x100b3a00 @@ -68,12 +68,12 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) MxU8* bitmapData = m_frameBitmap->GetImage(); MxU8* chunkData = p_chunk->GetData(); - MxBool paletteChanged = m_mxSmack.m_frameTypes[m_currentFrame] & 1; + MxBool paletteChanged = m_mxSmk.m_frameTypes[m_currentFrame] & 1; m_currentFrame++; VTable0x88(); MxRectList rects(TRUE); - MxSmack::LoadFrame(bitmapInfo, bitmapData, &m_mxSmack, chunkData, paletteChanged, &rects); + MxSmk::LoadFrame(bitmapInfo, bitmapData, &m_mxSmk, chunkData, paletteChanged, &rects); if (((MxDSMediaAction*) m_action)->GetPaletteManagement() && paletteChanged) { RealizePalette(); @@ -93,17 +93,17 @@ void MxSmkPresenter::LoadFrame(MxStreamChunk* p_chunk) // FUNCTION: LEGO1 0x100b4260 void MxSmkPresenter::VTable0x88() { - if ((m_mxSmack.m_smackTag.SmackerType & 1) != 0) { - MxU32 und = (m_currentFrame % m_mxSmack.m_smackTag.Frames); + if ((m_mxSmk.m_smackTag.SmackerType & 1) != 0) { + MxU32 und = (m_currentFrame % m_mxSmk.m_smackTag.Frames); if (1 < m_currentFrame && und == 1) { m_currentFrame = 1; } } else { - if (m_mxSmack.m_smackTag.Frames == m_currentFrame) { + if (m_mxSmk.m_smackTag.Frames == m_currentFrame) { m_currentFrame = 0; // TODO: struct incorrect, Palette at wrong offset? - memset(&m_mxSmack.m_smackTag.Palette[4], 0, sizeof(m_mxSmack.m_smackTag.Palette)); + memset(&m_mxSmk.m_smackTag.Palette[4], 0, sizeof(m_mxSmk.m_smackTag.Palette)); } } } diff --git a/LEGO1/realtime/matrix.cpp b/LEGO1/realtime/matrix.cpp deleted file mode 100644 index c1de153586..0000000000 --- a/LEGO1/realtime/matrix.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "matrix.h" - -#include "decomp.h" - -DECOMP_SIZE_ASSERT(Matrix4, 0x08); diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index b0ace048ce..c792f4da52 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -3,356 +3,53 @@ #include "vector.h" -#include +// Note: virtual function overloads appear in the virtual table +// in reverse order of appearance. struct UnknownMatrixType { float m_data[4][4]; }; -// Note: Many functions most likely take const references/pointers instead of non-const. -// The class needs to undergo a very careful refactoring to fix that (no matches should break). - // VTABLE: LEGO1 0x100d4350 // VTABLE: BETA10 0x101b8340 // SIZE 0x08 class Matrix4 { +protected: + float (*m_data)[4]; + public: // FUNCTION: LEGO1 0x10004500 // FUNCTION: BETA10 0x1000fc70 Matrix4(float (*p_data)[4]) { SetData(p_data); } - // Note: virtual function overloads appear in the virtual table - // in reverse order of appearance. - - // FUNCTION: LEGO1 0x10002320 - // FUNCTION: BETA10 0x1000fcb0 - virtual void Equals(float (*p_data)[4]) { memcpy(m_data, p_data, sizeof(float) * 4 * 4); } // vtable+0x04 - - // FUNCTION: LEGO1 0x10002340 - // FUNCTION: BETA10 0x1000fcf0 - virtual void Equals(const Matrix4& p_matrix) - { - memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4); - } // vtable+0x00 - - // FUNCTION: LEGO1 0x10002360 - // FUNCTION: BETA10 0x1000fd30 - virtual void SetData(float (*p_data)[4]) { m_data = p_data; } // vtable+0x0c - - // FUNCTION: LEGO1 0x10002370 - // FUNCTION: BETA10 0x1000fd60 - virtual void SetData(UnknownMatrixType& p_matrix) { m_data = p_matrix.m_data; } // vtable+0x08 - - // FUNCTION: LEGO1 0x10002380 - // FUNCTION: BETA10 0x1000fd90 - virtual float (*GetData())[4] { return m_data; } // vtable+0x14 - - // FUNCTION: LEGO1 0x10002390 - // FUNCTION: BETA10 0x1000fdc0 - virtual float (*GetData() const)[4] { return m_data; } // vtable+0x10 - - // FUNCTION: LEGO1 0x100023a0 - // FUNCTION: BETA10 0x1000fdf0 - virtual float* Element(int p_row, int p_col) { return &m_data[p_row][p_col]; } // vtable+0x1c - - // FUNCTION: LEGO1 0x100023c0 - // FUNCTION: BETA10 0x1000fe30 - virtual const float* Element(int p_row, int p_col) const { return &m_data[p_row][p_col]; } // vtable+0x18 - - // FUNCTION: LEGO1 0x100023e0 - // FUNCTION: BETA10 0x1000fe70 - virtual void Clear() { memset(m_data, 0, 16 * sizeof(float)); } // vtable+0x20 - - // FUNCTION: LEGO1 0x100023f0 - // FUNCTION: BETA10 0x1000feb0 - virtual void SetIdentity() - { - Clear(); - m_data[0][0] = 1.0f; - m_data[1][1] = 1.0f; - m_data[2][2] = 1.0f; - m_data[3][3] = 1.0f; - } // vtable+0x24 - - // FUNCTION: LEGO1 0x10002420 - // FUNCTION: BETA10 0x1000ff20 - virtual void operator=(const Matrix4& p_matrix) { Equals(p_matrix); } // vtable+0x28 - - // FUNCTION: LEGO1 0x10002430 - // FUNCTION: BETA10 0x1000ff50 - virtual Matrix4& operator+=(float (*p_data)[4]) - { - for (int i = 0; i < 16; i++) { - ((float*) m_data)[i] += ((float*) p_data)[i]; - } - return *this; - } // vtable+0x2c - - // FUNCTION: LEGO1 0x10002460 - // FUNCTION: BETA10 0x1000ffc0 - virtual void TranslateBy(const float& p_x, const float& p_y, const float& p_z) - { - m_data[3][0] += p_x; - m_data[3][1] += p_y; - m_data[3][2] += p_z; - } // vtable+0x30 - - // FUNCTION: LEGO1 0x100024a0 - // FUNCTION: BETA10 0x10010040 - virtual void SetTranslation(const float& p_x, const float& p_y, const float& p_z) - { - m_data[3][0] = p_x; - m_data[3][1] = p_y; - m_data[3][2] = p_z; - } // vtable+0x34 - - // FUNCTION: LEGO1 0x100024d0 - // FUNCTION: BETA10 0x100100a0 - virtual void Product(float (*p_a)[4], float (*p_b)[4]) - { - float* cur = (float*) m_data; - for (int row = 0; row < 4; row++) { - for (int col = 0; col < 4; col++) { - *cur = 0.0f; - for (int k = 0; k < 4; k++) { - *cur += p_a[row][k] * p_b[k][col]; - } - cur++; - } - } - } // vtable+0x3c - - // FUNCTION: LEGO1 0x10002530 - // FUNCTION: BETA10 0x10010180 - virtual void Product(const Matrix4& p_a, const Matrix4& p_b) { Product(p_a.m_data, p_b.m_data); } // vtable+0x38 - - inline virtual void ToQuaternion(Vector4& p_resultQuat); // vtable+0x40 - inline virtual int FromQuaternion(const Vector4& p_vec); // vtable+0x44 - - // FUNCTION: LEGO1 0x100a0ff0 - // FUNCTION: BETA10 0x1001fe60 - void Scale(const float& p_x, const float& p_y, const float& p_z) - { - for (int i = 0; i < 4; i++) { - m_data[i][0] *= p_x; - m_data[i][1] *= p_y; - m_data[i][2] *= p_z; - } - } - - // FUNCTION: BETA10 0x1001c6a0 - void RotateX(const float& p_angle) - { - float s = sin(p_angle); - float c = cos(p_angle); - float matrix[4][4]; - memcpy(matrix, m_data, sizeof(float) * 16); - for (int i = 0; i < 4; i++) { - m_data[i][1] = matrix[i][1] * c - matrix[i][2] * s; - m_data[i][2] = matrix[i][2] * c + matrix[i][1] * s; - } - } - - // FUNCTION: BETA10 0x1001fd60 - void RotateY(const float& p_angle) - { - float s = sin(p_angle); - float c = cos(p_angle); - float matrix[4][4]; - memcpy(matrix, m_data, sizeof(float) * 16); - for (int i = 0; i < 4; i++) { - m_data[i][0] = matrix[i][0] * c + matrix[i][2] * s; - m_data[i][2] = matrix[i][2] * c - matrix[i][0] * s; - } - } - - // FUNCTION: BETA10 0x1006ab10 - void RotateZ(const float& p_angle) - { - float s = sin(p_angle); - float c = cos(p_angle); - float matrix[4][4]; - memcpy(matrix, m_data, sizeof(float) * 16); - for (int i = 0; i < 4; i++) { - m_data[i][0] = matrix[i][0] * c - matrix[i][1] * s; - m_data[i][1] = matrix[i][1] * c + matrix[i][0] * s; - } - } - - inline int Unknown(Matrix4& p_mat); - - // FUNCTION: LEGO1 0x1006b500 - void Swap(int p_d1, int p_d2) - { - for (int i = 0; i < 4; i++) { - float e = m_data[p_d1][i]; - m_data[p_d1][i] = m_data[p_d2][i]; - m_data[p_d2][i] = e; - } - } + inline virtual void Equals(float (*p_data)[4]); // vtable+0x04 + inline virtual void Equals(const Matrix4& p_matrix); // vtable+0x00 + inline virtual void SetData(float (*p_data)[4]); // vtable+0x0c + inline virtual void SetData(UnknownMatrixType& p_matrix); // vtable+0x08 + inline virtual float (*GetData())[4]; // vtable+0x14 + inline virtual float (*GetData() const)[4]; // vtable+0x10 + inline virtual float* Element(int p_row, int p_col); // vtable+0x1c + inline virtual const float* Element(int p_row, int p_col) const; // vtable+0x18 + inline virtual void Clear(); // vtable+0x20 + inline virtual void SetIdentity(); // vtable+0x24 + inline virtual void operator=(const Matrix4& p_matrix); // vtable+0x28 + inline virtual Matrix4& operator+=(float (*p_data)[4]); // vtable+0x2c + inline virtual void TranslateBy(const float& p_x, const float& p_y, const float& p_z); // vtable+0x30 + inline virtual void SetTranslation(const float& p_x, const float& p_y, const float& p_z); // vtable+0x34 + inline virtual void Product(float (*p_a)[4], float (*p_b)[4]); // vtable+0x3c + inline virtual void Product(const Matrix4& p_a, const Matrix4& p_b); // vtable+0x38 + inline virtual void ToQuaternion(Vector4& p_resultQuat); // vtable+0x40 + inline virtual int FromQuaternion(const Vector4& p_vec); // vtable+0x44 + + inline void Scale(const float& p_x, const float& p_y, const float& p_z); + inline void RotateX(const float& p_angle); + inline void RotateY(const float& p_angle); + inline void RotateZ(const float& p_angle); + inline int BETA_1005a590(Matrix4& p_mat); + inline void Swap(int p_d1, int p_d2); float* operator[](int idx) { return m_data[idx]; } const float* operator[](int idx) const { return m_data[idx]; } - -protected: - float (*m_data)[4]; }; -// FUNCTION: LEGO1 0x10002550 -// FUNCTION: BETA10 0x100101c0 -inline void Matrix4::ToQuaternion(Vector4& p_outQuat) -{ - float trace = m_data[0][0] + m_data[1][1] + m_data[2][2]; - if (trace > 0) { - trace = sqrt(trace + 1.0); - p_outQuat[3] = trace * 0.5f; - trace = 0.5f / trace; - p_outQuat[0] = (m_data[2][1] - m_data[1][2]) * trace; - p_outQuat[1] = (m_data[0][2] - m_data[2][0]) * trace; - p_outQuat[2] = (m_data[1][0] - m_data[0][1]) * trace; - } - else { - - // GLOBAL: LEGO1 0x100d4090 - static int rotateIndex[] = {1, 2, 0}; - - // Largest element along the trace - int largest = 0; - if (m_data[0][0] < m_data[1][1]) { - largest = 1; - } - if (*Element(largest, largest) < m_data[2][2]) { - largest = 2; - } - - int next = rotateIndex[largest]; - int nextNext = rotateIndex[next]; - - float trace = sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0); - - p_outQuat[largest] = trace * 0.5f; - trace = 0.5f / trace; - - p_outQuat[3] = (*Element(nextNext, next) - *Element(next, nextNext)) * trace; - p_outQuat[next] = (*Element(largest, next) + *Element(next, largest)) * trace; - p_outQuat[nextNext] = (*Element(largest, nextNext) + *Element(nextNext, largest)) * trace; - } -} - -// FUNCTION: LEGO1 0x10002710 -// FUNCTION: BETA10 0x10010550 -inline int Matrix4::FromQuaternion(const Vector4& p_vec) -{ - float len = p_vec.LenSquared(); - - if (len > 0.0f) { - float v7 = 2.0f / len; - - float v9 = p_vec[0] * v7; - float v11 = p_vec[1] * v7; - float v12 = p_vec[2] * v7; - - float v13 = p_vec[3] * v9; - float v14 = p_vec[3] * v11; - float v16 = p_vec[3] * v12; - - float v17 = p_vec[0] * v9; - float v22 = p_vec[0] * v11; - float v23 = p_vec[0] * v12; - - float v18 = p_vec[1] * v11; - float v24 = p_vec[1] * v12; - float v19 = p_vec[2] * v12; - - m_data[0][0] = 1.0f - (v18 + v19); - m_data[1][0] = v22 + v16; - m_data[2][0] = v23 - v14; - - m_data[0][1] = v22 - v16; - m_data[1][1] = 1.0f - (v17 + v19); - m_data[2][1] = v24 + v13; - - m_data[0][2] = v14 + v23; - m_data[1][2] = v24 - v13; - m_data[2][2] = 1.0f - (v18 + v17); - - m_data[3][0] = 0; - m_data[3][1] = 0; - m_data[3][2] = 0; - m_data[3][3] = 1.0f; - - m_data[0][3] = 0; - m_data[1][3] = 0; - m_data[2][3] = 0; - return 0; - } - - return -1; -} - -// FUNCTION: BETA10 0x1005a590 -inline int Matrix4::Unknown(Matrix4& p_mat) -{ - float local5c[4][4]; - Matrix4 localc(local5c); - - ((Matrix4&) localc) = *this; - p_mat.SetIdentity(); - - for (int i = 0; i < 4; i++) { - int local1c = i; - int local10; - - for (local10 = i + 1; local10 < 4; local10++) { - if (fabs(localc[local1c][i]) < fabs(localc[local10][i])) { - local1c = local10; - } - } - - if (local1c != i) { - localc.Swap(local1c, i); - p_mat.Swap(local1c, i); - } - - if (localc[i][i] < 0.001f && localc[i][i] > -0.001f) { - return -1; - } - - float local60 = localc[i][i]; - int local18; - - for (local18 = 0; local18 < 4; local18++) { - p_mat[i][local18] /= local60; - } - - for (local18 = 0; local18 < 4; local18++) { - localc[i][local18] /= local60; - } - - for (local10 = 0; local10 < 4; local10++) { - if (i != local10) { - float afStack70[4]; - - for (local18 = 0; local18 < 4; local18++) { - afStack70[local18] = p_mat[i][local18] * localc[local10][i]; - } - - for (local18 = 0; local18 < 4; local18++) { - p_mat[local10][local18] -= afStack70[local18]; - } - - for (local18 = 0; local18 < 4; local18++) { - afStack70[local18] = localc[i][local18] * localc[local10][i]; - } - - for (local18 = 0; local18 < 4; local18++) { - localc[local10][local18] -= afStack70[local18]; - } - } - } - } - - return 0; -} - #endif // MATRIX_H diff --git a/LEGO1/realtime/matrix4d.inl.h b/LEGO1/realtime/matrix4d.inl.h new file mode 100644 index 0000000000..2bf22a85eb --- /dev/null +++ b/LEGO1/realtime/matrix4d.inl.h @@ -0,0 +1,365 @@ +#ifndef MATRIX4D_H +#define MATRIX4D_H + +#include "matrix.h" + +#include +#include + +// FUNCTION: LEGO1 0x10002320 +// FUNCTION: BETA10 0x1000fcb0 +void Matrix4::Equals(float (*p_data)[4]) +{ + memcpy(m_data, p_data, sizeof(float) * 4 * 4); +} + +// FUNCTION: LEGO1 0x10002340 +// FUNCTION: BETA10 0x1000fcf0 +void Matrix4::Equals(const Matrix4& p_matrix) +{ + memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4); +} + +// FUNCTION: LEGO1 0x10002360 +// FUNCTION: BETA10 0x1000fd30 +void Matrix4::SetData(float (*p_data)[4]) +{ + m_data = p_data; +} + +// FUNCTION: LEGO1 0x10002370 +// FUNCTION: BETA10 0x1000fd60 +void Matrix4::SetData(UnknownMatrixType& p_matrix) +{ + m_data = p_matrix.m_data; +} + +// FUNCTION: LEGO1 0x10002380 +// FUNCTION: BETA10 0x1000fd90 +float (*Matrix4::GetData())[4] +{ + return m_data; +} + +// FUNCTION: LEGO1 0x10002390 +// FUNCTION: BETA10 0x1000fdc0 +float (*Matrix4::GetData() const)[4] +{ + return m_data; +} + +// FUNCTION: LEGO1 0x100023a0 +// FUNCTION: BETA10 0x1000fdf0 +float* Matrix4::Element(int p_row, int p_col) +{ + return &m_data[p_row][p_col]; +} + +// FUNCTION: LEGO1 0x100023c0 +// FUNCTION: BETA10 0x1000fe30 +const float* Matrix4::Element(int p_row, int p_col) const +{ + return &m_data[p_row][p_col]; +} + +// FUNCTION: LEGO1 0x100023e0 +// FUNCTION: BETA10 0x1000fe70 +void Matrix4::Clear() +{ + memset(m_data, 0, 16 * sizeof(float)); +} + +// FUNCTION: LEGO1 0x100023f0 +// FUNCTION: BETA10 0x1000feb0 +void Matrix4::SetIdentity() +{ + Clear(); + m_data[0][0] = 1.0f; + m_data[1][1] = 1.0f; + m_data[2][2] = 1.0f; + m_data[3][3] = 1.0f; +} + +// FUNCTION: LEGO1 0x10002420 +// FUNCTION: BETA10 0x1000ff20 +void Matrix4::operator=(const Matrix4& p_matrix) +{ + Equals(p_matrix); +} + +// FUNCTION: LEGO1 0x10002430 +// FUNCTION: BETA10 0x1000ff50 +Matrix4& Matrix4::operator+=(float (*p_data)[4]) +{ + for (int i = 0; i < 16; i++) { + ((float*) m_data)[i] += ((float*) p_data)[i]; + } + + return *this; +} + +// FUNCTION: LEGO1 0x10002460 +// FUNCTION: BETA10 0x1000ffc0 +void Matrix4::TranslateBy(const float& p_x, const float& p_y, const float& p_z) +{ + m_data[3][0] += p_x; + m_data[3][1] += p_y; + m_data[3][2] += p_z; +} + +// FUNCTION: LEGO1 0x100024a0 +// FUNCTION: BETA10 0x10010040 +void Matrix4::SetTranslation(const float& p_x, const float& p_y, const float& p_z) +{ + m_data[3][0] = p_x; + m_data[3][1] = p_y; + m_data[3][2] = p_z; +} + +// FUNCTION: LEGO1 0x100024d0 +// FUNCTION: BETA10 0x100100a0 +void Matrix4::Product(float (*p_a)[4], float (*p_b)[4]) +{ + float* cur = (float*) m_data; + + for (int row = 0; row < 4; row++) { + for (int col = 0; col < 4; col++) { + *cur = 0.0f; + for (int k = 0; k < 4; k++) { + *cur += p_a[row][k] * p_b[k][col]; + } + cur++; + } + } +} + +// FUNCTION: LEGO1 0x10002530 +// FUNCTION: BETA10 0x10010180 +void Matrix4::Product(const Matrix4& p_a, const Matrix4& p_b) +{ + Product(p_a.m_data, p_b.m_data); +} + +// FUNCTION: LEGO1 0x10002550 +// FUNCTION: BETA10 0x100101c0 +void Matrix4::ToQuaternion(Vector4& p_outQuat) +{ + float trace; + float localc = m_data[0][0] + m_data[1][1] + m_data[2][2]; + + if (localc > 0) { + trace = (float) sqrt(localc + 1.0); + p_outQuat[3] = trace * 0.5f; + trace = 0.5f / trace; + p_outQuat[0] = (m_data[2][1] - m_data[1][2]) * trace; + p_outQuat[1] = (m_data[0][2] - m_data[2][0]) * trace; + p_outQuat[2] = (m_data[1][0] - m_data[0][1]) * trace; + } + else { + // GLOBAL: LEGO1 0x100d4090 + static int rotateIndex[] = {1, 2, 0}; + + // Largest element along the trace + int largest = 0; + if (m_data[0][0] < m_data[1][1]) { + largest = 1; + } + if (*Element(largest, largest) < m_data[2][2]) { + largest = 2; + } + + int next = rotateIndex[largest]; + int nextNext = rotateIndex[next]; + + trace = (float) sqrt(*Element(largest, largest) - (*Element(nextNext, nextNext) + *Element(next, next)) + 1.0); + + p_outQuat[largest] = trace * 0.5f; + trace = 0.5f / trace; + + p_outQuat[3] = (*Element(nextNext, next) - *Element(next, nextNext)) * trace; + p_outQuat[next] = (*Element(largest, next) + *Element(next, largest)) * trace; + p_outQuat[nextNext] = (*Element(largest, nextNext) + *Element(nextNext, largest)) * trace; + } +} + +// FUNCTION: LEGO1 0x10002710 +// FUNCTION: BETA10 0x10010550 +int Matrix4::FromQuaternion(const Vector4& p_vec) +{ + float local14 = p_vec.LenSquared(); + + if (local14 > 0.0f) { + local14 = 2.0f / local14; + + float local24 = p_vec[0] * local14; + float local34 = p_vec[1] * local14; + float local10 = p_vec[2] * local14; + + float local28 = p_vec[3] * local24; + float local2c = p_vec[3] * local34; + float local30 = p_vec[3] * local10; + + float local38 = p_vec[0] * local24; + float local8 = p_vec[0] * local34; + float localc = p_vec[0] * local10; + + float local18 = p_vec[1] * local34; + float local1c = p_vec[1] * local10; + float local20 = p_vec[2] * local10; + + m_data[0][0] = 1.0f - (local18 + local20); + m_data[1][0] = local8 + local30; + m_data[2][0] = localc - local2c; + + m_data[0][1] = local8 - local30; + m_data[1][1] = 1.0f - (local38 + local20); + m_data[2][1] = local1c + local28; + + m_data[0][2] = local2c + localc; + m_data[1][2] = local1c - local28; + m_data[2][2] = 1.0f - (local18 + local38); + + m_data[3][0] = 0.0f; + m_data[3][1] = 0.0f; + m_data[3][2] = 0.0f; + m_data[3][3] = 1.0f; + + m_data[0][3] = 0.0f; + m_data[1][3] = 0.0f; + m_data[2][3] = 0.0f; + return 0; + } + else { + return -1; + } +} + +// FUNCTION: LEGO1 0x100a0ff0 +// FUNCTION: BETA10 0x1001fe60 +void Matrix4::Scale(const float& p_x, const float& p_y, const float& p_z) +{ + for (int i = 0; i < 4; i++) { + m_data[i][0] *= p_x; + m_data[i][1] *= p_y; + m_data[i][2] *= p_z; + } +} + +// FUNCTION: BETA10 0x1001c6a0 +void Matrix4::RotateX(const float& p_angle) +{ + float s = sin(p_angle); + float c = cos(p_angle); + float matrix[4][4]; + memcpy(matrix, m_data, sizeof(float) * 16); + + for (int i = 0; i < 4; i++) { + m_data[i][1] = matrix[i][1] * c - matrix[i][2] * s; + m_data[i][2] = matrix[i][2] * c + matrix[i][1] * s; + } +} + +// FUNCTION: BETA10 0x1001fd60 +void Matrix4::RotateY(const float& p_angle) +{ + float s = sin(p_angle); + float c = cos(p_angle); + float matrix[4][4]; + memcpy(matrix, m_data, sizeof(float) * 16); + + for (int i = 0; i < 4; i++) { + m_data[i][0] = matrix[i][0] * c + matrix[i][2] * s; + m_data[i][2] = matrix[i][2] * c - matrix[i][0] * s; + } +} + +// FUNCTION: BETA10 0x1006ab10 +void Matrix4::RotateZ(const float& p_angle) +{ + float s = sin(p_angle); + float c = cos(p_angle); + float matrix[4][4]; + memcpy(matrix, m_data, sizeof(float) * 16); + + for (int i = 0; i < 4; i++) { + m_data[i][0] = matrix[i][0] * c - matrix[i][1] * s; + m_data[i][1] = matrix[i][1] * c + matrix[i][0] * s; + } +} + +// FUNCTION: BETA10 0x1005a590 +int Matrix4::BETA_1005a590(Matrix4& p_mat) +{ + float local5c[4][4]; + Matrix4 localc(local5c); + + ((Matrix4&) localc) = *this; + p_mat.SetIdentity(); + + for (int i = 0; i < 4; i++) { + int local1c = i; + int local10; + + for (local10 = i + 1; local10 < 4; local10++) { + if (fabs(localc[local1c][i]) < fabs(localc[local10][i])) { + local1c = local10; + } + } + + if (local1c != i) { + localc.Swap(local1c, i); + p_mat.Swap(local1c, i); + } + + if (localc[i][i] < 0.001f && localc[i][i] > -0.001f) { + return -1; + } + + float local60 = localc[i][i]; + int local18; + + for (local18 = 0; local18 < 4; local18++) { + p_mat[i][local18] /= local60; + } + + for (local18 = 0; local18 < 4; local18++) { + localc[i][local18] /= local60; + } + + for (local10 = 0; local10 < 4; local10++) { + if (i != local10) { + float afStack70[4]; + + for (local18 = 0; local18 < 4; local18++) { + afStack70[local18] = p_mat[i][local18] * localc[local10][i]; + } + + for (local18 = 0; local18 < 4; local18++) { + p_mat[local10][local18] -= afStack70[local18]; + } + + for (local18 = 0; local18 < 4; local18++) { + afStack70[local18] = localc[i][local18] * localc[local10][i]; + } + + for (local18 = 0; local18 < 4; local18++) { + localc[local10][local18] -= afStack70[local18]; + } + } + } + } + + return 0; +} + +// FUNCTION: LEGO1 0x1006b500 +void Matrix4::Swap(int p_d1, int p_d2) +{ + for (int i = 0; i < 4; i++) { + float e = m_data[p_d1][i]; + m_data[p_d1][i] = m_data[p_d2][i]; + m_data[p_d2][i] = e; + } +} + +#endif // MATRIX4D_H diff --git a/LEGO1/realtime/vector.cpp b/LEGO1/realtime/vector.cpp deleted file mode 100644 index ad09b0b0ea..0000000000 --- a/LEGO1/realtime/vector.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "vector.h" - -#include "decomp.h" - -DECOMP_SIZE_ASSERT(Vector2, 0x08); -DECOMP_SIZE_ASSERT(Vector3, 0x08); -DECOMP_SIZE_ASSERT(Vector4, 0x08); diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index f609c7af1b..defaab5730 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -3,172 +3,54 @@ #include "compat.h" -#include -#include - -// Note: Many functions most likely take const references/pointers instead of non-const. -// The class needs to undergo a very careful refactoring to fix that (no matches should break). +// Note: virtual function overloads appear in the virtual table +// in reverse order of appearance. // VTABLE: LEGO1 0x100d4288 // VTABLE: BETA10 0x101b8440 // SIZE 0x08 class Vector2 { +protected: + inline virtual void AddImpl(const float* p_value); // vtable+0x04 + inline virtual void AddImpl(float p_value); // vtable+0x00 + inline virtual void SubImpl(const float* p_value); // vtable+0x08 + inline virtual void MulImpl(const float* p_value); // vtable+0x10 + inline virtual void MulImpl(const float& p_value); // vtable+0x0c + inline virtual void DivImpl(const float& p_value); // vtable+0x14 + inline virtual float DotImpl(const float* p_a, const float* p_b) const; // vtable+0x18 + inline virtual void SetData(float* p_data); // vtable+0x1c + inline virtual void EqualsImpl(const float* p_data); // vtable+0x20 + + float* m_data; // 0x04 + public: // FUNCTION: LEGO1 0x1000c0f0 // FUNCTION: BETA10 0x100116a0 Vector2(float* p_data) { SetData(p_data); } - // Note: virtual function overloads appear in the virtual table - // in reverse order of appearance. - - // FUNCTION: LEGO1 0x10001f80 - virtual void AddImpl(float* p_value) - { - m_data[0] += p_value[0]; - m_data[1] += p_value[1]; - } // vtable+0x04 - - // FUNCTION: LEGO1 0x10001fa0 - virtual void AddImpl(float p_value) - { - m_data[0] += p_value; - m_data[1] += p_value; - } // vtable+0x00 - - // FUNCTION: LEGO1 0x10001fc0 - virtual void SubImpl(float* p_value) - { - m_data[0] -= p_value[0]; - m_data[1] -= p_value[1]; - } // vtable+0x08 - - // Those are also overloads in all likelihood, - // but we need a type to do that. - - // FUNCTION: LEGO1 0x10002000 - virtual void MulScalarImpl(float* p_value) - { - m_data[0] *= *p_value; - m_data[1] *= *p_value; - } // vtable+0x0c - - // FUNCTION: LEGO1 0x10001fe0 - virtual void MulVectorImpl(float* p_value) - { - m_data[0] *= p_value[0]; - m_data[1] *= p_value[1]; - } // vtable+0x10 - - // FUNCTION: LEGO1 0x10002020 - virtual void DivScalarImpl(float* p_value) - { - m_data[0] /= *p_value; - m_data[1] /= *p_value; - } // vtable+0x14 - - // FUNCTION: LEGO1 0x10002040 - virtual float DotImpl(float* p_a, float* p_b) const { return p_b[0] * p_a[0] + p_b[1] * p_a[1]; } // vtable+0x18 - - // FUNCTION: LEGO1 0x10002060 - // FUNCTION: BETA10 0x10010c90 - virtual void SetData(float* p_data) { m_data = p_data; } // vtable+0x1c - - // FUNCTION: LEGO1 0x10002070 - virtual void EqualsImpl(float* p_data) { memcpy(m_data, p_data, sizeof(float) * 2); } // vtable+0x20 - - // FUNCTION: LEGO1 0x10002090 - virtual float* GetData() { return m_data; } // vtable+0x28 - - // FUNCTION: LEGO1 0x100020a0 - virtual const float* GetData() const { return m_data; } // vtable+0x24 - - // FUNCTION: LEGO1 0x100020b0 - virtual void Clear() { memset(m_data, 0, sizeof(float) * 2); } // vtable+0x2c - - // FUNCTION: LEGO1 0x100020d0 - virtual float Dot(float* p_a, float* p_b) const { return DotImpl(p_a, p_b); } // vtable+0x3c - - // FUNCTION: LEGO1 0x100020f0 - // FUNCTION: BETA10 0x100108c0 - virtual float Dot(Vector2* p_a, Vector2* p_b) const { return DotImpl(p_a->m_data, p_b->m_data); } // vtable+0x38 - - // FUNCTION: LEGO1 0x10002110 - virtual float Dot(float* p_a, Vector2* p_b) const { return DotImpl(p_a, p_b->m_data); } // vtable+0x34 - - // FUNCTION: LEGO1 0x10002130 - virtual float Dot(Vector2* p_a, float* p_b) const { return DotImpl(p_a->m_data, p_b); } // vtable+0x30 - - // FUNCTION: LEGO1 0x10002150 - virtual float LenSquared() const { return m_data[0] * m_data[0] + m_data[1] * m_data[1]; } // vtable+0x40 - - // FUNCTION: LEGO1 0x10002160 - // FUNCTION: BETA10 0x10010900 - virtual int Unitize() - { - float sq = LenSquared(); - - if (sq > 0.0f) { - float root = sqrt(sq); - if (root > 0.0f) { - DivScalarImpl(&root); - return 0; - } - } - - return -1; - } // vtable+0x44 - -private: - // FUNCTION: LEGO1 0x100021c0 - virtual void Add(float p_value) { AddImpl(p_value); } // vtable+0x50 - - // FUNCTION: LEGO1 0x100021d0 - virtual void Add(float* p_other) { AddImpl(p_other); } // vtable+0x4c - - // FUNCTION: LEGO1 0x100021e0 - virtual void Add(const Vector2& p_other) { AddImpl((float*) p_other.m_data); } // vtable+0x48 - - // FUNCTION: LEGO1 0x100021f0 - virtual void Sub(const float* p_other) { SubImpl((float*) p_other); } // vtable+0x58 - - // FUNCTION: LEGO1 0x10002200 - virtual void Sub(const Vector2& p_other) { SubImpl((float*) p_other.m_data); } // vtable+0x54 - - // FUNCTION: LEGO1 0x10002210 - virtual void Mul(float* p_other) { MulVectorImpl(p_other); } // vtable+0x64 - - // FUNCTION: LEGO1 0x10002220 - virtual void Mul(Vector2* p_other) { MulVectorImpl(p_other->m_data); } // vtable+0x60 - - // FUNCTION: LEGO1 0x10002230 - virtual void Mul(const float& p_value) { MulScalarImpl((float*) &p_value); } // vtable+0x5c - - // FUNCTION: LEGO1 0x10002240 - virtual void Div(const float& p_value) { DivScalarImpl((float*) &p_value); } // vtable+0x68 - -public: - // FUNCTION: LEGO1 0x10002250 - virtual void SetVector(float* p_other) { EqualsImpl(p_other); } // vtable+0x70 - - // FUNCTION: LEGO1 0x10002260 - // FUNCTION: BETA10 0x100110c0 - virtual void SetVector(const Vector2* p_other) { EqualsImpl(p_other->m_data); } // vtable+0x6c - - // Note: it's unclear whether Vector3::operator= has been defined explicitly - // with the same function body as Vector2& operator=. The BETA indicates that; - // however, it makes LEGO1 0x10010be0 disappear and worsens matches in - // at least these functions: - // LEGO1 0x100109b0 - // LEGO1 0x10023130 - // LEGO1 0x1002de10 - // LEGO1 0x10050a80 - // LEGO1 0x10053980 - // LEGO1 0x100648f0 - // LEGO1 0x10064b50 - // LEGO1 0x10084030 - // LEGO1 0x100a9410 - // However, defining it as in the BETA improves at least these functions: - // LEGO1 0x10042300 + // FUNCTION: BETA10 0x100109e0 + Vector2(const float* p_data) { m_data = (float*) p_data; } + + inline virtual float* GetData(); // vtable+0x28 + inline virtual const float* GetData() const; // vtable+0x24 + inline virtual void Clear(); // vtable+0x2c + inline virtual float Dot(const float* p_a, const float* p_b) const; // vtable+0x3c + inline virtual float Dot(const Vector2& p_a, const Vector2& p_b) const; // vtable+0x38 + inline virtual float Dot(const float* p_a, const Vector2& p_b) const; // vtable+0x34 + inline virtual float Dot(const Vector2& p_a, const float* p_b) const; // vtable+0x30 + inline virtual float LenSquared() const; // vtable+0x40 + inline virtual int Unitize(); // vtable+0x44 + inline virtual void operator+=(float p_value); // vtable+0x50 + inline virtual void operator+=(const float* p_other); // vtable+0x4c + inline virtual void operator+=(const Vector2& p_other); // vtable+0x48 + inline virtual void operator-=(const float* p_other); // vtable+0x58 + inline virtual void operator-=(const Vector2& p_other); // vtable+0x54 + inline virtual void operator*=(const float* p_other); // vtable+0x64 + inline virtual void operator*=(const Vector2& p_other); // vtable+0x60 + inline virtual void operator*=(const float& p_value); // vtable+0x5c + inline virtual void operator/=(const float& p_value); // vtable+0x68 + inline virtual void operator=(const float* p_other); // vtable+0x70 + inline virtual void operator=(const Vector2& p_other); // vtable+0x6c // SYNTHETIC: LEGO1 0x10010be0 // SYNTHETIC: BETA10 0x100121e0 @@ -177,39 +59,28 @@ class Vector2 { // SYNTHETIC: BETA10 0x1004af40 // Vector4::operator= - Vector2& operator=(const Vector2& p_other) - { - Vector2::SetVector(&p_other); - return *this; - } - // FUNCTION: BETA10 0x1001d140 float& operator[](int idx) { return m_data[idx]; } // FUNCTION: BETA10 0x1001d170 const float& operator[](int idx) const { return m_data[idx]; } - - void operator+=(float p_value) { Add(p_value); } - void operator+=(float* p_other) { Add(p_other); } - void operator+=(const Vector2& p_other) { Add(p_other); } - - void operator-=(const float* p_other) { Sub(p_other); } - void operator-=(const Vector2& p_other) { Sub(p_other); } - - void operator*=(float* p_other) { Mul(p_other); } - void operator*=(Vector2* p_other) { Mul(p_other); } - void operator*=(const float& p_value) { Mul(p_value); } - - void operator/=(const float& p_value) { Div(p_value); } - -protected: - float* m_data; // 0x04 }; // VTABLE: LEGO1 0x100d4518 // VTABLE: BETA10 0x101b8398 // SIZE 0x08 class Vector3 : public Vector2 { +protected: + inline void AddImpl(const float* p_value) override; // vtable+0x04 + inline void AddImpl(float p_value) override; // vtable+0x00 + inline void SubImpl(const float* p_value) override; // vtable+0x08 + inline void MulImpl(const float* p_value) override; // vtable+0x10 + inline void MulImpl(const float& p_value) override; // vtable+0x0c + inline void DivImpl(const float& p_value) override; // vtable+0x14 + inline float DotImpl(const float* p_a, const float* p_b) const override; // vtable+0x18 + inline void EqualsImpl(const float* p_data) override; // vtable+0x20 + inline virtual void EqualsCrossImpl(const float* p_a, const float* p_b); // vtable+0x74 + public: // FUNCTION: LEGO1 0x1001d150 // FUNCTION: BETA10 0x10011660 @@ -221,108 +92,14 @@ class Vector3 : public Vector2 { // initialization with a const source fundamentally incompatible. // FUNCTION: BETA10 0x100109a0 - Vector3(const float* p_data) : Vector2((float*) p_data) {} - - // Note: virtual function overloads appear in the virtual table - // in reverse order of appearance. - - // FUNCTION: LEGO1 0x10002270 - // FUNCTION: BETA10 0x10011350 - virtual void EqualsCrossImpl(float* p_a, float* p_b) - { - m_data[0] = p_a[1] * p_b[2] - p_a[2] * p_b[1]; - m_data[1] = p_a[2] * p_b[0] - p_a[0] * p_b[2]; - m_data[2] = p_a[0] * p_b[1] - p_a[1] * p_b[0]; - } // vtable+0x74 - - // FUNCTION: LEGO1 0x100022c0 - // FUNCTION: BETA10 0x10011430 - virtual void EqualsCross(Vector3* p_a, Vector3* p_b) { EqualsCrossImpl(p_a->m_data, p_b->m_data); } // vtable+0x80 - - // FUNCTION: LEGO1 0x100022e0 - virtual void EqualsCross(Vector3* p_a, float* p_b) { EqualsCrossImpl(p_a->m_data, p_b); } // vtable+0x7c - - // FUNCTION: LEGO1 0x10002300 - virtual void EqualsCross(float* p_a, Vector3* p_b) { EqualsCrossImpl(p_a, p_b->m_data); } // vtable+0x78 - - // FUNCTION: LEGO1 0x10003bf0 - virtual void Fill(const float& p_value) - { - m_data[0] = p_value; - m_data[1] = p_value; - m_data[2] = p_value; - } // vtable+0x84 + Vector3(const float* p_data) : Vector2(p_data) {} - // Vector2 overrides - - // FUNCTION: LEGO1 0x10003a60 - void AddImpl(float* p_value) override - { - m_data[0] += p_value[0]; - m_data[1] += p_value[1]; - m_data[2] += p_value[2]; - } // vtable+0x04 - - // FUNCTION: LEGO1 0x10003a90 - void AddImpl(float p_value) override - { - m_data[0] += p_value; - m_data[1] += p_value; - m_data[2] += p_value; - } // vtable+0x00 - - // FUNCTION: LEGO1 0x10003ac0 - void SubImpl(float* p_value) override - { - m_data[0] -= p_value[0]; - m_data[1] -= p_value[1]; - m_data[2] -= p_value[2]; - } // vtable+0x08 - - // FUNCTION: LEGO1 0x10003b20 - void MulScalarImpl(float* p_value) override - { - m_data[0] *= *p_value; - m_data[1] *= *p_value; - m_data[2] *= *p_value; - } // vtable+0x0c - - // FUNCTION: LEGO1 0x10003af0 - void MulVectorImpl(float* p_value) override - { - m_data[0] *= p_value[0]; - m_data[1] *= p_value[1]; - m_data[2] *= p_value[2]; - } // vtable+0x10 - - // FUNCTION: LEGO1 0x10003b50 - void DivScalarImpl(float* p_value) override - { - m_data[0] /= *p_value; - m_data[1] /= *p_value; - m_data[2] /= *p_value; - } // vtable+0x14 - - // FUNCTION: LEGO1 0x10003b80 - float DotImpl(float* p_a, float* p_b) const override - { - return p_a[0] * p_b[0] + p_a[2] * p_b[2] + p_a[1] * p_b[1]; - } // vtable+0x18 - - // FUNCTION: LEGO1 0x10003ba0 - // FUNCTION: BETA10 0x100113f0 - void EqualsImpl(float* p_data) override { memcpy(m_data, p_data, sizeof(float) * 3); } // vtable+0x20 - - // FUNCTION: LEGO1 0x10003bc0 - // FUNCTION: BETA10 0x100114f0 - void Clear() override { memset(m_data, 0, sizeof(float) * 3); } // vtable+0x2c - - // FUNCTION: LEGO1 0x10003bd0 - // FUNCTION: BETA10 0x10011530 - float LenSquared() const override - { - return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2]; - } // vtable+0x40 + inline void Clear() override; // vtable+0x2c + inline float LenSquared() const override; // vtable+0x40 + inline virtual void EqualsCross(const Vector3& p_a, const Vector3& p_b); // vtable+0x80 + inline virtual void EqualsCross(const Vector3& p_a, const float* p_b); // vtable+0x7c + inline virtual void EqualsCross(const float* p_a, const Vector3& p_b); // vtable+0x78 + inline virtual void Fill(const float& p_value); // vtable+0x84 friend class Mx3DPointFloat; }; @@ -331,6 +108,16 @@ class Vector3 : public Vector2 { // VTABLE: BETA10 0x101bac38 // SIZE 0x08 class Vector4 : public Vector3 { +protected: + inline void AddImpl(const float* p_value) override; // vtable+0x04 + inline void AddImpl(float p_value) override; // vtable+0x00 + inline void SubImpl(const float* p_value) override; // vtable+0x08 + inline void MulImpl(const float* p_value) override; // vtable+0x10 + inline void MulImpl(const float& p_value) override; // vtable+0x0c + inline void DivImpl(const float& p_value) override; // vtable+0x14 + inline float DotImpl(const float* p_a, const float* p_b) const override; // vtable+0x18 + inline void EqualsImpl(const float* p_data) override; // vtable+0x20 + public: // FUNCTION: BETA10 0x10048780 Vector4(float* p_data) : Vector3(p_data) {} @@ -343,108 +130,15 @@ class Vector4 : public Vector3 { // supporting the theory that this decompilation is correct. // FUNCTION: BETA10 0x100701b0 - Vector4(const float* p_data) : Vector3((float*) p_data) {} - - // Note: virtual function overloads appear in the virtual table - // in reverse order of appearance. - - // FUNCTION: LEGO1 0x10002a40 - virtual void SetMatrixProduct(float* p_vec, float* p_mat) - { - m_data[0] = p_vec[0] * p_mat[0] + p_vec[1] * p_mat[4] + p_vec[2] * p_mat[8] + p_vec[3] * p_mat[12]; - m_data[1] = p_vec[0] * p_mat[1] + p_vec[1] * p_mat[5] + p_vec[2] * p_mat[9] + p_vec[4] * p_mat[13]; - m_data[2] = p_vec[0] * p_mat[2] + p_vec[1] * p_mat[6] + p_vec[2] * p_mat[10] + p_vec[4] * p_mat[14]; - m_data[3] = p_vec[0] * p_mat[3] + p_vec[1] * p_mat[7] + p_vec[2] * p_mat[11] + p_vec[4] * p_mat[15]; - } // vtable+0x8c - - // FUNCTION: LEGO1 0x10002ae0 - virtual void SetMatrixProduct(Vector4* p_a, float* p_b) { SetMatrixProduct(p_a->m_data, p_b); } // vtable+0x88 - - inline virtual int NormalizeQuaternion(); // vtable+0x90 - inline virtual int EqualsHamiltonProduct(Vector4* p_a, Vector4* p_b); // vtable+0x94 - - // Vector3 overrides - - // FUNCTION: LEGO1 0x10002870 - void AddImpl(float* p_value) override - { - m_data[0] += p_value[0]; - m_data[1] += p_value[1]; - m_data[2] += p_value[2]; - m_data[3] += p_value[3]; - } // vtable+0x04 - - // FUNCTION: LEGO1 0x100028b0 - void AddImpl(float p_value) override - { - m_data[0] += p_value; - m_data[1] += p_value; - m_data[2] += p_value; - m_data[3] += p_value; - } // vtable+0x00 - - // FUNCTION: LEGO1 0x100028f0 - void SubImpl(float* p_value) override - { - m_data[0] -= p_value[0]; - m_data[1] -= p_value[1]; - m_data[2] -= p_value[2]; - m_data[3] -= p_value[3]; - } // vtable+0x08 - - // FUNCTION: LEGO1 0x10002970 - void MulScalarImpl(float* p_value) override - { - m_data[0] *= *p_value; - m_data[1] *= *p_value; - m_data[2] *= *p_value; - m_data[3] *= *p_value; - } // vtable+0x0c - - // FUNCTION: LEGO1 0x10002930 - void MulVectorImpl(float* p_value) override - { - m_data[0] *= p_value[0]; - m_data[1] *= p_value[1]; - m_data[2] *= p_value[2]; - m_data[3] *= p_value[3]; - } // vtable+0x10 + Vector4(const float* p_data) : Vector3(p_data) {} - // FUNCTION: LEGO1 0x100029b0 - void DivScalarImpl(float* p_value) override - { - m_data[0] /= *p_value; - m_data[1] /= *p_value; - m_data[2] /= *p_value; - m_data[3] /= *p_value; - } // vtable+0x14 - - // FUNCTION: LEGO1 0x100029f0 - float DotImpl(float* p_a, float* p_b) const override - { - return p_a[0] * p_b[0] + p_a[2] * p_b[2] + (p_a[1] * p_b[1] + p_a[3] * p_b[3]); - } // vtable+0x18 - - // FUNCTION: LEGO1 0x10002a20 - void EqualsImpl(float* p_data) override { memcpy(m_data, p_data, sizeof(float) * 4); } // vtable+0x20 - - // FUNCTION: LEGO1 0x10002b00 - void Clear() override { memset(m_data, 0, sizeof(float) * 4); } // vtable+0x2c - - // FUNCTION: LEGO1 0x10002b20 - float LenSquared() const override - { - return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2] + m_data[3] * m_data[3]; - } // vtable+0x40 - - // FUNCTION: LEGO1 0x10002b40 - void Fill(const float& p_value) override - { - m_data[0] = p_value; - m_data[1] = p_value; - m_data[2] = p_value; - m_data[3] = p_value; - } // vtable+0x84 + inline void Clear() override; // vtable+0x2c + inline float LenSquared() const override; // vtable+0x40 + inline void Fill(const float& p_value) override; // vtable+0x84 + inline virtual void SetMatrixProduct(const float* p_vec, const float* p_mat); // vtable+0x8c + inline virtual void SetMatrixProduct(const Vector4& p_a, const float* p_b); // vtable+0x88 + inline virtual int NormalizeQuaternion(); // vtable+0x90 + inline virtual int EqualsHamiltonProduct(const Vector4& p_a, const Vector4& p_b); // vtable+0x94 float& operator[](int idx) { return m_data[idx]; } @@ -454,42 +148,4 @@ class Vector4 : public Vector3 { friend class Mx4DPointFloat; }; -// FUNCTION: LEGO1 0x10002b70 -// FUNCTION: BETA10 0x10048ad0 -inline int Vector4::NormalizeQuaternion() -{ - float* v = m_data; - float magnitude = v[0] * v[0] + v[2] * v[2] + v[1] * v[1]; - if (magnitude > 0.0f) { - float theta = v[3] * 0.5f; - v[3] = cos(theta); - magnitude = sin(theta) / sqrt(magnitude); - Vector3::MulScalarImpl(&magnitude); - return 0; - } - return -1; -} - -inline static float QuaternionProductScalarPart(float* bDat, float* aDat) -{ - // We have no indication from the beta that this function exists, - // but it helps with the stack layout of Vector4::EqualsHamiltonProduct() - return aDat[3] * bDat[3] - (aDat[0] * bDat[0] + aDat[2] * bDat[2] + aDat[1] * bDat[1]); -} - -// FUNCTION: LEGO1 0x10002bf0 -// FUNCTION: BETA10 0x10048c20 -inline int Vector4::EqualsHamiltonProduct(Vector4* p_a, Vector4* p_b) -{ - m_data[3] = QuaternionProductScalarPart(p_a->m_data, p_b->m_data); - - Vector3::EqualsCrossImpl(p_a->m_data, p_b->m_data); - - m_data[0] = p_b->m_data[3] * p_a->m_data[0] + p_a->m_data[3] * p_b->m_data[0] + m_data[0]; - m_data[1] = p_b->m_data[1] * p_a->m_data[3] + p_a->m_data[1] * p_b->m_data[3] + m_data[1]; - m_data[2] = p_b->m_data[2] * p_a->m_data[3] + p_a->m_data[2] * p_b->m_data[3] + m_data[2]; - - return 0; -} - #endif // VECTOR_H diff --git a/LEGO1/realtime/vector2d.inl.h b/LEGO1/realtime/vector2d.inl.h new file mode 100644 index 0000000000..95e7ea7d61 --- /dev/null +++ b/LEGO1/realtime/vector2d.inl.h @@ -0,0 +1,203 @@ +#ifndef VECTOR2D_H +#define VECTOR2D_H + +#include "vector.h" + +#include +#include + +// FUNCTION: LEGO1 0x10001f80 +void Vector2::AddImpl(const float* p_value) +{ + m_data[0] += p_value[0]; + m_data[1] += p_value[1]; +} + +// FUNCTION: LEGO1 0x10001fa0 +void Vector2::AddImpl(float p_value) +{ + m_data[0] += p_value; + m_data[1] += p_value; +} + +// FUNCTION: LEGO1 0x10001fc0 +void Vector2::SubImpl(const float* p_value) +{ + m_data[0] -= p_value[0]; + m_data[1] -= p_value[1]; +} + +// FUNCTION: LEGO1 0x10001fe0 +void Vector2::MulImpl(const float* p_value) +{ + m_data[0] *= p_value[0]; + m_data[1] *= p_value[1]; +} + +// FUNCTION: LEGO1 0x10002000 +void Vector2::MulImpl(const float& p_value) +{ + m_data[0] *= p_value; + m_data[1] *= p_value; +} + +// FUNCTION: LEGO1 0x10002020 +void Vector2::DivImpl(const float& p_value) +{ + m_data[0] /= p_value; + m_data[1] /= p_value; +} + +// FUNCTION: LEGO1 0x10002040 +float Vector2::DotImpl(const float* p_a, const float* p_b) const +{ + return p_b[0] * p_a[0] + p_b[1] * p_a[1]; +} + +// FUNCTION: LEGO1 0x10002060 +// FUNCTION: BETA10 0x10010c90 +void Vector2::SetData(float* p_data) +{ + m_data = p_data; +} + +// FUNCTION: LEGO1 0x10002070 +void Vector2::EqualsImpl(const float* p_data) +{ + memcpy(m_data, p_data, sizeof(float) * 2); +} + +// FUNCTION: LEGO1 0x10002090 +float* Vector2::GetData() +{ + return m_data; +} + +// FUNCTION: LEGO1 0x100020a0 +const float* Vector2::GetData() const +{ + return m_data; +} + +// FUNCTION: LEGO1 0x100020b0 +void Vector2::Clear() +{ + memset(m_data, 0, sizeof(float) * 2); +} + +// FUNCTION: LEGO1 0x100020d0 +float Vector2::Dot(const float* p_a, const float* p_b) const +{ + return DotImpl(p_a, p_b); +} + +// FUNCTION: LEGO1 0x100020f0 +// FUNCTION: BETA10 0x100108c0 +float Vector2::Dot(const Vector2& p_a, const Vector2& p_b) const +{ + return DotImpl(p_a.m_data, p_b.m_data); +} + +// FUNCTION: LEGO1 0x10002110 +float Vector2::Dot(const float* p_a, const Vector2& p_b) const +{ + return DotImpl(p_a, p_b.m_data); +} + +// FUNCTION: LEGO1 0x10002130 +float Vector2::Dot(const Vector2& p_a, const float* p_b) const +{ + return DotImpl(p_a.m_data, p_b); +} + +// FUNCTION: LEGO1 0x10002150 +float Vector2::LenSquared() const +{ + return m_data[0] * m_data[0] + m_data[1] * m_data[1]; +} + +// FUNCTION: LEGO1 0x10002160 +// FUNCTION: BETA10 0x10010900 +int Vector2::Unitize() +{ + float sq = LenSquared(); + + if (sq > 0.0f) { + float root = sqrt(sq); + if (root > 0.0f) { + DivImpl(root); + return 0; + } + } + + return -1; +} + +// FUNCTION: LEGO1 0x100021c0 +void Vector2::operator+=(float p_value) +{ + AddImpl(p_value); +} + +// FUNCTION: LEGO1 0x100021d0 +void Vector2::operator+=(const float* p_other) +{ + AddImpl(p_other); +} + +// FUNCTION: LEGO1 0x100021e0 +void Vector2::operator+=(const Vector2& p_other) +{ + AddImpl(p_other.m_data); +} + +// FUNCTION: LEGO1 0x100021f0 +void Vector2::operator-=(const float* p_other) +{ + SubImpl(p_other); +} + +// FUNCTION: LEGO1 0x10002200 +void Vector2::operator-=(const Vector2& p_other) +{ + SubImpl(p_other.m_data); +} + +// FUNCTION: LEGO1 0x10002210 +void Vector2::operator*=(const float* p_other) +{ + MulImpl(p_other); +} + +// FUNCTION: LEGO1 0x10002220 +void Vector2::operator*=(const Vector2& p_other) +{ + MulImpl(p_other.m_data); +} + +// FUNCTION: LEGO1 0x10002230 +void Vector2::operator*=(const float& p_value) +{ + MulImpl(p_value); +} + +// FUNCTION: LEGO1 0x10002240 +void Vector2::operator/=(const float& p_value) +{ + DivImpl(p_value); +} + +// FUNCTION: LEGO1 0x10002250 +void Vector2::operator=(const float* p_other) +{ + EqualsImpl(p_other); +} + +// FUNCTION: LEGO1 0x10002260 +// FUNCTION: BETA10 0x100110c0 +void Vector2::operator=(const Vector2& p_other) +{ + EqualsImpl(p_other.m_data); +} + +#endif // VECTOR2D_H diff --git a/LEGO1/realtime/vector3d.inl.h b/LEGO1/realtime/vector3d.inl.h new file mode 100644 index 0000000000..517b777fe9 --- /dev/null +++ b/LEGO1/realtime/vector3d.inl.h @@ -0,0 +1,117 @@ +#ifndef VECTOR3D_H +#define VECTOR3D_H + +#include "vector2d.inl.h" + +// FUNCTION: LEGO1 0x10002270 +// FUNCTION: BETA10 0x10011350 +void Vector3::EqualsCrossImpl(const float* p_a, const float* p_b) +{ + m_data[0] = p_a[1] * p_b[2] - p_a[2] * p_b[1]; + m_data[1] = p_a[2] * p_b[0] - p_a[0] * p_b[2]; + m_data[2] = p_a[0] * p_b[1] - p_a[1] * p_b[0]; +} + +// FUNCTION: LEGO1 0x100022c0 +// FUNCTION: BETA10 0x10011430 +void Vector3::EqualsCross(const Vector3& p_a, const Vector3& p_b) +{ + EqualsCrossImpl(p_a.m_data, p_b.m_data); +} + +// FUNCTION: LEGO1 0x100022e0 +void Vector3::EqualsCross(const Vector3& p_a, const float* p_b) +{ + EqualsCrossImpl(p_a.m_data, p_b); +} + +// FUNCTION: LEGO1 0x10002300 +void Vector3::EqualsCross(const float* p_a, const Vector3& p_b) +{ + EqualsCrossImpl(p_a, p_b.m_data); +} + +// FUNCTION: LEGO1 0x10003a60 +void Vector3::AddImpl(const float* p_value) +{ + m_data[0] += p_value[0]; + m_data[1] += p_value[1]; + m_data[2] += p_value[2]; +} + +// FUNCTION: LEGO1 0x10003a90 +void Vector3::AddImpl(float p_value) +{ + m_data[0] += p_value; + m_data[1] += p_value; + m_data[2] += p_value; +} + +// FUNCTION: LEGO1 0x10003ac0 +void Vector3::SubImpl(const float* p_value) +{ + m_data[0] -= p_value[0]; + m_data[1] -= p_value[1]; + m_data[2] -= p_value[2]; +} + +// FUNCTION: LEGO1 0x10003af0 +void Vector3::MulImpl(const float* p_value) +{ + m_data[0] *= p_value[0]; + m_data[1] *= p_value[1]; + m_data[2] *= p_value[2]; +} + +// FUNCTION: LEGO1 0x10003b20 +void Vector3::MulImpl(const float& p_value) +{ + m_data[0] *= p_value; + m_data[1] *= p_value; + m_data[2] *= p_value; +} + +// FUNCTION: LEGO1 0x10003b50 +void Vector3::DivImpl(const float& p_value) +{ + m_data[0] /= p_value; + m_data[1] /= p_value; + m_data[2] /= p_value; +} + +// FUNCTION: LEGO1 0x10003b80 +float Vector3::DotImpl(const float* p_a, const float* p_b) const +{ + return p_a[0] * p_b[0] + p_a[2] * p_b[2] + p_a[1] * p_b[1]; +} + +// FUNCTION: LEGO1 0x10003ba0 +// FUNCTION: BETA10 0x100113f0 +void Vector3::EqualsImpl(const float* p_data) +{ + memcpy(m_data, p_data, sizeof(float) * 3); +} + +// FUNCTION: LEGO1 0x10003bc0 +// FUNCTION: BETA10 0x100114f0 +void Vector3::Clear() +{ + memset(m_data, 0, sizeof(float) * 3); +} + +// FUNCTION: LEGO1 0x10003bd0 +// FUNCTION: BETA10 0x10011530 +float Vector3::LenSquared() const +{ + return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2]; +} + +// FUNCTION: LEGO1 0x10003bf0 +void Vector3::Fill(const float& p_value) +{ + m_data[0] = p_value; + m_data[1] = p_value; + m_data[2] = p_value; +} + +#endif // VECTOR3D_H diff --git a/LEGO1/realtime/vector4d.inl.h b/LEGO1/realtime/vector4d.inl.h new file mode 100644 index 0000000000..a94e8f093c --- /dev/null +++ b/LEGO1/realtime/vector4d.inl.h @@ -0,0 +1,145 @@ +#ifndef VECTOR4D_H +#define VECTOR4D_H + +#include "vector.h" + +// FUNCTION: LEGO1 0x10002870 +void Vector4::AddImpl(const float* p_value) +{ + m_data[0] += p_value[0]; + m_data[1] += p_value[1]; + m_data[2] += p_value[2]; + m_data[3] += p_value[3]; +} + +// FUNCTION: LEGO1 0x100028b0 +void Vector4::AddImpl(float p_value) +{ + m_data[0] += p_value; + m_data[1] += p_value; + m_data[2] += p_value; + m_data[3] += p_value; +} + +// FUNCTION: LEGO1 0x100028f0 +void Vector4::SubImpl(const float* p_value) +{ + m_data[0] -= p_value[0]; + m_data[1] -= p_value[1]; + m_data[2] -= p_value[2]; + m_data[3] -= p_value[3]; +} + +// FUNCTION: LEGO1 0x10002930 +void Vector4::MulImpl(const float* p_value) +{ + m_data[0] *= p_value[0]; + m_data[1] *= p_value[1]; + m_data[2] *= p_value[2]; + m_data[3] *= p_value[3]; +} + +// FUNCTION: LEGO1 0x10002970 +void Vector4::MulImpl(const float& p_value) +{ + m_data[0] *= p_value; + m_data[1] *= p_value; + m_data[2] *= p_value; + m_data[3] *= p_value; +} + +// FUNCTION: LEGO1 0x100029b0 +void Vector4::DivImpl(const float& p_value) +{ + m_data[0] /= p_value; + m_data[1] /= p_value; + m_data[2] /= p_value; + m_data[3] /= p_value; +} + +// FUNCTION: LEGO1 0x100029f0 +float Vector4::DotImpl(const float* p_a, const float* p_b) const +{ + return p_a[0] * p_b[0] + p_a[2] * p_b[2] + (p_a[1] * p_b[1] + p_a[3] * p_b[3]); +} + +// FUNCTION: LEGO1 0x10002a20 +void Vector4::EqualsImpl(const float* p_data) +{ + memcpy(m_data, p_data, sizeof(float) * 4); +} + +// FUNCTION: LEGO1 0x10002a40 +void Vector4::SetMatrixProduct(const float* p_vec, const float* p_mat) +{ + m_data[0] = p_vec[0] * p_mat[0] + p_vec[1] * p_mat[4] + p_vec[2] * p_mat[8] + p_vec[3] * p_mat[12]; + m_data[1] = p_vec[0] * p_mat[1] + p_vec[1] * p_mat[5] + p_vec[2] * p_mat[9] + p_vec[4] * p_mat[13]; + m_data[2] = p_vec[0] * p_mat[2] + p_vec[1] * p_mat[6] + p_vec[2] * p_mat[10] + p_vec[4] * p_mat[14]; + m_data[3] = p_vec[0] * p_mat[3] + p_vec[1] * p_mat[7] + p_vec[2] * p_mat[11] + p_vec[4] * p_mat[15]; +} + +// FUNCTION: LEGO1 0x10002ae0 +void Vector4::SetMatrixProduct(const Vector4& p_a, const float* p_b) +{ + SetMatrixProduct(p_a.m_data, p_b); +} + +// FUNCTION: LEGO1 0x10002b00 +void Vector4::Clear() +{ + memset(m_data, 0, sizeof(float) * 4); +} + +// FUNCTION: LEGO1 0x10002b20 +float Vector4::LenSquared() const +{ + return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2] + m_data[3] * m_data[3]; +} + +// FUNCTION: LEGO1 0x10002b40 +void Vector4::Fill(const float& p_value) +{ + m_data[0] = p_value; + m_data[1] = p_value; + m_data[2] = p_value; + m_data[3] = p_value; +} + +// FUNCTION: LEGO1 0x10002b70 +// FUNCTION: BETA10 0x10048ad0 +int Vector4::NormalizeQuaternion() +{ + float length = m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2]; + + if (length > 0.0f) { + float theta = m_data[3] * 0.5f; + float magnitude = sin((double) theta); + m_data[3] = cos((double) theta); + + magnitude = magnitude / (float) sqrt((double) length); + m_data[0] *= magnitude; + m_data[1] *= magnitude; + m_data[2] *= magnitude; + return 0; + } + else { + return -1; + } +} + +// FUNCTION: LEGO1 0x10002bf0 +// FUNCTION: BETA10 0x10048c20 +int Vector4::EqualsHamiltonProduct(const Vector4& p_a, const Vector4& p_b) +{ + m_data[3] = p_a.m_data[3] * p_b.m_data[3] - + (p_a.m_data[0] * p_b.m_data[0] + p_a.m_data[2] * p_b.m_data[2] + p_a.m_data[1] * p_b.m_data[1]); + + Vector3::EqualsCrossImpl(p_a.m_data, p_b.m_data); + + m_data[0] = p_b.m_data[3] * p_a.m_data[0] + p_a.m_data[3] * p_b.m_data[0] + m_data[0]; + m_data[1] = p_b.m_data[1] * p_a.m_data[3] + p_a.m_data[1] * p_b.m_data[3] + m_data[1]; + m_data[2] = p_b.m_data[2] * p_a.m_data[3] + p_a.m_data[2] * p_b.m_data[3] + m_data[2]; + return 0; +} + +#endif // VECTOR4D_H diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index a2998c7ad3..eba702cb4d 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -411,7 +411,7 @@ class TglD3DRMIMAGE { Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer); void Destroy(); - void FillRowsOfTexture(int y, int height, char* content); + Result FillRowsOfTexture(int y, int height, char* content); Result InitializePalette(int paletteSize, PaletteEntry* pEntries); D3DRMIMAGE m_image; diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index d02b88400b..ea8ef1b0ec 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -81,7 +81,7 @@ TglD3DRMIMAGE::TglD3DRMIMAGE( void TglD3DRMIMAGE::Destroy() { if (m_texelsAllocatedByClient == 0) { - delete m_image.buffer1; + delete[] ((char*) m_image.buffer1); } delete m_image.palette; } @@ -111,7 +111,7 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff m_image.bytes_per_line = width; if (!m_texelsAllocatedByClient) { - delete[] m_image.buffer1; + delete[] ((char*) m_image.buffer1); m_image.buffer1 = NULL; } @@ -129,10 +129,11 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff } // FUNCTION: LEGO1 0x100a1510 -void TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent) +Result TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent) { // The purpose is clearly this but I can't get the assembly to line up. memcpy((char*) m_image.buffer1 + (y * m_image.bytes_per_line), pContent, height * m_image.bytes_per_line); + return Success; } // FUNCTION: LEGO1 0x100a1550 diff --git a/LEGO1/tgl/tglvector.h b/LEGO1/tgl/tglvector.h index 8612724fa5..49d60c0a8a 100644 --- a/LEGO1/tgl/tglvector.h +++ b/LEGO1/tgl/tglvector.h @@ -10,15 +10,15 @@ namespace Tgl namespace Constant { -const float Pi = 3.14159265358979323846; +const double Pi = 3.14159265358979323846; }; -inline float DegreesToRadians(float degrees) +inline double DegreesToRadians(double degrees) { return Constant::Pi * (degrees / 180.0); } -inline float RadiansToDegrees(float radians) +inline double RadiansToDegrees(double radians) { return (radians / Constant::Pi) * 180.0; } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 3feb3c935d..8f92f6f225 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -435,10 +435,10 @@ void ViewManager::UpdateViewTransformations() y = a; y -= b; - normal.EqualsCross(&x, &y); + normal.EqualsCross(x, y); normal.Unitize(); - frustum_planes[i][3] = -normal.Dot(&normal, &a); + frustum_planes[i][3] = -normal.Dot(normal, a); } flags |= c_bit4; diff --git a/README.md b/README.md index 660bd74634..c24dc4efbc 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo ``` - **Visual C++ 4.2 has issues with paths containing spaces**. If you get configure or build errors, make sure neither CMake, the repository, nor Visual C++ 4.2 is in a path that contains spaces. - Replace `` with the source repository. This can be `..` if your build folder is inside the source repository. - - `RelWithDebInfo` is recommended because it will produce debug symbols useful for further decompilation work. However, you can change this to `Release` if you don't need them. `Debug` builds are not recommended because they are unlikely to be compatible with the retail `LEGO1.DLL`, which is currently the only way to use this decompilation for gameplay. + - `RelWithDebInfo` is recommended because it will produce debug symbols useful for further decompilation work. However, you can change this to `Release` if you don't need them. While `Debug` builds can be compiled and used, they are not recommended as the primary goal is to match the code to the original binary. This is because the retail binaries were compiled as `Release` builds. - `NMake Makefiles` is most recommended because it will be immediately compatible with Visual C++ 4.2. For faster builds, you can use `Ninja` (if you have it installed), however due to limitations in Visual C++ 4.2, you can only build `Release` builds this way (debug symbols cannot be generated with `Ninja`). 1. Build the project by running `nmake` or `cmake --build ` 1. When this is done, there should be a recompiled `ISLE.EXE` and `LEGO1.DLL` in the build folder. @@ -46,9 +46,32 @@ cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo If you have a CMake-compatible IDE, it should be pretty straightforward to use this repository, as long as you can use `VCVARS32.BAT` and set the generator to `NMake Makefiles`. +### Docker + +Alternatively, we support Docker as a method of compilation. This is ideal for users on Linux and macOS who do not wish to manually configure a Wine environment for compiling this project. + +Compilation should be as simple as configuring and running the following command: + +``` +docker run -d \ + -e CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" \ + -v :/isle:rw \ + -v :/build:rw \ + ghcr.io/isledecomp/isle:latest +``` + +`` should be replaced with the path to the source code directory (ie: the root of this repository). +`` should be replaced with the path to the build folder you'd like CMake to use during compilation. + +You can pass as many CMake flags as you'd like in the `CMAKE_FLAGS` environment variable, but the default configuration provided in the command is already ideal for building highly-accurate binaries. + ## Usage -Simply place the compiled `ISLE.EXE` and `LEGO1.DLL` into LEGO Island's install folder (usually `C:\Program Files\LEGO Island` or `C:\Program Files (x86)\LEGO Island`). Alternatively, LEGO Island can run from any directory as long as `ISLE.EXE` and `LEGO1.DLL` are in the same directory, and the registry keys (usually `HKEY_LOCAL_MACHINE\Software\Mindscape\LEGO Island` or `HKEY_LOCAL_MACHINE\Software\Wow6432Node\Mindscape\LEGO Island`) point to the correct location for the asset files. +The simplest way to use the recompiled binaries is to swap the original executables (`ISLE.EXE`, `LEGO1.DLL`, and `CONFIG.EXE`) in LEGO Island's installation directory for the ones that you've built from this source code. By default, LEGO Island is installed to `C:\Program Files\LEGO Island` on 32-bit operating systems and `C:\Program Files (x86)\LEGO Island` on 64-bit operating systems. + +For advanced users, you can get LEGO Island to run from anywhere as long as `ISLE.EXE` and `LEGO1.DLL` are in the same directory and the `cdpath` and `diskpath` registry keys (usually found in `HKEY_LOCAL_MACHINE\Software\Mindscape\LEGO Island` on 32-bit operating systems and `HKEY_LOCAL_MACHINE\Software\Wow6432Node\Mindscape\LEGO Island` on 64-bit operating systems) point to the correct location for the asset files (the directory that contains the `LEGO` folder). + +If you see an error about `d3drm.dll`, you will need to acquire a copy and place it in the same directory as the game executables, as it has not shipped with Windows since Windows XP. We have published a [known good copy here](https://legoisland.org/download/d3drm.zip) that works with LEGO Island. ## Contributing diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..8fbe4130f6 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,24 @@ +FROM debian:latest + +# Gather dependencies +RUN dpkg --add-architecture i386 +RUN apt-get update -y +RUN apt-get install git wine wine64 wine32 wget unzip -y + +# Silence debug warnings in wine (creates noise during compile) +RUN export WINEDEBUG=-all + +# Set up the wineprefix +RUN wine wineboot + +# Set up MSVC 4.20 and CMake for Windows +RUN git clone https://github.com/itsmattkc/MSVC420 ~/.wine/drive_c/msvc +RUN wget https://github.com/Kitware/CMake/releases/download/v3.26.6/cmake-3.26.6-windows-i386.zip +RUN unzip cmake-3.26.6-windows-i386.zip -d ~/.wine/drive_c +RUN mv ~/.wine/drive_c/cmake-3.26.6-windows-i386 ~/.wine/drive_c/cmake +RUN rm cmake-3.26.6-windows-i386.zip + +# Set up entrypoint script to perform the build +COPY entrypoint.sh entrypoint.sh +RUN chmod +x entrypoint.sh +ENTRYPOINT [ "./entrypoint.sh" ] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000000..2bd88684e9 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Populate the Windows path inside of the wineprefix +# TODO: This is in here because writing to the registry seems +# to fail when performed in the Dockerfile itself; investigate +wine reg ADD 'HKCU\Environment' /v PATH /d 'C:\msvc\bin;C:\msvc\bin\winnt;C:\cmake\bin;C:\windows\system32' /f +wine reg ADD 'HKCU\Environment' /v INCLUDE /d 'C:\msvc\include;C:\msvc\mfc\include' /f +wine reg ADD 'HKCU\Environment' /v LIB /d 'C:\msvc\lib;C:\msvc\mfc\lib' /f +wine reg ADD 'HKCU\Environment' /v TMP /d 'Z:\build' /f +wine reg ADD 'HKCU\Environment' /v TEMP /d 'Z:\build' /f + +# Configure build with CMake +wine cmake -B build isle -G "NMake Makefiles" $CMAKE_FLAGS + +# Start compiling LEGO Island +wine cmake --build build + +# Unlock directories +chmod -R 777 isle build