diff options
175 files changed, 4611 insertions, 26532 deletions
diff --git a/premake5.lua b/premake5.lua index 6a27c5af..03610a03 100644 --- a/premake5.lua +++ b/premake5.lua @@ -48,10 +48,10 @@ workspace "reVC" filter { "system:windows" } platforms { - "win-x86-RW33_d3d8-mss", + "win-x86-RW34_d3d8-mss", "win-x86-librw_d3d9-mss", "win-x86-librw_gl3_glfw-mss", - "win-x86-RW33_d3d8-oal", + "win-x86-RW34_d3d8-oal", "win-x86-librw_d3d9-oal", "win-x86-librw_gl3_glfw-oal", } @@ -128,7 +128,7 @@ project "librw" targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" files { path.join(Librw, "src/*.*") } files { path.join(Librw, "src/*/*.*") } - filter "platforms:*RW33*" + filter "platforms:*RW34*" flags { "ExcludeFromBuild" } filter {} end @@ -218,11 +218,11 @@ project "reVC" filter "platforms:linux*oal" links { "openal", "mpg123", "sndfile", "pthread" } - filter "platforms:*RW33*" + filter "platforms:*RW34*" staticruntime "on" includedirs { "rwsdk/include/d3d8" } libdirs { "rwsdk/lib/d3d8/release" } - links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" } + links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtanim", "rtcharse", "rpanisot" } defines { "RWLIBS" } linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text" diff --git a/rwsdk/include/d3d8/baaplylt.c b/rwsdk/include/d3d8/baaplylt.c deleted file mode 100644 index ad518e6a..00000000 --- a/rwsdk/include/d3d8/baaplylt.c +++ /dev/null @@ -1,793 +0,0 @@ - -/* If this file is used outside of the core RW SDK, - * the following things need to be defined - */ -#if (!defined(RWASSERT)) -#define RWASSERT(_assertval) /* No op */ -#endif -#if (!defined(RWFUNCTION)) -#define RWFUNCTION(_rwfunctionstring) /* No op */ -#endif -#if (!defined(RWRETURN)) -#define RWRETURN(_rwreturnval) return(_rwreturnval) -#endif -#if (!defined(RWRETURNVOID)) -#define RWRETURNVOID() return -#endif - -/* These are used by specular lighting, - * sorry I have to leave them in here... IDBS - * I'll make it neater when I have time. - */ -#if (!defined(FALLOFFAMBIENT)) -#define FALLOFFAMBIENT() /* No op */ -#endif -#if (!defined(FALLOFFDIRECTIONAL)) -#define FALLOFFDIRECTIONAL() /* No op */ -#endif -#if (!defined(FALLOFFPOINT)) -#define FALLOFFPOINT() /* No op */ -#endif -#if (!defined(FALLOFFSPOT)) -#define FALLOFFSPOT() /* No op */ -#endif -#if (!defined(FALLOFFSOFTSPOT)) -#define FALLOFFSOFTSPOT() /* No op */ -#endif - -/*************************************************************************** - _rwApplyAmbientLight - - On entry : Instanced data - : Light - : Optional inverse object matrix - : (to transform light to object space) - : Inverse scale of object - : Surface properties of the light - On exit : - */ - -static void -_rwApplyAmbientLight(VERTSARG, - const void *voidLight, - const RwMatrix * __RWUNUSED__ inverseMat, - RwReal __RWUNUSED__ invScale, - const RwSurfaceProperties * surfaceProps) -{ - CAMVERTDECL; - NUMVERTDECL; - const RpLight *light = (const RpLight *) voidLight; - RwReal scale; - RwV3d vertToLight; - - RWFUNCTION(RWSTRING("_rwApplyAmbientLight")); - RWASSERT(light); - RWASSERT(surfaceProps); - - CAMVERTINIT(); - NUMVERTINIT(); - - /* No directional component: - * (this is used in CAMVERTADDRGBA in a specular lighting node) */ - vertToLight.x = 0; - vertToLight.y = 0; - vertToLight.z = 0; - - /* rpLIGHTAMBIENT - Constant illumination on all vertices - */ - if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA)) - { - scale = 255.0f * light->color.red * surfaceProps->ambient; - - /* Ambient light affects all vertices the same */ - while (numVert--) - { - RwReal lum = scale; - -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFAMBIENT - CAMVERTADDRGBA(1, 1, 1, 0); - CAMVERTINC(); - } - } - else - /* perform for coloured lights */ - { - scale = 255.0f * surfaceProps->ambient; - - /* Ambient light affects all vertices the same */ - while (numVert--) - { - RwReal lum = scale; - -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFAMBIENT - CAMVERTADDRGBA(light->color.red, light->color.green, - light->color.blue, 0); - CAMVERTINC(); - } - } - RWRETURNVOID(); -} - -/*************************************************************************** - _rwApplyDirectionalLight - - On entry : Instanced data - : Light - : Optional inverse object matrix - : (to transform light to object space) - : Inverse scale of object - : Surface properties of the light - On exit : - */ - -static void -_rwApplyDirectionalLight(VERTSARG, - const void *voidLight, - const RwMatrix * inverseMat, - RwReal __RWUNUSED__ invScale, - const RwSurfaceProperties * surfaceProps) -{ - OBJCAMVERTDECL; - NUMVERTDECL; - const RpLight *light = (const RpLight *) voidLight; - RwV3d vertToLight; - RwReal scale; - RwReal dot; - RwFrame *lightFrame; - - RWFUNCTION(RWSTRING("_rwApplyDirectionalLight")); - RWASSERT(light); - RWASSERT(surfaceProps); - - OBJCAMVERTINIT(); - NUMVERTINIT(); - - /* rpLIGHTDIRECTIONAL - Lighting scaled by dot product - * of vertex normal and light lookAt vector. - */ - /* This may not have a frame - we need to check */ - lightFrame = RpLightGetFrame(light); - if (lightFrame) - { - vertToLight = RwFrameGetLTM(lightFrame)->at; - - /* Transform the light into object space if necessary */ - if (inverseMat) - { - RwV3dTransformVectors(&vertToLight, &vertToLight, 1, inverseMat); - _rwV3dNormalize(&vertToLight, &vertToLight); - } - - /* Vert TO light */ - RwV3dScale(&vertToLight, &vertToLight, -1); - - /* Optimise for grey lights? */ - if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA)) - { - /* Use one of the light colour intensities as general intensity */ - /* light vector tests are to be identical to others */ - scale = 255.0f * light->color.red * surfaceProps->diffuse; - - /* Loop through each of the vertices */ - while (numVert--) - { - RwV3d objNormal; - - OBJVERTGETNORMAL(&objNormal); - /* Calculate angle between vertex normal and light vector */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - - /* Ensure vector is facing light, - * don't light areas not facing */ - - if (dot > 0.0f) - { - RwReal lum = dot * scale; - -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFDIRECTIONAL - CAMVERTADDRGBA(1, 1, 1, 0); - } - - /* Next vertex */ - OBJCAMVERTINC(); - } - } - else - /* perform for coloured lights */ - { - scale = 255.0f * surfaceProps->diffuse; - - /* Loop through each of the vertices */ - while (numVert--) - { - RwV3d objNormal; - - OBJVERTGETNORMAL(&objNormal); - /* Calculate angle between vertex normal and light vector */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - - /* Ensure vector is facing light, - * don't light areas not facing */ - - if (dot > 0.0f) - { - RwReal lum = dot * scale; - -#define FALLOFFCALC FALLOFFDIRECTIONAL - CAMVERTADDRGBA(light->color.red, light->color.green, - light->color.blue, 0); - } - - /* Next vertex */ - OBJCAMVERTINC(); - } - } - } - - RWRETURNVOID(); -} - -/*************************************************************************** - _rwApplyPointLight - - On entry : Instanced data - : Light - : Optional inverse object matrix - : (to transform light to object space) - : Inverse scale of object - : Surface properties of the light - On exit : - */ - -static void -_rwApplyPointLight(VERTSARG, const void *voidLight, - const RwMatrix * inverseMat, - RwReal invScale, const RwSurfaceProperties * surfaceProps) -{ - OBJCAMVERTDECL; - NUMVERTDECL; - const RpLight *light = (const RpLight *) voidLight; - RwReal scale, recipRad; - RwV3d lightPos, vertToLight; - RwReal radSquared; - - RWFUNCTION(RWSTRING("_rwApplyPointLight")); - RWASSERT(light); - RWASSERT(surfaceProps); - - OBJCAMVERTINIT(); - NUMVERTINIT(); - - /* rpLIGHTPOINT - Linear falloff with distance, scaled by - * dot product of vertex normal and light to vertex vector. - */ - lightPos = RwFrameGetLTM(RpLightGetFrame(light))->pos; - - if (inverseMat) - { - RwReal scaledRad; - - scaledRad = ((light->radius) * (invScale)); - radSquared = ((scaledRad) * (scaledRad)); - recipRad = (((RwReal) (1)) / (scaledRad)); - - /* Transform light into object space */ - RwV3dTransformPoints(&lightPos, &lightPos, 1, inverseMat); - } - else - { - radSquared = ((light->radius) * (light->radius)); - recipRad = (((RwReal) (1)) / (light->radius)); - } - - if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA)) - { - /* The scale encapsulates the common elements to do - * with light intensity and surface lighting properties - */ - scale = - ((((RwReal) (255)) * (light->color.red))) * - (surfaceProps->diffuse); - - while (numVert--) - { - RwV3d objVertex, objNormal; - RwReal dot, dist2; - - OBJVERTGETPOS(&objVertex); - OBJVERTGETNORMAL(&objNormal); - - /* Discover the vector between vertex and light and it's length */ - RwV3dSub(&vertToLight, &lightPos, &objVertex); - - /* Ensure that this vertex is facing the light source */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - if (dot > 0.0f) - { - /* Ensure vertex lies within the light's radius */ - dist2 = RwV3dDotProduct(&vertToLight, &vertToLight); - if (dist2 < radSquared) - { - RwReal lum; - RwReal recipDist; - RwReal dist; - - rwSqrt(&dist, dist2); - recipDist = - (dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f; - - /* - * The following simplifies down to: - * - * -scale * - * (dot/dist) * - * (1 - dist/lightRadius) - * - * Where - * scale - * takes care of the light intensity and - * diffuse lighting coefficient - * (dot/dist) - * is a normalised dot product of - * light->vertex vector and vertex normal - * (1 - dist/lightRadius) - * is a linear falloff factor - */ - lum = scale * dot * (recipDist - recipRad); - - /* Calculate the luminance at vertex */ -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFPOINT - CAMVERTADDRGBA(1, 1, 1, 0); - } - } - - OBJCAMVERTINC(); - } - } - else - { - scale = (((RwReal) (255)) * (surfaceProps->diffuse)); - - while (numVert--) - { - RwV3d objVertex, objNormal; - RwReal dot, dist2; - - OBJVERTGETPOS(&objVertex); - OBJVERTGETNORMAL(&objNormal); - - /* Discover the vector between vertex and light and it's length */ - RwV3dSub(&vertToLight, &lightPos, &objVertex); - - /* Ensure that this vertex is facing the light source */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - if (dot > 0.0f) - { - dist2 = RwV3dDotProduct(&vertToLight, &vertToLight); - - /* Ensure vertex lies within the light's radius */ - if (dist2 < radSquared) - { - RwReal lum; - RwReal recipDist; - RwReal dist; - - /* Only now calculate the actual length of vector */ - rwSqrt(&dist, dist2); - recipDist = - (dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f; - - lum = scale * dot * (recipDist - recipRad); - /* Alter the luminance according to light colour */ -#define FALLOFFCALC FALLOFFPOINT - CAMVERTADDRGBA(light->color.red, light->color.green, - light->color.blue, 0); - } - } - - /* Next point */ - OBJCAMVERTINC(); - } - } - RWRETURNVOID(); -} - -/*************************************************************************** - _rwApplySpotLight - - On entry : Instanced data - : Light - : Optional inverse object matrix - : (to transform light to object space) - : Inverse scale of object - : Surface properties of the light - On exit : - */ - -static void -_rwApplySpotLight(VERTSARG, - const void *voidLight, - const RwMatrix * inverseMat, - RwReal invScale, const RwSurfaceProperties * surfaceProps) -{ - OBJCAMVERTDECL; - NUMVERTDECL; - const RpLight *light = (const RpLight *) voidLight; - RwReal recipRad; - RwReal radSquared; - RwV3d lightPos, at; - - RWFUNCTION(RWSTRING("_rwApplySpotLight")); - RWASSERT(light); - RWASSERT(surfaceProps); - - OBJCAMVERTINIT(); - NUMVERTINIT(); - - /* rpLIGHTSPOT - Linear falloff with distance, cone to restrict - * angle that light has effect, constant intensity across cone, - * scaled by dot product of vertex normal and light to vertex vector. - */ - - lightPos = RwFrameGetLTM(RpLightGetFrame(light))->pos; - at = RwFrameGetLTM(RpLightGetFrame(light))->at; - - if (inverseMat) - { - RwReal scaledRad; - - scaledRad = ((light->radius) * (invScale)); - recipRad = (((RwReal) (1)) / (scaledRad)); - radSquared = ((scaledRad) * (scaledRad)); - - /* Transform light into object space */ - /* The at is required to ensure within cone */ - RwV3dTransformPoints(&lightPos, &lightPos, 1, inverseMat); - RwV3dTransformVectors(&at, &at, 1, inverseMat); - _rwV3dNormalize(&at, &at); - } - else - { - recipRad = (((RwReal) (1)) / (light->radius)); - radSquared = ((light->radius) * (light->radius)); - } - - if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA)) - { - RwReal scale = - - ((RwReal) 255) * (light->color.red) * (surfaceProps->diffuse); - - while (numVert--) - { - RwV3d vertToLight, objVertex, objNormal; - RwReal dot; - - OBJVERTGETPOS(&objVertex); - OBJVERTGETNORMAL(&objNormal); - - /* Find the squared distance from light point to vertex */ - RwV3dSub(&vertToLight, &lightPos, &objVertex); - - /* Ensure that this vertex is facing the light source */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - if (dot > 0.0f) - { - RwReal dist2; - - /* Ensure vertex lies within the light's radius */ - dist2 = RwV3dDotProduct(&vertToLight, &vertToLight); - if (dist2 < radSquared) - { - RwReal dist; - RwReal compare; - RwReal proj; - - rwSqrt(&dist, dist2); - compare = dist * light->minusCosAngle; - proj = RwV3dDotProduct(&vertToLight, &at); - - if (proj < compare) - { - RwReal lum; - RwReal recipDist; - - /* Get the real distance from the light - * to the vertex (not squared) */ - recipDist = - (dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f; - - /* This model is the same as the point source - * inside the cone, zero outside the cone */ - lum = scale * dot * (recipDist - recipRad); -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFSPOT - CAMVERTADDRGBA(1, 1, 1, 0); - } - } - /* Next vertex */ - OBJCAMVERTINC(); - } - } - } - else - { - RwReal scale = - - (((RwReal) (255)) * (surfaceProps->diffuse)); - - while (numVert--) - { - RwV3d vertToLight, objVertex, objNormal; - RwReal dot; - - OBJVERTGETPOS(&objVertex); - OBJVERTGETNORMAL(&objNormal); - - /* Find the squared distance from light point to vertex */ - RwV3dSub(&vertToLight, &lightPos, &objVertex); - - /* Ensure that this vertex is facing the light source */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - if (dot > 0.0f) - { - RwReal dist2; - - /* Ensure vertex lies within the light's radius */ - dist2 = RwV3dDotProduct(&vertToLight, &vertToLight); - if (dist2 < radSquared) - { - RwReal dist; - RwReal compare; - RwReal proj; - - rwSqrt(&dist, dist2); - compare = dist * light->minusCosAngle; - proj = RwV3dDotProduct(&vertToLight, &at); - - if (proj < compare) - { - RwReal lum; - RwReal recipDist; - - recipDist = - (dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f; - - /* This model is the same as the point source - * inside the cone, zero outside the cone */ - lum = scale * dot * (recipDist - recipRad); - - /* Introduce the light colours as a - * scaling factor for luminance */ -#define FALLOFFCALC FALLOFFSPOT - CAMVERTADDRGBA(light->color.red, - light->color.green, light->color.blue, - 0); - } - } - } - - /* Next */ - OBJCAMVERTINC(); - } - } - - RWRETURNVOID(); -} - -/*************************************************************************** - _rwApplySpotSoftLight - - On entry : Instanced data - : Light - : Optional inverse object matrix - : (to transform light to object space) - : Inverse scale of object - : Surface properties of the light - On exit : - */ - -static void -_rwApplySpotSoftLight(VERTSARG, const void *voidLight, - const RwMatrix * inverseMat, RwReal invScale, - const RwSurfaceProperties * surfaceProps) -{ - OBJCAMVERTDECL; - NUMVERTDECL; - const RpLight *light = (const RpLight *) voidLight; - RwReal recipRad; - RwReal radSquared; - RwV3d lightPos, at; - - RWFUNCTION(RWSTRING("_rwApplySpotSoftLight")); - RWASSERT(light); - RWASSERT(surfaceProps); - - OBJCAMVERTINIT(); - NUMVERTINIT(); - - /* rpLIGHTSPOTSOFT - Linear falloff with distance, cone to restrict - * angle that light has effect, falloff to edge of cone, scaled by - * dot product of vertex normal and light to vertex vector. - */ - - lightPos = RwFrameGetLTM(RpLightGetFrame(light))->pos; - at = RwFrameGetLTM(RpLightGetFrame(light))->at; - - if (inverseMat) - { - RwReal scaledRad; - - scaledRad = ((light->radius) * (invScale)); - recipRad = (((RwReal) (1)) / (scaledRad)); - radSquared = ((scaledRad) * (scaledRad)); - - /* Transform light into object space */ - /* The at is required to ensure within cone */ - RwV3dTransformPoints(&lightPos, &lightPos, 1, inverseMat); - RwV3dTransformVectors(&at, &at, 1, inverseMat); - _rwV3dNormalize(&at, &at); - } - else - { - recipRad = 1.0f / light->radius; - radSquared = light->radius * light->radius; - } - - if (rwObjectTestPrivateFlags(light, rpLIGHTPRIVATENOCHROMA)) - { - RwReal scale = - - ((RwReal) 255) * (light->color.red) * (surfaceProps->diffuse); - - while (numVert--) - { - RwV3d vertToLight, objVertex, objNormal; - RwReal dot; - - OBJVERTGETPOS(&objVertex); - OBJVERTGETNORMAL(&objNormal); - - /* Find the squared distance from light point to vertex */ - RwV3dSub(&vertToLight, &lightPos, &objVertex); - - /* Ensure that this vertex is facing the light source */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - if (dot > 0.0f) - { - RwReal dist2; - - /* Ensure vertex lies within the light's radius */ - dist2 = RwV3dDotProduct(&vertToLight, &vertToLight); - if (dist2 < radSquared) - { - RwReal dist; - RwReal compare; - RwReal proj; - - rwSqrt(&dist, dist2); - compare = dist * light->minusCosAngle; - proj = RwV3dDotProduct(&vertToLight, &at); - - if (proj < compare) - { - RwReal lum; - RwReal recipDist; - RwReal normalise; - - recipDist = - (dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f; - - /* This model is the same as the point source - * inside the cone, zero outside the cone */ - lum = scale * dot * (recipDist - recipRad); - - /* It has an extra term for quadratic falloff - * across the cone though */ - normalise = (dist + compare); - RWASSERT(normalise >= 0.0f); - if (normalise > 0.0f) - { - normalise = (dist + proj) / normalise; - - normalise *= normalise; - lum *= (((RwReal) 1) - normalise); - } - -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFSOFTSPOT - CAMVERTADDRGBA(1, 1, 1, 0); - } - } - } - - /* Next */ - OBJCAMVERTINC(); - } - } - - else - { - RwReal scale = 255.0f * surfaceProps->diffuse; - - while (numVert--) - { - RwV3d vertToLight, objVertex, objNormal; - RwReal dot; - - OBJVERTGETPOS(&objVertex); - OBJVERTGETNORMAL(&objNormal); - - /* Find the squared distance from light point to vertex */ - RwV3dSub(&vertToLight, &lightPos, &objVertex); - - /* Ensure that this vertex is facing the light source */ - dot = RwV3dDotProduct(&vertToLight, &objNormal); - if (dot > 0.0f) - { - RwReal dist2; - - /* Ensure vertex lies within the light's radius */ - dist2 = RwV3dDotProduct(&vertToLight, &vertToLight); - if (dist2 < radSquared) - { - RwReal dist; - RwReal compare; - RwReal proj; - - rwSqrt(&dist, dist2); - compare = dist * light->minusCosAngle; - proj = RwV3dDotProduct(&vertToLight, &at); - - if (proj < compare) - { - - RwReal lum; - RwReal normalise; - RwReal recipDist; - - /* Get the real distance from the light - * to the vertex (not squared) */ - recipDist = - (dist > 0.0f) ? (((RwReal) 1) / dist) : 0.0f; - - /* This model is the same as the point source - * inside the cone, zero outside the cone */ - lum = scale * dot * (recipDist - recipRad); - - /* It has an extra term for quadratic falloff - * across the cone though */ - /* It has an extra term for quadratic falloff - * across the cone though */ - normalise = (dist + compare); - RWASSERT(normalise >= 0.0f); - if (normalise > 0.0f) - { - normalise = (dist + proj) / normalise; - - normalise *= normalise; - lum *= (((RwReal) 1) - normalise); - - } - /* Introduce the light colours as a - * scaling factor for luminance */ -#undef FALLOFFCALC -#define FALLOFFCALC FALLOFFSOFTSPOT - CAMVERTADDRGBA(light->color.red, - light->color.green, - light->color.blue, 0); - } - } - } - - /* Next */ - OBJCAMVERTINC(); - } - } - - RWRETURNVOID(); -} diff --git a/rwsdk/include/d3d8/rpanisot.h b/rwsdk/include/d3d8/rpanisot.h index 4f4445a4..323786f4 100644 --- a/rwsdk/include/d3d8/rpanisot.h +++ b/rwsdk/include/d3d8/rpanisot.h @@ -7,7 +7,7 @@ /** * \defgroup rpanisot RpAnisot - * \ingroup rpplugin + * \ingroup mipmapping * * Anisotropic Texture Sampling Plugin for RenderWare Graphics. */ @@ -22,7 +22,7 @@ * \li \b Plugin \b attachments: \ref RpWorldPluginAttach, \ref RpAnisotPluginAttach * * \subsection anisotoverview Overview - * The RpAnisot plugin is used to extend an RwTexture with a maximum + * The RpAnisot plugin is used to extend an \ref RwTexture with a maximum * anisotropy value that will be used when a particular texture is drawn. * When textured polygons are viewed nearly edge on, for example when looking * dowm a road or a football pitch, distant pixels are not sampled very well diff --git a/rwsdk/include/d3d8/rpanisot.rpe b/rwsdk/include/d3d8/rpanisot.rpe index 5216ec9c..0464081f 100644 --- a/rwsdk/include/d3d8/rpanisot.rpe +++ b/rwsdk/include/d3d8/rpanisot.rpe @@ -160,472 +160,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionLabel { diff --git a/rwsdk/include/d3d8/rpcollis.h b/rwsdk/include/d3d8/rpcollis.h index 908fb68e..23e67f35 100644 --- a/rwsdk/include/d3d8/rpcollis.h +++ b/rwsdk/include/d3d8/rpcollis.h @@ -31,7 +31,7 @@ /** * \defgroup rpcollis RpCollision - * \ingroup rpplugin + * \ingroup collisiondetection * * Collision Plugin for RenderWare Graphics. */ @@ -67,12 +67,12 @@ enum RpIntersectType }; typedef enum RpIntersectType RpIntersectType; +typedef union RpIntersectData RpIntersectData; /** * \ingroup rpcollis * RpIntersectData, this union type is used to specify the parameters * for an intersection primitive of the desired type (\ref RpIntersectType) */ -typedef union RpIntersectData RpIntersectData; union RpIntersectData { RwLine line; /**<For type rpINTERSECTLINE */ @@ -144,7 +144,6 @@ struct RpCollisionBuildParam /** * \ingroup rpcollis - * \typedef RpIntersectionCallBackWorldTriangle * \ref RpIntersectionCallBackWorldTriangle represents the function called * from \ref RpCollisionWorldForAllIntersections for all intersections between * the specified primitive and the static geometry in a given world. This @@ -152,6 +151,10 @@ struct RpCollisionBuildParam * indicate success. The callback may return NULL to terminate further * callbacks on the world. * + * \note The memory pointed to by collTriangle is stored on the stack. + * This memory should be considered volatile. To use this data outside + * of the iterator, copy the contents. + * * \param intersection Pointer to the intersection primitive. * \param sector Pointer to the world sector containing the triangle. * \param collTriangle Pointer to the \ref RpCollisionTriangle representing @@ -181,7 +184,6 @@ typedef RpCollisionTriangle *(*RpIntersectionCallBackWorldTriangle) /** * \ingroup rpcollis - * \typedef RpIntersectionCallBackAtomic * \ref RpIntersectionCallBackAtomic represents the function called from * \ref RpWorldForAllAtomicIntersections for all intersections between the * specified primitive and collision atomics in a given world. This function @@ -215,7 +217,6 @@ typedef RpAtomic *(*RpIntersectionCallBackAtomic) /** * \ingroup rpcollis - * \typedef RpIntersectionCallBackWorldSector * \ref RpIntersectionCallBackWorldSector represents the function called from * \ref RpWorldForAllWorldSectorIntersections for all intersections between the * specified primitive and world sectors in a given world. This function should @@ -234,7 +235,6 @@ typedef RpWorldSector *(*RpIntersectionCallBackWorldSector) /** * \ingroup rpcollis - * \typedef RpIntersectionCallBackGeometryTriangle * \ref RpIntersectionCallBackGeometryTriangle represents the function called * from \ref RpAtomicForAllIntersections and * \ref RpCollisionGeometryForAllIntersections diff --git a/rwsdk/include/d3d8/rpcollis.rpe b/rwsdk/include/d3d8/rpcollis.rpe index 3e891755..49ad286f 100644 --- a/rwsdk/include/d3d8/rpcollis.rpe +++ b/rwsdk/include/d3d8/rpcollis.rpe @@ -158,472 +158,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionCollis { diff --git a/rwsdk/include/d3d8/rpcriter.h b/rwsdk/include/d3d8/rpcriter.h index c1af25b8..de55389f 100644 --- a/rwsdk/include/d3d8/rpcriter.h +++ b/rwsdk/include/d3d8/rpcriter.h @@ -1,261 +1,6 @@ -/* Doxygen Core Library groups */ - -/** - * \defgroup rwcore Core Library - * - * Core Library - */ - -/** - * \defgroup datatypes Data Types - * \ingroup rwcore - * - * Basic Data Types - */ - -#ifndef RWPLCORE -/** - * \defgroup rwbbox RwBBox - * \ingroup rwcore - * - * Bounding Box - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwcamera RwCamera - * \ingroup rwcore - * - * Cameras define how and what things can be seen. They also define the - * depth and width of the view by the use of clip-planes and the view - * window. - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwcameravertex RwCameraVertex - * \ingroup rwcore - * - * Camera space vertex data access - */ -#endif /* RWPLCORE */ - -/** - * \defgroup rwdebug RwDebug - * \ingroup rwcore - * - * Debug handling - */ - -/** - * \defgroup rwengine RwEngine - * \ingroup rwcore - * - * Device handling. - */ - -/** - * \defgroup rwerror RwError - * \ingroup rwcore - * - * Error code handling - */ - -#ifndef RWPLCORE -/** - * \defgroup rwframe RwFrame - * \ingroup rwcore - * - * Frames define relationships between objects and the world - */ -#endif /* RWPLCORE */ - -/** - * \defgroup rwfreelist RwFreeList - * \ingroup rwcore - * - * Free lists - */ - -#ifndef RWPLCORE -/** - * \defgroup rwimage RwImage - * \ingroup rwcore - * - * Image handling. - */ -#endif /* RWPLCORE */ - -/** - * \defgroup rwim2d RwIm2D - * \ingroup rwcore - * - * 2D immediate mode support - */ - -#ifndef RWPLCORE -/** - * \defgroup rwim2dcameravertex RwIm2DCameraVertex - * \ingroup rwcore - * - * 2D Camera space vertex data access - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwim2dvertex RwIm2DVertex - * \ingroup rwcore - * - * Im2D Vertex data access - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwim3d RwIm3D - * \ingroup rwcore - * - * 3D immediate mode support - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwim3dvertex RwIm3DVertex - * \ingroup rwcore - * - * Im3D Vertex data access - */ -#endif /* RWPLCORE */ - -/** - * \defgroup rwmatrix RwMatrix - * \ingroup rwcore - * - * Handling binary matrix representations. - */ - -/** - * \defgroup rwmem RwMem - * \ingroup rwcore - * - * Memory - */ - -#ifndef RWPLCORE -/** - * \defgroup rwobject RwObject - * \ingroup rwcore - * - * object - */ -#endif /* RWPLCORE */ - -/** - * \defgroup rwos RwOs - * \ingroup rwcore - * - * Operating System - */ - -#ifndef RWPLCORE -/** - * \defgroup rwraster RwRaster - * \ingroup rwcore - * - * Image/raster coupling handling. - */ -#endif /* RWPLCORE */ - -/** - * \defgroup rwrenderstate RwRenderState - * \ingroup rwcore - * - * Render states - */ - -/** - * \defgroup rwresources RwResources - * \ingroup rwcore - * - * Resource handling. - * Resources are used to instance objects into. - */ - - -/** - * \defgroup rwrgba RwRGBA - * \ingroup rwcore - * - * Color space functionality. - */ - - -/** - * \defgroup rwstream RwStream - * \ingroup rwcore - * - * Stream - */ - -#ifndef RWPLCORE -/** - * \defgroup rwtexdict RwTexDictionary - * \ingroup rwcore - * - * Texture Dictionary - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwtexture RwTexture - * \ingroup rwcore - * - * Texture handling. - * Textures are special cases of rasters that can be applied to polygons. - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwv2d RwV2d - * \ingroup rwcore - * - * 2D Vector mathematics. - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwv3d RwV3d - * \ingroup rwcore - * - * 3D Vector mathematics. - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwcorepowerpipe PowerPipe - * \ingroup rwcore - * - * PowerPipe - */ -#endif /* RWPLCORE */ - -#ifndef RWPLCORE -/** - * \defgroup rwcoregeneric Generic - * \ingroup rwcorepowerpipe - * - * Generic Pipeline - * - */ -#endif /* RWPLCORE */ +#ifdef DOXYGEN +#include "doxygen.h" +#endif /* DOXYGEN */ /* These are plugins */ #define rwID_METRICSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x01) @@ -306,137 +51,10 @@ #define rwID_MULTITEXPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2c) #define rwID_CHAINPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2d) #define rwID_TOONPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2e) -#define rwID_PTANKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2f) - -#define rwID_PRTSTDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x30) - - -/********************************************************/ - -/* Doxygen plugin groups. */ - -#ifndef RWPLCORE - -/** - * \defgroup rpplugin Plugins - * - * API Plugins - * - */ - -/** - * \defgroup rpworld RpWorld - * \ingroup rpplugin - * - * World handling Plugin - * - * Gives objects context, - * and provides a mechanism for efficient static object rendering. - */ - -/********************************************************/ - -/** - * \defgroup rpworlddatatypes Data Types - * \ingroup rpworld - * - * RpWorld Data types - */ - -/** - * \defgroup rpatomic RpAtomic - * \ingroup rpworld - * - * Atomics - */ - -/** - * \defgroup rpclump RpClump - * \ingroup rpworld - * - * Clumps - */ - -/** - * \defgroup rpgeometry RpGeometry - * \ingroup rpworld - * - * Handling atomic's geometry - */ - - -/** - * \defgroup rpinterpolator RpInterpolator - * \ingroup rpworld - * - * Interpolators - */ - -/** - * \defgroup rplight RpLight - * \ingroup rpworld - * - * Lighting 3D objects. - * Lights are used to illuminate atomics and worlds - */ - -/** - * \defgroup rpmaterial RpMaterial - * \ingroup rpworld - * - * Handling surface materials - * Materials describe how things are to appear when rendered - */ - -/** - * \defgroup rpmesh RpMesh - * \ingroup rpworld - * - * Provide construction and enumeration facilities for meshes. - */ - -/** - * \defgroup rpmorphtarget RpMorphTarget - * \ingroup rpworld - * - * Morph Targets - */ - -/** - * \defgroup rpworldsub RpWorld - * \ingroup rpworld - * - * RpWorld sub group - */ - -/** - * \defgroup rpworldsector RpWorldSector - * \ingroup rpworld - * - * Handling atomic sectors - */ - -/** - * \defgroup rpworldrwcamera RwCamera - * \ingroup rpworld - * - * Cameras - */ - -/** - * \defgroup rpworldpowerpipe PowerPipe - * \ingroup rpworld - * - * PowerPipe - */ - -/** - * \defgroup rpworldp2generic Generic - * \ingroup rpworldpowerpipe - * - * Generic - */ -#endif /* RWPLCORE */ +#define rwID_PTANKPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x2f) +#define rwID_PRTSTDPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x30) +#define rwID_PDSPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x31) +#define rwID_PRTADVPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x32) /* These are toolkits */ #define rwID_CHARSEPLUGIN MAKECHUNKID(rwVENDORID_CRITERIONTK, 0x80) @@ -480,93 +98,9 @@ #define rwID_BARYCENTRIC MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb2) #define rwID_PITEXDICTIONARYTK MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb3) #define rwID_TOCTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb4) - -/**********************************************************************/ - -/* Doxygen Toolkit groups */ - -/** - * \defgroup rttool Toolkits - * - * API Toolkits - */ - -/** - * \defgroup fxpack FXPack - * - * FXPack component group - */ - -/**********************************************************************/ - -/** - * \defgroup platformspecific Platform Specific - * - * Links to all platform specific information in the API Reference can - * be found in this folder. - */ - -/**********************************************************************/ - -/* Index Page definition for API Reference. Don't mess with it unless you know what you're doing. */ +#define rwID_TPLTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb5) +#define rwID_ALTPIPETOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb6) +#define rwID_ANIMTOOLKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb7) +#define rwID_SKINSPLITTOOKIT MAKECHUNKID(rwVENDORID_CRITERIONTK, 0xb8) -/** - * \mainpage RenderWare Graphics API Reference - * - * \image html rwglogo.jpg - * - * This document provides an API Reference for release 3.3 of the RenderWare - * Graphics SDK. - * - * You do not have to wait for a major release to obtain a current API - * Reference. An up-to-date API Reference is compiled every week and goes out - * with the weekly build. The footer declares when it was generated. - * - * \section otherdocs Documentation Available - * RenderWare Graphics is supplied with: - * - * - A top-level README.PDF -- If you read nothing else, at least read this! - * - this API Reference - * - the User Guide - * - Artist's documentation (if installed) - * - Examples documentation - * - Maestro documentation - * - Tools documentation - * - White Papers - * - readme.txt files for each of the supplied Examples - * - * \section contactus Contact Us - * - * \subsection csl Criterion Software Ltd. - * For general information about RenderWare e-mail info@csl.com. - * - * \subsection devrels Developer Relations - * - * For information regarding Support please email devrels@csl.com - * - * \subsection sales Sales - * - * For sales information contact: rw-sales@csl.com - * - * \section copyright Copyright Notice - * - * The information in this document is subject to change without notice and does not represent - * a commitment on the part of Criterion Software Ltd. The software described in this document is - * furnished under a license agreement or a non-disclosure agreement. The software may be used or - * copied only in accordance with the terms of the agreement. It is against the law to copy the - * software on any medium except as specifically allowed in the license or non-disclosure agreement. - * - * No part of this documentation may be reproduced or transmitted in any form or by any means for any - * purpose without the express written permission of Criterion Software Ltd. - * - * Copyright © 1993 - 2002 Criterion Software Ltd. All rights reserved. - * - * Canon and RenderWare are registered trademarks of Canon Inc. Nintendo is a registered trademark - * and NINTENDO GAMECUBE a trademark of Nintendo Co., Ltd. Microsoft is a registered trademark and - * Xbox is a trademark of Microsoft Corporation. PlayStation is a registered trademark of Sony Computer - * Entertainment Inc. - * - * All other trademarks mentioned herein are the property of their respective companies. - * - */ diff --git a/rwsdk/include/d3d8/rpdbgerr.c b/rwsdk/include/d3d8/rpdbgerr.c index 0c83c04e..70bc941d 100644 --- a/rwsdk/include/d3d8/rpdbgerr.c +++ b/rwsdk/include/d3d8/rpdbgerr.c @@ -31,7 +31,7 @@ #include <rwcore.h> #include <rpdbgerr.h> -static const char rcsid[] __RWUNUSED__ = "@@(#)$Id: //RenderWare/RW33Active/dev/rwsdk/src/plcore/rpdbgerr.c#1 $"; +static const char rcsid[] __RWUNUSED__ = "@@(#)$Id: rpdbgerr.c,v 1.2 2004/08/31 17:40:34 gtristram Exp $"; #ifdef RWDEBUG diff --git a/rwsdk/include/d3d8/rpdbgerr.h b/rwsdk/include/d3d8/rpdbgerr.h index 6918469a..e0500057 100644 --- a/rwsdk/include/d3d8/rpdbgerr.h +++ b/rwsdk/include/d3d8/rpdbgerr.h @@ -16,8 +16,6 @@ /* Pick up _ASSERTE macro */ #ifdef _XBOX #include <xtl.h> -#else /* _XBOX */ -#include <windows.h> #endif /* _XBOX */ #if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) #define _CRTDBG_MAP_ALLOC @@ -235,6 +233,22 @@ do \ } \ while (0) +#define RWASSERTM(condition, messageArgs) \ +do \ +{ \ + if (!(condition)) \ + { \ + RwDebugSendMessage(rwDEBUGASSERT, \ + __dbFunctionName, \ + RWSTRING(#condition)); \ + RwDebugSendMessage(rwDEBUGMESSAGE, \ + __dbFunctionName, \ + _rwdbsprintf messageArgs); \ + } \ + RWASSERTE(condition); \ +} \ +while (0) + #else /* RWDEBUG */ #define RWRETURN(value) return(value) @@ -253,6 +267,7 @@ while (0) #define RWFUNCTION(name) #define RWAPIFUNCTION(name) #define RWASSERT(condition) +#define RWASSERTM(condition, messageArgs) #define RWMESSAGE(args) #endif diff --git a/rwsdk/include/d3d8/rpdmorph.h b/rwsdk/include/d3d8/rpdmorph.h index 1494bf3d..89c51b31 100644 --- a/rwsdk/include/d3d8/rpdmorph.h +++ b/rwsdk/include/d3d8/rpdmorph.h @@ -28,7 +28,7 @@ /** * \defgroup rpdmorph RpDMorph - * \ingroup rpplugin + * \ingroup deltamorphing * \file rpdmorph.h * * Delta Morphing Plugin for RenderWare Graphics. @@ -153,7 +153,7 @@ RpDMorphTargetGetFlags( RpDMorphTarget *dMorphTarget ); * These functions work at the DMorphAtomic level. */ extern RpAtomic * -RpDMorphAtomicInitalize( RpAtomic *atomic ); +RpDMorphAtomicInitialize( RpAtomic *atomic ); extern RwReal * RpDMorphAtomicGetDMorphValues( RpAtomic *atomic ); diff --git a/rwsdk/include/d3d8/rpdmorph.rpe b/rwsdk/include/d3d8/rpdmorph.rpe index a5202425..b35acc4e 100644 --- a/rwsdk/include/d3d8/rpdmorph.rpe +++ b/rwsdk/include/d3d8/rpdmorph.rpe @@ -160,472 +160,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionDMorph { diff --git a/rwsdk/include/d3d8/rphanim.h b/rwsdk/include/d3d8/rphanim.h index a9b0438a..0d1bba7a 100644 --- a/rwsdk/include/d3d8/rphanim.h +++ b/rwsdk/include/d3d8/rphanim.h @@ -26,7 +26,6 @@ * Purpose : Hierarchical animation * * * **************************************************************************/ - #ifndef RPHANIM_H #define RPHANIM_H @@ -38,7 +37,7 @@ /** * \defgroup rphanim RpHAnim - * \ingroup rpplugin + * \ingroup objectframehanim * * Hierarchical Animation Plugin for RenderWare Graphics. */ @@ -66,45 +65,26 @@ */ #include <rphanim.rpe> /* automatically generated header file */ #include <rtquat.h> +#include <rtanim.h> #define rpHANIMSTREAMCURRENTVERSION 0x100 -/** - * \ingroup rphanim - * \ref RpHAnimAtomicGlobalVars typedef for struct RpHAnimAtomicGlobalVars - */ +#if (!defined(DOXYGEN)) + typedef struct RpHAnimAtomicGlobalVars RpHAnimAtomicGlobalVars; -/** - * \ingroup rphanim - * \struct RpHAnimAtomicGlobalVars - */ struct RpHAnimAtomicGlobalVars { - RwInt32 engineOffset ; /* Offset into global data */ + RwInt32 engineOffset; RwFreeList *HAnimFreeList; - RwFreeList *HAnimAnimationFreeList; }; -extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals; +#endif /* (!defined(DOXYGEN)) */ -#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimStdKeyFrame) +#define rpHANIMSTDKEYFRAMESIZE sizeof(RpHAnimKeyFrame) #define rpHANIMSTDKEYFRAMETYPEID 0x1 -#define RwAnimMalloc() \ - RwFreeListAlloc(RpHAnimAtomicGlobals.HAnimFreeList) - -#define RwAnimFree(_anim) \ - RwFreeListFree(RpHAnimAtomicGlobals.HAnimFreeList, (_anim)) - -#define RwAnimAnimationMalloc() \ - RwFreeListAlloc(RpHAnimAtomicGlobals.HAnimAnimationFreeList) - -#define RwAnimAnimationFree(_animAnimation) \ - RwFreeListFree(RpHAnimAtomicGlobals.HAnimAnimationFreeList, \ - (_animAnimation)) - -#define RpV3dInterpolate(o, a, s, b) \ +#define RpV3dInterpolate(o,a,s,b) \ MACRO_START \ { \ (o)->x = (((a)->x) + ((s)) * (((b)->x) - ((a)->x))); \ @@ -113,223 +93,57 @@ MACRO_START \ } \ MACRO_STOP -/** - * \ingroup rphanim - * \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy - */ -typedef struct RpHAnimHierarchy RpHAnimHierarchy; - -/** - * \ingroup rphanim - * \ref RpHAnimAnimation typedef for struct RpHAnimAnimation - */ -typedef struct RpHAnimAnimation RpHAnimAnimation; - -/** - * \ingroup rphanim - * \ref RpHAnimHierarchyCallBack - * This typedef defines a callback function for use with the - * \ref RpHAnimHierarchySetAnimCallBack and - * \ref RpHAnimHierarchySetAnimLoopCallBack functions. - * - * \param hierarchy - * A pointer to the AnimHierarchy structure. - * - * \param data User-defined data. - * You can use this to pass your own data - * structure(s) to the callback function. - * - * \see RpHAnimHierarchySetAnimCallBack - * \see RpHAnimHierarchySetAnimLoopCallBack - * - */ - -typedef RpHAnimHierarchy * (*RpHAnimHierarchyCallBack) (RpHAnimHierarchy *hierarchy, - void *data); - -/* - * The following CallBacks are needed for each overloaded interpolation - * scheme. See RpHAnimInterpolatorInfo. - */ - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameToMatrixCallBack - * This typedef defines a callback function for converting - * an animation keyframe into a modeling matrix. The output matrix will be - * used to construct the array of world or local space matrices for the - * hierarchy as obtained with \ref RpHAnimHierarchyGetMatrixArray, and - * possibly used for updating an external \ref RwFrame hierarchy. - * - * \param matrix This is the matrix to store the output of the conversion - * \param voidIFrame This is a void pointer to the keyframe and should be cast - * to the keyframe type this callback is for. - */ -typedef void (*RpHAnimKeyFrameToMatrixCallBack) (RwMatrix *matrix, void *voidIFrame); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameBlendCallBack - * This typedef defines a callback function for blending between two animation - * keyframes by the given blend factor. - * - * \param voidOut This is the void pointer for the output of the blend - * \param voidIn1 First input keyframe - * \param voidIn2 Second input keyframe - * \param alpha Blend factor - */ -typedef void (*RpHAnimKeyFrameBlendCallBack) (void *voidOut, void *voidIn1, - void *voidIn2, RwReal alpha); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameInterpolateCallBack - * This typedef defines a callback function for interpolating between two - * animation keyframes according to the given time. - * - * \param voidOut This is the void pointer for the output of the - * interpolation - * \param voidIn1 First input keyframe - * \param voidIn2 Second input keyframe - * \param time Time at which to interpolate - */ -typedef void (*RpHAnimKeyFrameInterpolateCallBack) (void *voidOut, void *voidIn1, - void *voidIn2, RwReal time); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameAddCallBack - * This typedef defines a callback function for adding together two animation - * keyframes. One of the keyframes would usually be a delta. - * - * \param voidOut This is the void pointer for the output summed keyframe - * \param voidIn1 First input keyframe - * \param voidIn2 Second input keyframe - */ -typedef void (*RpHAnimKeyFrameAddCallBack) (void *voidOut, void *voidIn1, - void *voidIn2); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameMulRecipCallBack - * This typedef defines a callback function for multiplying a keyframe - * by the inverse of another keyframe - * - * \param voidFrame This is the void pointer for the keyframe to be modified - * \param voidStart First start keyframe to take the reciprocal of. - */ -typedef void (*RpHAnimKeyFrameMulRecipCallBack) (void *voidFrame, void *voidStart); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameStreamReadCallBack - * This typedef defines a callback function for reading in keyframes - * from an \ref RwStream for the given animation. - * - * \param stream The stream to read the keyframes from - * \param animation The animation to read the keyframes into - * - * \return Pointer to the animation. - */ -typedef RpHAnimAnimation * (*RpHAnimKeyFrameStreamReadCallBack) (RwStream *stream, RpHAnimAnimation *animation); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameStreamWriteCallBack - * This typedef defines a callback function for writing keyframes from the - * given animation to an \ref RwStream. - * - * \param animation The animation to write out from - * \param stream The stream to write the keyframes to - * - * \return TRUE if successful. - */ -typedef RwBool (*RpHAnimKeyFrameStreamWriteCallBack) (RpHAnimAnimation *animation, RwStream *stream); - -/** - * \ingroup rphanim - * \ref RpHAnimKeyFrameStreamGetSizeCallBack - * This typedef defines a callback function for calculating the binary stream - * size of keyframe data within an animation. - * - * \param animation The animation to calculate sizes of - * - * \return Size in bytes of the keyframe data. - */ -typedef RwInt32 (*RpHAnimKeyFrameStreamGetSizeCallBack) (RpHAnimAnimation *animation); /** * \ingroup rphanim - * \ref RpHAnimInterpolatorInfo - * typedef for struct \ref RpHAnimInterpolatorInfo + * \ref RpHAnimKeyFrame + * typedef for struct RpHAnimKeyFrame. Based on \ref RtAnimKeyFrameHeader. */ -typedef struct RpHAnimInterpolatorInfo RpHAnimInterpolatorInfo; +typedef struct RpHAnimKeyFrame RpHAnimKeyFrame; /** * \ingroup rphanim - * \struct RpHAnimInterpolatorInfo - * This is used to hold information for a keyframe interpolation scheme. - * - * \see RpHAnimRegisterInterpolationScheme - * \see RpHAnimGetInterpolatorInfo + * \struct RpHAnimKeyFrame + * A structure representing the standard keyframe data. Sequences of + * such keyframes in an \ref RtAnimAnimation defines the animation of each + * node in a hierarchy. */ -struct RpHAnimInterpolatorInfo +struct RpHAnimKeyFrame { - RwInt32 typeID; /**< The ID of the interpolation scheme */ - RwInt32 keyFrameSize; /**< Size in bytes of the keyframe structure */ - RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB; /**< Pointer to a function that converts a keyframe to a matrix */ - RpHAnimKeyFrameBlendCallBack keyFrameBlendCB; /**< Pointer to a function that blends between a pair of keyframes for a given delta value */ - RpHAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB; /**< Pointer to a function that interpolates between two keyframes for a given time in between */ - RpHAnimKeyFrameAddCallBack keyFrameAddCB; /**< Pointer to a function that adds two keyframes (one of which may be a delta) */ - RpHAnimKeyFrameMulRecipCallBack keyFrameMulRecipCB; /**< Pointer to a function that multiplies a keyframe by the reciprocal of another */ - RpHAnimKeyFrameStreamReadCallBack keyFrameStreamReadCB; /**< Pointer to a function that reads the keyframes from a stream for a given animation */ - RpHAnimKeyFrameStreamWriteCallBack keyFrameStreamWriteCB; /**< Pointer to a function that writes the keyframes to a stream for a given animation */ - RpHAnimKeyFrameStreamGetSizeCallBack keyFrameStreamGetSizeCB; /**< Pointer to a function that returns the binary stream size of the keyframes for a given animation */ + RpHAnimKeyFrame *prevFrame; /**< Pointer to the previous keyframe */ + RwReal time; /**< Time at keyframe */ + RtQuat q; /**< Quaternion rotation at keyframe */ + RwV3d t; /**< Translation at keyframe */ }; /** * \ingroup rphanim - * \ref RpHAnimKeyFrameHeader - * typedef for struct RpHAnimKeyFrameHeader + * \ref RpHAnimInterpFrame + * typedef for struct RpHAnimInterpFrame. Based on \ref RtAnimInterpFrameHeader. */ -typedef struct RpHAnimKeyFrameHeader RpHAnimKeyFrameHeader; +typedef struct RpHAnimInterpFrame RpHAnimInterpFrame; /** * \ingroup rphanim - * \struct RpHAnimKeyFrameHeader - * Holds header information for a keyframe. All keyframe structures used with - * the overloadable interpolation system should start with this data. - * - * \see RpHAnimStdKeyFrame - * \see RpHAnimRegisterInterpolationScheme + * \struct RpHAnimInterpFrame + * A structure representing an interpolated keyframe. The initial part of the + * structure matches \ref RtAnimInterpFrameHeader. */ -struct RpHAnimKeyFrameHeader +struct RpHAnimInterpFrame { - void *prevFrame; /**< Previous keyframe for particular hierarchy node */ - RwReal time; /**< Time at keyframe */ + RpHAnimKeyFrame *keyFrame1; + /**< Pointer to 1st keyframe of current interpolation pair */ + RpHAnimKeyFrame *keyFrame2; + /**< Pointer to 2nd keyframe of current interpolation pair */ + RtQuat q; /**< Quaternion rotation */ + RwV3d t; /**< Translation */ }; /** * \ingroup rphanim - * \ref RpHAnimStdKeyFrame - * typedef for struct RpHAnimStdKeyFrame - */ -typedef struct RpHAnimStdKeyFrame RpHAnimStdKeyFrame; - -/** - * \ingroup rphanim - * \struct RpHAnimStdKeyFrame - * A structure representing the standard keyframe data. Sequences of - * such keyframes in an \ref RpHAnimAnimation defines the animation of each - * node in a hierarchy. + * \ref RpHAnimHierarchy typedef for struct RpHAnimHierarchy */ -struct RpHAnimStdKeyFrame -{ - RpHAnimStdKeyFrame *prevFrame; /**< Previous keyframe for particular hierarchy node */ - RwReal time; /**< Time at keyframe */ - RtQuat q; /**< Quaternion rotation at keyframe */ - RwV3d t; /**< Translation at keyframe */ -}; +typedef struct RpHAnimHierarchy RpHAnimHierarchy; /* Flags for FrameInfos */ @@ -347,54 +161,23 @@ typedef struct RpHAnimNodeInfo RpHAnimNodeInfo; * \ingroup rphanim * \struct RpHAnimNodeInfo * + * Used to describe a hierarchy toplogy. + * It holds flags representing its position in the + * hierarchy as well as a pointer to the matching \ref RwFrame if the + * hierarchy has been attached to a \ref RwFrame hierarchy. + * */ struct RpHAnimNodeInfo { - RwInt32 nodeID; /**< User defined ID for this node */ - RwInt32 nodeIndex; /**< Array index of node */ + RwInt32 nodeID; /**< User defined ID for this node */ + RwInt32 nodeIndex; /**< Array index of node */ RwInt32 flags; /**< Matrix push/pop flags */ RwFrame * pFrame; /**< Pointer to an attached RwFrame (see \ref RpHAnimHierarchyAttach) */ }; /** * \ingroup rphanim - * \struct RpHAnimAnimation - * A hierarchical animation consists of an array of keyframe structures, - * along with some flags and a duration. - * - * The keyframes should be presented in the order they are needed - * to animate forwards through time. Pointers link all of the keyframes - * for a particular node backwards through time in a list. - * - * For example, a 3 node animation, with keyframes at the following times: - * - * Node 1: 0.0, 1.0, 2.0, 3.0 - * Node 2: 0.0, 3.0 - * Node 3: 0.0, 2.0, 2.5, 3.0 - * - * should be formatted in an RpHAnimAnimation animation like this: - * - * B1,0.0 B2,0.0 B3,0.0 B1,1.0, B2,3.0, B3,2.0, B1,2.0, B1,3.0, B3,2.5 B3,3.0 - * - * Each node MUST start at time = 0.0, and each node must terminate with a keyframe - * at time = duration of animation. - * - * \see RpHAnimAnimationCreate - */ -struct RpHAnimAnimation -{ - RpHAnimInterpolatorInfo *interpInfo; /**< Pointer to interpolation scheme information */ - RwInt32 numFrames; /**< Number of keyframes in the animation */ - RwInt32 flags; /**< Specifies details about animation, relative translation modes etc */ - RwReal duration; /**< Duration of animation in seconds */ - void *pFrames; /**< Pointer to the animation keyframes */ -}; - -/** - * \ingroup rphanim * \ref RpHAnimHierarchyFlag defines type and update modes in HAnimHierarchies - * - * \see RpAnimHierarchyFlag */ enum RpHAnimHierarchyFlag { @@ -411,9 +194,7 @@ enum RpHAnimHierarchyFlag rpHANIMHIERARCHYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; -/** - * \ingroup rphanim - * \typedef RpHAnimHierarchyFlag +/* * These flags are used to control the creation and * update status of the hierarchy */ @@ -422,13 +203,7 @@ typedef enum RpHAnimHierarchyFlag RpHAnimHierarchyFlag; /** * \ingroup rphanim * \struct RpHAnimHierarchy - * An RpHAnimHierarchy is used to "play back" an animation - it holds the - * interpolated keyframe data for the current state of an animation - * concatenated on the end of the structure. - * - * The rpHANIMHIERARCHYGETINTERPFRAME() macro can be used to access the current - * interpolated data, for the current time or to write to this data to override - * it with procedural animation. + * An RpHAnimHierarchy is used to "play back" an animation. * * The structure of a hierarchy is defined by an array * of \ref RpHAnimNodeInfo structures. @@ -443,48 +218,18 @@ struct RpHAnimHierarchy { RwInt32 flags; /**< Flags for the hierarchy */ RwInt32 numNodes; /**< Number of nodes in the hierarchy */ - RpHAnimAnimation *pCurrentAnim; /**< Current animation applied to hierarchy */ - RwReal currentTime; /**< Current animation time */ - void *pNextFrame; /**< Next animation keyframe to be played */ - RpHAnimHierarchyCallBack pAnimCallBack; /**< Animation callback function pointer */ - void *pAnimCallBackData; /**< Animation callback function user data */ - RwReal animCallBackTime; /**< Trigger time for callback function */ - RpHAnimHierarchyCallBack pAnimLoopCallBack; /**< Animation loop callback function pointer */ - void *pAnimLoopCallBackData; /**< Animation loop callback function data */ + RwMatrix *pMatrixArray; /**< Pointer to node matrices*/ void *pMatrixArrayUnaligned; /**< Pointer to memory used for node matrices * from which the aligned pMatrixArray is allocated */ RpHAnimNodeInfo *pNodeInfo; /**< Array of node information (push/pop flags etc) */ RwFrame *parentFrame; /**< Pointer to the Root RwFrame of the hierarchy this * RpHAnimHierarchy represents */ - RwInt32 maxKeyFrameSize; /**< Maximum size of keyframes usable on this hierarhcy - * (set at creation time) */ - RwInt32 currentKeyFrameSize; /**< Size of keyframes in the current animation */ - RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB; /**< Internal use */ - RpHAnimKeyFrameBlendCallBack keyFrameBlendCB; /**< Internal use */ - RpHAnimKeyFrameInterpolateCallBack keyFrameInterpolateCB; /**< Internal use */ - RpHAnimKeyFrameAddCallBack keyFrameAddCB; /**< Internal use */ RpHAnimHierarchy *parentHierarchy; /**< Internal use */ - RwInt32 offsetInParent; /**< Internal use */ RwInt32 rootParentOffset; /**< Internal use */ -}; -#define rpHANIMHIERARCHYGETINTERPFRAME( hierarchy, nodeIndex ) \ - ( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \ - ((nodeIndex) * \ - hierarchy->currentKeyFrameSize) ) ) ) - -#define rpHANIMHIERARCHYGETINTERPFRAME1( hierarchy, nodeIndex ) \ - ( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \ - ((hierarchy->numNodes + \ - (nodeIndex)) * \ - hierarchy->currentKeyFrameSize) ) ) ) - -#define rpHANIMHIERARCHYGETINTERPFRAME2( hierarchy, nodeIndex ) \ - ( (void *)( ( (RwUInt8 *)&(hierarchy[1]) + \ - ((hierarchy->numNodes * 2 + \ - (nodeIndex)) * \ - hierarchy->currentKeyFrameSize) ) ) ) + RtAnimInterpolator *currentAnim; /**< Internal use */ +}; /** * \ingroup rphanim @@ -496,36 +241,40 @@ typedef struct RpHAnimFrameExtension RpHAnimFrameExtension; /** * \ingroup rphanim * \struct RpHAnimFrameExtension + * + * Used to extend \ref RwFrame objects, and thus + * allow the mapping between animation hierarchy node ID and \ref RwFrame. + * */ struct RpHAnimFrameExtension { - RwInt32 id; /**< ID given to this RwFrame (default of -1) */ + RwInt32 id; /**< ID given to this RwFrame (default of -1) */ RpHAnimHierarchy *hierarchy; /**< Pointer to Animation hierarchy attached to this RwFrame */ }; /*--- Plugin API Functions ---*/ -#define RpHAnimHierarchySetFlagsMacro(hierarchy, _flags) \ +#define RpHAnimHierarchySetFlagsMacro(hierarchy,_flags) \ MACRO_START \ { \ - (hierarchy)->flags = _flags; \ + (hierarchy)->flags = _flags; \ } \ MACRO_STOP #define RpHAnimHierarchyGetFlagsMacro(hierarchy) \ ((hierarchy)->flags) -#define RpHAnimStdKeyFrameToMatrixMacro(_matrix, _voidIFrame) \ +#define RpHAnimKeyFrameToMatrixMacro(_matrix,_voidIFrame) \ MACRO_START \ { \ - RpHAnimStdKeyFrame * iFrame = (RpHAnimStdKeyFrame *)(_voidIFrame); \ + RpHAnimInterpFrame * iFrame = (RpHAnimInterpFrame *)(_voidIFrame); \ \ /* \ * RpHAnim uses the same types of quaternion as RtQuat \ * hence no conjugate call as in RpSkin \ */ \ \ - RtQuatUnitConvertToMatrix(&iFrame->q, (_matrix)); \ + RtQuatUnitConvertToMatrix(&iFrame->q,(_matrix)); \ \ (_matrix)->pos.x = iFrame->t.x; \ (_matrix)->pos.y = iFrame->t.y; \ @@ -534,14 +283,14 @@ MACRO_START \ MACRO_STOP + #if (! defined(RWDEBUG)) -#define RpHAnimHierarchySetFlags(hierarchy, _flags) \ - RpHAnimHierarchySetFlagsMacro(hierarchy, _flags) +#define RpHAnimHierarchySetFlags(hierarchy,_flags) \ + RpHAnimHierarchySetFlagsMacro(hierarchy,_flags) #define RpHAnimHierarchyGetFlags(hierarchy) \ (RpHAnimHierarchyFlag)RpHAnimHierarchyGetFlagsMacro(hierarchy) - #endif /* (! defined(RWDEBUG)) */ #ifdef __cplusplus @@ -549,6 +298,8 @@ extern "C" { #endif /* __cplusplus */ +extern RpHAnimAtomicGlobalVars RpHAnimAtomicGlobals; + #if (defined(RWDEBUG)) extern RpHAnimHierarchy * @@ -560,15 +311,9 @@ RpHAnimHierarchyGetFlags(RpHAnimHierarchy *hierarchy); #endif /* (defined(RWDEBUG)) */ -/* Keyframe Interpolator Types */ - -extern RwBool -RpHAnimRegisterInterpolationScheme(RpHAnimInterpolatorInfo *interpolatorInfo); - -extern RpHAnimInterpolatorInfo * -RpHAnimGetInterpolatorInfo(RwInt32 typeID); - /* Animation hierarchy creation */ +extern void +RpHAnimHierarchySetFreeListCreateParams(RwInt32 blockSize,RwInt32 numBlocksToPrealloc); extern RpHAnimHierarchy * RpHAnimHierarchyCreate(RwInt32 numNodes, @@ -613,45 +358,10 @@ extern RpHAnimHierarchy * RpHAnimFrameGetHierarchy(RwFrame *frame); /* Macros for legacy support of old function names */ -#define RpHAnimSetHierarchy(frame, hierarchy) \ - RpHAnimFrameSetHierarchy(frame, hierarchy) +#define RpHAnimSetHierarchy(frame,hierarchy) \ + RpHAnimFrameSetHierarchy(frame,hierarchy) #define RpHAnimGetHierarchy(frame) RpHAnimFrameGetHierarchy(frame) -extern RwBool -RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy, - RwInt32 keyFrameTypeID); - -extern RwBool -RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy, - RpHAnimAnimation *anim); - -extern RwBool -RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy, - RwReal time); - -extern RwBool -RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy, - RwReal time); - -extern RwBool -RpHAnimHierarchyStdKeyFrameAddAnimTime(RpHAnimHierarchy *hierarchy, - RwReal time); - -extern RwBool -RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy, - RwReal time); - -extern RpHAnimHierarchy * -RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy, - RpHAnimHierarchyCallBack callBack, - RwReal time, - void *data ); - -extern RpHAnimHierarchy * -RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy, - RpHAnimHierarchyCallBack callBack, - void *data ); - extern RwMatrix * RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy *hierarchy); @@ -665,209 +375,267 @@ extern RwInt32 RpHAnimIDGetIndex(RpHAnimHierarchy *hierarchy, RwInt32 ID); -/* Animations */ - -extern RpHAnimAnimation * -RpHAnimAnimationCreate(RwInt32 typeID, - RwInt32 numFrames, - RwInt32 flags, - RwReal duration); - -extern RpHAnimAnimation * -RpHAnimAnimationDestroy(RpHAnimAnimation *animation); +/* Plugin support */ -#ifdef RWDEBUG +extern RwBool +RpHAnimPluginAttach(void); -extern RwInt32 -RpHAnimAnimationGetTypeID(RpHAnimAnimation *animation); +/* Hanim keyframe functions */ -#else /* RWDEBUG */ +extern void +RpHAnimKeyFrameApply(void *matrix, + void *voidIFrame); -#define RpHAnimAnimationGetTypeID(animation) \ - (animation->interpInfo->typeID) +extern void +RpHAnimKeyFrameBlend(void *voidOut, + void *voidIn1, + void *voidIn2, + RwReal alpha); -#endif /* RWDEBUG */ +extern void +RpHAnimKeyFrameInterpolate(void *voidOut, + void *voidIn1, + void *voidIn2, + RwReal time); -extern RpHAnimAnimation * -RpHAnimAnimationRead(const RwChar * filename); +extern void +RpHAnimKeyFrameAdd(void *voidOut, + void *voidIn1, + void *voidIn2); -extern RwBool -RpHAnimAnimationWrite(RpHAnimAnimation *animation, - const RwChar * filename); +extern void +RpHAnimKeyFrameMulRecip(void *voidFrame, + void *voidStart); -extern RpHAnimAnimation * -RpHAnimAnimationStreamRead(RwStream *stream); +extern RtAnimAnimation * +RpHAnimKeyFrameStreamRead(RwStream *stream, + RtAnimAnimation *animation); extern RwBool -RpHAnimAnimationStreamWrite(RpHAnimAnimation *animation, - RwStream *stream); +RpHAnimKeyFrameStreamWrite(RtAnimAnimation *animation, + RwStream *stream); extern RwInt32 -RpHAnimAnimationStreamGetSize(RpHAnimAnimation *animation); +RpHAnimKeyFrameStreamGetSize(RtAnimAnimation *animation); -extern RwBool -RpHAnimAnimationMakeDelta(RpHAnimAnimation *animation, - RwInt32 numNodes, - RwReal time); - -/* Plugin support */ +/* Access to RwFrame ID's */ extern RwBool -RpHAnimPluginAttach(void); +RpHAnimFrameSetID(RwFrame *frame, + RwInt32 id); -/* Overloadable keyframe functions */ +extern RwInt32 +RpHAnimFrameGetID(RwFrame *frame); -#define RpHAnimFrameToMatrixMacro(hierarchy, matrix, iFrame) \ -MACRO_START \ -{ \ - const RpHAnimKeyFrameToMatrixCallBack keyFrameToMatrixCB = \ - (hierarchy)->keyFrameToMatrixCB; \ - \ - if (RpHAnimStdKeyFrameToMatrix == keyFrameToMatrixCB) \ - { \ - RpHAnimStdKeyFrameToMatrixMacro((matrix), (iFrame)); \ - } \ - else \ - { \ - keyFrameToMatrixCB((matrix), (iFrame)); \ - } \ -} \ -MACRO_STOP +/* + * Utility Functions + */ +#define RpHAnimHierarchySetCurrentAnimMacro(hierarchy,anim)\ + RtAnimInterpolatorSetCurrentAnim((hierarchy)->currentAnim,anim) -#define RpHAnimFrameInterpolateMacro(hierarchy, out, in1, in2, time) \ -MACRO_START \ -{ \ - (hierarchy)->keyFrameInterpolateCB((out), (in1), (in2), (time)); \ -} \ -MACRO_STOP +#define RpHAnimHierarchyGetCurrentAnimMacro(hierarchy)\ + RtAnimInterpolatorGetCurrentAnim((hierarchy)->currentAnim) -#define RpHAnimFrameBlendMacro(hierarchy, out, in1, in2, fAlpha) \ -MACRO_START \ -{ \ - (hierarchy)->keyFrameBlendCB((out), (in1), (in2), (fAlpha)); \ -} \ -MACRO_STOP +#define RpHAnimHierarchySetCurrentAnimTimeMacro(hierarchy,time)\ + RtAnimInterpolatorSetCurrentTime((hierarchy)->currentAnim,time) -#define RpHAnimFrameAddTogetherMacro(hierarchy, out, in1, in2) \ -MACRO_START \ -{ \ - (hierarchy)->keyFrameAddCB((out), (in1), (in2)); \ -} \ -MACRO_STOP +#define RpHAnimHierarchyAddAnimTimeMacro(hierarchy,time)\ + RtAnimInterpolatorAddAnimTime((hierarchy)->currentAnim,time) -#ifdef RWDEBUG -void -RpHAnimFrameInterpolate(RpHAnimHierarchy *hierarchy, - void *out, void *in1, - void *in2, RwReal time); +#define RpHAnimHierarchySubAnimTimeMacro(hierarchy,time)\ + RtAnimInterpolatorSubAnimTime((hierarchy)->currentAnim,time) -void -RpHAnimFrameBlend(RpHAnimHierarchy *hierarchy, - void *out, - void *in1, - void *in2, - RwReal alpha); +#define RpHAnimHierarchySetKeyFrameCallBacksMacro(hierarchy,keyFrameTypeID) \ + RtAnimInterpolatorSetKeyFrameCallBacks((hierarchy)->currentAnim,\ + keyFrameTypeID) -void -RpHAnimFrameToMatrix(RpHAnimHierarchy *hierarchy, - RwMatrix *matrix, void *iFrame); +#define RpHAnimHierarchyBlendMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\ + RtAnimInterpolatorBlend((outHierarchy)->currentAnim,\ + (inHierarchy1)->currentAnim,\ + (inHierarchy2)->currentAnim,\ + alpha) -void -RpHAnimFrameAddTogether(RpHAnimHierarchy *hierarchy, - void *out, void *in1, void *in2); +#define RpHAnimHierarchyAddTogetherMacro(outHierarchy,inHierarchy1,inHierarchy2)\ + RtAnimInterpolatorAddTogether((outHierarchy)->currentAnim,\ + (inHierarchy1)->currentAnim,\ + (inHierarchy2)->currentAnim) -#else /* RWDEBUG */ -#define RpHAnimFrameToMatrix(hierarchy, matrix, iFrame) \ - RpHAnimFrameToMatrixMacro(hierarchy, matrix, iFrame) +#define RpHAnimHierarchySetAnimCallBackMacro(hierarchy,callBack,time,data)\ + RtAnimInterpolatorSetAnimCallBack((hierarchy)->currentAnim,callBack,time,data) -#define RpHAnimFrameInterpolate(hierarchy, out, in1, in2, time) \ - RpHAnimFrameInterpolateMacro(hierarchy, out, in1, in2, time) +#define RpHAnimHierarchySetAnimLoopCallBackMacro(hierarchy,callBack,data)\ + RtAnimInterpolatorSetAnimLoopCallBack((hierarchy)->currentAnim,callBack,data) -#define RpHAnimFrameBlend(hierarchy, out, in1, in2, alpha) \ - RpHAnimFrameBlendMacro(hierarchy, out, in1, in2, alpha) +#define RpHAnimHierarchyBlendSubHierarchyMacro(outHierarchy,inHierarchy1,inHierarchy2,alpha)\ + RtAnimInterpolatorBlendSubInterpolator((outHierarchy)->currentAnim,(inHierarchy1)->currentAnim,(inHierarchy2)->currentAnim,alpha) -#define RpHAnimFrameAddTogether(hierarchy, out, in1, in2) \ - RpHAnimFrameAddTogetherMacro(hierarchy, out, in1, in2) +#define RpHAnimHierarchyAddSubHierarchyMacro(outHierarchy,mainHierarchy,subHierarchy)\ + RtAnimInterpolatorAddSubInterpolator((outHierarchy)->currentAnim,(mainHierarchy)->currentAnim,(subHierarchy)->currentAnim) -#endif /* RWDEBUG */ - -/* Standard keyframe functions */ +#define RpHAnimHierarchyCopyMacro(outHierarchy,inHierarchy)\ + RtAnimInterpolatorCopy((outHierarchy)->currentAnim,(inHierarchy)->currentAnim) -extern void -RpHAnimStdKeyFrameToMatrix(RwMatrix *matrix, - void * voidIFrame); -extern void -RpHAnimStdKeyFrameBlend(void *voidOut, - void *voidIn1, - void *voidIn2, - RwReal alpha); -extern void -RpHAnimStdKeyFrameInterpolate(void *voidOut, - void *voidIn1, - void *voidIn2, - RwReal time); +#ifdef RWDEBUG +extern RwBool +RpHAnimHierarchySetCurrentAnim(RpHAnimHierarchy *hierarchy, + RtAnimAnimation *anim); -extern void -RpHAnimStdKeyFrameAdd(void *voidOut, - void *voidIn1, - void *voidIn2); +extern RtAnimAnimation * +RpHAnimHierarchyGetCurrentAnim(RpHAnimHierarchy *hierarchy); -extern void -RpHAnimStdKeyFrameMulRecip(void *voidFrame, - void *voidStart); +extern RwBool +RpHAnimHierarchySetCurrentAnimTime(RpHAnimHierarchy *hierarchy, + RwReal time); -extern RpHAnimAnimation * -RpHAnimStdKeyFrameStreamRead(RwStream *stream, - RpHAnimAnimation *animation); +extern RwBool +RpHAnimHierarchyAddAnimTime(RpHAnimHierarchy *hierarchy, + RwReal time); extern RwBool -RpHAnimStdKeyFrameStreamWrite(RpHAnimAnimation *animation, - RwStream *stream); +RpHAnimHierarchySubAnimTime(RpHAnimHierarchy *hierarchy, + RwReal time); -extern RwInt32 -RpHAnimStdKeyFrameStreamGetSize(RpHAnimAnimation *animation); +extern RwBool +RpHAnimHierarchySetKeyFrameCallBacks(RpHAnimHierarchy *hierarchy, + RwInt32 keyFrameTypeID); -/* Hierarchy blending/combination functions */ +extern void +RpHAnimHierarchySetAnimCallBack(RpHAnimHierarchy *hierarchy, + RtAnimCallBack callBack, + RwReal time, + void *data); extern RwBool RpHAnimHierarchyBlend(RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy1, RpHAnimHierarchy *inHierarchy2, RwReal alpha); + extern RwBool RpHAnimHierarchyAddTogether(RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy1, RpHAnimHierarchy *inHierarchy2); +extern void +RpHAnimHierarchySetAnimLoopCallBack(RpHAnimHierarchy *hierarchy, + RtAnimCallBack callBack, + void *data); extern RwBool RpHAnimHierarchyBlendSubHierarchy(RpHAnimHierarchy *outHierarchy, - RpHAnimHierarchy *inHierarchy1, - RpHAnimHierarchy *inHierarchy2, - RwReal alpha); + RpHAnimHierarchy *inHierarchy1, + RpHAnimHierarchy *inHierarchy2, + RwReal alpha); extern RwBool RpHAnimHierarchyAddSubHierarchy(RpHAnimHierarchy *outHierarchy, - RpHAnimHierarchy *mainHierarchy, - RpHAnimHierarchy *subHierarchy); - + RpHAnimHierarchy *mainHierarchy1, + RpHAnimHierarchy *subHierarchy2); extern RwBool RpHAnimHierarchyCopy(RpHAnimHierarchy *outHierarchy, RpHAnimHierarchy *inHierarchy); -/* Access to RwFrame ID's */ +#else -extern RwBool -RpHAnimFrameSetID(RwFrame *frame, - RwInt32 id); +#define RpHAnimHierarchySetCurrentAnim(hierarchy,anim) \ + RpHAnimHierarchySetCurrentAnimMacro((hierarchy),(anim)) -extern RwInt32 -RpHAnimFrameGetID(RwFrame *frame); +#define RpHAnimHierarchyGetCurrentAnim(hierarchy) \ + RpHAnimHierarchyGetCurrentAnimMacro((hierarchy)) + +#define RpHAnimHierarchySetCurrentAnimTime(hierarchy,time) \ + RpHAnimHierarchySetCurrentAnimTimeMacro((hierarchy),(time)) + +#define RpHAnimHierarchyAddAnimTime(hierarchy,time) \ + RpHAnimHierarchyAddAnimTimeMacro((hierarchy),(time)) + +#define RpHAnimHierarchySubAnimTime(hierarchy,time) \ + RpHAnimHierarchySubAnimTimeMacro((hierarchy),(time)) + +#define RpHAnimHierarchySetKeyFrameCallBacks(hierarchy,keyFrameTypeID) \ + RpHAnimHierarchySetKeyFrameCallBacksMacro((hierarchy),(keyFrameTypeID)) + +#define RpHAnimHierarchyBlend(outHierarchy,inHierarchy1,inHierarchy2,alpha) \ + RpHAnimHierarchyBlendMacro((outHierarchy),(inHierarchy1),(inHierarchy2),(alpha)) + +#define RpHAnimHierarchyAddTogether(outHierarchy,inHierarchy1,inHierarchy2) \ + RpHAnimHierarchyAddTogetherMacro((outHierarchy),(inHierarchy1),(inHierarchy2)) + +#define RpHAnimHierarchySetAnimCallBack(hierarchy,callBack,time,data)\ + RpHAnimHierarchySetAnimCallBackMacro((hierarchy),(callBack),(time),(data)) + +#define RpHAnimHierarchySetAnimLoopCallBack(hierarchy,callBack,data)\ + RpHAnimHierarchySetAnimLoopCallBackMacro((hierarchy),(callBack),(data)) + +#define RpHAnimHierarchyBlendSubHierarchy(outHierarchy,inHierarchy1,inHierarchy2,alpha)\ + RpHAnimHierarchyBlendSubHierarchyMacro((outHierarchy),(inHierarchy1),(inHierarchy2),(alpha)) + +#define RpHAnimHierarchyAddSubHierarchy(outHierarchy,mainHierarchy,subHierarchy)\ + RpHAnimHierarchyAddSubHierarchyMacro((outHierarchy),(mainHierarchy),(subHierarchy)) + +#define RpHAnimHierarchyCopy(outHierarchy,inHierarchy)\ + RpHAnimHierarchyCopyMacro((outHierarchy),(inHierarchy)) + +#endif /* RWDEBUG */ #ifdef __cplusplus } #endif /* __cplusplus */ +/* Legacy TypeDef */ + + +typedef RtAnimAnimation RpHAnimAnimation; +typedef RpHAnimKeyFrame RpHAnimStdKeyFrame; + +/* Legacy Macros */ + + +/* Animations */ + + +#define RpHAnimAnimationCreate(typeID,numFrames,flags,duration)\ + RtAnimAnimationCreate((typeID),(numFrames),(flags),(duration)) + + +#define RpHAnimAnimationDestroy(animation)\ + RtAnimAnimationDestroy((animation)) + +#define RpHAnimAnimationGetTypeID(animation)\ + RtAnimAnimationGetTypeID((animation)) + + +#define RpHAnimAnimationRead(filename)\ + RtAnimAnimationRead((filename)) + + +#define RpHAnimAnimationWrite(animation,filename)\ + RtAnimAnimationWrite((animation),(filename)) + + +#define RpHAnimAnimationStreamRead(stream)\ + RtAnimAnimationStreamRead((stream)) + + +#define RpHAnimAnimationStreamWrite(animation,stream)\ + RtAnimAnimationStreamWrite((animation),(stream)) + + +#define RpHAnimAnimationStreamGetSize(animation)\ + RtAnimAnimationStreamGetSize((animation)) + + +#define RpHAnimAnimationMakeDelta(animation,numNodes,time)\ + RtAnimAnimationMakeDelta((animation),(numNodes),(time)) + + +/* Animation Interpolator */ + +#define RpHAnimHierarchyStdKeyFrameAddAnimTime(hierarchy,time)\ + RpHAnimHierarchyHAnimKeyFrameAddAnimTime((hierarchy),(time)) + +#define RpHAnimHierarchyHAnimKeyFrameAddAnimTime(hierarchy,time)\ + RpHAnimHierarchyAddAnimTime((hierarchy),(time)) #endif /* RPHANIM_H */ diff --git a/rwsdk/include/d3d8/rphanim.rpe b/rwsdk/include/d3d8/rphanim.rpe index c60f8591..1c05d0e9 100644 --- a/rwsdk/include/d3d8/rphanim.rpe +++ b/rwsdk/include/d3d8/rphanim.rpe @@ -160,481 +160,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionHANIM { -E_RP_HANIM_INTERP_IDINUSE, - -E_RP_HANIM_INTERP_BLOCKFULL, - -E_RP_HANIM_INTERP_IDUNKNOWN, e_rwdb_CriterionHANIMLAST = RWFORCEENUMSIZEINT }; diff --git a/rwsdk/include/d3d8/rplodatm.h b/rwsdk/include/d3d8/rplodatm.h index d4583338..4e9c8648 100644 --- a/rwsdk/include/d3d8/rplodatm.h +++ b/rwsdk/include/d3d8/rplodatm.h @@ -34,7 +34,7 @@ /** * \defgroup rplodatm RpLODAtomic - * \ingroup rpplugin + * \ingroup scenemanagement * * Level of Detail Management Plugin for RenderWare Graphics. */ @@ -72,6 +72,9 @@ extern "C" { #endif /* __cplusplus */ + extern void + RpLODAtomicCacheSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwBool RpLODAtomicPluginAttach( void ); diff --git a/rwsdk/include/d3d8/rplodatm.rpe b/rwsdk/include/d3d8/rplodatm.rpe index 649bc3bc..a5764cfc 100644 --- a/rwsdk/include/d3d8/rplodatm.rpe +++ b/rwsdk/include/d3d8/rplodatm.rpe @@ -163,472 +163,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionLODATM { diff --git a/rwsdk/include/d3d8/rplogo.h b/rwsdk/include/d3d8/rplogo.h index ed527a29..a46823ac 100644 --- a/rwsdk/include/d3d8/rplogo.h +++ b/rwsdk/include/d3d8/rplogo.h @@ -33,7 +33,7 @@ /** * \defgroup rplogo RpLogo - * \ingroup rpplugin + * \ingroup 2dtools * * Logo Plugin for RenderWare Graphics. */ diff --git a/rwsdk/include/d3d8/rplogo.rpe b/rwsdk/include/d3d8/rplogo.rpe index f37b6920..a7f66565 100644 --- a/rwsdk/include/d3d8/rplogo.rpe +++ b/rwsdk/include/d3d8/rplogo.rpe @@ -160,472 +160,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionLogo { diff --git a/rwsdk/include/d3d8/rpltmap.h b/rwsdk/include/d3d8/rpltmap.h index 5add9a26..18c91955 100644 --- a/rwsdk/include/d3d8/rpltmap.h +++ b/rwsdk/include/d3d8/rpltmap.h @@ -1,7 +1,7 @@ /** * \defgroup rpltmap RpLtMap - * \ingroup rpplugin + * \ingroup lighting * * Lightmap Plugin for RenderWare Graphics. */ @@ -17,6 +17,15 @@ #include "rpworld.h" +/* Used during lightmap illumination (sliver triangles are skipped + * (their texels should be filled by dilate()), because their normals + * can't be accurately calculated) */ +#define rpLTMAPDEFAULTSLIVERAREATHRESHOLD (0.001f) + +/* Used during lightmap UV calculation (polySets may be + * joined on the basis of vertices with equal positions) */ +#define rpLTMAPDEFAULTVERTEXWELDTHRESHOLD (0.1f) + #define rpLTMAPDEFAULTLIGHTMAPSIZE 128 #define rpLTMAPMINLIGHTMAPSIZE 16 #define rpLTMAPMAXLIGHTMAPSIZE 512/*?? any better way of determining this ??*/ diff --git a/rwsdk/include/d3d8/rpltmap.rpe b/rwsdk/include/d3d8/rpltmap.rpe index 413caf4c..6e58b62b 100644 --- a/rwsdk/include/d3d8/rpltmap.rpe +++ b/rwsdk/include/d3d8/rpltmap.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionLTMAP { diff --git a/rwsdk/include/d3d8/rpmatfx.h b/rwsdk/include/d3d8/rpmatfx.h index 9b091dd8..fb7ade45 100644 --- a/rwsdk/include/d3d8/rpmatfx.h +++ b/rwsdk/include/d3d8/rpmatfx.h @@ -17,7 +17,7 @@ /** * \defgroup rpmatfx RpMatFX - * \ingroup rpplugin + * \ingroup materials * * Material Effects Plugin for RenderWare Graphics. */ @@ -58,6 +58,10 @@ extern "C" #endif /* __cplusplus */ /*--- Plugin functions ------------------------------------------------------*/ +extern void +RpMatFXMaterialDataSetFreeListCreateParams( RwInt32 blockSize, + RwInt32 numBlocksToPrealloc ); + extern RwBool RpMatFXPluginAttach( void ); diff --git a/rwsdk/include/d3d8/rpmatfx.rpe b/rwsdk/include/d3d8/rpmatfx.rpe index bbc588e3..ba83d96a 100644 --- a/rwsdk/include/d3d8/rpmatfx.rpe +++ b/rwsdk/include/d3d8/rpmatfx.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionMATERIALEFFECTS { diff --git a/rwsdk/include/d3d8/rpmipkl.h b/rwsdk/include/d3d8/rpmipkl.h index 5b8f7e51..82ad7f03 100644 --- a/rwsdk/include/d3d8/rpmipkl.h +++ b/rwsdk/include/d3d8/rpmipkl.h @@ -7,9 +7,9 @@ /** * \defgroup rpmipkl RpMipmapKL - * \ingroup rpplugin + * \ingroup mipmapping * - * PS2/MipMap KL Value Plugin for RenderWare Graphics. + * PlayStation 2 / MipMap KL Value Plugin for RenderWare Graphics. */ #include <rwcore.h> @@ -19,6 +19,28 @@ extern "C" { #endif +#if (defined(SKY2_DRVMODEL_H)) || (defined(NULLSKY_DRVMODEL_H)) + +#define RpMipmapKLTextureSetDefaultK RpSkyTextureSetDefaultMipmapK + +#define RpMipmapKLTextureSetDefaultL RpSkyTextureSetDefaultMipmapL + +#define RpMipmapKLTextureGetDefaultK RpSkyTextureGetDefaultMipmapK + +#define RpMipmapKLTextureGetDefaultL RpSkyTextureGetDefaultMipmapL + +#define RpMipmapKLTextureSetK RpSkyTextureSetMipmapK + +#define RpMipmapKLTextureSetL RpSkyTextureSetMipmapL + +#define RpMipmapKLTextureGetK RpSkyTextureGetMipmapK + +#define RpMipmapKLTextureGetL RpSkyTextureGetMipmapL + +#define RpMipmapKLPluginAttach() (TRUE) + +#else /* (defined(SKY2_DRVMODEL_H)) || (defined(NULLSKY_DRVMODEL_H)) */ + extern RwReal RpMipmapKLTextureSetDefaultK(RwReal val); extern RwUInt32 RpMipmapKLTextureSetDefaultL(RwUInt32 val); extern RwReal RpMipmapKLTextureGetDefaultK(void); @@ -31,6 +53,8 @@ extern RwUInt32 RpMipmapKLTextureGetL(RwTexture *tex); extern RwBool RpMipmapKLPluginAttach(void); +#endif /* (defined(SKY2_DRVMODEL_H)) || (defined(NULLSKY_DRVMODEL_H)) */ + #ifdef __cplusplus } #endif diff --git a/rwsdk/include/d3d8/rpmipkl.rpe b/rwsdk/include/d3d8/rpmipkl.rpe index 5216ec9c..0464081f 100644 --- a/rwsdk/include/d3d8/rpmipkl.rpe +++ b/rwsdk/include/d3d8/rpmipkl.rpe @@ -160,472 +160,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionLabel { diff --git a/rwsdk/include/d3d8/rpmorph.h b/rwsdk/include/d3d8/rpmorph.h index 4177fba8..52ea70df 100644 --- a/rwsdk/include/d3d8/rpmorph.h +++ b/rwsdk/include/d3d8/rpmorph.h @@ -38,7 +38,7 @@ /** * \defgroup rpmorph RpMorph - * \ingroup rpplugin + * \ingroup morphing * * Morphing Plugin for RenderWare Graphics. */ @@ -76,7 +76,6 @@ struct RpMorphInterpolator /** * \ingroup rpmorph - * \typedef RpMorphGeometryCallBack * This is the callback function supplied to \ref RpMorphGeometrySetCallBack * and returned from \ref RpMorphGeometryGetCallBack. * The supplied function will be passed a pointer to the geometry's parent atomic, diff --git a/rwsdk/include/d3d8/rpmorph.rpe b/rwsdk/include/d3d8/rpmorph.rpe index 14b13076..47834a81 100644 --- a/rwsdk/include/d3d8/rpmorph.rpe +++ b/rwsdk/include/d3d8/rpmorph.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionMorph { diff --git a/rwsdk/include/d3d8/rppatch.h b/rwsdk/include/d3d8/rppatch.h index eb80663f..0b54fb1b 100644 --- a/rwsdk/include/d3d8/rppatch.h +++ b/rwsdk/include/d3d8/rppatch.h @@ -4,7 +4,7 @@ /** * \defgroup rppatch RpPatch - * \ingroup rpplugin + * \ingroup bezierpatches * * Bezier patch library * @@ -124,7 +124,7 @@ * \ingroup rppatch * \ref RpPatchMeshFlag * When creating a \ref RpPatchMesh, these flags can be OR'ed together to - * specify the format along with the \ref rpPATCHMESHTEXCOORDSETS (n) macro + * specify the format along with the \ref rpPATCHMESHTEXCOORDSETS(num) macro * to specify the number of texture coordinate sets required. * * \see RpPatchMeshCreate @@ -220,7 +220,7 @@ typedef struct RpPatchMesh RpPatchMesh; * The patch mesh should be unlocked with \ref RpPatchMeshUnlock before it is * added to an \ref RpAtomic with \ref RpPatchAtomicSetPatchMesh. * - * \see RpPatchMesDefinition + * \see RpPatchMeshDefinition */ struct RpPatchMesh { @@ -278,7 +278,7 @@ struct RpPatchLODRange /** * \ingroup rppatch - * \typedef RpPatchLODUserData + * \ref RpPatchLODUserData * typedef for the user data passed to the \ref RpPatchLODCallBack * function which calculates the atomics' LOD. * @@ -289,9 +289,14 @@ typedef void *RpPatchLODUserData; /** * \ingroup rppatch - * \typedef RpPatchLODCallBack + * \ref RpPatchLODCallBack * typedef for the patch atomic LOD calculation function. * + * \param atomic + * \param userData + * + * \return + * * \see RpPatchAtomicSetPatchLODCallBack * \see RpPatchAtomicGetPatchLODCallBack */ @@ -309,6 +314,13 @@ extern "C" /*---------------------------------------------------------------------------* *- Plugin functions -* *---------------------------------------------------------------------------*/ +extern void +RpPatchGeometrySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void +RpPatchAtomicSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + + extern RwBool RpPatchPluginAttach(void); diff --git a/rwsdk/include/d3d8/rppatch.rpe b/rwsdk/include/d3d8/rppatch.rpe index 6d433990..85dca470 100644 --- a/rwsdk/include/d3d8/rppatch.rpe +++ b/rwsdk/include/d3d8/rppatch.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionPATCH { diff --git a/rwsdk/include/d3d8/rpprtstd.h b/rwsdk/include/d3d8/rpprtstd.h index ad1b87f7..ba0bf1d6 100644 --- a/rwsdk/include/d3d8/rpprtstd.h +++ b/rwsdk/include/d3d8/rpprtstd.h @@ -28,7 +28,7 @@ /** * \defgroup rpprtstd RpPrtStd - * \ingroup rpplugin + * \ingroup particles * * Particle Animation Plugin for RenderWare Graphics. */ @@ -52,7 +52,7 @@ -#define PRTSTD_RSRAND2(_seed) (((RwReal)((RwReal) (_seed) * PRTSTD_SRAND_IMAX) * \ +#define PRTSTD_2RSRAND2(_seed) (((RwReal)((RwReal) (_seed) * PRTSTD_SRAND_IMAX) * \ (RwReal)1.0)) /** @@ -84,6 +84,8 @@ enum RpPrtStdEmitterFlags rpPRTSTDEMITTERFLAGUPDATEPARTICLE = 0x00000020, /**< This indicated if the emitter's particles are updated. */ rpPRTSTDEMITTERFLAGRENDER = 0x00000040, /**< This indicates if the emitter is rendered. */ rpPRTSTDEMITTERFLAGRENDERPARTICLE = 0x00000080, /**< This indicates if the emitter's particles are rendered. */ + rpPRTSTDEMITTERFLAGNOBUFFERSWAP = 0x00000100, /**< Internal usage */ + rpPRTSTDEMITTERFLAGSTREAMREAD = 0x00000200, /**< Internal usage */ rpPRTSTDEMITTERFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; @@ -109,15 +111,12 @@ enum RpPrtStdParticleCallBackCode rpPRTSTDPARTICLECALLBACKRENDER, /**< Particle render callback */ rpPRTSTDPARTICLECALLBACKCREATE, /**< Particle create callback */ rpPRTSTDPARTICLECALLBACKDESTROY, /**< Particle destroy callback */ - rpPRTSTDPARTICLECALLBACKSTREAMREAD, /**< Particle stream input callback */ - rpPRTSTDPARTICLECALLBACKSTREAMWRITE, /**< Particle stream outout callback */ - rpPRTSTDPARTICLECALLBACKSTREAMGETSIZE, /**< Particle stream get size callback */ rpPRTSTDPARTICLECALLBACKFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RpPrtStdParticleCallBackCode RpPrtStdParticleCallBackCode; -#define rpPRTSTDEMITTERCALLBACKMAX 10 +#define rpPRTSTDEMITTERCALLBACKMAX 11 /** * \ingroup rpprtstd @@ -137,6 +136,7 @@ enum RpPrtStdEmitterCallBackCode rpPRTSTDEMITTERCALLBACKSTREAMREAD, /**< Emitter stream input callback */ rpPRTSTDEMITTERCALLBACKSTREAMWRITE, /**< Emitter stream output callback */ rpPRTSTDEMITTERCALLBACKSTREAMGETSIZE, /**< Emitter stream get size callback */ + rpPRTSTDEMITTERCALLBACKCLONE, /**< Emitter clone callback */ rpPRTSTDEMITTERCALLBACKFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; @@ -154,7 +154,7 @@ typedef struct RpPrtStdEmitter RWALIGN(RpPrtStdEmitter, rwMATRIXALIGNMENT); /** * \ingroup rpprtstd - * \typedef RpPrtStdEmitterCallBack + * \ref RpPrtStdEmitterCallBack * \ref RpPrtStdEmitterCallBack represents the function called for processing * a \ref RpPrtStdEmitter. There can several types of the functions, each performing a * specific task defined by \ref RpPrtStdEmitterCallBackCode. @@ -172,7 +172,6 @@ typedef RpPrtStdEmitter * typedef struct RpPrtStdParticleBatch RWALIGN(RpPrtStdParticleBatch, rwMATRIXALIGNMENT); /** * \ingroup rpprtstd - * \typedef RpPrtStdParticleCallBack * \ref RpPrtStdParticleCallBack represents the function called for processing * a \ref RpPrtStdParticleBatch. There can be several types of the functions, each * performing a specific task defined by \ref RpPrtStdParticleCallBackCode. @@ -189,7 +188,6 @@ typedef RpPrtStdParticleBatch * /** * \ingroup rpprtstd - * \typedef RpPrtStdEmitterCallBackArray * \ref RpPrtStdEmitterCallBackArray represents a set of callback functions for * processing a \ref RpPrtStdEmitter. All the functions are of the type \ref * RpPrtStdEmitterCallBack. @@ -201,7 +199,6 @@ typedef RpPrtStdEmitterCallBack /** * \ingroup rpprtstd - * \typedef RpPrtStdParticleCallBackArray * \ref RpPrtStdParticleCallBackArray represents a set of callback functions for * processing a \ref RpPrtStdParticleBatch. All the functions are of the type \ref * RpPrtStdParticleCallBack. @@ -221,7 +218,6 @@ typedef RpPrtStdParticleCallBack typedef struct RpPrtStdEmitterClass RpPrtStdEmitterClass; /** * \ingroup rpprtstd - * \typedef RpPrtStdEClassSetupCallBack * \ref RpPrtStdEClassSetupCallBack represents the function called for setting up an * emitter class's set of callback function. The callback function is called * after an emitter class is streamed in. @@ -237,7 +233,6 @@ typedef RpPrtStdEmitterClass * typedef struct RpPrtStdParticleClass RpPrtStdParticleClass; /** * \ingroup rpprtstd - * \typedef RpPrtStdPClassSetupCallBack * \ref RpPrtStdPClassSetupCallBack represents the function called for setting up an * emitter class's set of callback function. The callback function is called * after an emitter class is streamed in. @@ -273,6 +268,7 @@ struct RpPrtStdPropertyTable RpPrtStdPropertyTable *next; /**< Internal usage */ RwInt32 id; /**< Property table's id */ + RwInt32 refCount; /**< Reference count. Internal usage */ RwInt32 numProp; /**< Number of properties in the table */ RwInt32 maxProp; /**< Internal usage */ @@ -295,6 +291,7 @@ struct RpPrtStdEmitterClass RpPrtStdEmitterClass *next; /**< Internal usage */ RwInt32 id; /**< Emitter class's id */ + RwInt32 refCount; /**< Reference count. Internal usage */ RwInt32 objSize; /**< Size of the emitter */ RpPrtStdPropertyTable *propTab; /**< Reference to a table of emitter properties */ @@ -316,6 +313,7 @@ struct RpPrtStdParticleClass RpPrtStdParticleClass *next; /**< Internal usage */ RwInt32 id; /**< Particle class's id */ + RwInt32 refCount; /**< Reference count. Internal usage */ RwInt32 objSize; /**< Size of a particle */ RpPrtStdPropertyTable *propTab; /**< Reference to a table of particle properties */ @@ -403,7 +401,6 @@ struct RpPrtStdEmitter #define rpPRTSTDPROPERTYCODEEMITTERSTANDARD 1 #define rpPRTSTDPROPERTYCODEEMITTERPRTCOLOR 2 #define rpPRTSTDPROPERTYCODEEMITTERPRTTEXCOORDS 3 -#define rpPRTSTDPROPERTYCODEEMITTERPRTANIMFRAME 4 #define rpPRTSTDPROPERTYCODEEMITTERPRTSIZE 5 #define rpPRTSTDPROPERTYCODEEMITTERPTANK 6 #define rpPRTSTDPROPERTYCODEEMITTERPRTVELOCITY 7 @@ -414,7 +411,6 @@ struct RpPrtStdEmitter #define rpPRTSTDEMITTERDATAFLAGSTANDARD 0x00000001 #define rpPRTSTDEMITTERDATAFLAGPRTCOLOR 0x00000002 #define rpPRTSTDEMITTERDATAFLAGPRTTEXCOORDS 0x00000004 -#define rpPRTSTDEMITTERDATAFLAGPRTANIMFRAME 0x00000008 #define rpPRTSTDEMITTERDATAFLAGPRTSIZE 0x00000010 #define rpPRTSTDEMITTERDATAFLAGPTANK 0x00000020 #define rpPRTSTDEMITTERDATAFLAGPRTMATRIX 0x00000040 @@ -436,7 +432,7 @@ typedef struct RpPrtStdEmitterStandard RpPrtStdEmitterStandard; * particles. Once an emitter has reached its maximum number of particles, no further particles are * emitted until some of the existing particles have died. * - * Most properties have a bias value to vary the property value. This uses the seed field + * Most properties have a bias value to vary the property's value. This uses the seed field * to give a degreee of randomness. */ struct RpPrtStdEmitterStandard @@ -522,15 +518,6 @@ struct RpPrtStdEmitterPrtTexCoords prtEndUV1Bias; /**< Particle end bottom right texcoords bias */ }; -typedef struct RpPrtStdEmitterPrtAnimFrame RpPrtStdEmitterPrtAnimFrame; - -struct RpPrtStdEmitterPrtAnimFrame -{ - RwInt32 prtNumFrames; - - RwTexCoords *prtAnimFrameTexCoords; -}; - typedef struct RpPrtStdEmitterPrtSize RpPrtStdEmitterPrtSize; /** @@ -550,18 +537,47 @@ struct RpPrtStdEmitterPrtSize prtEndSizeBias; /**< Particle end size bias */ }; + +/** + * \ingroup rpprtstd + * A set of flag settings for use in the \ref RpPrtStdEmitterPrtMatrix flag + */ +enum RpPrtStdEmitterPrtMatrixFlags +{ + rpPRTSTDEMITTERPRTMTXFLAGSCNSMTX = 0x00000001, /**< Apply the prtCnsMtx matrix to + * each particle if set */ + RPPRTSTDEMITTERPRTMTXFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT +}; + +typedef enum RpPrtStdEmitterPrtMatrixFlags RpPrtStdEmitterPrtMatrixFlags; + typedef struct RpPrtStdEmitterPrtMatrix RWALIGN(RpPrtStdEmitterPrtMatrix, rwMATRIXALIGNMENT); +/** + * \ingroup rpprtstd + * \struct RpPrtStdEmitterPrtMatrix + * + * An optional structure to construct a matrix for each particle during emissions. A particle + * can be represented as a single matrix. This gives the particles an orientation rather than + * just a simple position. + * + * This allows transformation to be applied to the particles, such as rotation. If + * \ref rpPRTSTDEMITTERPRTMTXFLAGSCNSMTX is set in the flag, then the prtCnsMatrix is applied to each + * particle during particle update. + * + * If this structure is not present, then it assumes the particles will have just a position + * property. + */ struct RpPrtStdEmitterPrtMatrix { - RwMatrix prtCnsMtx; + RwMatrix prtCnsMtx; /**< Transformation matrix to be applied to each particle */ - RwV3d prtPosMtxAt, - prtPosMtxAtBias; - RwV3d prtPosMtxUp, - prtPosMtxUpBias; + RwV3d prtPosMtxAt, /**< Particle initial look at vector */ + prtPosMtxAtBias; /**< Particle initial look at vector bias */ + RwV3d prtPosMtxUp, /**< Particle initial up vector. */ + prtPosMtxUpBias; /**< Particle initial up vector bias */ - RwInt32 flags; + RwInt32 flags; /**< Particle matrix flag. See \ref RpPrtStdEmitterPrtMatrixFlags */ }; /************************************************************************ @@ -584,18 +600,42 @@ enum RpPrtStdPTankPropertyCode typedef enum RpPrtStdPTankPropertyCode RpPrtStdPTankPropertyCode; typedef struct RpPrtStdEmitterPTank RpPrtStdEmitterPTank; + +/** + * \ingroup rpprtstd + * \struct RpPrtStdEmitterPTank + * + * A structure for storing the data required to create a RpPTank for use + * with the emitter. The structure allows the user to create a RpPTank + * manually. + */ struct RpPrtStdEmitterPTank { - RwUInt32 dataFlags, - platFlags, - numPrt, - maxPrt, - updateFlags, - emitFlags; - RpAtomic *pTank; - RwChar **dataInPtrs, - **dataOutPtrs; - RwInt32 *dataStride; + RwUInt32 dataFlags, /**< Data flag used in RpPTank creation. See + * \ref RpPTankAtomicCreate */ + platFlags, /**< Platform flag used in RpPTank creation. See + * \ref RpPTankAtomicCreate */ + numPrt, /**< An integer representing the current number of active + * particles */ + maxPrt, /**< An integer representing the maxiumum number of particles + * stored in the RpPTank */ + updateFlags, /**< A flag representing the properties to be updated by + * the particle emiiter during update. A user may select to + * update some properties manually by unsetting the relevant + * bits in the flag. + * The flag settings are the same as \ref RpPTankDataFlags */ + emitFlags; /**< A flag representing the properties to be initialised + * by the particle emitter during particles emission. A user + * may select to initialise some properties manually by + * unsetting the relevant bits in the flag. + * The flag settings are the same as \ref RpPTankDataFlags */ + RpAtomic *pTank; /**< Pointer to the RpPTank */ + RwChar **dataInPtrs, /**< Internal usage */ + **dataOutPtrs; /**< Internal usage */ + RwInt32 *dataStride; /**< Internal usage */ + RwUInt32 strSrcBlend; /**< Internal usage */ + RwUInt32 strDstBlend; /**< Internal usage */ + RwBool strVtxABlend; /**< Internal usage */ }; /************************************************************************ @@ -608,7 +648,6 @@ struct RpPrtStdEmitterPTank #define rpPRTSTDPROPERTYCODEPARTICLEPOSITION 1 #define rpPRTSTDPROPERTYCODEPARTICLECOLOR 2 #define rpPRTSTDPROPERTYCODEPARTICLETEXCOORDS 3 -#define rpPRTSTDPROPERTYCODEPARTICLEANIMFRAME 4 #define rpPRTSTDPROPERTYCODEPARTICLESIZE 5 #define rpPRTSTDPROPERTYCODEPARTICLEVELOCITY 6 #define rpPRTSTDPROPERTYCODEPARTICLEMATRIX 7 @@ -619,7 +658,6 @@ struct RpPrtStdEmitterPTank #define rpPRTSTDPARTICLEDATAFLAGPOSITION 0x00000002 #define rpPRTSTDPARTICLEDATAFLAGCOLOR 0x00000004 #define rpPRTSTDPARTICLEDATAFLAGTEXCOORDS 0x00000008 -#define rpPRTSTDPARTICLEDATAFLAGANIMFRAME 0x00000010 #define rpPRTSTDPARTICLEDATAFLAGSIZE 0x00000020 #define rpPRTSTDPARTICLEDATAFLAGVELOCITY 0x00000040 #define rpPRTSTDPARTICLEDATAFLAGMATRIX 0x00000080 @@ -675,15 +713,6 @@ struct RpPrtStdParticleTexCoords deltaUV1; /**< Particle's bottom right texcoords rate of change */ }; -typedef struct RpPrtStdParticleAnimFrame RpPrtStdParticleAnimFrame; - -struct RpPrtStdParticleAnimFrame -{ - RwInt32 frame; - - RwReal delta; -}; - typedef struct RpPrtStdParticleSize RpPrtStdParticleSize; /** @@ -714,10 +743,13 @@ extern "C" /************************************************************************/ extern RwBool -RpParticleStandardPluginAttach( void ); +RpPrtStdPluginAttach( void ); /************************************************************************/ +extern RwBool +RpAtomicIsParticleEmitter(RpAtomic *atomic); + extern RpAtomic * RpPrtStdAtomicCreate(RpPrtStdEmitterClass *eClass, void *data); @@ -750,6 +782,9 @@ extern RwBool RpPrtStdEmitterDestroy(RpPrtStdEmitter *emt); extern RpPrtStdEmitter * +RpPrtStdEmitterClone(RpPrtStdEmitter *emt); + +extern RpPrtStdEmitter * RpPrtStdEmitterForAllParticleBatch(RpPrtStdEmitter *emt, RpPrtStdParticleCallBack callback, void * data); @@ -835,7 +870,6 @@ RpPrtStdPropTabStreamWrite(RpPrtStdPropertyTable *eClass, extern RwInt32 RpPrtStdPropTabStreamGetSize(RpPrtStdPropertyTable *eClass); - /************************************************************************/ extern RwBool @@ -941,6 +975,11 @@ RpPrtStdGlobalDataStreamWrite(RwStream *stream); extern RwInt32 RpPrtStdGlobalDataStreamGetSize( void ); +extern void +RpPrtStdGlobalDataSetStreamEmbedded( RwBool embedded ); + +extern RwBool +RpPrtStdGlobalDataGetStreamEmbedded( void ); /************************************************************************/ @@ -964,10 +1003,18 @@ RpPrtStdEmitterStdEmitCB(RpAtomic *atomic, RpPrtStdEmitter *emt, void *data); extern RpPrtStdEmitter * +RpPrtStdEmitterStdCloneCB(RpAtomic *atomic, + RpPrtStdEmitter *emt, void *data); + +extern RpPrtStdEmitter * RpPrtStdEmitterStdCreateCB(RpAtomic *atomic, RpPrtStdEmitter *emt, void *data); extern RpPrtStdEmitter * +RpPrtStdEmitterStdDestroyCB(RpAtomic *atomic, + RpPrtStdEmitter *emt, void *data); + +extern RpPrtStdEmitter * RpPrtStdEmitterStdBeginUpdateCB(RpAtomic *atomic, RpPrtStdEmitter *emt, void *data); diff --git a/rwsdk/include/d3d8/rpprtstd.rpe b/rwsdk/include/d3d8/rpprtstd.rpe index df860d45..d628c6c0 100644 --- a/rwsdk/include/d3d8/rpprtstd.rpe +++ b/rwsdk/include/d3d8/rpprtstd.rpe @@ -160,480 +160,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -enum e_rwdb_CriterionParticleStandard +enum e_rwdb_CriterionPrtStandard { - e_rwdb_CriterionParticleStandardLAST = RWFORCEENUMSIZEINT + e_rwdb_CriterionPrtStandardLAST = RWFORCEENUMSIZEINT }; -typedef enum e_rwdb_CriterionParticleStandard e_rwdb_CriterionParticleStandard; +typedef enum e_rwdb_CriterionPrtStandard e_rwdb_CriterionPrtStandard; diff --git a/rwsdk/include/d3d8/rpptank.h b/rwsdk/include/d3d8/rpptank.h index 20931f21..d4c1116d 100644 --- a/rwsdk/include/d3d8/rpptank.h +++ b/rwsdk/include/d3d8/rpptank.h @@ -13,12 +13,13 @@ /** * \defgroup rpptank RpPTank - * \ingroup rpplugin + * \ingroup particles * * PTank Plugin for RenderWare. */ /*--- Include files ---*/ + #include <string.h> #include "rwcore.h" @@ -139,7 +140,7 @@ enum RpPTankInstanceFlags rpPTANKIFLAGCENTER = ((int)0x01000000), /**<Center position changed*/ /* free = ((int)0x04000000), */ /* free = ((int)0x08000000), */ -/* free = ((int)0x10000000), */ + rpPTANKIFLAGALPHABLENDING = ((int)0x10000000), /**<Internal Use*/ rpPTANKIFLAGALL = ((int)0xFFFFFFFF), RPPTANKINSTANCEFLAGSFORCEENUMSIZEINT = RWFORCEENUMSIZEINT @@ -244,20 +245,22 @@ extern const RwInt32 datasize[]; /** * \ingroup rpptank - * \typedef rpptankAllocCallBack + * \ref RpPTankAllocCallBack + * * ... */ -typedef void *(* rpPTankAllocCallBack)(RpPTankData *ptankGlobal, +typedef void *(* RpPTankAllocCallBack)(RpPTankData *ptankGlobal, RwInt32 maxPCount, RwUInt32 dataFlags, RwUInt32 platFlags); /** * \ingroup rpptank - * \typedef rpPTankCreateCallBack + * \ref RpPTankCreateCallBack + * * ... */ -typedef RwBool (* rpPTankCreateCallBack)(RpAtomic *atomic, +typedef RwBool (* RpPTankCreateCallBack)(RpAtomic *atomic, RpPTankData *ptankGlobal, RwInt32 maxPCount, RwUInt32 dataFlags, @@ -265,37 +268,37 @@ typedef RwBool (* rpPTankCreateCallBack)(RpAtomic *atomic, /** * \ingroup rpptank - * \typedef rpPTankInstanceCallBack + * \ref RpPTankInstanceCallBack * ... */ -typedef RwBool (* rpPTankInstanceCallBack)(RpAtomic *atomic, +typedef RwBool (* RpPTankInstanceCallBack)(RpAtomic *atomic, RpPTankData *ptankGlobal, RwInt32 actPCount, RwUInt32 instFlags); /** * \ingroup rpptank - * \typedef rpPTankRenderCallBack + * \ref RpPTankRenderCallBack * ... */ -typedef RwBool (* rpPTankRenderCallBack)(RpAtomic *atomic, +typedef RwBool (* RpPTankRenderCallBack)(RpAtomic *atomic, RpPTankData *ptankGlobal, RwInt32 actPCount); -typedef struct rpPTankCallBacks rpPTankCallBacks; +typedef struct RpPTankCallBacks RpPTankCallBacks; -struct rpPTankCallBacks +struct RpPTankCallBacks { - rpPTankAllocCallBack alloc; - rpPTankCreateCallBack create; - rpPTankInstanceCallBack instance; - rpPTankRenderCallBack render; + RpPTankAllocCallBack alloc; + RpPTankCreateCallBack create; + RpPTankInstanceCallBack instance; + RpPTankRenderCallBack render; }; /* private typedefs */ -typedef struct rpPTANKInstanceSetupData rpPTANKInstanceSetupData; +typedef struct RpPTANKInstanceSetupData RpPTANKInstanceSetupData; -struct rpPTANKInstanceSetupData +struct RpPTANKInstanceSetupData { RwBool instancePositions; RwBool instanceUVs; @@ -312,27 +315,27 @@ struct rpPTANKInstanceSetupData }; -typedef void (* rpPTankGENInstancePosCallback)( +typedef void (* RpPTankGENInstancePosCallback)( RpPTankLockStruct *dstCluster, RwV3d *right, RwV3d *up, RwInt32 pCount, RpPTankData *ptankGlobal); -typedef void (* rpPTankGENInstanceCallback)( +typedef void (* RpPTankGENInstanceCallback)( RpPTankLockStruct *dstCluster, RwInt32 pCount, RpPTankData *ptankGlobal); -typedef void (* rpPTankGENInstanceSetupCallback)( - rpPTANKInstanceSetupData *data, +typedef void (* RpPTankGENInstanceSetupCallback)( + RpPTANKInstanceSetupData *data, RpAtomic *atomic, RpPTankData *ptankGlobal, RwInt32 actPCount, RwUInt32 instFlags); -typedef void (* rpPTankGENInstanceEndingCallback)( - rpPTANKInstanceSetupData *data, +typedef void (* RpPTankGENInstanceEndingCallback)( + RpPTANKInstanceSetupData *data, RpAtomic *atomic, RpPTankData *ptankGlobal, RwInt32 actPCount, @@ -351,15 +354,15 @@ struct RpPTankAtomicExtPrv /* Rendering callback */ RpAtomicCallBackRender defaultRenderCB; - rpPTankCallBacks ptankCallBacks; + RpPTankCallBacks ptankCallBacks; /* Instancing CallBacks */ - rpPTankGENInstanceSetupCallback insSetupCB; - rpPTankGENInstancePosCallback insPosCB; - rpPTankGENInstanceCallback insUVCB; - rpPTankGENInstanceCallback insColorsCB; - rpPTankGENInstanceCallback insNormalsCB; - rpPTankGENInstanceEndingCallback insEndingCB; + RpPTankGENInstanceSetupCallback insSetupCB; + RpPTankGENInstancePosCallback insPosCB; + RpPTankGENInstanceCallback insUVCB; + RpPTankGENInstanceCallback insColorsCB; + RpPTankGENInstanceCallback insNormalsCB; + RpPTankGENInstanceEndingCallback insEndingCB; RwUInt32 lockFlags; RwUInt32 instFlags; @@ -390,7 +393,6 @@ extern RwInt32 _rpPTankGlobalsOffset; /* Offset in RwEngine */ #endif - extern RwBool RpPTankPluginAttach(void); @@ -523,7 +525,7 @@ MACRO_START\ RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor = *col_;\ if( RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0) )\ {\ - RpMaterialSetColor(\ + (void)RpMaterialSetColor(\ RpGeometryGetMaterial(RpAtomicGetGeometry(atm_),0),\ &RPATOMICPTANKPLUGINDATA(atm_)->publicData.cColor);\ }\ @@ -759,6 +761,14 @@ extern RpAtomic * RpPTankAtomicUnlock(RpAtomic *atomic); +/* + * Stealth functions ********************************************************* + */ +RpAtomic* +_rpPTankAtomicCreateCustom(RwInt32 maxParticleNum, + RwUInt32 dataFlags, RwUInt32 platFlags, + RpPTankCallBacks *callbacks); + #ifdef __cplusplus } #endif /* __cplusplus */ @@ -767,6 +777,41 @@ RpPTankAtomicUnlock(RpAtomic *atomic); /*---- start: c:/daily/rwsdk/plugin/ptank/d3d8/ptankplatform.h----*/ +/** + * \defgroup rpptankd3d8 D3D8 + * \ingroup rpptank + * + * D3D8 specific documentation. + */ + +/** + * \ingroup rpptankd3d8 + * \par D3D8 specific data flags + * + * <ul> + * <li> rpPTANKD3D8FLAGSUSEPOINTSPRITES selects the D3D8 optimized pipeline. At the + * moment, this pipeline use point sprites when the hardware supports them, + * which don't allow use of all the PTank flags. Only the following flags are + * supported when using the D3D8 optimized pipes: + * + * <ul> + * <li> rpPTANKDFLAGPOSITION + * <li> rpPTANKDFLAGNORMAL + * <li> rpPTANKDFLAGSIZE (if the hardware supports the D3DFVF_PSIZE vertex format flag) + * <li> rpPTANKDFLAGCOLOR + * <li> rpPTANKDFLAGUSECENTER + * <li> rpPTANKDFLAGARRAY + * <li> rpPTANKDFLAGSTRUCTURE + * </ul> + * + * The texture coordinates are generated by the hardware and can't be specified. + * </ul> + * + * If the hardware does not support point sprites, the default pipeline is used + * instead. + * + */ + enum RpPTankD3D8Flags { rpPTANKD3D8FLAGSUSEPOINTSPRITES = 0x00000001, @@ -774,6 +819,8 @@ enum RpPTankD3D8Flags rpPTANKD3D8FLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; +typedef enum RpPTankD3D8Flags RpPTankD3D8Flags; + /*---- end: c:/daily/rwsdk/plugin/ptank/d3d8/ptankplatform.h----*/ #endif /* RPPTANK_H */ diff --git a/rwsdk/include/d3d8/rpptank.rpe b/rwsdk/include/d3d8/rpptank.rpe index 485b5dd8..2a9b45d3 100644 --- a/rwsdk/include/d3d8/rpptank.rpe +++ b/rwsdk/include/d3d8/rpptank.rpe @@ -146,472 +146,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rwsdk/include/d3d8/rppvs.h b/rwsdk/include/d3d8/rppvs.h index 29fc2343..08738933 100644 --- a/rwsdk/include/d3d8/rppvs.h +++ b/rwsdk/include/d3d8/rppvs.h @@ -32,7 +32,7 @@ /** * \defgroup rppvs RpPVS - * \ingroup rpplugin + * \ingroup pvs * * Geometric Potentially Visible Set Plugin for RenderWare Graphics. */ @@ -122,11 +122,14 @@ typedef RpWorldSector *(*RpPVSCallBack) (RpWorldSector * worldSector, #define RpPVSCallback RpPVSCallBack typedef struct _RpPVSCallBack _RpPVSCallBack; + +#if (!defined(DOXYGEN)) struct _RpPVSCallBack { RpPVSCallBack callback; void *data; }; +#endif /* (!defined(DOXYGEN)) */ enum _rpPVSPartitionId { @@ -145,6 +148,7 @@ typedef struct _rpPVSPolyList *_rpPVSPolyListPtr; typedef struct _rpPVSPoly _rpPVSPoly; typedef struct _rpPVSPoly *_rpPVSPolyPtr; +#if (!defined(DOXYGEN)) typedef struct _rpPVSPlaneEq _rpPVSPlaneEq; struct _rpPVSPlaneEq { @@ -158,12 +162,13 @@ struct _rpPVSPlaneEq _rpPVSPartitionId lastresult; /* temp: stores result of last polygon wrt this plane */ }; -typedef struct +typedef struct RwV3i RwV3i; +struct RwV3i { RwInt32 x; RwInt32 y; RwInt32 z; -}RwV3i; +}; typedef struct _rpPVSPolyRecord _rpPVSPolyRecord; struct _rpPVSPolyRecord @@ -205,47 +210,45 @@ struct _rpPVSPolyList }; typedef struct RpPVS RpPVS; + struct RpPVS { - RwInt32 sectorID; /* Id of the sector */ - RwInt32 vismaplength; /* Length of vismap */ - RwInt32 sampleKey; /* Currently unused, for future use */ + RwInt32 sectorID; + RwInt32 vismaplength; + RwInt32 sampleKey; RpPVSVisMap *vismap; - _rpPVSPolyListPtr sectailpoly; /* Pointer to last polygon in polygons list that is in this sector */ + _rpPVSPolyListPtr sectailpoly; + _rpPVSPartitionId potential; - _rpPVSPartitionId potential; /* temp: is sector in out or split from current shadow volume - for heirarchical clip */ RwUInt32 numpols; - RwBBox sbox; /* Bounding box of the sector */ - RwBBox gbox; /* Bounding box of the geometry of the sector */ - RwReal diagonal; /* Diagonal size of bounding box of the sector */ - RwV3d centre; /* Centre of the sector */ - RwInt32 axessig[3]; /* sampling significance of the axes of the gbox */ + RwBBox sbox; + RwBBox gbox; + RwReal diagonal; + RwV3d centre; + RwInt32 axessig[3]; }; typedef struct RpPVSCache RpPVSCache; struct RpPVSCache { - RwBool processed; /* flag to indicate exisiting PVS data for the world */ - RwBool formatted; /* flag to indicate exisiting intermediate polygonal data for PVS generation */ + RwBool processed; + RwBool formatted; + RwInt32 NumWorldSectors; - /* stats collection */ RwInt32 ptotal; RwInt32 paccept; - /* pipeline hooking */ RwBool hooked; - /* used during vismap allocation */ RwUInt32 nextID; RwInt32 viscount; - /* Used during construction */ RpPVSProgressCallBack progressCallBack; - _rpPVSPolyListPtr polygons; /* A copy of the input data set of all world polygons */ + _rpPVSPolyListPtr polygons; RpWorldSectorCallBackRender renderCallBack; }; @@ -255,23 +258,23 @@ struct RpPVSGlobalVars { RpWorld *World; - RwInt32 worldOffset; /* Offset into global data */ - RwInt32 sectorOffset; /* Offset into global data */ + RwInt32 worldOffset; + RwInt32 sectorOffset; - RwBool collis; /* Collision detection */ - RwBool bfc; /* Backface culling */ + RwBool collis; + RwBool bfc; - RwInt32 NumWorldSectors; RwInt32 progress_count; RwReal diagonal; RwReal gran; - RwInt32 InSector; /* Current sector id */ - RwV3d ViewPos; /* Current view pos */ - RpPVS *CurrPVS; /* Current PVS sector */ + RwInt32 InSector; + RwV3d ViewPos; + RpPVS *CurrPVS; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** diff --git a/rwsdk/include/d3d8/rppvs.rpe b/rwsdk/include/d3d8/rppvs.rpe index dc060cff..62c983b0 100644 --- a/rwsdk/include/d3d8/rppvs.rpe +++ b/rwsdk/include/d3d8/rppvs.rpe @@ -161,472 +161,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionGPVS { diff --git a/rwsdk/include/d3d8/rprandom.h b/rwsdk/include/d3d8/rprandom.h index 8690c69a..aebbfed9 100644 --- a/rwsdk/include/d3d8/rprandom.h +++ b/rwsdk/include/d3d8/rprandom.h @@ -28,7 +28,7 @@ /** * \defgroup rprandom RpRandom - * \ingroup rpplugin + * \ingroup mathtools * * Random Number Generation Plugin for RenderWare Graphics. */ diff --git a/rwsdk/include/d3d8/rprandom.rpe b/rwsdk/include/d3d8/rprandom.rpe index 8e267eee..d3fe964b 100644 --- a/rwsdk/include/d3d8/rprandom.rpe +++ b/rwsdk/include/d3d8/rprandom.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionRandom { diff --git a/rwsdk/include/d3d8/rpskin.h b/rwsdk/include/d3d8/rpskin.h index df446c1b..8a6ea204 100644 --- a/rwsdk/include/d3d8/rpskin.h +++ b/rwsdk/include/d3d8/rpskin.h @@ -4,7 +4,7 @@ /** * \defgroup rpskin RpSkin - * \ingroup rpplugin + * \ingroup skinning * * Skin Plugin for RenderWare Graphics. */ @@ -48,7 +48,7 @@ struct RwMatrixWeights /** * \ingroup rpskin - * \typedef RpSkin + * \struct RpSkin * * Skin object. This should be considered an opaque type. * Use the RpSkin API functions to access. @@ -69,6 +69,9 @@ extern "C" /*---------------------------------------------------------------------------* *- Plugin functions -* *---------------------------------------------------------------------------*/ +extern void RpSkinSetFreeListCreateParams( + RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwBool RpSkinPluginAttach(void); @@ -114,6 +117,9 @@ RpSkinGetVertexBoneIndices( RpSkin *skin ); extern const RwMatrix * RpSkinGetSkinToBoneMatrices( RpSkin *skin ); +extern RwBool +RpSkinIsSplit( RpSkin *skin ); + /*---------------------------------------------------------------------------* *- Skin pipeline -* *---------------------------------------------------------------------------*/ @@ -131,7 +137,6 @@ enum RpSkinType rpSKINTYPEGENERIC = 1, /**<Generic skin rendering. */ rpSKINTYPEMATFX = 2, /**<Material effects skin rendering. */ rpSKINTYPETOON = 3, /**<Toon skin rendering. */ - rpSKINTYPEMATFXTOON = 4, /**<Note Toon + MatFX on same object NOT currently supported */ rpSKINTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RpSkinType RpSkinType; @@ -143,6 +148,32 @@ RpSkinAtomicSetType( RpAtomic *atomic, extern RpSkinType RpSkinAtomicGetType( RpAtomic *atomic ); +/*---------------------------------------------------------------------------* + *- Internal API -* + *---------------------------------------------------------------------------*/ +extern RpGeometry * +_rpSkinInitialize(RpGeometry *geometry); + +extern RpGeometry * +_rpSkinDeinitialize(RpGeometry *geometry); + +extern RwUInt8 * +_rpSkinGetMeshBoneRemapIndices( RpSkin *skin ); + +extern RwUInt8 * +_rpSkinGetMeshBoneRLECount( RpSkin *skin ); + +extern RwUInt8 * +_rpSkinGetMeshBoneRLE( RpSkin *skin ); + +extern RpSkin * +_rpSkinSplitDataCreate( RpSkin *skin, RwUInt32 boneLimit, + RwUInt32 numMatrices, RwUInt32 numMeshes, + RwUInt32 numRLE ); + +extern RwBool +_rpSkinSplitDataDestroy( RpSkin *skin ); + /*---------------------------------------------------------------------------*/ #ifdef __cplusplus @@ -167,6 +198,29 @@ RpSkinAtomicGetType( RpAtomic *atomic ); * D3D8 skin pipeline extension. */ +/** + * \defgroup rpskind3d8features Features + * \ingroup rpskind3d8 + * + * D3D8 skin pipeline features. + */ + +/** + * \defgroup rpskind3d8restrictions Restrictions + * \ingroup rpskind3d8 + * + * D3D8 skin pipeline restrictions. + */ + +/** + * \defgroup rpskinbonelimit Bone limit + * \ingroup rpskind3d8restrictions + * + * \par Bone limit + * The bone limit is 256 as skinning is performed on the CPU. + * + */ + /*===========================================================================* *--- D3D8 Defines -----------------------------------------------------------* diff --git a/rwsdk/include/d3d8/rpskin.rpe b/rwsdk/include/d3d8/rpskin.rpe index 57cecd5e..02d7e162 100644 --- a/rwsdk/include/d3d8/rpskin.rpe +++ b/rwsdk/include/d3d8/rpskin.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionSKIN { diff --git a/rwsdk/include/d3d8/rpspline.h b/rwsdk/include/d3d8/rpspline.h index 53fd8484..df3a21d9 100644 --- a/rwsdk/include/d3d8/rpspline.h +++ b/rwsdk/include/d3d8/rpspline.h @@ -39,7 +39,7 @@ /** * \defgroup rpspline RpSpline - * \ingroup rpplugin + * \ingroup mathtools * * Spline Plugin for RenderWare Graphics. */ diff --git a/rwsdk/include/d3d8/rpspline.rpe b/rwsdk/include/d3d8/rpspline.rpe index 27670751..55748bdd 100644 --- a/rwsdk/include/d3d8/rpspline.rpe +++ b/rwsdk/include/d3d8/rpspline.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionSpline { diff --git a/rwsdk/include/d3d8/rpstereo.h b/rwsdk/include/d3d8/rpstereo.h deleted file mode 100644 index 5a8db912..00000000 --- a/rwsdk/include/d3d8/rpstereo.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Stereo camera plugin - */ - -/********************************************************************** - * - * File : rpstereo.h - * - * Abstract : Add Stereo Camera support to RenderWare - * - ********************************************************************** - * - * This file is a product of Criterion Software Ltd. - * - * This file is provided as is with no warranties of any kind and is - * provided without any obligation on Criterion Software Ltd. or - * Canon Inc. to assist in its use or modification. - * - * Criterion Software Ltd. will not, under any - * circumstances, be liable for any lost revenue or other damages arising - * from the use of this file. - * - * Copyright (c) 1998 Criterion Software Ltd. - * All Rights Reserved. - * - * RenderWare is a trademark of Canon Inc. - * - ************************************************************************/ - -#ifndef RPSTEREO_H -#define RPSTEREO_H - -/** - * \defgroup rpstereo RpStereo - * \ingroup rpplugin - * - * Stereo Camera Plugin for RenderWare Graphics. - */ - -/*--- Include files ---*/ -#include <rwcore.h> -#include <rpworld.h> - -#include "rpstereo.rpe" /* automatically generated header file */ - -/*--- Global Structures ---*/ - -/* Supported Stereo Modes */ - -/** - * \ingroup rpstereo - * \ref RpStereoCameraMode - * Stereo camera mode enumeration. - */ -enum RpStereoCameraMode -{ - rpNASTEREOMODE = 0, - rpSTEREOMONO, /**< Render as Mono camera - single - * image - */ - rpSTEREOLEFTRIGHT, /**< Vertical split screen. Left eye - * image on left of screen. Right eye - * image on right of screen. - */ - rpSTEREORIGHTLEFT, /**< Vertical split screen. Right eye - * image on left of screen. Left eye image - * on right of screen. - */ - - rpSTEREOROTATE90, /**< As for rpSTEREOLEFTRIGHT - with - * the images rotated inwards by 90 degrees - */ - rpSTEREOINTERLACEDLEFTRIGHT, /**< Left and right eye images on - * alternate scanlines. The left eye image - * on the topmost line of the display. - */ - - rpSTEREOINTERLACEDRIGHTLEFT, /**< Left and right eye images on - * alternate scanlines. The right eye - * image is on the topmost line of the - * display. - */ - rpSTEREOLASTMODE, - rpSTEREOCAMERAMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT -}; - -/* - * typedef for stereo camera mode enumeration. - */ -typedef enum RpStereoCameraMode RpStereoCameraMode; - -/*--- Constants ---*/ - -/* These may be used to quickly adapt an existing application to a - * stereo version. - */ - -#ifdef RPSTEREO_OVERLOAD -#define RwCameraBeginUpdate RpStereoCameraBeginUpdate -#define RwCameraEndUpdate RpStereoCameraEndUpdate -#undef RpWorldRender -#define RpWorldRender RpStereoWorldRender -#undef RpClumpRender -#define RpClumpRender RpStereoClumpRender -#undef RpAtomicRender -#define RpAtomicRender RpStereoAtomicRender -#undef RpWorldSectorRender -#define RpWorldSectorRender RpStereoWorldSectorRender -#endif - -/*--- Plugin API Functions ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -RwBool RpStereoPluginAttach(void); - -RpWorld *RpStereoWorldRender(RpWorld *world); -RpClump *RpStereoClumpRender(RpClump *clump); -RpAtomic *RpStereoAtomicRender(RpAtomic *atomic); -RpWorldSector *RpStereoWorldSectorRender(RpWorldSector *sector); - -RwCamera *RpStereoCameraBeginUpdate(RwCamera *camera); -RwCamera *RpStereoCameraEndUpdate(RwCamera *stereoCam); - -RwReal RpStereoCameraGetSeparation(RwCamera *stereoCam); -RwReal RpStereoCameraGetFocal(RwCamera *stereoCam); -RpStereoCameraMode RpStereoCameraGetMode(RwCamera *stereoCam); - -RwCamera *RpStereoCameraSetSeparation(RwCamera *stereoCam, RwReal dist); -RwCamera *RpStereoCameraSetFocal(RwCamera *stereoCam, RwReal focal); -RwCamera *RpStereoCameraSetMode(RwCamera *stereoCam, RpStereoCameraMode newMode); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* RPSTEREO_H */ - diff --git a/rwsdk/include/d3d8/rpstereo.rpe b/rwsdk/include/d3d8/rpstereo.rpe deleted file mode 100644 index b89dde2e..00000000 --- a/rwsdk/include/d3d8/rpstereo.rpe +++ /dev/null @@ -1,641 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -enum e_rwdb_CriterionStereo -{ - - -E_RP_STEREO_INVMODE, - -E_RP_STEREO_INVFOCAL, - - e_rwdb_CriterionStereoLAST = RWFORCEENUMSIZEINT -}; - -typedef enum e_rwdb_CriterionStereo e_rwdb_CriterionStereo; - - diff --git a/rwsdk/include/d3d8/rpusrdat.h b/rwsdk/include/d3d8/rpusrdat.h index 3665e064..92a56e31 100644 --- a/rwsdk/include/d3d8/rpusrdat.h +++ b/rwsdk/include/d3d8/rpusrdat.h @@ -3,7 +3,7 @@ /** * \defgroup rpuserdata RpUserData - * \ingroup rpplugin + * \ingroup scenemanagement * * User Data Plugin for RenderWare Graphics. */ diff --git a/rwsdk/include/d3d8/rpusrdat.rpe b/rwsdk/include/d3d8/rpusrdat.rpe index 31c37fd1..f5879a00 100644 --- a/rwsdk/include/d3d8/rpusrdat.rpe +++ b/rwsdk/include/d3d8/rpusrdat.rpe @@ -160,472 +160,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionUserData { diff --git a/rwsdk/include/d3d8/rpworld.h b/rwsdk/include/d3d8/rpworld.h index 21fdc31b..0d0489ce 100644 --- a/rwsdk/include/d3d8/rpworld.h +++ b/rwsdk/include/d3d8/rpworld.h @@ -22,7 +22,7 @@ /************************************************************************* * * Filename: <C:/daily/rwsdk/include/d3d8/rpworld.h> - * Automatically Generated on: Wed Jul 10 10:45:01 2002 + * Automatically Generated on: Thu Jan 23 11:06:24 2003 * ************************************************************************/ @@ -75,135 +75,32 @@ extern RxNodeDefinition *RxNodeDefinitionGetD3D8AtomicAllInOne(void); extern "C" { #endif /* __cplusplus */ -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeWorldSectorInstance.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetWorldSectorInstance(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeWorldSectorEnumerateLights.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetWorldSectorEnumerateLights(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodePreLight.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetPreLight(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodePostLight.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetPostLight(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeMaterialScatter.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetMaterialScatter(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeLight.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetLight(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeFastPathSplitter.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetFastPathSplitter(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ +extern void RwD3D8VertexBufferManagerChangeDefaultSize(RwUInt32 defaultSize); -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeAtomicInstance.h ---*/ +extern RwBool _rxD3D8VertexBufferManagerCreate(RwUInt32 fvf, + RwUInt32 size, + void **vertexBuffer, + RwUInt32 *baseIndex); -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetAtomicInstance(void); +extern void _rxD3D8VertexBufferManagerDestroy(RwUInt32 fvf, + RwUInt32 size, + void *vertexBuffer, + RwUInt32 baseIndex); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/nodeAtomicEnumerateLights.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ +extern RwBool _rxD3D8VertexBufferManagerCreateNoFVF(RwUInt32 stride, + RwUInt32 size, + void **vertexBuffer, + RwUInt32 *baseIndex); -extern RxNodeDefinition *RxNodeDefinitionGetAtomicEnumerateLights(void); +extern void _rxD3D8VertexBufferManagerDestroyNoFVF(RwUInt32 stride, + RwUInt32 size, + void *vertexBuffer, + RwUInt32 baseIndex); #ifdef __cplusplus } -#endif /* __cplusplus */ - +#endif /* __cplusplus */ /*--- Automatically derived from: c:/daily/rwsdk/world/bamateri.h ---*/ @@ -222,15 +119,17 @@ extern RxNodeDefinition *RxNodeDefinitionGetAtomicEnumerateLights(void); typedef struct RpMaterialChunkInfo RpMaterialChunkInfo; typedef struct RpMaterialChunkInfo _rpMaterial; +#if (!defined(DOXYGEN)) struct RpMaterialChunkInfo { - RwInt32 flags; /**< Material flags - unused currently - - for future expansion */ - RwRGBA color; /**< Colour of material. */ - RwInt32 unused; /**< Not used */ - RwBool textured; /**< Are we textured? */ - RwSurfaceProperties surfaceProps; /**< Surface properties */ + RwInt32 flags; /* Material flags - unused currently - + * for future expansion */ + RwRGBA color; /* Color of material. */ + RwInt32 unused; /* Not used */ + RwBool textured; /* Are we textured? */ + RwSurfaceProperties surfaceProps;/* Surface properties */ }; +#endif /* (!defined(DOXYGEN)) */ #if (!defined(RwMaterialAssign)) #define RwMaterialAssign(_target, _source) \ @@ -238,8 +137,8 @@ struct RpMaterialChunkInfo #endif /* (!defined(RwMaterialAssign)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpMaterial + * \ingroup rpmaterial + * \struct RpMaterial * Material object. This should be * considered an opaque type. Use the RpMaterial API functions to access. */ @@ -258,9 +157,8 @@ struct RpMaterial #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpMaterialCallBack - \ref RpMaterialCallBack + * \ingroup rpmaterial + * \ref RpMaterialCallBack * represents the function called from \ref RpGeometryForAllMaterials and * \ref RpWorldForAllMaterials for all materials referenced by polygons in a * given geometry. This function should return a pointer to the current @@ -268,7 +166,7 @@ struct RpMaterial * further callbacks on the materials. * * \param material Pointer to the current material - * \param data Pointer to developer-defined data structure. + * \param data Pointer to developer-defined data structure. * * \return Pointer to the current material. */ @@ -346,6 +244,9 @@ extern "C" #endif /* __cplusplus */ +extern void RpMaterialSetFreeListCreateParams( RwInt32 blockSize, + RwInt32 numBlocksToPrealloc ); + /* Creating, destroying and referencing materials */ extern RpMaterial *RpMaterialCreate(void); extern RwBool RpMaterialDestroy(RpMaterial *material); @@ -388,6 +289,8 @@ extern RwInt32 RpMaterialRegisterPluginStream(RwUInt32 pluginID, extern RwInt32 RpMaterialSetStreamAlwaysCallBack( RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); +extern RwInt32 RpMaterialSetStreamRightsCallBack(RwUInt32 pluginID, + RwPluginDataChunkRightsCallBack rightsCB); extern RwInt32 RpMaterialGetPluginOffset(RwUInt32 pluginID); extern RwBool RpMaterialValidatePlugins(const RpMaterial *material); @@ -414,12 +317,15 @@ _rpMaterialChunkInfoRead(RwStream *stream, */ typedef struct RpMaterialList RpMaterialList; + +#if (!defined(DOXYGEN)) struct RpMaterialList { RpMaterial **materials; RwInt32 numMaterials; RwInt32 space; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** Function prototypes @@ -531,16 +437,14 @@ extern RwModuleInfo meshModule; Global types */ -/** - * \ingroup rpworlddatatypes - * \typedef RpMeshHeader +/* * typedef for header structure listing all meshes * constituting a single RpGeometry or RpWorldSector */ typedef struct RpMeshHeader RpMeshHeader; /** - * \ingroup rpworlddatatypes + * \ingroup rpmesh * \ref RpMeshHeaderFlags * represents the different types of mesh. * \see RpMeshHeader @@ -549,18 +453,18 @@ enum RpMeshHeaderFlags { /* NOTE: trilists are denoted by absence of any other * primtype flags, so be careful that you test: - * (triListFlag == flags&triListFlag) + * (triListFlag == (flags&triListFlag)) * or: - * (0 == flags&rpMESHHEADERPRIMMASK) + * (0 == (flags&rpMESHHEADERPRIMMASK)) * and not: * (flags&triListFlag) */ rpMESHHEADERTRISTRIP = 0x0001, /**< Render as tristrips */ - rpMESHHEADERTRIFAN = 0x0002, /**< On PS2 these will be converted to trilists */ + rpMESHHEADERTRIFAN = 0x0002, /**< On PlayStation 2 these will be converted to trilists */ rpMESHHEADERLINELIST = 0x0004, /**< Render as linelists */ - rpMESHHEADERPOLYLINE = 0x0008, /**< On PS2 these will be converted to linelists */ + rpMESHHEADERPOLYLINE = 0x0008, /**< On PlayStation 2 these will be converted to linelists */ rpMESHHEADERPOINTLIST = 0x0010, /**< Pointlists are supported only if rendered by - * custom pipelines; there is no default RenderWare + * custom pipelines; there is no default RenderWare * way to render pointlists. */ rpMESHHEADERPRIMMASK = 0x00FF, /**< All bits reserved for specifying primitive type */ @@ -576,6 +480,8 @@ enum RpMeshHeaderFlags typedef enum RpMeshHeaderFlags RpMeshHeaderFlags; typedef struct rpMeshGlobals rpMeshGlobals; + +#if (!defined(DOXYGEN)) struct rpMeshGlobals { RwInt16 nextSerialNum; @@ -583,11 +489,12 @@ struct rpMeshGlobals RwUInt8 meshFlagsToPrimType[rpMESHHEADERPRIMTYPEOR]; RwUInt8 primTypeToMeshFlags[rwPRIMTYPEOR]; }; +#endif /* (!defined(DOXYGEN)) */ typedef struct RpBuildMeshTriangle RpBuildMeshTriangle; /** - * \ingroup rpworlddatatypes + * \ingroup rpmesh * \struct RpBuildMeshTriangle * This type represents an array of indices into * the object vertex array. Used during the construction @@ -613,7 +520,7 @@ struct RpBuildMeshTriangle typedef struct RpBuildMesh RpBuildMesh; /** - * \ingroup rpworlddatatypes + * \ingroup rpmesh * \struct RpBuildMesh * This type represents a mesh ready for tri stripping. * @@ -640,7 +547,7 @@ struct RpBuildMesh typedef struct RpMesh RpMesh; /** - * \ingroup rpworlddatatypes + * \ingroup rpmesh * \struct RpMesh * This type represents a single polygon mesh. * A mesh is defined as a collection of triangles derived from an RpGeometry @@ -659,7 +566,7 @@ struct RpMesh }; /** - * \ingroup rpworlddatatypes + * \ingroup rpmesh * \struct RpMeshHeader * Header for all meshes that constitute a single RpGeometry or RpWorldSector */ @@ -679,9 +586,8 @@ struct RpMeshHeader }; /** - * \ingroup rpworlddatatypes - * \typedef RpMeshCallBack - * \ref RpMeshCallBack is the callback + * \ingroup rpmesh + * \ref RpMeshCallBack is the callback * function supplied to \ref RpGeometryForAllMeshes and * \ref RpWorldSectorForAllMeshes for all meshes in a given geometry. * @@ -689,14 +595,13 @@ struct RpMeshHeader * success. The callback may return NULL to terminate further callbacks * on the meshes. * - * \param mesh Pointer to the current mesh, supplied by - * iterator. - * \param meshHeader Pointer to the meshes header - * \param data Pointer to developer-defined data structure. + * \param mesh Pointer to the current mesh, supplied by + * iterator. + * \param meshHeader Pointer to the meshes header + * \param data Pointer to developer-defined data structure. * - * \return - * Returns a pointer to the current mesh if successful or NULL if an error - * occurred. + * \return Returns a pointer to the current mesh if successful or NULL + * if an error occurred. */ typedef RpMesh *(*RpMeshCallBack) (RpMesh * mesh, RpMeshHeader * meshHeader, @@ -823,29 +728,29 @@ extern RpMeshHeader * _rpMeshHeaderCreate(RwUInt32 size); naTmp[1] = RwRealToFixed((v).y); \ naTmp[2] = RwRealToFixed((v).z); \ \ - if (naTmp[0] >= RwFixedCast(1)) \ + if (naTmp[0] >= RwIntToFixed(1)) \ { \ - naTmp[0] = RwFixedCast(1)-1; \ + naTmp[0] = RwIntToFixed(1)-1; \ } \ - if (naTmp[0] <= RwFixedCast(-1)) \ + if (naTmp[0] <= RwIntToFixed(-1)) \ { \ - naTmp[0] = RwFixedCast(-1)+1; \ + naTmp[0] = RwIntToFixed(-1)+1; \ } \ - if (naTmp[1] >= RwFixedCast(1)) \ + if (naTmp[1] >= RwIntToFixed(1)) \ { \ - naTmp[1] = RwFixedCast(1)-1; \ + naTmp[1] = RwIntToFixed(1)-1; \ } \ - if (naTmp[1] <= RwFixedCast(-1)) \ + if (naTmp[1] <= RwIntToFixed(-1)) \ { \ - naTmp[1] = RwFixedCast(-1)+1; \ + naTmp[1] = RwIntToFixed(-1)+1; \ } \ - if (naTmp[2] >= RwFixedCast(1)) \ + if (naTmp[2] >= RwIntToFixed(1)) \ { \ - naTmp[2] = RwFixedCast(1)-1; \ + naTmp[2] = RwIntToFixed(1)-1; \ } \ - if (naTmp[2] <= RwFixedCast(-1)) \ + if (naTmp[2] <= RwIntToFixed(-1)) \ { \ - naTmp[2] = RwFixedCast(-1)+1; \ + naTmp[2] = RwIntToFixed(-1)+1; \ } \ \ (n).x = (RwInt8)(naTmp[0]>>9); \ @@ -853,37 +758,13 @@ extern RpMeshHeader * _rpMeshHeaderCreate(RwUInt32 size); (n).z = (RwInt8)(naTmp[2]>>9); \ } -/* RpCollSector access macros - for pre v304 data */ -#define RWCOLLSECTORGETTYPE(sect) \ - ((sect).cType&0x80) - -#define RWCOLLSECTORGETPLANE(sect) \ - ((((sect).cType)>>3)&0xc) - -#define RWCOLLSECTORGETON(sect) \ - (((sect).cType)&0x1f) - -#define RWCOLLSECTORGETVERTEX(sect) \ - (sect).vertex - -#define RWCOLLSECTORGETSTART(sect) \ - (sect).start - -#define RWCOLLSECTORGETNOPOLYS(sect) \ - (sect).cType - -#define RWCOLLSECTORSETPOLYGONS(sect,no,st) \ - (sect).cType = (RwUInt8)(no); \ - (sect).start = (RwUInt8)(st) - -#define rwMAXCOLLISIONCUTS 7 - /**************************************************************************** Global types */ typedef struct RpVertexNormal RpVertexNormal; +#if (!defined(DOXYGEN)) struct RpVertexNormal { RwInt8 x; @@ -899,28 +780,11 @@ struct RpPolygon RwUInt16 matIndex; RwUInt16 vertIndex[3]; }; - -/* RpCollSector - for pre v304 data */ -#define RWCOLLSECTORSETPLANE(sect,plane,vert,no,st) \ - (sect).cType = (RwUInt8)(0x80|((plane)<<3)|(no)); \ - (sect).vertex = (RwUInt8)(vert); \ - (sect).start = (RwUInt8)(st) - -typedef struct RpCollSector RpCollSector; - -struct RpCollSector -{ - RwUInt8 cType; /* Bit 7 - 1 plane */ - /* 0 polygons */ - /* Bit 6-5 - plane */ - /* Bit 4-0 - amount ON plane */ - RwUInt8 vertex; /* Vertex index used for the split */ - RwUInt8 start; /* Starting polygon */ -}; +#endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpWorldSector + * \ingroup rpworldsector + * \struct RpWorldSector * World Sector object. This should be * considered an opaque type. Use the RpWorldSector API functions to access. */ @@ -958,9 +822,6 @@ struct RpWorldSector /* Bounding box tightly enclosing geometry */ RwBBox tightBoundingBox; - /* The root of the bsp collision tree for pre v304 data */ - RpCollSector *colSectorRoot; - /* The mesh which groups same material polygons together */ RpMeshHeader *mesh; @@ -981,9 +842,8 @@ struct RpWorldSector #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpWorldSectorCallBack - \ref RpWorldSectorCallBack + * \ingroup rpworldsector + * \ref RpWorldSectorCallBack * represents the function called from \ref RpWorldForAllWorldSectors, * \ref RpAtomicForAllWorldSectors and \ref RpLightForAllWorldSectors for all * world sectors in a given world or world sectors a given atomic or light lies @@ -991,15 +851,17 @@ struct RpWorldSector * indicate success. The callback may return NULL to terminate further * callbacks on the atomic or light. * + * \param sector Pointer to the current world sector + * \param data Pointer to developer-defined data structure. + * * \return Pointer to the current world sector. * - * \param sector Pointer to the current world sector - * \param data Pointer to developer-defined data structure. */ typedef RpWorldSector *(*RpWorldSectorCallBack)(RpWorldSector *worldSector, void *data); typedef struct RpSector RpSector; +#if (!defined(DOXYGEN)) struct RpSector { RwInt32 type; @@ -1022,7 +884,7 @@ struct RpPlaneSector RwReal leftValue; RwReal rightValue; }; - +#endif /* (!defined(DOXYGEN)) */ #ifdef __cplusplus extern "C" @@ -1101,15 +963,16 @@ extern RwBool RpWorldSectorValidatePlugins(const RpWorldSector *sector); Defines */ +#define RPTRISTRIPPOLYGONMAXEDGES 3 + /** - * \ingroup rpworlddatatypes - * \typedef RpTriStripMeshCallBack + * \ingroup rpmesh * \ref RpTriStripMeshCallBack is the callback to generate triangle strips * when the triangle stripped geometries or world sectors are unlocked. * * \param buildMesh pointer to the mesh which the triangle strip will be - * generated from. - * \param data pointer to user-supplied data to pass to the callback + * generated from. + * \param data pointer to user-supplied data to pass to the callback * function. * * \return a pointer to the constructed mesh header. @@ -1119,10 +982,156 @@ typedef RpMeshHeader * (*RpTriStripMeshCallBack) (RpBuildMesh *buildMesh, void *data); + /**************************************************************************** Global types */ +typedef struct RpTriStripEdge RpTriStripEdge; + +typedef struct RpTriStripPolygon RpTriStripPolygon; +/** + * \ingroup rpmesh + * \struct RpTriStripPolygon + * This type represents a polygon. + * + * \see RpTriStripPolygonFollowStrip + * \see RpBuildMeshGenerateTriStrip + * \see RpTriStripMeshTunnel + */ +struct RpTriStripPolygon +{ + RwLLLink inEndLink; /**< link for list of polygons joined by fewer than + 2 strip edges */ + RwLLLink inUsedLink; /**< link for list of used polygons */ + RwLLLink inFreeLink; /**< link for list of free polygons */ + RwUInt32 numEdges; /**< number of edges */ + RpTriStripEdge *edges[RPTRISTRIPPOLYGONMAXEDGES]; /**< polygon edges */ + RxVertexIndex vertIndex[RPTRISTRIPPOLYGONMAXEDGES]; /**< polygon vertex + indices */ + RwUInt32 testFrame; /**< used to prevent a tri-strip being counted by + the cost function more than once */ +}; + +/** + * \ingroup rpmesh + * \struct RpTriStripEdge + * This type represents a polygon edge which may be part of a tri-strip. + * + * \see RpTriStripPolygonFollowStrip + * \see RpBuildMeshGenerateTriStrip + * \see RpTriStripMeshTunnel + */ +struct RpTriStripEdge +{ + RwLLLink inUsedLink; /**< link for list of used edges */ + RwLLLink inFreeLink; /**< link for list of free edges */ + RpTriStripPolygon *poly1; /**< first polygon including this edge */ + RpTriStripPolygon *poly2; /**< second polygon including this edge or NULL + if this edge is only included in one */ + RxVertexIndex vert1; /**< index of first vertex of edge */ + RxVertexIndex vert2; /**< index of second vertex of edge */ + RwBool strip; /**< TRUE if the edge is part of a tri-strip */ +}; + +typedef struct RpTriStripMesh RpTriStripMesh; +/** + * \ingroup rpmesh + * \struct RpTriStripMesh + * This type represents a mesh and the tri-strips it contains. + * + * \see RpBuildMeshGenerateTriStrip + * \see RpTriStripMeshTunnel + */ +struct RpTriStripMesh +{ + RwUInt32 numPolygons; /**< the number of polygons in the mesh */ + RwLinkList polygonEndList; /**< linked list of polygons joined by fewer + than 2 strip edges. */ + RwLinkList polygonUsedList; /**< linked list of used polygons */ + RwLinkList polygonFreeList; /**< linked list of free polygons */ + RwLinkList edgeUsedList; /**< linked list of used edges */ + RwLinkList edgeFreeList; /**< linked list of free edges */ +}; + +/** + * \ingroup rpmesh + * \ref RpTriStripMeshStripCallBack represents the callback function to + * tri-strip a mesh. + * + * \param mesh Pointer to the mesh to tri-strip. + * \param data Pointer to user-supplied data. + * + * \return Returns a pointer to the current mesh if successful or NULL if an + * error occurred. + */ +typedef RpTriStripMesh * +(*RpTriStripMeshStripCallBack) (RpTriStripMesh *mesh, void *data); + +typedef struct RpTriStripData RpTriStripData; +/** + * \ingroup rpmesh + * \struct RpTriStripData + * This type represents the data required by the + * \ref RpBuildMeshGenerateTriStrip function to tri-strip a mesh. This data must + * be the user-supplied data passed into RpMeshSetTriStripMethod when using + * \ref RpBuildMeshGenerateTriStrip. + * + * \see RpMeshGetTriStripMethod + * \see RpMeshSetTriStripMethod + * \see RpBuildMeshGenerateTriStrip + * \see RpTriStripMeshTunnel + */ +struct RpTriStripData +{ + RwBool ignoreWinding; /**< TRUE to ignore winding order */ + RpTriStripMeshStripCallBack stripCB; /**< callback to tri-strip mesh */ + void *data; /**< data to supply to callback */ +}; + +/** + * \ingroup rpmesh + * \ref RpTriStripCostCallBack represents the callback function used by the + * tunnelling tri-stripper to determine the cost of a tri-strip. + * + * \param startPolygon Pointer to polygon at the start of the tri-strip. + * \param testFrame Value that must be written to the testFrame of all + * polygons in the tri-strip + * \param data Pointer to user-supplied data. + * + * \return Returns the cost of the tri-strip. + */ +typedef RwUInt32 +(*RpTriStripCostCallBack) (RpTriStripPolygon *startPolygon, RwUInt32 testFrame, void *data); + +typedef struct RpTriStripTunnelData RpTriStripTunnelData; +/** + * \ingroup rpmesh + * \struct RpTriStripTunnelData + * This type represents the data required by the + * \ref RpTriStripMeshTunnel function to tri-strip a mesh. This data must + * be the user-supplied data in the RpTriStripData structure passed into + * \ref RpMeshSetTriStripMethod as the user-supplied data when using + * \ref RpTriStripMeshTunnel. + * + * \see RpMeshGetTriStripMethod + * \see RpMeshSetTriStripMethod + * \see RpBuildMeshGenerateTriStrip + * \see RpTriStripMeshTunnel + * \see RpTriStripDefaultCost + */ +struct RpTriStripTunnelData +{ + RwReal quality; /**< the higher the value the better the + output but the longer it will take; + values greater than 1 are unlikely to + be useful */ + RwUInt32 lengthLimit; /**< the maximum tunnel length to use */ + RpTriStripCostCallBack costCB; /**< callback to determine tri-strip cost */ + void *data; /**< data to supply to callbacks */ +}; + + /**************************************************************************** Global Variables @@ -1138,8 +1147,27 @@ extern "C" { #endif /* __cplusplus */ +/* Tri-strip manipulating functions */ +extern RpTriStripPolygon * +RpTriStripPolygonFollowStrip(RpTriStripPolygon *curr, RpTriStripPolygon *prev); + +/* Callback strip costing functions */ +extern RwUInt32 +RpTriStripDefaultCost(RpTriStripPolygon *startPolygon, RwUInt32 testFrame, + void *data); + +/* Callback mesh stripping functions */ +extern RpTriStripMesh * +RpTriStripMeshTunnel(RpTriStripMesh *mesh, void *data); -/* Callback mesh generating functions */ +extern RpTriStripMesh * +RpTriStripMeshQuick(RpTriStripMesh *mesh, void *data); + +/* New callback mesh generating function */ +extern RpMeshHeader * +RpBuildMeshGenerateTriStrip(RpBuildMesh *buildMesh, void *data); + +/* Old callback mesh generating functions. Probably obsolete */ extern RpMeshHeader * RpBuildMeshGenerateTrivialTriStrip(RpBuildMesh *buildMesh, void *data); @@ -1164,7 +1192,7 @@ extern RpMeshHeader * RpBuildMeshGenerateExhaustiveIgnoreWindingTriStrip(RpBuildMesh *buildmesh, void *data); -/* Functions to set and get the global mesh tristrip algorithm */ +/* Functions to set and get the global mesh tri-strip algorithm */ extern RwBool RpMeshSetTriStripMethod(RpTriStripMeshCallBack callback, void *data); @@ -1225,6 +1253,7 @@ _rpMeshOptimise(RpBuildMesh *buildmesh, RwUInt32 flags); typedef struct RpLightChunkInfo RpLightChunkInfo; typedef struct RpLightChunkInfo _rpLight; +#if (!defined(DOXYGEN)) struct RpLightChunkInfo { RwReal radius; /**< radius */ @@ -1234,6 +1263,7 @@ struct RpLightChunkInfo RwReal minusCosAngle; /**< minusCosAngle */ RwUInt32 typeAndFlags; /**< typeAndFlags */ }; +#endif /* (!defined(DOXYGEN)) */ /* Type ID */ #define rpLIGHT 3 @@ -1242,7 +1272,7 @@ struct RpLightChunkInfo #define rpLIGHTPOSITIONINGSTART 0x80 /** - * \ingroup rpworlddatatypes + * \ingroup rplight * \ref RpLightType are * light sub types. This type represents the different * types of light source that can be created using the API function \ref RpLightCreate. @@ -1265,12 +1295,17 @@ enum RpLightType typedef enum RpLightType RpLightType; #define rpLIGHTMINCONEANGLE ((RwReal)0.0f) -#if ((defined(XBOX_DRVMODEL_H)) || (defined(OPENGL_DRVMODEL_H)) || (defined(GCN_DRVMODEL_H))) -/* XBox has Micro$oft-penned drivers, no wonder it crashes... */ -/* OpenGL and GCN clamp to 90 internally, so we mirror that behaviour */ -#define rpLIGHTMAXCONEANGLE ((RwReal)89.9999f) + +#if (defined(XBOX_DRVMODEL_H)) +#define rpLIGHTMAXCONEANGLE (rwPIOVER2) +#elif (defined(OPENGL_DRVMODEL_H)) +#define rpLIGHTMAXCONEANGLE (rwPIOVER2) +#elif (defined(GCN_DRVMODEL_H)) +#define rpLIGHTMAXCONEANGLE (rwPIOVER2) +#elif (defined(D3D8_DRVMODEL_H)) +#define rpLIGHTMAXCONEANGLE (rwPIOVER2) #else -#define rpLIGHTMAXCONEANGLE ((RwReal)180.0f) +#define rpLIGHTMAXCONEANGLE (rwPI) #endif /*************/ @@ -1280,7 +1315,7 @@ typedef enum RpLightType RpLightType; /*************/ /** - * \ingroup rpworlddatatypes + * \ingroup rplight * \ref RpLightFlag defines what geometry is influenced by the light. * The bit-field RpLightFlag specifies the options available for controlling the scope * of a light source (see API function \ref RpLightSetFlags):*/ @@ -1327,10 +1362,10 @@ MACRO_STOP /** - * \ingroup rpworlddatatypes - * \typedef RpLight - * Light. This should be - * considered an opaque type. User the RpLight API functions to access. + * \ingroup rplight + * \struct RpLight + * Light object. This should be + * considered an opaque type. Use the RpLight API functions to access. */ typedef struct RpLight RpLight; @@ -1349,8 +1384,7 @@ struct RpLight #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpLightCallBack + * \ingroup rplight * \ref RpLightCallBack * represents the function called from \ref RpWorldForAllLights and * \ref RpWorld SectorForAllLights for all lights in a given world or world @@ -1358,25 +1392,34 @@ struct RpLight * indicate success. The callback may return NULL to terminate further * callbacks on the world sector. * + * \param light Pointer to the current light in the world + * sector. + * \param data Pointer to developer-defined data structure. + * * \return Pointer to the current light. - * - * \param light Pointer to the current light in the world - * sector. - * \param data Pointer to developer-defined data structure. */ typedef RpLight *(*RpLightCallBack) (RpLight * light, void *data); typedef struct RpLightTie RpLightTie; +/** + * \ingroup rplight + * \struct RpLightTie + * + * RpLightTie is a linked list of lights inside world sectors. These are + * created when frame hierarchies are updated as part of an \ref RwCameraBeginUpdate. + * This is used for determining which lights influence a world sector and the atomics inside it. + * Creation and destruction of RpLightTies is internal to the world plugin. + */ struct RpLightTie { /* Information for an atomic sector */ - RwLLLink lightInWorldSector; /* Lights IN this ATOMIC SECTOR */ - RpLight *light; + RwLLLink lightInWorldSector; /**< Lights IN this ATOMIC SECTOR */ + RpLight *light; /**< A pointer to a light */ /* Information for a atomic */ - RwLLLink WorldSectorInLight; /* Atomic sectors HOLDING this Light */ - RpWorldSector *sect; + RwLLLink WorldSectorInLight; /**< Atomic sectors HOLDING this Light */ + RpWorldSector *sect; /**< A pointer to a world sector */ }; @@ -1453,6 +1496,7 @@ extern RwUInt32 RpLightGetFlags(const RpLight *light); #endif /* (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ /* API Functions */ +extern void RpLightSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); extern RpLight *RpLightCreate(RwInt32 type); extern RwBool RpLightDestroy(RpLight *light); extern RpLight *RpLightSetRadius(RpLight *light, RwReal radius); @@ -1491,9 +1535,7 @@ extern RwBool RpLightValidatePlugins(const RpLight * light); /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/d3d8/D3D8lights.h ---*/ -/** - * \ingroup rplightd3d8 - * \typedef RpD3D8AttenuationParams +/* * typedef for struct RpD3D8AttenuationParams */ typedef struct RpD3D8AttenuationParams RpD3D8AttenuationParams; @@ -1546,21 +1588,6 @@ _rwD3D8LightsClose(void); #endif /* __cplusplus */ -/*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/p2stdclsw.h ---*/ -typedef RpLight *RxLight; -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxClusterDefinition RxClLights; /* Uses the RxLight type (see above) */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - - /*--- Automatically derived from: c:/daily/rwsdk/world/bageomet.h ---*/ /* @@ -1579,7 +1606,7 @@ extern RxClusterDefinition RxClLights; /* Uses the RxLight type (see above) */ #define rpGEOMETRY 8 /** - * \ingroup rpworlddatatypes + * \ingroup rpgeometry * RpGeometryFlag * Geometry type flags * @@ -1630,7 +1657,7 @@ typedef enum RpGeometryFlag RpGeometryFlag; #define rpGEOMETRYTEXCOORDSETS(_num) ((_num & 0xff) << 16) /** - * \ingroup rpworlddatatypes + * \ingroup rpgeometry * RpGeometryLockMode * Geometry lock flags */ @@ -1665,22 +1692,25 @@ typedef enum RpGeometryLockMode RpGeometryLockMode; */ typedef struct rpGeometryGlobals rpGeometryGlobals; + +#if (!defined(DOXYGEN)) struct rpGeometryGlobals { RwFreeList *geomFreeList; }; +#endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpGeometry + * \ingroup rpgeometry + * \struct RpGeometry * Geometry object. This should be considered an opaque type. * Use the RpGeometry API functions to access. */ typedef struct RpGeometry RpGeometry; /** - * \ingroup rpworlddatatypes - * \typedef RpMorphTarget + * \ingroup rpmorphtarget + * \struct RpMorphTarget * Morph target -- vertex positions and normals. * This should be considered an opaque type. * Use RpMorphTarget API functions to access. @@ -1700,7 +1730,7 @@ struct RpMorphTarget typedef struct RpTriangle RpTriangle; /** - * \ingroup rpworlddatatypes + * \ingroup rpgeometry * \struct RpTriangle * This type represents a triangle in a geometry specified * by three indices into the geometry's vertex list (vertIndex) @@ -1736,18 +1766,12 @@ struct RpGeometry RwTexCoords *texCoords[rwMAXTEXTURECOORDS]; /* Texture coordinates */ - RwSurfaceProperties ignoredSurfaceProps; /* Not used in pp rendering, but present - * so if pipe1 files are read and written these - * values are not lost - */ - RpMeshHeader *mesh; /* The mesh - groups polys of the same material */ RwResEntry *repEntry; /* Information for an instance */ RpMorphTarget *morphTarget; /* The Morph Target */ }; -#endif /* (!defined(DOXYGEN)) */ typedef struct RpGeometryChunkInfo RpGeometryChunkInfo; typedef struct RpGeometryChunkInfo _rpGeometry; @@ -1760,27 +1784,27 @@ struct RpGeometryChunkInfo RwInt32 numVertices; RwInt32 numMorphTargets; - - RwSurfaceProperties ignoredSurfaceProps; }; +#endif /* (!defined(DOXYGEN)) */ /* Callbacks */ /** - * \ingroup rpworlddatatypes - * \typedef RpGeometryCallBack + * \ingroup rpgeometry * \ref RpGeometryCallBack represents the simple callback function for the \ref RpGeometry object. * The callback may return NULL to terminate further callbacks on * the geometry. * * \param geometry Pointer to the current geometry, supplied by iterator. - * \param data Pointer to developer-defined data structure. + * \param data Pointer to developer-defined data structure. + * + * \return */ typedef RpGeometry *(*RpGeometryCallBack)(RpGeometry *geometry, void *data); /** - * \ingroup rpworlddatatypes - * \typedef RpGeometrySortByMaterialCallBack + * \ingroup rpgeometry + * \ref RpGeometrySortByMaterialCallBack * \ref RpGeometrySortByMaterialCallBack is used by * \ref RpGeometrySortByMaterial in order to preserve the validity of plugin * data when the vertices in an \ref RpGeometry are sorted (and some possibly @@ -1790,11 +1814,11 @@ typedef RpGeometry *(*RpGeometryCallBack)(RpGeometry *geometry, void *data); * vertex in the new geometry, the index of the corresponding vertex in the * original geometry. * - * \param oldGeom Pointer to the source geometry. - * \param newGeom Pointer to the new, sorted geometry. - * \param remapTable pointer to the vertex map table + * \param oldGeom Pointer to the source geometry. + * \param newGeom Pointer to the new, sorted geometry. + * \param remapTable Pointer to the vertex map table * \param numberOfEntries Number of vertices in the new - * geometry (size of the map table) + * geometry (size of the map table) */ typedef void (*RpGeometrySortByMaterialCallBack)(const RpGeometry *oldGeom, RpGeometry *newGeom, @@ -2106,25 +2130,10 @@ RpGeometrySetFlags(RpGeometry *geometry, #endif -/* Lighting characteristics */ - -extern const RwSurfaceProperties * -_rpGeometryGetSurfaceProperties(const RpGeometry *geometry); - -extern RpGeometry * -_rpGeometrySetSurfaceProperties(RpGeometry *geometry, - const RwSurfaceProperties *surfaceProperties); - #ifdef __cplusplus } #endif /* __cplusplus */ -#define RpGeometryGetSurfaceProperties(_geometry) \ - _rpGeometryGetSurfaceProperties(_geometry) - -#define RpGeometrySetSurfaceProperties(_geometry, _surfaceProperties) \ - _rpGeometrySetSurfaceProperties(_geometry, _surfaceProperties) - #define rpGeometryAddRef(_geometry) \ _rpGeometryAddRef(_geometry) @@ -2164,7 +2173,7 @@ enum RpInterpolatorFlag typedef enum RpInterpolatorFlag rpInterpolatorFlag; /** - * \ingroup rpworlddatatypes + * \ingroup rpatomic * The bit-field type RpAtomicFlag specifies the options available for * controlling the behavior of atomics. See API function \ref RpAtomicSetFlags. * @@ -2188,7 +2197,7 @@ enum RpAtomicFlag typedef enum RpAtomicFlag RpAtomicFlag; /** - * \ingroup rpworlddatatypes + * \ingroup rpatomic * \ref RpAtomicSetGeomFlag defines how an atomic references a new geometry * * \see RpAtomicSetGeometry @@ -2214,16 +2223,16 @@ typedef enum RpAtomicPrivateFlag rpAtomicPrivateFlag; /** - * \ingroup rpworlddatatypes - * \typedef RpAtomic + * \ingroup rpatomic + * \struct RpAtomic * Atomic Geometry object. This should be * considered an opaque type. Use the RpAtomic API functions to access. */ typedef struct RpAtomic RpAtomic; /** - * \ingroup rpworlddatatypes - * \typedef RpInterpolator + * \ingroup rpinterpolator + * \struct RpInterpolator * Morph Target Interpolator. * This should be considered an opaque type. * Use the RpInterpolator API functions to access. @@ -2245,16 +2254,15 @@ struct RpInterpolator /* More callbacks */ /** - * \ingroup rpworlddatatypes - * \typedef RpClump + * \ingroup rpclump + * \struct RpClump * Clump Geometry object. This should be * considered an opaque type. Use the RpClump API functions to access. */ typedef struct RpClump RpClump; /** - * \ingroup rpworlddatatypes - * \typedef RpClumpCallBack + * \ingroup rpclump * \ref RpClumpCallBack represents the * function called from \ref RwCameraForAllClumpsInFrustum and * \ref RwCameraForAllClumpsNotInFrustum when a clump lies inside the current camera's @@ -2263,8 +2271,8 @@ typedef struct RpClump RpClump; * NULL to terminate further callbacks on the clumps. * * \param clump Pointer to the current clump, supplied by - * iterator. - * \param data Pointer to developer-defined data structure. + * iterator. + * \param data Pointer to developer-defined data structure. * * \return Pointer to the current clump. * @@ -2303,8 +2311,7 @@ struct RpClump #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpAtomicCallBackRender + * \ingroup rpatomic * \ref RpAtomicCallBackRender represents the function called from * \ref RpAtomicRender when the specified atomic * lies inside the current camera's view frustum. The default callback @@ -2312,10 +2319,13 @@ struct RpClump * return a pointer to the atomic to indicate success. * * \param atomic Pointer to the current atomic, supplied by - * iterator. + * iterator. + * + * \return Returns a pointer to the atomic to indicate success. * * \see RpAtomicRender */ + typedef RpAtomic *(*RpAtomicCallBackRender) (RpAtomic * atomic); #if (!defined(DOXYGEN)) @@ -2356,8 +2366,7 @@ struct RpAtomic #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rpworlddatatypes - * \typedef RpAtomicCallBack + * \ingroup rpatomic * \ref RpAtomicCallBack represents the function called from \ref RpWorldSectorForAllAtomics and * \ref RpClumpForAllAtomics for all atomics in a given world sector or clump. * This function should return a pointer to the current atomic to indicate @@ -2365,28 +2374,40 @@ struct RpAtomic * the world sector. * * \param atomic Pointer to the current atomic, supplied by - * iterator. - * \param data Pointer to developer-defined data structure. + * iterator. + * \param data Pointer to developer-defined data structure. + * + * \return Returns a pointer to the current atomic */ typedef RpAtomic *(*RpAtomicCallBack) (RpAtomic * atomic, void *data); typedef struct RpTie RpTie; +/** + * \ingroup rpatomic + * \struct RpTie + * + * RpTie is a linked list of atomics inside world sectors. These are + * created when frame hierarchies are updated as part of an \ref RwCameraBeginUpdate. + * This is used for frustum culling atomics by world sector. + * Creation and destruction of RpTies is internal to the world plugin. + */ struct RpTie { /* Information for an atomic sector */ - RwLLLink lAtomicInWorldSector; /* Atomics IN this ATOMIC SECTOR */ - RpAtomic *apAtom; + RwLLLink lAtomicInWorldSector; /**< Atomics IN this ATOMIC SECTOR */ + RpAtomic *apAtom; /**< An atomic */ /* Information for a atomic */ - RwLLLink lWorldSectorInAtomic; /* Atomic sectors HOLDING this atomic */ - RpWorldSector *worldSector; + RwLLLink lWorldSectorInAtomic; /**< Atomic sectors HOLDING this atomic */ + RpWorldSector *worldSector; /**< A world sector */ }; typedef struct RpClumpChunkInfo RpClumpChunkInfo; typedef struct RpClumpChunkInfo _rpClump; typedef struct RpClumpChunkInfo33000 _rpClump33000; +#if (!defined(DOXYGEN)) struct RpClumpChunkInfo { RwInt32 numAtomics; @@ -2398,6 +2419,7 @@ struct RpClumpChunkInfo33000 { RwInt32 numAtomics; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** <macro/inline functionality @@ -2608,6 +2630,12 @@ extern "C" #endif /* __cplusplus */ +extern void +RpAtomicSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void +RpClumpSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + /* Macro version of RpAtomicSetRenderCallBack needs this */ extern RpAtomic * AtomicDefaultRenderCallBack(RpAtomic * atomic); @@ -2918,7 +2946,7 @@ enum RpWorldPrivateFlag typedef enum RpWorldPrivateFlag RpWorldPrivateFlag; /** - * \ingroup rpworlddatatypes + * \ingroup rpworldsub * The bit-field type \ref RpWorldFlag specifies the options available * for creating the static geometry component of a world (see API function \ref RpWorldSetFlags): */ @@ -3027,7 +3055,7 @@ typedef enum RpWorldFlag RpWorldFlag; /** - * \ingroup rpworlddatatypes + * \ingroup rpworldsub * \ref RpWorldRenderOrder * represents the options available for * the rendering order of world sectors in the camera's view frustum (see @@ -3043,25 +3071,25 @@ enum RpWorldRenderOrder typedef enum RpWorldRenderOrder RpWorldRenderOrder; /** - * \ingroup rpworlddatatypes - * \typedef RpWorldSectorCallBackRender + * \ingroup rpworldsector * \ref RpWorldSectorCallBackRender represents the function called from * \ref RpWorldSectorRender when the specified world sector lies inside the * current camera's view frustum. The default callback initiates execution of * the world sector rendering pipeline. This function should return a pointer * to the world sector to indicate success * + * \param worldSector Pointer to the world sector to be + * rendered + * * \return Pointer to the world sector. * - * \param worldSector Pointer to the world sector to be - * rendered */ typedef RpWorldSector *(*RpWorldSectorCallBackRender) (RpWorldSector * worldSector); /** - * \ingroup rpworlddatatypes - * \typedef RpWorld + * \ingroup rpworldsub + * \struct RpWorld * World object. This should be considered an opaque type. * Use the RpWorld API functions to access. */ @@ -3104,9 +3132,6 @@ struct RpWorld /* Bounding box around the whole world */ RwBBox boundingBox; - /* Surface properties */ - RwSurfaceProperties surfaceProps; - /* The callbacks functions */ RpWorldSectorCallBackRender renderCallBack; @@ -3191,13 +3216,6 @@ extern RwBool RpWorldDestroy(RpWorld * world); extern RpWorld *RpWorldCreate(RwBBox * boundingBox); extern RwBool RpWorldInstance(RpWorld *world); -/* Getting/setting */ -extern RpWorld *_rpWorldSetSurfaceProperties(RpWorld * world, - const RwSurfaceProperties - * surface); -extern const RwSurfaceProperties * - _rpWorldGetSurfaceProperties(const RpWorld *world); - /* Sector callbacks */ extern RpWorld *RpWorldSetSectorRenderCallBack(RpWorld * world, RpWorldSectorCallBackRender @@ -3260,12 +3278,6 @@ extern RwUInt32 RpWorldGetFlags(const RpWorld *world); } #endif /* __cplusplus */ -#define RpWorldSetSurfaceProperties(_world, _surface) \ - _rpWorldSetSurfaceProperties(_world, _surface) - -#define RpWorldGetSurfaceProperties(_world) \ - _rpWorldGetSurfaceProperties(_world) - #define rpWorldFindBBox(_world, _boundingBox) \ _rpWorldFindBBox(_world, _boundingBox) @@ -3292,7 +3304,7 @@ extern RwUInt32 RpWorldGetFlags(const RpWorld *world); typedef struct RxD3D8ResEntryHeader RxD3D8ResEntryHeader; /** - * \ingroup rpworldd3d8 + * \ingroup worldextensionsd3d8 * \struct RxD3D8ResEntryHeader * This structure contains D3D8 resource specific components. */ @@ -3305,7 +3317,7 @@ struct RxD3D8ResEntryHeader /* This is what I keep in memory as part of the instance data setup */ typedef struct RxD3D8InstanceData RxD3D8InstanceData; /** - * \ingroup rpworldd3d8 + * \ingroup worldextensionsd3d8 * \struct RxD3D8InstanceData * This structure contains D3D8 resource specific components. */ @@ -3337,7 +3349,7 @@ struct RxD3D8InstanceData }; /** - * \ingroup rpworldd3d8 + * \ingroup worldextensionsd3d8 * \ref RxD3D8AllInOneInstanceCallBack callback function. * * \param object Pointer to the object. @@ -3354,7 +3366,7 @@ typedef RwBool (*RxD3D8AllInOneInstanceCallBack)(void *object, RwBool reinstance); /** - * \ingroup rpworldd3d8 + * \ingroup worldextensionsd3d8 * \ref RxD3D8AllInOneReinstanceCallBack callback function. * * \param object Pointer to the object. @@ -3373,7 +3385,7 @@ typedef RwBool (*RxD3D8AllInOneReinstanceCallBack)(void *object, RxD3D8AllInOneInstanceCallBack instanceCallback); /** - * \ingroup rpworldd3d8 + * \ingroup worldextensionsd3d8 * \ref RxD3D8AllInOneLightingCallBack callback function. * * \param object Void pointer to the object. @@ -3386,7 +3398,7 @@ typedef RwBool (*RxD3D8AllInOneReinstanceCallBack)(void *object, typedef void (*RxD3D8AllInOneLightingCallBack)(void *object); /** - * \ingroup rpworldd3d8 + * \ingroup worldextensionsd3d8 * \ref RxD3D8AllInOneRenderCallBack callback function. * * \param repEntry Pointer to a resource entry. @@ -3443,9 +3455,6 @@ RxD3D8AllInOneGetRenderCallBack(RxPipelineNode *node); /*--- Automatically derived from: C:/daily/rwsdk/world/pipe/p2/bapipew.h ---*/ -#define RpWorldGetGenericSectorPipelineMacro() \ - (RXPIPELINEGLOBAL(genericWorldSectorPipeline)) - #define RpWorldGetDefaultSectorPipelineMacro() \ (RXPIPELINEGLOBAL(currentWorldSectorPipeline)) @@ -3461,9 +3470,6 @@ RxD3D8AllInOneGetRenderCallBack(RxPipelineNode *node); #define RpWorldSectorGetPipelineMacro(_sector, _pipeline) \ ( (*(_pipeline) = (_sector)->pipeline), _sector ) -#define RpAtomicGetGenericPipelineMacro() \ - (RXPIPELINEGLOBAL(genericAtomicPipeline)) - #define RpAtomicGetDefaultPipelineMacro() \ (RXPIPELINEGLOBAL(currentAtomicPipeline)) @@ -3473,9 +3479,6 @@ RxD3D8AllInOneGetRenderCallBack(RxPipelineNode *node); #define RpAtomicGetPipelineMacro(_atomic, _pipeline) \ ( (*(_pipeline) = (_atomic)->pipeline), _atomic ) -#define RpMaterialGetGenericPipelineMacro() \ - (RXPIPELINEGLOBAL(genericMaterialPipeline)) - #define RpMaterialGetDefaultPipelineMacro() \ (RXPIPELINEGLOBAL(currentMaterialPipeline)) @@ -3488,19 +3491,16 @@ RxD3D8AllInOneGetRenderCallBack(RxPipelineNode *node); #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) -#define RpWorldGetGenericSectorPipeline RpWorldGetGenericSectorPipelineMacro #define RpWorldGetDefaultSectorPipeline RpWorldGetDefaultSectorPipelineMacro #define RpWorldSetSectorPipeline RpWorldSetSectorPipelineMacro #define RpWorldGetSectorPipeline RpWorldGetSectorPipelineMacro #define RpWorldSectorSetPipeline RpWorldSectorSetPipelineMacro #define RpWorldSectorGetPipeline RpWorldSectorGetPipelineMacro -#define RpAtomicGetGenericPipeline RpAtomicGetGenericPipelineMacro #define RpAtomicGetDefaultPipeline RpAtomicGetDefaultPipelineMacro #define RpAtomicSetPipeline RpAtomicSetPipelineMacro #define RpAtomicGetPipeline RpAtomicGetPipelineMacro -#define RpMaterialGetGenericPipeline RpMaterialGetGenericPipelineMacro #define RpMaterialGetDefaultPipeline RpMaterialGetDefaultPipelineMacro #define RpMaterialSetPipeline RpMaterialSetPipelineMacro #define RpMaterialGetPipeline RpMaterialGetPipelineMacro @@ -3556,7 +3556,6 @@ extern RpGeometry *RpGeometrySortByMaterial(const RpGeometry * geometry, #endif /* __cplusplus */ /* LEGACY-SUPPORT macros */ -#define RpWorldGetGenericSectorInstancePipeline RpWorldGetGenericSectorPipeline #define RpWorldSetDefaultSectorInstancePipeline RpWorldSetDefaultSectorPipeline #define RpWorldGetDefaultSectorInstancePipeline RpWorldGetDefaultSectorPipeline #define RpWorldSetSectorInstancePipeline RpWorldSetSectorPipeline @@ -3564,13 +3563,11 @@ extern RpGeometry *RpGeometrySortByMaterial(const RpGeometry * geometry, #define RpWorldSectorSetInstancePipeline RpWorldSectorSetPipeline #define RpWorldSectorGetInstancePipeline RpWorldSectorGetPipeline -#define RpAtomicGetGenericInstancePipeline RpAtomicGetGenericPipeline #define RpAtomicGetDefaultInstancePipeline RpAtomicGetDefaultPipeline #define RpAtomicSetDefaultInstancePipeline RpAtomicSetDefaultPipeline #define RpAtomicSetInstancePipeline RpAtomicSetPipeline #define RpAtomicGetInstancePipeline RpAtomicGetPipeline -#define RpMaterialGetGenericRenderPipeline RpMaterialGetGenericPipeline #define RpMaterialSetDefaultRenderPipeline RpMaterialSetDefaultPipeline #define RpMaterialGetDefaultRenderPipeline RpMaterialGetDefaultPipeline #define RpMaterialSetRenderPipeline RpMaterialSetPipeline @@ -3587,6 +3584,9 @@ extern "C" { #endif /* __cplusplus */ +extern void RpTieSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); +extern void RpLightTieSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + /* Adding and removing cameras to/from the world */ extern RpWorld *RpWorldRemoveCamera(RpWorld *world, RwCamera *camera); extern RpWorld *RpWorldAddCamera(RpWorld *world, RwCamera *camera); @@ -3648,6 +3648,7 @@ extern RpWorldSector *RpWorldSectorForAllLights(RpWorldSector *sector, typedef struct RpWorldChunkInfoSector RpWorldSectorChunkInfo; typedef struct RpWorldChunkInfoSector _rpWorldSector; +#if (!defined(DOXYGEN)) struct RpWorldChunkInfoSector { RwInt32 matListWindowBase; @@ -3655,10 +3656,11 @@ struct RpWorldChunkInfoSector RwInt32 numVertices; RwV3d inf; RwV3d sup; - RwBool collSectorPresent; + RwBool collSectorPresent; /* unused but retains same struct size */ RwBool unused; }; + typedef struct RpPlaneSectorChunkInfo RpPlaneSectorChunkInfo; typedef struct RpPlaneSectorChunkInfo _rpPlaneSector; @@ -3681,6 +3683,26 @@ struct RpWorldChunkInfo RwV3d invWorldOrigin; + RwInt32 numPolygons; + RwInt32 numVertices; + RwInt32 numPlaneSectors; + RwInt32 numWorldSectors; + RwInt32 colSectorSize; + + RwInt32 format; /* Flags about the world */ + + /* Added in 34003 */ + RwBBox boundingBox; +}; + +typedef struct rpWorldChunkInfo34000 rpWorldChunkInfo34000; + +struct rpWorldChunkInfo34000 +{ + RwBool rootIsWorldSector; + + RwV3d invWorldOrigin; + RwSurfaceProperties surfaceProps; RwInt32 numPolygons; @@ -3691,6 +3713,7 @@ struct RpWorldChunkInfo RwInt32 format; /* Flags about the world */ }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** Function prototypes diff --git a/rwsdk/include/d3d8/rt2d.h b/rwsdk/include/d3d8/rt2d.h index 5bf1faea..0584d3a5 100644 --- a/rwsdk/include/d3d8/rt2d.h +++ b/rwsdk/include/d3d8/rt2d.h @@ -17,7 +17,7 @@ /** * \defgroup rt2d Rt2d - * \ingroup rttool + * \ingroup 2dtools * * 2D Rendering Toolkit for RenderWare. */ @@ -117,6 +117,7 @@ Includes */ +#include "rpworld.h" #include "rt2d.rpe" /* automatically generated header file */ /**************************************************************************** @@ -132,6 +133,13 @@ #define Rt2dCTMReadMacro(_result) \ (RwMatrixCopy((_result), _rt2dCTMGet()), (_result)) +#if defined (GCN_DRVMODEL_H) + #define VERTEXCACHESIZE 64 +#else + #define VERTEXCACHESIZE 256 +#endif + + /**************************************************************************** Global Types */ @@ -152,16 +160,21 @@ typedef struct rt2dShadeParameters rt2dShadeParameters; * rt2dShadeParameters * describes Shade Parameters */ + +#if (!defined(DOXYGEN)) struct rt2dShadeParameters { RwRGBAReal col; /* col */ RwV2d uv; /* uv */ }; +#endif /* (!defined(DOXYGEN)) */ /** * \ingroup rt2ddatatypes - * \typedef Rt2dBrush - * typedef for a structure describing a Brush (opaque) + * \struct Rt2dBrush + * Brush object. + * This should be considered an opaque type. + * Use Rt2dBrush API functions to access. */ typedef struct Rt2dBrush Rt2dBrush; @@ -169,35 +182,37 @@ typedef struct Rt2dBrush Rt2dBrush; * Rt2dBrush * structure describing a Brush */ -#if defined (GCN_DRVMODEL_H) - #define VERTEXCACHESIZE 64 -#else - #define VERTEXCACHESIZE 256 -#endif - +#if (!defined(DOXYGEN)) struct Rt2dBrush { - RWIM3DVERTEX vertex[VERTEXCACHESIZE]; rt2dShadeParameters top; rt2dShadeParameters dtop; rt2dShadeParameters bottom; rt2dShadeParameters dbottom; - RwInt32 calcFields; + RwRGBA colorCache; + RwInt32 flag; RwTexture *texture; + RpMaterial *material; RwReal halfwidth; + RwInt32 refCount; }; +#endif /* (!defined(DOXYGEN)) */ /** * \ingroup rt2ddatatypes - * \typedef Rt2dPath - * typedef for a structure describing a Path (opaque) + * \struct Rt2dPath + * Path object. + * This should be considered an opaque type. + * Use Rt2dPath API functions to access. */ typedef struct Rt2dPath Rt2dPath; /** * \ingroup rt2ddatatypes - * \typedef Rt2dFont - * typedef for a structure describing a Font (opaque) + * \struct Rt2dFont + * Font object. + * This should be considered an opaque type. + * Use Rt2dFont API functions to access. */ typedef struct Rt2dFont Rt2dFont; @@ -206,11 +221,6 @@ typedef struct Rt2dFont Rt2dFont; */ typedef struct _rt2dFontDictionaryNode _rt2dFontDictionaryNode; -/** - * \ingroup rt2ddatatypes - * \typedef Rt2dBBox - * typedef for a structure describing a Bounding Box - */ typedef struct Rt2dBBox Rt2dBBox; /** @@ -228,8 +238,8 @@ struct Rt2dBBox /** * \ingroup rt2ddatatypes - * \typedef Rt2dObject - * typedef for a structure describing a 2d Object + * \struct Rt2dObject + * Structure describing a 2d Object * This should be considered an opaque type. * Use Rt2dObject, Rt2dScene, Rt2dShape, Rt2dPickRegion or Rt2dObjectString * API functions to access. @@ -246,6 +256,7 @@ typedef struct _rt2dScene _rt2dScene; */ typedef struct _rt2dDepthOfObject _rt2dDepthOfObject; +#if (!defined(DOXYGEN)) /* * typedef for a structure describing the depth of an object */ @@ -265,15 +276,47 @@ struct _rt2dScene RwSList *depths; /* depths for depthsort */ RwBool isDirtyDepths; /* depthsort needs updating */ }; +#endif /* (!defined(DOXYGEN)) */ /* * typedef for a structure describing a shape (opaque) */ typedef struct _rt2dShape _rt2dShape; +#if (!defined(DOXYGEN)) +typedef struct _rt2dShapeRep _rt2dShapeRep; +struct _rt2dShapeRep +{ + RwSList *nodes; /* individual stroked/filled regions of the shape */ + RwUInt32 refCount; /* number of shapes referencing this rep */ + RpGeometry *geometry; /* Shareable geometry */ +}; + +extern _rt2dShapeRep * + _rt2dShapeRepCreate(); + +extern RwBool +_rt2dShapeRepDestroy(_rt2dShapeRep *); + +extern RwUInt32 +_rt2dShapeRepAddRef(_rt2dShapeRep *); + +typedef struct _rt2dSceneResourcePool _rt2dSceneResourcePool; +struct _rt2dSceneResourcePool +{ + _rt2dShapeRep **shapeReps; + RwUInt32 numShapeReps; +}; + +extern RwBool +_rt2dSceneResourcePoolFindShapeRep(const _rt2dSceneResourcePool * pool, + const _rt2dShapeRep * rep, RwInt32 * npIndex); + struct _rt2dShape { - RwSList *nodes; /* individual stroked/filled regions of the shape */ + _rt2dShapeRep *rep; + RwRGBA *colorCache; /* Shape's color cache */ + RpAtomic *atomic; /* Atomic repn */ }; /* @@ -295,6 +338,7 @@ struct _rt2dPickRegion /* * structure describing a renderable text string */ + struct _rt2dObjectString { RwChar *textString; /* Text string to be rendered */ @@ -303,6 +347,7 @@ struct _rt2dObjectString RwReal height; /* Font rendering Height */ _rt2dFontDictionaryNode *font; /* Dictionary node identifying font to be used */ }; +#endif /* (!defined(DOXYGEN)) */ /* * typedef for a renderable string @@ -324,6 +369,7 @@ enum Rt2dObjectTypeEnum { typedef union _rt2dObjectdata _rt2dObjectdata; +#if (!defined(DOXYGEN)) union _rt2dObjectdata { _rt2dShape shape; @@ -335,11 +381,13 @@ union _rt2dObjectdata /* * A base structure for forming a hierarchy of 2D shapes */ -#if (!defined(DOXYGEN)) -#define Rt2dObjectIsLocked 0x00000001 -#define Rt2dObjectDirtyLTM 0x00000002 -#define Rt2dObjectVisible 0x00000004 +#define Rt2dObjectIsLocked 0x00000001 +#define Rt2dObjectDirtyLTM 0x00000002 +#define Rt2dObjectVisible 0x00000004 +#define Rt2dObjectDirtyColor 0x00000008 + +#define Rt2dObjectStringGotNoFonts 0x01000000 struct Rt2dObject { @@ -357,13 +405,37 @@ struct Rt2dObject /** * \ingroup rt2ddatatypes - * \typedef Rt2dObjectCallBack - * typedef for a callback on an object + * \ref Rt2dObjectCallBack + * typedef for a callback on an object in a collection + * + * \param object is a specific object + * \param parent is the containing scene + * \param data is user data + * + * \return return value is ignored */ typedef Rt2dObject *(* Rt2dObjectCallBack)(Rt2dObject *object, Rt2dObject *parent, void *data); /** * \ingroup rt2ddatatypes + * \ref Rt2dFontCallBackRead + * Rt2dFontCallBackRead represents the function used by Rt2dFontRead to read + * the specified font from a disk file. This function should return a + * pointer to the font to indicate success. The returned font is owned by + * the Rt2d internal font dictionary, and is destroyed on calling + * \ref Rt2dClose + * + * \param name is the name of the font to read + * + * \return return the font if successful, NULL otherwise + * + * \see Rt2dFontSetReadCallBack + * \see Rt2dFontGetReadCallBack + */ +typedef Rt2dFont*(* Rt2dFontCallBackRead)(const RwChar *name); + +/** + * \ingroup rt2ddatatypes * \ref Rt2dJustificationType * enumeration describing Justification */ @@ -381,6 +453,20 @@ enum Rt2dJustificationType */ typedef enum Rt2dJustificationType Rt2dJustificationType; +/** + * \ingroup rt2ddatatypes + * \ref Rt2dShapeNodeFlag + * Passed to \ref Rt2dShapeAddNode, these flags specify + * the type and properties of the path. + */ +enum Rt2dShapeNodeFlag +{ + rt2dSHAPENODEFLAGNONE = 0x0000, + rt2dSHAPENODEFLAGSOLID = 0x0001, /**< Shape's node is a solid, not outline */ + rt2dSHAPENODEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensure sizeof(enum) == sizeof(RwInt32) */ +}; + + #if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) #define Rt2dBrushSetWidth(_brush, _width) \ @@ -397,7 +483,20 @@ typedef enum Rt2dJustificationType Rt2dJustificationType; /**************************************************************************** Function prototypes */ +extern void +Rt2dBrushSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void +Rt2dFontSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void +Rt2dFontDictNodeSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); +extern void +Rt2dObjectSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void +Rt2dPathSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); /* * INITIALIZE @@ -407,6 +506,13 @@ Rt2dOpen(RwCamera *cam); extern void Rt2dClose(void); + +extern void +Rt2dTriVertSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void +Rt2dTriPolySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + /* * PATHS */ @@ -518,6 +624,12 @@ Rt2dFontSetPath(const RwChar *path); extern Rt2dFont * Rt2dFontRead(const RwChar *name); +extern RwBool +Rt2dFontSetReadCallBack(Rt2dFontCallBackRead fpCallBack); + +extern Rt2dFontCallBackRead +Rt2dFontGetReadCallBack (void); + extern RwUInt32 _rt2dFontStreamGetSize(Rt2dFont *font); @@ -695,6 +807,10 @@ Rt2dObjectIsObjectString(Rt2dObject *object); extern Rt2dObject * Rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src); +/* in-place dst version, destruction not req */ +extern Rt2dObject * +_rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src); + /* * HIERARCHICAL SCENE FUNCTIONS - SCENE */ @@ -766,14 +882,8 @@ Rt2dShapeCreate(void); extern RwBool Rt2dShapeDestroy(Rt2dObject * shape); -extern Rt2dBrush * -Rt2dShapeGetNewBrush(Rt2dObject *shape); - -extern Rt2dPath * -Rt2dShapeGetNewPath(Rt2dObject *shape); - extern Rt2dObject * -Rt2dShapeAddNode(Rt2dObject *shape, Rt2dPath *path, Rt2dBrush *fill, Rt2dBrush *stroke ); +Rt2dShapeAddNode(Rt2dObject *shape, RwUInt32 flag, Rt2dPath *path, Rt2dBrush *brush ); extern RwInt32 Rt2dShapeGetNodeCount(Rt2dObject *shape); @@ -792,9 +902,15 @@ Rt2dShapeRender(Rt2dObject *object); extern Rt2dObject * Rt2dShapeMorph(Rt2dObject *result, - Rt2dObject *source, - Rt2dObject *destination, - RwReal alpha); + Rt2dObject *source, + Rt2dObject *destination, + RwReal alpha); + +extern Rt2dObject * +Rt2dShapeLock(Rt2dObject * shape); + +extern Rt2dObject * +Rt2dShapeUnlock(Rt2dObject * shape); /* * HIERARCHICAL SCENE FUNCTIONS - PICK REGION @@ -895,6 +1011,7 @@ Rt2dCTMRead(RwMatrix * result); #endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/rwsdk/include/d3d8/rt2d.rpe b/rwsdk/include/d3d8/rt2d.rpe index 1f9f8881..b18db155 100644 --- a/rwsdk/include/d3d8/rt2d.rpe +++ b/rwsdk/include/d3d8/rt2d.rpe @@ -150,476 +150,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_Criterion2D { +E_RW_FONTNOTFOUND, e_rwdb_Criterion2DLAST = RWFORCEENUMSIZEINT }; diff --git a/rwsdk/include/d3d8/rt2danim.h b/rwsdk/include/d3d8/rt2danim.h index cd593a8e..996262af 100644 --- a/rwsdk/include/d3d8/rt2danim.h +++ b/rwsdk/include/d3d8/rt2danim.h @@ -10,8 +10,8 @@ #define RT2DANIM_H /** - * \defgroup rt2danim Rt2dAnim - * \ingroup rttool + * \defgroup rt2danim Rt2dAnim (inc. Maestro) + * \ingroup 2dtools * * A toolkit to coordinate the display, storage and manipulation of 2D * animations. @@ -166,101 +166,132 @@ typedef enum Rt2dStringLabelType Rt2dStringLabelType; /** * \ingroup rt2danimsub - * \typedef Rt2dAnimProps - * typedef for a structure describing the current state of a scene (opaque) + * \struct Rt2dAnimProps + * Structure describing the current state of a scene. + * This should be considered an opaque type. Use the + * Rt2dAnim API functions to access. */ typedef struct Rt2dAnimProps Rt2dAnimProps; /** * \ingroup rt2danimsub - * \typedef Rt2dKeyFrameList - * typedef for a structure describing a list of keyframes + * \struct Rt2dKeyFrameList + * Structure describing an entire list of keyframes + * This should be considered an opaque type. Use the + * Rt2dKeyFrameList API functions to access. */ typedef struct Rt2dKeyFrameList Rt2dKeyFrameList; /** * \ingroup rt2danimsub - * \typedef Rt2dAnimObjectUpdate - * typedef for a structure describing a set of changes to a 2d object (opaque) + * \struct Rt2dKeyFrameSet + * structure describing a set of keyframe actions to be applied to a 2D object. + * This should be considered an opaque type. Use the + * Rt2dAnim API functions to access. */ -typedef struct Rt2dAnimObjectUpdate Rt2dAnimObjectUpdate; +typedef struct Rt2dKeyFrameSet Rt2dKeyFrameSet; /** * \ingroup rt2danimsub - * \typedef Rt2dKeyFrameTransform - * typedef for a structure describing a transform change to a 2d object (opaque) + * \struct Rt2dAnimObjectUpdate + * Structure describing an unoptimized update to an object + * This should be considered an opaque type. Use the + * Rt2dAnim API functions to access. */ -typedef struct Rt2dKeyFrameTransform Rt2dKeyFrameTransform; +typedef struct Rt2dAnimObjectUpdate Rt2dAnimObjectUpdate; /** * \ingroup rt2danimsub - * \typedef Rt2dKeyFrameColor - * typedef for a structure describing a color change to a 2d object (opaque) + * \struct Rt2dKeyFrameTransform + * Structure describing a transform change to a 2d object. + * This should be considered an opaque type. Use the + * Rt2dAnim API functions to access. + */ +typedef struct Rt2dKeyFrameTransform Rt2dKeyFrameTransform; + +/* + * Typedef for struct Rt2dKeyFrameColor describing a color + * change to a 2d object. */ typedef struct Rt2dKeyFrameColor Rt2dKeyFrameColor; -/** - * \ingroup rt2danimsub - * \typedef Rt2dKeyFrameShow - * typedef for a structure describing a displayable or depth change to a 2d object (opaque) +/* + * Structure describing a displayable or depth change to a 2d object. */ typedef struct Rt2dKeyFrameShow Rt2dKeyFrameShow; -/** - * \ingroup rt2danimsub - * \typedef Rt2dKeyFrameMorph - * typedef for a structure describing a morph change to a 2d object (opaque) +/* + * Structure describing a morph change to a 2d object. */ typedef struct Rt2dKeyFrameMorph Rt2dKeyFrameMorph; /** * \ingroup rt2danimsub - * \typedef Rt2dAnim - * typedef for a structure describing a 2d animation (opaque) + * \struct Rt2dAnim + * Structure describing a 2d animation. + * This should be considered an opaque type. Use the + * Rt2dAnim API functions to access. */ typedef struct Rt2dAnim Rt2dAnim; /** * \ingroup rt2dbutton - * \typedef Rt2dButton - * typedef for a structure describing a button (opaque) + * \struct Rt2dButton + * Structure describing a button. + * This should be considered an opaque type. Use the + * Rt2dButton API functions to access. */ typedef struct Rt2dButton Rt2dButton; /** * \ingroup rt2dcel - * \typedef Rt2dCel - * typedef for a structure describing a cel (opaque) + * \struct Rt2dCel + * Structure describing a cel. + * This should be considered an opaque type. Use the + * Rt2dCel API functions to access. */ typedef struct Rt2dCel Rt2dCel; /** * \ingroup rt2dcel - * \typedef Rt2dCelList - * typedef for a structure describing a cel list (opaque) + * \struct Rt2dCelList + * Structure describing a cel list. + * This should be considered an opaque type. Use the + * Rt2dCel API functions to access. */ typedef struct Rt2dCelList Rt2dCelList; /** * \ingroup rt2dmaestro - * \typedef Rt2dMaestro - * typedef for a structure describing a maestro (opaque) + * \struct Rt2dMaestro + * Structure describing a maestro. + * This should be considered an opaque type. Use the + * Rt2dMaestro API functions to access. */ typedef struct Rt2dMaestro Rt2dMaestro; -/** - * \ingroup rt2dmessage - * \typedef Rt2dMessage - * typedef for a structure describing a message (opaque) +/* + * Structure describing a message. */ typedef struct Rt2dMessage Rt2dMessage; +/** + * \ingroup rt2dmessage + * \struct Rt2dMessageList + * Structure describing a message. + * This should be considered an opaque type. Use the + * Rt2dMessage API functions to access. + */ typedef struct Rt2dMessageList Rt2dMessageList; /** * \ingroup rt2dstringlabel - * \typedef Rt2dStringLabel - * typedef for a structure describing a string label (opaque) + * \struct Rt2dStringLabel + * Structure used to store and access named data, either internal or user. + * A type and a name may be used to access internal and user data. + * + * This should be considered an opaque type. Use the + * Rt2dStringLabel API functions to access. */ typedef struct Rt2dStringLabel Rt2dStringLabel; @@ -277,7 +308,8 @@ struct Rt2dKeyFrameTransform /** * \ingroup rt2danimsub * \struct Rt2dKeyFrameColor - * structure describing a color setting action + * Structure describing a color + * change to a 2d object. */ struct Rt2dKeyFrameColor { @@ -287,7 +319,7 @@ struct Rt2dKeyFrameColor /** * \ingroup rt2danimsub * \struct Rt2dKeyFrameShow - * structure describing a show/hide action + * Structure describing a show/hide change and a depth change to a 2d object. */ struct Rt2dKeyFrameShow { @@ -299,7 +331,7 @@ struct Rt2dKeyFrameShow /** * \ingroup rt2danimsub * \struct Rt2dKeyFrameMorph - * structure describing a morph action + * Structure describing a morph change to a 2d object. */ struct Rt2dKeyFrameMorph { @@ -355,69 +387,73 @@ MACRO_START \ } \ MACRO_STOP -/** - * \ingroup rt2dstringlabel - * \struct Rt2dStringLabel - * structure containing label information. The enitityType identifies the type +/* + * structure containing label information. The entityType identifies the type * of the label. The label's name is stored as an index * in common storage area. The entityType and name of the label are used as keys * during a search. Additional internal and user data can be stored with the * label. */ + +#if (!defined(DOXYGEN)) struct Rt2dStringLabel { - RwUInt32 entityType; /**< type of the label - (\ref Rt2dStringLabelType) */ - RwInt32 nameIndex; /**< index of name in internal data + RwUInt32 entityType; /* type of the label + (see Rt2dStringLabelType) */ + RwInt32 nameIndex; /* index of name in internal data area */ - void *internalData; /**< internal data */ - void *userData; /**< customizable data */ + void *internalData; /* internal data */ + void *userData; /* customizable data */ }; +#endif /* (!defined(DOXYGEN)) */ + #define _rt2dStringLabelGetStringLabelTypeMacro(_strLabel) \ - ((_strLabel)->entityType); + ((_strLabel)->entityType) #define _rt2dStringLabelSetStringLabelTypeMacro(_strLabel, _entityType) \ - ((_strLabel)->entityType = (_entityType)); + ((_strLabel)->entityType = (_entityType)) #define _rt2dStringLabelGetNameIndexMacro(_strLabel) \ - ((_strLabel)->nameIndex); + ((_strLabel)->nameIndex) #define _rt2dStringLabelSetNameIndexMacro(_strLabel, _index) \ - ((_strLabel)->nameIndex = (_index)); + ((_strLabel)->nameIndex = (_index)) #define _rt2dStringLabelGetInternalDataMacro(_strLabel) \ - ((_strLabel)->internalData); + ((_strLabel)->internalData) #define _rt2dStringLabelSetInternalDataMacro(_strLabel, _internalData) \ - ((_strLabel)->internalData = (_internalData)); + ((_strLabel)->internalData = (_internalData)) #define _rt2dStringLabelGetUserDataMacro(_strLabel) \ - ((_strLabel)->userData); + ((_strLabel)->userData) #define _rt2dStringLabelSetUserDataMacro(_strLabel, _userData) \ - ((_strLabel)->userData = (_userData)); + ((_strLabel)->userData = (_userData)) -/** - * \ingroup rt2dcel - * \struct Rt2dCel +/* * structure containing cel information. The name of the cel is stored as an * index into a label table. The buttons in the cel are stored as indices. These - * reference a list of buttons held by the cel's parent maestro. Any messages + * reference a list of buttons held by the cel's parent maestro. Any messages * to be process when the cel is active is stored as index into the parent's * maestro's message storage area. */ + +#if (!defined(DOXYGEN)) struct Rt2dCel { - RwInt32 strLabelIndex; /**< Frame label */ - RwInt32 celIndex; /**< Frame number */ - RwSList *buttonIndices; /**< List of buttons active in - this frame */ - RwInt32 messageListIndex; /**< Messages to be posted after - displaying this frame */ + RwInt32 strLabelIndex; /* Frame label */ + RwInt32 celIndex; /* Frame number */ + RwSList *buttonIndices; /* List of buttons active in + this frame */ + RwInt32 messageListIndex; /* Messages to be posted after + displaying this frame */ }; +#endif /* (!defined(DOXYGEN)) */ + #define _rt2dCelGetStringLabelIndexMacro(_cel) \ ((_cel)->strLabelIndex); @@ -443,14 +479,16 @@ typedef Rt2dAnim *(*Rt2dAnimCallBack)(Rt2dAnim *object, void *data); /** * \ingroup rt2danimsub - * \typedef Rt2dKeyFrameListCallBack + * \ref Rt2dKeyFrameListCallBack * This typedef defines a callback function to apply to a frame list. * - * \param anim Pointer to the animation - * \param props Pointer to the props that the animation acts upon - * \param keyframeList The key frame list + * \param anim Pointer to the animation + * \param props Pointer to the props that the animation acts upon + * \param keyframeList The key frame list * \param keyframeListTime The key frame list time - * \param data User defined data + * \param data User defined data + * + * \return return value is ignored */ typedef Rt2dKeyFrameList *(Rt2dKeyFrameListCallBack)( Rt2dAnim *anim, @@ -461,12 +499,14 @@ typedef Rt2dKeyFrameList *(Rt2dKeyFrameListCallBack)( /** * \ingroup rt2danimsub - * \typedef Rt2dAnimOnEndReachedCallBack + * \ref Rt2dAnimOnEndReachedCallBack * This typedef defines a callback function called at the end of an animation. * - * \param anim Pointer to the animation ending - * \param props Pointer to the props that the animation acts upon + * \param anim Pointer to the animation ending + * \param props Pointer to the props that the animation acts upon * \param remainingDeltaTime Remaining time + * + * \return return value is ignored */ typedef Rt2dAnim *(*Rt2dAnimOnEndReachedCallBack)(Rt2dAnim *anim, Rt2dAnimProps *props, @@ -474,14 +514,14 @@ typedef Rt2dAnim *(*Rt2dAnimOnEndReachedCallBack)(Rt2dAnim *anim, /** * \ingroup rt2dmaestro - * \typedef Rt2dMaestroAnimationsCallBack + * \ref Rt2dMaestroAnimationsCallBack * \ref Rt2dMaestroAnimationsCallBack represents the function called from * \ref Rt2dMaestroForAllAnimations for all animations in the maestro. * This function * should return the current maestro to indicate success. The callback may * return NULL to terminate further callbacks on the maestro. * - * \param maestro Pointer to parent maestro. + * \param maestro Pointer to parent maestro. * \param anim Pointer to the animation. * \param props Pointer to the anim's props. * \param pData Pointer to private data. @@ -494,7 +534,6 @@ typedef Rt2dMaestro *(*Rt2dMaestroAnimationsCallBack) /** * \ingroup rt2dmessage - * \typedef Rt2dMessageHandlerCallBack * \ref Rt2dMessageHandlerCallBack represents the function called from * \ref Rt2dMaestroProcessMessages for all messages in the maestro's * process message queue. The maestro does not filter any messages. The @@ -504,7 +543,7 @@ typedef Rt2dMaestro *(*Rt2dMaestroAnimationsCallBack) * callback may return NULL to terminate further callbacks on the maestro. * * \param maestro Pointer to parent maestro. - * \param message Pointer to the message. + * \param message Pointer to the message. * * \return Pointer to the message. */ @@ -531,6 +570,18 @@ typedef Rt2dMessage * */ /* + * Toolkit-level initialization / finalization + */ +/* + * INITIALIZE + */ +extern void +Rt2dAnimOpen(void); + +extern void +Rt2dAnimClose(void); + +/* * Rt2dAnim */ @@ -747,7 +798,7 @@ Rt2dMaestroAddButton(Rt2dMaestro *maestro, RwInt32 strLabelIdx, RwInt32 objectId extern Rt2dCel * Rt2dCelCreate(Rt2dMaestro *maestro, - RwChar *name, + const RwChar *name, RwInt32 celIndex, RwInt32 messageListIndex); extern Rt2dCelList * @@ -966,7 +1017,7 @@ Rt2dMessageHandlerDefaultCallBack(Rt2dMaestro *maestro, Rt2dMessage *message); */ extern Rt2dStringLabel * Rt2dMaestroFindStringLabel(Rt2dMaestro *maestro, - Rt2dStringLabelType entityType, RwChar *lookupName, + Rt2dStringLabelType entityType, const RwChar *lookupName, RwInt32 *index); extern Rt2dStringLabel * @@ -974,7 +1025,7 @@ Rt2dMaestroGetStringLabelByIndex(Rt2dMaestro *maestro, RwInt32 index); extern Rt2dMaestro * Rt2dMaestroAddStringLabel(Rt2dMaestro *maestro, - Rt2dStringLabelType entityType, RwChar *name, + Rt2dStringLabelType entityType, const RwChar *name, void *internalData, RwInt32 *index); extern const RwChar * @@ -985,28 +1036,28 @@ Rt2dMaestroGetStringLabelName(Rt2dMaestro *maestro, #if !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) #define Rt2dStringLabelGetStringLabelType(_strLabel) \ - _rt2dStringLabelGetStringLabelTypeMacro((_strLabel)); + _rt2dStringLabelGetStringLabelTypeMacro((_strLabel)) #define Rt2dStringLabelSetStringLabelType(_strLabel, _entityType) \ - _rt2dStringLabelSetStringLabelTypeMacro((_strLabel), (_entityType)); + _rt2dStringLabelSetStringLabelTypeMacro((_strLabel), (_entityType)) #define Rt2dStringLabelGetNameIndex(_strLabel) \ - _rt2dStringLabelGetNameIndexMacro((_strLabel)); + _rt2dStringLabelGetNameIndexMacro((_strLabel)) #define Rt2dStringLabelSetNameIndex(_strLabel, _index) \ - _rt2dStringLabelSetNameIndexMacro((_strLabel), (_index)); + _rt2dStringLabelSetNameIndexMacro((_strLabel), (_index)) #define Rt2dStringLabelGetInternalData(_strLabel) \ - _rt2dStringLabelGetInternalDataMacro((_strLabel)); + _rt2dStringLabelGetInternalDataMacro((_strLabel)) #define Rt2dStringLabelSetInternalData(_strLabel, _internalData) \ - _rt2dStringLabelSetInternalDataMacro((_strLabel), (_internalData)); + _rt2dStringLabelSetInternalDataMacro((_strLabel), (_internalData)) #define Rt2dStringLabelGetUserData(_strLabel) \ - _rt2dStringLabelGetUserDataMacro((_strLabel)); + _rt2dStringLabelGetUserDataMacro((_strLabel)) #define Rt2dStringLabelSetUserData(_strLabel, _userData) \ - _rt2dStringLabelSetUserDataMacro((_strLabel), (_userData)); + _rt2dStringLabelSetUserDataMacro((_strLabel), (_userData)) #else /* !(defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) */ diff --git a/rwsdk/include/d3d8/rt2danim.rpe b/rwsdk/include/d3d8/rt2danim.rpe index 82a9dac9..0e61ec5c 100644 --- a/rwsdk/include/d3d8/rt2danim.rpe +++ b/rwsdk/include/d3d8/rt2danim.rpe @@ -150,480 +150,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -enum rwPLUGIN_ERRENUM +enum e_rwdb_Criterion2DAnim { - rwPLUGIN_ERRENUMLAST = RWFORCEENUMSIZEINT + e_rwdb_Criterion2DAnimLAST = RWFORCEENUMSIZEINT }; -typedef enum rwPLUGIN_ERRENUM rwPLUGIN_ERRENUM; +typedef enum e_rwdb_Criterion2DAnim e_rwdb_Criterion2DAnim; diff --git a/rwsdk/include/d3d8/rtbary.h b/rwsdk/include/d3d8/rtbary.h index 61c39b07..2531914d 100644 --- a/rwsdk/include/d3d8/rtbary.h +++ b/rwsdk/include/d3d8/rtbary.h @@ -11,7 +11,7 @@ /** * \defgroup rtbary RtBary - * \ingroup rttool + * \ingroup mathtools * * Barycentric Toolkit for RenderWare. */ @@ -32,7 +32,7 @@ /** * \ingroup rtbary - * \typedef RtBaryV4d + * \ref RtBaryV4d * typedef for the 4 element homogeneous row of a transform matrix mapping * a point from Cartesian space to the barycentric space defined by a triangle. */ @@ -40,7 +40,7 @@ typedef RwReal RtBaryV4d[4]; /** * \ingroup rtbary - * \typedef RtBaryTransform + * \ref RtBaryTransform * typedef for the 4x4 homogeneous transform matrix mapping a point * from Cartesian space to the barycentric space defined by a triangle. */ diff --git a/rwsdk/include/d3d8/rtbary.rpe b/rwsdk/include/d3d8/rtbary.rpe index fdfe3afe..0fec6a77 100644 --- a/rwsdk/include/d3d8/rtbary.rpe +++ b/rwsdk/include/d3d8/rtbary.rpe @@ -166,472 +166,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionBary { diff --git a/rwsdk/include/d3d8/rtbezpat.h b/rwsdk/include/d3d8/rtbezpat.h index 8a5960cb..f25f5ce9 100644 --- a/rwsdk/include/d3d8/rtbezpat.h +++ b/rwsdk/include/d3d8/rtbezpat.h @@ -8,17 +8,12 @@ /** * \defgroup rtbezpatch RtBezPat - * \ingroup rttool + * \ingroup mathtools * * The Bezier Patch Toolkit is a group of functions that support the way * RenderWare processes patches. */ -/** - * \ingroup rtbezpatch - * \typedef RtBezierV4d - * typedef for struct RtBezierV4d. - */ typedef struct RtBezierV4d RtBezierV4d; /** @@ -42,7 +37,7 @@ struct RtBezierV4d /** * \ingroup rtbezpatch - * \typedef RtBezierRow + * \ref RtBezierRow * typedef for a row of vectors. * RtBezierRow is an array of 4 vectors */ @@ -50,7 +45,7 @@ typedef RtBezierV4d RtBezierRow[4]; /** * \ingroup rtbezpatch - * \typedef RtBezierMatrix + * \ref RtBezierMatrix * typedef for a matrix of 4*4 vectors. * RtBezierMatrix is an array of 4 rows. */ diff --git a/rwsdk/include/d3d8/rtbezpat.rpe b/rwsdk/include/d3d8/rtbezpat.rpe index e49b65b4..0f6dc700 100644 --- a/rwsdk/include/d3d8/rtbezpat.rpe +++ b/rwsdk/include/d3d8/rtbezpat.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionBEZPATCH { diff --git a/rwsdk/include/d3d8/rtbmp.h b/rwsdk/include/d3d8/rtbmp.h index 37b5c97b..c3bb5c95 100644 --- a/rwsdk/include/d3d8/rtbmp.h +++ b/rwsdk/include/d3d8/rtbmp.h @@ -12,7 +12,7 @@ /** * \defgroup rtbmp RtBMP - * \ingroup rttool + * \ingroup imageconversiontools * * BMP Image Format Toolkit for RenderWare. * diff --git a/rwsdk/include/d3d8/rtbmp.rpe b/rwsdk/include/d3d8/rtbmp.rpe index 29dad089..37c546f9 100644 --- a/rwsdk/include/d3d8/rtbmp.rpe +++ b/rwsdk/include/d3d8/rtbmp.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionBMP { diff --git a/rwsdk/include/d3d8/rtcharse.h b/rwsdk/include/d3d8/rtcharse.h index 4fdc2568..6c7a3902 100644 --- a/rwsdk/include/d3d8/rtcharse.h +++ b/rwsdk/include/d3d8/rtcharse.h @@ -16,7 +16,7 @@ /** * \defgroup rtcharset RtCharset - * \ingroup rttool + * \ingroup 2dtools * * Character Set/Foot Toolkit for RenderWare. */ @@ -61,7 +61,7 @@ struct RtCharsetDesc /** * \ingroup rtcharset - * \typedef RtCharset + * \ref RtCharset * typedef for a structure defining a character set (opaque). * \see RtCharsetCreate */ diff --git a/rwsdk/include/d3d8/rtcharse.rpe b/rwsdk/include/d3d8/rtcharse.rpe index 39c37312..30c5ff4d 100644 --- a/rwsdk/include/d3d8/rtcharse.rpe +++ b/rwsdk/include/d3d8/rtcharse.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionCharset { diff --git a/rwsdk/include/d3d8/rtimport.h b/rwsdk/include/d3d8/rtimport.h index cf4e6283..2cc6383b 100644 --- a/rwsdk/include/d3d8/rtimport.h +++ b/rwsdk/include/d3d8/rtimport.h @@ -10,15 +10,15 @@ #define RTIMPORT_H /** - * \defgroup rtimport RtWorldImport - * \ingroup rttool + * \defgroup rtworldimport RtWorldImport + * \ingroup basicgeometry * - * World Import Toolkit for Renderware. + * World Import Toolkit for RenderWare. */ /** * \defgroup selectors RtWorldImportPartitionSelectors - * \ingroup rtimport + * \ingroup rtworldimport * * The set of provided RtWorldImportPartitionSelectors: * Selects a good partition by calling one of the @@ -29,7 +29,7 @@ /** * \defgroup iterators RtWorldImportPartitionIterators - * \ingroup rtimport + * \ingroup rtworldimport * * The set of provided RtWorldImportPartitionIterators: * Iterates through a set of candidate partitions, possibly @@ -39,7 +39,7 @@ /** * \defgroup evaluators RtWorldImportPartitionEvaluators - * \ingroup rtimport + * \ingroup rtworldimport * * The set of provided RtWorldImportPartitionEvaluators: * Uses a combination of statistics, build sector, build status, and @@ -51,7 +51,7 @@ /** * \defgroup terminators RtWorldImportPartitionTerminators - * \ingroup rtimport + * \ingroup rtworldimport * * The set of provided RtWorldImportPartitionTerminators: * Checks given criteria about the statistics, build sector, build status, and @@ -61,7 +61,7 @@ /** * \defgroup kd RtWorldImportGuideKD - * \ingroup rtimport + * \ingroup rtworldimport * * Tools to manipulate the \ref RtWorldImportGuideKDTree that is used to * manually build the sectors of a world. @@ -69,7 +69,7 @@ /** * \defgroup hints RtWorldImportHints - * \ingroup rtimport + * \ingroup rtworldimport * * Tools to aid the build process by giving hints as to what geometry should * not be split, and what geometry makes for a good partitioning guide. @@ -96,7 +96,7 @@ #define rtWORLDIMPORTPROGRESSBSPCOMPRESSEND 5 /** - * \ingroup rtimport + * \ingroup rtworldimport * \def rtWORLDIMPORTINVALIDPARTITION * * This value means that no partition was found, or that the partition was @@ -104,51 +104,61 @@ */ #define rtWORLDIMPORTINVALIDPARTITION RwRealMAXVAL -/**************************************************************************** - Global types - */ - -/** - * Internal use only - */ -typedef union RtWorldImportVertexState RtWorldImportVertexState; +/* maintained in Bin-tree */ +#define CONGRUENTVERTEXCHILDREN 2 +/* maintained in Quad-tree */ +#define WELDVERTEXCHILDREN 4 -/** - * \ingroup rtimport - * \typedef RtWorldImportVertex - * - * typedef for struct \ref RtWorldImportVertex +/**************************************************************************** + Global types */ +#if (!defined(DOXYGEN)) typedef struct RtWorldImportVertex RtWorldImportVertex; -/** - * \ingroup rtimport - * \typedef RtWorldImportWeldVertex - * - * typedef for struct \ref RtWorldImportWeldVertex - */ typedef struct RtWorldImportWeldVertex RtWorldImportWeldVertex; -/** - * \ingroup rtimport - * \typedef RtWorldImportBuildVertex - * - * typedef for struct \ref RtWorldImportBuildVertex - */ typedef struct RtWorldImportBuildVertex RtWorldImportBuildVertex; +/* Internal use only */ +typedef union RtWorldImportVertexState RtWorldImportVertexState; +/* Internal use only */ +union RtWorldImportVertexState +{ + /* clipFlags, two types, first is based on partition only, 2nd is + * also based on partition, but takes overlaps into consideration. i.e. + * number splits is usually higher in clipFlags[0] than [1] */ + RwInt32 clipFlags[2]; /* Internal use only */ + RwInt32 forwardingAddress; /* Internal use only */ + RtWorldImportVertex *vpVert; /* Internal use only */ + RtWorldImportWeldVertex *vpWeldVert; /* Internal use only */ + RtWorldImportBuildVertex *vpBuildVert; /* Internal use only */ + RwSList *slist; /* Internal use only */ +}; +#endif /* (!defined(DOXYGEN)) */ /** - * \ingroup rtimport - * \typedef RtWorldImportBuildPolyInfo + * \ingroup rtworldimport + * \struct RtWorldImportVertex + * Holds data for each vertex in the import world. * - * typedef for struct \ref RtWorldImportBuildPolyInfo */ +struct RtWorldImportVertex +{ + RwV3d OC; /**< World space vertex position */ + RwV3d normal; /**< World space vertex normal */ + RwRGBA preLitCol; /**< Vertex Prelight color */ + RwTexCoords texCoords[rwMAXTEXTURECOORDS]; + /**< Vertex texture coordinates */ + RtWorldImportVertexState state; /**< Internal use only */ + RwInt32 matIndex; /**< Vertex material index */ + void *pUserdata; /**< Pointer to unspecified per vertex user data */ +}; + typedef struct RtWorldImportBuildPolyInfo RtWorldImportBuildPolyInfo; /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildPolyInfo * * Information about a polygon @@ -167,7 +177,7 @@ struct RtWorldImportBuildPolyInfo typedef union RtWorldImportBuildVertexMode RtWorldImportBuildVertexMode; /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildVertexMode * * Mode of the vertex. @@ -182,7 +192,7 @@ union RtWorldImportBuildVertexMode }; /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildVertex * * A list of polygons as a list of vertices where the end of poly boundary @@ -198,30 +208,16 @@ struct RtWorldImportBuildVertex /**< we store some poly info in the end marker of a boundary */ }; - - -/** - * \ingroup rtimport - * \typedef RtWorldImportGuideKDTree - * - * typedef for struct \ref RtWorldImportGuideKDTree - */ -typedef struct RtWorldImportGuideKDTree RtWorldImportGuideKDTree; - /* NB Merged RtWorldImportPartition with RtWorldImportBuildClipStatistics because * there was a unique one-to-one relationship between them, and it made things easier * just updating one stucture, without having to update both in sequence... */ -/** - * \ingroup rtimport - * \typedef RtWorldImportBuildClipStatistics - * - * typedef for struct \ref RtWorldImportBuildClipStatistics - */ + typedef struct RtWorldImportBuildClipStatistics RtWorldImportBuildClipStatistics; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildClipStatistics * * Holds statistics about a partition or candidate partition during @@ -231,15 +227,15 @@ struct RtWorldImportBuildClipStatistics { RwInt32 numPotentialSplit; /**< The number of polygons split by the partition, - * disgregarding overlaps */ + * disregarding overlaps */ RwInt32 numPotentialLeft; /**< The number of potential polygons and fragments on the - * left of the partition, disgregarding overlaps */ + * left of the partition, disregarding overlaps */ RwInt32 numPotentialRight; /**< The number of potential polygons and fragments on the - * right of the partition, disgregarding overlaps */ + * right of the partition, disregarding overlaps */ RwInt32 numActualSplit; @@ -276,15 +272,13 @@ struct RtWorldImportBuildClipStatistics /**< The actual, relative size of the overlap on the right of the partition */ }; -/** - * \ingroup rtimport - * \typedef RtWorldImportPartition - * - * typedef for struct \ref RtWorldImportPartition +/* + * typedef for struct RtWorldImportPartition */ typedef struct RtWorldImportPartition RtWorldImportPartition; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportPartition * * A partitioning plane. @@ -311,8 +305,14 @@ struct RtWorldImportPartition /**< The statistics for the partition */ }; +/* + * typedef for struct \ref RtWorldImportGuideKDTree + */ +typedef struct RtWorldImportGuideKDTree RtWorldImportGuideKDTree; + + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportGuideKDTree * Represents the structure of a binary tree with * no contents per se. It is used to build a BSP in a user specified @@ -342,6 +342,7 @@ struct RtWorldImportGuideKDTree typedef struct _rtWorldImportGuideKDStackElement _rtWorldImportGuideKDStackElement; +#if (!defined(DOXYGEN)) struct _rtWorldImportGuideKDStackElement { RwBool terminal; @@ -357,16 +358,15 @@ struct _rtWorldImportGuideKDStack _rtWorldImportGuideKDStackElement *current; _rtWorldImportGuideKDStackElement *bottom; }; +#endif /* (!defined(DOXYGEN)) */ -/** - * \ingroup rtimport - * \typedef RtWorldImportBuildSector - * - * typedef for struct \ref RtWorldImportBuildSector +/* + * typedef for struct RtWorldImportBuildSector */ typedef struct RtWorldImportBuildSector RtWorldImportBuildSector; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildSector * * Holds information about the sector that is being subdivided @@ -401,15 +401,13 @@ struct RtWorldImportBuildSector /**< Maximum number of materials in the in the world */ }; -/** - * \ingroup rtimport - * \typedef RtWorldImportBuildStatus - * - * typedef for struct \ref RtWorldImportBuildStatus +/* + * typedef for struct RtWorldImportBuildStatus */ typedef struct RtWorldImportBuildStatus RtWorldImportBuildStatus; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildStatus * World Import Build Status Structure * Used to store the current tree's build status @@ -419,50 +417,41 @@ struct RtWorldImportBuildStatus RwInt32 depth; /**< current depth in the tree */ }; -/** - * Internal use only - */ -union RtWorldImportVertexState +typedef struct RwRGBAUInt32 RwRGBAUInt32; + +#if (!defined(DOXYGEN)) +struct RwRGBAUInt32 { - /* clipFlags, two types, first is based on partition only, 2nd is - * also based on partition, but takes overlaps into consideration. i.e. - * number splits is usually higher in clipFlags[0] than [1] */ - RwInt32 clipFlags[2]; /**< Internal use only */ - RwInt32 forwardingAddress; /**< Internal use only */ - RtWorldImportVertex *vpVert; /**< Internal use only */ - RtWorldImportWeldVertex *vpWeldVert; /**< Internal use only */ - RtWorldImportBuildVertex *vpBuildVert; /**< Internal use only */ - RwSList *slist; /**< Internal use only */ + RwUInt32 red, green, blue, alpha; }; -/** - * \ingroup rtimport - * \struct RtWorldImportVertex - * Holds data for each vertex in the import world. - * - */ -struct RtWorldImportVertex +typedef struct RtWorldImportCongruentVertex RtWorldImportCongruentVertex; + +struct RtWorldImportCongruentVertex { - RwV3d OC; /**< World space vertex position */ - RwV3d normal; /**< World space vertex normal */ - RwRGBA preLitCol; /**< Vertex Prelight color */ - RwTexCoords texCoords[rwMAXTEXTURECOORDS]; - /**< Vertex texture coordinates */ - RtWorldImportVertexState state; /**< Internal use only */ - RwInt32 matIndex; /**< Vertex material index */ - void *pUserdata; /**< Pointer to unspecified per vertex user data */ + RwInt32 destIdx; + RtWorldImportVertex vertex; + RtWorldImportVertex Mean; + RwRGBAUInt32 preLitMean; + RwInt32 refCount; + RtWorldImportCongruentVertex *child[CONGRUENTVERTEXCHILDREN]; }; -/** - * \ingroup rtimport - * \typedef RtWorldImportTriangle +struct RtWorldImportWeldVertex +{ + RtWorldImportVertex *sourcePtr; + RtWorldImportCongruentVertex *CongruentVertex; + RtWorldImportWeldVertex *child[WELDVERTEXCHILDREN]; +}; +#endif /* (!defined(DOXYGEN)) */ + +/* * Holds data for each triangle in the import world. - * - * \see RtWorldImportTriangle */ typedef struct RtWorldImportTriangle RtWorldImportTriangle; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportTriangle * Holds data for each triangle in the import world. * @@ -476,38 +465,69 @@ struct RtWorldImportTriangle }; + + +/* + * typedef for struct RtWorldImportBBoxHintDesc + */ +typedef struct RtWorldImportBBoxHintDesc RtWorldImportBBoxHintDesc; /** - * \ingroup rtimport - * \typedef RtWorldImportHints - * - * typedef for struct \ref RtWorldImportHints + * \ingroup rtworldimport + * \struct RtWorldImportBBoxHintDesc + * Bounding box hints and (priority) values used to control the world + * sectorization process. + */ +struct RtWorldImportBBoxHintDesc +{ + RwBBox bBox; /**< The (necessarily orthogonal) bounding box */ + RwReal value; /**< The value or priority of the hint (highest is most important) */ +}; + +/* + * typedef for struct RtWorldImportHints */ typedef struct RtWorldImportHints RtWorldImportHints; /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportHints * Bounding box hints used to control the world sectorization process. * \see RtWorldImportHintsSet */ struct RtWorldImportHints { - /** The bounding box hints */ - RwBBox *boundingBoxes; - /** The number of bounding box hints */ - RwInt32 numBoundingBoxes; + RtWorldImportBBoxHintDesc *boundingBoxes; /**< The bounding box hints */ + RwInt32 numBoundingBoxes; /**< The number of bounding box hints */ }; + /** - * \ingroup rtimport - * \typedef RtWorldImportParameters + * \ingroup rtworldimport + * \ref RtWorldImportHintGroup * + * An enumeration that can be passed to + * \ref RtWorldImportHintsSetGroup and \ref RtWorldImportHintsGetGroup to determine + * whether hints will contribute towards the shield hint group or partition hint group + */ +typedef enum +{ + rtWORLDIMPORTSHIELDHINT = 0, + rtWORLDIMPORTPARTITIONHINT, + + rtWORLDIMPORTFORCEENUMSIZEINT = RWFORCEENUMSIZEINT +} +RtWorldImportHintGroup; + + + + +/* * typedef for struct \ref RtWorldImportParameters */ typedef struct RtWorldImportParameters RtWorldImportParameters; /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportParameters * Parameters used with \ref RtWorldImportCreateWorld. * They are initialized to default values using \ref RtWorldImportParametersInit. @@ -563,15 +583,13 @@ struct RtWorldImportParameters /**< If TRUE the world will be checked for validity during the build process. */ }; -/** - * \ingroup rtimport - * \typedef RtWorldImport - * - * typedef for struct \ref RtWorldImport +/* + * typedef for struct RtWorldImport */ typedef struct RtWorldImport RtWorldImport; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImport * World Import State Structure */ @@ -583,14 +601,10 @@ struct RtWorldImport RtWorldImportTriangle *polygons; /**< Triangle array */ RwInt32 numPolygons; /**< Triangle count */ - - - RwSurfaceProperties surfaceProps; /**< The world's surface - lighting properties */ }; /** - * \ingroup rtimport + * \ingroup rtworldimport * \ref RtWorldImportProgressCallBack is the type for the callback function supplied to * \ref RtWorldImportSetProgressCallBack. * @@ -626,65 +640,102 @@ struct RtWorldImport typedef RwBool (*RtWorldImportProgressCallBack)(RwInt32 msg, RwReal value); /** - * \ingroup rtimport - * \typedef RtWorldImportDestroyVertexUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportDestroyVertexUserdataCallBack * * A pointer to the CallBack function that will be called during * vertex destruction. + * + * \param pUserdata + * + * \return */ typedef RwBool (*RtWorldImportDestroyVertexUserdataCallBack)(void **pUserdata); /** - * \ingroup rtimport - * \typedef RtWorldImportCloneVertexUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportCloneVertexUserdataCallBack * * A pointer to the CallBack function that will be called during * vertex cloning. + * + * \param pUserdataDst + * \param pUserdataSrc + * + * \return */ typedef RwBool (*RtWorldImportCloneVertexUserdataCallBack)(void **pUserdataDst, void **pUserdataSrc); /** - * \ingroup rtimport - * \typedef RtWorldImportInterpVertexUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportInterpVertexUserdataCallBack * * A pointer to the CallBack function that will be called during * vertex interpolation. + * + * \param pUserdataDst + * \param pUserdata1 + * \param pUserdata2 + * \param delta + * + * \return */ typedef RwBool (*RtWorldImportInterpVertexUserdataCallBack)(void **pUserdataDst, void **pUserdata1, void **pUserdata2, RwReal delta); /** - * \ingroup rtimport - * \typedef RtWorldImportDestroyPolygonUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportDestroyPolygonUserdataCallBack * * A pointer to the CallBack function that will be called during * polygon destruction. + * + * \param pUserdata + * + * \return */ typedef RwBool (*RtWorldImportDestroyPolygonUserdataCallBack)(void **pUserdata); /** - * \ingroup rtimport - * \typedef RtWorldImportSplitPolygonUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportSplitPolygonUserdataCallBack * * A pointer to the CallBack function that will be called during * polygon division. + * + * \param pUserdataDst + * \param pUserdataSrc + * + * \return */ typedef RwBool (*RtWorldImportSplitPolygonUserdataCallBack)(void **pUserdataDst, void **pUserdataSrc); /** - * \ingroup rtimport - * \typedef RtWorldImportSectorSetVertexUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportSectorSetVertexUserdataCallBack * * A pointer to the CallBack function that will be called during * the setting of the vertex user data. + * + * \param pUserdata + * \param sector + * \param index + * + * \return */ typedef RwBool (*RtWorldImportSectorSetVertexUserdataCallBack)(void **pUserdata, RpWorldSector *sector, RwInt32 index); /** - * \ingroup rtimport - * \typedef RtWorldImportSectorSetPolygonUserdataCallBack + * \ingroup rtworldimport + * \ref RtWorldImportSectorSetPolygonUserdataCallBack * * A pointer to the CallBack function that will be called during * the setting of the polygon user data. + * + * \param pUserdata + * \param sector + * \param index + * + * \return */ typedef RwBool (*RtWorldImportSectorSetPolygonUserdataCallBack)(void **pUserdata, RpWorldSector *sector, RwInt32 index); @@ -692,12 +743,18 @@ typedef RwBool (*RtWorldImportSectorSetPolygonUserdataCallBack)(void **pUserdata /** - * \ingroup rtimport - * \typedef RtWorldImportTerminationBuildCallBack + * \ingroup rtworldimport + * \ref RtWorldImportTerminationBuildCallBack * * A pointer to the function that will be called during the * build process to determine whether the current sector should * be subdivided further, or terminated. + * + * \param buildSector + * \param buildStatus + * \param pData + * + * \return */ typedef RwBool (*RtWorldImportTerminationBuildCallBack) (RtWorldImportBuildSector *buildSector, @@ -705,11 +762,17 @@ typedef RwBool (*RtWorldImportTerminationBuildCallBack) void *pData); /** - * \ingroup rtimport - * \typedef RtWorldImportPartitionBuildCallBack + * \ingroup rtworldimport + * \ref RtWorldImportPartitionBuildCallBack * * A pointer to the function that will be called during the * build process to select a suitable sector partition. + * + * \param buildSector + * \param buildStatus + * \param partition + * + * \return */ typedef RwReal (*RtWorldImportPartitionBuildCallBack) (RtWorldImportBuildSector *buildSector, @@ -717,15 +780,13 @@ typedef RwReal (*RtWorldImportPartitionBuildCallBack) RtWorldImportPartition *partition, void *pData); -/** - * \ingroup rtimport - * \typedef RtWorldImportBuildCallBacks - * +/* * typedef for struct \ref RtWorldImportBuildCallBacks */ typedef struct RtWorldImportBuildCallBacks RtWorldImportBuildCallBacks; /* MAYBE: rename to SectorCallBacks ?*/ + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportBuildCallBacks * Sectorization callbacks */ @@ -741,15 +802,13 @@ struct RtWorldImportBuildCallBacks /**< Termination callback user data */ }; -/** - * \ingroup rtimport - * \typedef RtWorldImportUserdataCallBacks - * +/* * typedef for struct \ref RtWorldImportUserdataCallBacks */ typedef struct RtWorldImportUserdataCallBacks RtWorldImportUserdataCallBacks; + /** - * \ingroup rtimport + * \ingroup rtworldimport * \struct RtWorldImportUserdataCallBacks * Bundle of callbacks */ @@ -772,8 +831,8 @@ struct RtWorldImportUserdataCallBacks }; /** - * \ingroup rtimport - * \typedef RtWorldImportBuildPartitionSelector + * \ingroup rtworldimport + * \ref RtWorldImportBuildPartitionSelector * * An enumeration that can be passed to * \ref RtWorldImportSetStandardBuildPartitionSelector to determine @@ -821,8 +880,6 @@ extern "C" extern RwBool _rtImportBuildSectorFindBBox(RtWorldImportBuildSector *buildSector, RwBBox *bbpOut); -/* TODO: decide where these scheme functions are going and which ones are public and - whether _rt or RT should be used */ extern void _rtWorldImportGuideKDCopy(RtWorldImportGuideKDTree *KD, RpSector *spSector, RwInt32 depth); extern void _rtWorldImportGuideKDStackDestroy(_rtWorldImportGuideKDStack *stack); @@ -862,6 +919,12 @@ RtWorldImportMaterialSeparatePartitionSelector(RtWorldImportBuildSector *buildSe RtWorldImportBuildStatus *buildStatus, RtWorldImportPartition *partition, void *userData); +extern RwReal +RtWorldImportPartitionHintPartitionSelector(RtWorldImportBuildSector *buildSector, + RtWorldImportBuildStatus *buildStatus, + RtWorldImportPartition *partition, + void * __RWUNUSED__ userData); + extern RwReal RtWorldImportMaximumOccluderPartitionSelector(RtWorldImportBuildSector *buildSector, @@ -1109,14 +1172,13 @@ RtWorldImportSectorAspectSizePartitionTerminator(RtWorldImportBuildSector * buil -/* END TODO */ /* WorldImport hints */ extern void -RtWorldImportHintsSet(RtWorldImportHints *hints); +RtWorldImportHintsSetGroup(RtWorldImportHints *hints, RtWorldImportHintGroup group); extern RtWorldImportHints * -RtWorldImportHintsGet(void); +RtWorldImportHintsGetGroup(RtWorldImportHintGroup group); extern RtWorldImportHints * RtWorldImportHintsCreate(void); @@ -1175,14 +1237,6 @@ extern RwInt32 RtWorldImportGetNumTriangles(RtWorldImport * nohsworld); extern RtWorldImportTriangle * RtWorldImportGetTriangles(RtWorldImport * nohsworld); -/* Surface lighting characteristics */ -extern RtWorldImport * -RtWorldImportSetSurfaceProperties(RtWorldImport * world, - RwSurfaceProperties * - surface); - -extern RwSurfaceProperties * -RtWorldImportGetSurfaceProperties(RtWorldImport * world); /* Progress callbacks */ extern void @@ -1254,6 +1308,12 @@ RtWorldImportSetStandardBuildPartitionSelector(RtWorldImportBuildPartitionSelect #define RtWorldImportParametersInitialize(_paramsPtr) \ *(_paramsPtr) = *RtWorldImportParametersInit(); +/* Back compatibility with former hints which only permitted type zero (shield) hints... */ +#define RtWorldImportHintsSet(_hints) \ +RtWorldImportHintsSetGroup(_hints, rtWORLDIMPORTSHIELDHINT); + +#define RtWorldImportHintsGet() \ +RtWorldImportHintsGetGroup(rtWORLDIMPORTSHIELDHINT); #endif /* RTIMPORT_H */ diff --git a/rwsdk/include/d3d8/rtimport.rpe b/rwsdk/include/d3d8/rtimport.rpe index d4b7ad2b..ff8d3d5c 100644 --- a/rwsdk/include/d3d8/rtimport.rpe +++ b/rwsdk/include/d3d8/rtimport.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionNoHSWorld { diff --git a/rwsdk/include/d3d8/rtintel.h b/rwsdk/include/d3d8/rtintel.h deleted file mode 100644 index c11329df..00000000 --- a/rwsdk/include/d3d8/rtintel.h +++ /dev/null @@ -1,1206 +0,0 @@ -/** - * Intel specific support toolkit - */ - -/********************************************************************** - * - * File : rtintel.h - * - * Abstract : Intel specific support/emulation - * - ********************************************************************** - * - * This file is a product of Criterion Software Ltd. - * - * This file is provided as is with no warranties of any kind and is - * provided without any obligation on Criterion Software Ltd. or - * Canon Inc. to assist in its use or modification. - * - * Criterion Software Ltd. will not, under any - * circumstances, be liable for any lost revenue or other damages arising - * from the use of this file. - * - * Copyright (c) 1998 Criterion Software Ltd. - * All Rights Reserved. - * - * RenderWare is a trademark of Canon Inc. - * - ************************************************************************/ - -#ifndef RTINTEL_H -#define RTINTEL_H - -/** - * \defgroup rtintel RtIntel - * \ingroup rttool - * - * Intel CPU Toolkit for RenderWare. - */ - -/**************************************************************************** - Include files - */ - -/* - * Pick up - * typedef struct _rwResEntryTag RwResEntry; - * from baresour.h (internal) / rwcore.h (external) - */ - -/**************************************************************************** - Global Types - */ - -#include "rtintel.rpe" /* automatically generated header file */ - -#if (!defined(RW_FIXED_64)) -typedef struct RwFixed64 RwFixed64; -struct RwFixed64 -{ - RwInt32 msb; - RwUInt32 lsb; -}; - -#define RW_FIXED_64 -#endif /* (!defined(RW_FIXED_64)) */ - -#define doubleFromRwFixed64(x) \ - ( ((double)((x).msb))*((double)(1<<16))*((double)(1<<16)) \ - + ((double)((x).lsb)) ) - -#if (!defined(RPINTELTIMEFUNCTION)) -typedef RwBool(*RtIntelTimeFunction) (void *data); - -#define RPINTELTIMEFUNCTION -#endif /* (!defined(RPINTELTIMEFUNCTION)) */ - -typedef struct RtIntelOverload RtIntelOverload; - -typedef void (*RwTransformFunction) (RwResEntry * repEntry); - -struct RtIntelOverload -{ - rwMatrixMultFn MatrixMultiplyFunction; - rwVectorMultFn VectorMultPointFunction; - rwVectorMultFn VectorMultVectorFunction; - RwTransformFunction TransformFunction; -}; - -#if (defined(__ICL)) -#define DEFINED__ICL " __ICL" -#define UNDEFINED__ICL "" -#else /* (defined(__ICL)) */ -#define DEFINED__ICL "" -#define UNDEFINED__ICL " __ICL" -#endif /* (defined(__ICL)) */ - -#if (defined(_MSC_VER)) - -# pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : " "DEFINED " DEFINED__ICL " ; UNDEFINED " UNDEFINED__ICL ) -/* # pragma message (__FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : " "DEFINED " DEFINED__ICL " ; UNDEFINED " UNDEFINED__ICL ) */ -/* # pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : " "DEFINED " DEFINED__ICL " ; UNDEFINED " UNDEFINED__ICL ) */ -#if (! (defined(__ICL) || defined(XBOX_DRVMODEL_H)) ) -#pragma message (__DATE__ " " __TIME__ " " __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : No MMX intrinsics - defaulting to software emulation") -#pragma message (__DATE__ " " __TIME__ " " __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : No SSE intrinsics - defaulting to software emulation") -#pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : No MMX intrinsics - defaulting to software emulation") -#endif /* (! (defined(__ICL) || defined(XBOX_DRVMODEL_H)) ) */ -#endif /* (defined(_MSC_VER)) */ - -/* - * MMX - */ - -#if (defined(__ICL)) - -#if (!defined(MMINTRIN_H)) -#include "mmintrin.h" -#define MMINTRIN_H -#endif /* (!defined(MMINTRIN_H)) */ - -#else /* (defined(__ICL)) */ - -#if (defined(_MSC_VER)) - -#if (!defined(__M64)) -typedef __int64 Rt_m64; - -#define __M64 -#endif /* (!defined(__M64)) */ - -#else /* (defined(_MSC_VER)) -- e.g. __GNUC__ */ - -#if (!defined(__M64)) - -typedef RwInt64 Rt_m64; - -#define __M64 - -#endif /* (!defined(__M64)) */ - -#endif /* (defined(_MSC_VER)) */ - -#endif /* (defined(__ICL)) */ - -/* - * SSE - */ - -/* - * From - * ccomp.pdf - * 12 Intel C/C++ Compiler User's Guide - * for Win32 Systems With Katmai New Instruction Support - * -------------------------------------------------------- - * Functionality Intrinsics Usage - * You need only define one preprocessor symbol and include the header file - * xmmintrin.h in your application to use the following functionality - * intrinsics: - * #define _MM_FUNCTIONALITY - * #include "xmmintrin.h" - * To encourage the compiler to inline the functionality intrinsic functions for - * better performance, consider using the -Qip and -Qipo compiler switches. - */ - -#if (defined(__ICL)) - -/* #define _MM2_FUNCTIONALITY */ - -/* #define _MM_FUNCTIONALITY */ - -/* #define _MM_NO_ABORT */ - -/* #define _MM_NO_ACCURACY */ - -/* #define _MM_NO_ALIGN_CHECK */ - -/* #define _MM_NO_INLINE */ - -/* - * Undefine "or", since this is valid assembler; e.g. in - * SDK10/include/xmm_func.h - * _asm { - * push eax - * fld f - * fstcw saved_cw - * mov eax, saved_cw - * or eax, 3072 - * mov new_cw, eax - * fldcw new_cw - * fistp ret - * fldcw saved_cw - * pop eax - * } - */ - -#if (!defined(XMMINTRIN_H)) -#include "xmmintrin.h" -#define XMMINTRIN_H -#endif /* (!defined(XMMINTRIN_H)) */ - -typedef __m64 Rt_m64; -typedef __m128 Rt_m128; - -#if (450 <= __ICL) -#if (!defined(EMMINTRIN_H)) -#include "emmintrin.h" -#define EMMINTRIN_H -typedef __m128d Rt_m128d; -typedef __m128i Rt_m128i; -#endif /* (!defined(EMMINTRIN_H)) */ -#else /* (450 <= __ICL) */ -typedef __m128 Rt_m128d; -typedef __m128 Rt_m128i; -#endif /* (450 <= __ICL) */ - -/* - * Report SSE options as compiler messages and object file comments - */ - -#ifdef _MM2_FUNCTIONALITY -#define DEFINED__MM2_FUNCTIONALITY " _MM2_FUNCTIONALITY" -#define UNDEFINED__MM2_FUNCTIONALITY "" -#else /* _MM2_FUNCTIONALITY */ -#define DEFINED__MM2_FUNCTIONALITY "" -#define UNDEFINED__MM2_FUNCTIONALITY " _MM2_FUNCTIONALITY" -#endif /* _MM2_FUNCTIONALITY */ - -#ifdef _MM_FUNCTIONALITY -#define DEFINED__MM_FUNCTIONALITY DEFINED__MM2_FUNCTIONALITY ## " _MM_FUNCTIONALITY" -#define UNDEFINED__MM_FUNCTIONALITY UNDEFINED__MM2_FUNCTIONALITY -#else /* _MM_FUNCTIONALITY */ -#define DEFINED__MM_FUNCTIONALITY DEFINED__MM2_FUNCTIONALITY -#define UNDEFINED__MM_FUNCTIONALITY UNDEFINED__MM2_FUNCTIONALITY ## " _MM_FUNCTIONALITY" -#endif /* _MM_FUNCTIONALITY */ - -#ifdef _MM_NO_ABORT -#define DEFINED__MM_NO_ABORT DEFINED__MM_FUNCTIONALITY ## " _MM_NO_ABORT" -#define UNDEFINED__MM_NO_ABORT UNDEFINED__MM_FUNCTIONALITY -#else /* _MM_NO_ABORT */ -#define DEFINED__MM_NO_ABORT DEFINED__MM_FUNCTIONALITY -#define UNDEFINED__MM_NO_ABORT UNDEFINED__MM_FUNCTIONALITY ## " _MM_NO_ABORT" -#endif /* _MM_NO_ABORT */ - -#ifdef _MM_NO_ACCURACY -#define DEFINED__MM_NO_ACCURACY DEFINED__MM_NO_ABORT ## " _MM_NO_ACCURACY" -#define UNDEFINED__MM_NO_ACCURACY UNDEFINED__MM_NO_ABORT -#else /* _MM_NO_ACCURACY */ -#define DEFINED__MM_NO_ACCURACY DEFINED__MM_NO_ABORT -#define UNDEFINED__MM_NO_ACCURACY UNDEFINED__MM_NO_ABORT ## " _MM_NO_ACCURACY" -#endif /* _MM_NO_ACCURACY */ - -#ifdef _MM_NO_ALIGN_CHECK -#define DEFINED__MM_NO_ALIGN_CHECK DEFINED__MM_NO_ACCURACY ## " _MM_NO_ALIGN_CHECK" -#define UNDEFINED__MM_NO_ALIGN_CHECK UNDEFINED__MM_NO_ACCURACY -#else /* _MM_NO_ALIGN_CHECK */ -#define DEFINED__MM_NO_ALIGN_CHECK DEFINED__MM_NO_ACCURACY -#define UNDEFINED__MM_NO_ALIGN_CHECK UNDEFINED__MM_NO_ACCURACY ## " _MM_NO_ALIGN_CHECK" -#endif /* _MM_NO_ALIGN_CHECK */ - -#ifdef _MM_NO_INLINE -#define DEFINED__MM_NO_INLINE DEFINED__MM_NO_ALIGN_CHECK ## " _MM_NO_INLINE" -#define UNDEFINED__MM_NO_INLINE UNDEFINED__MM_NO_ALIGN_CHECK -#else /* _MM_NO_INLINE */ -#define DEFINED__MM_NO_INLINE DEFINED__MM_NO_ALIGN_CHECK -#define UNDEFINED__MM_NO_INLINE UNDEFINED__MM_NO_ALIGN_CHECK ## " _MM_NO_INLINE" -#endif /* _MM_NO_INLINE */ - -#pragma comment ( user, "comment:" __DATE__" " __TIME__ " - " __FILE__ ":" RW_STRINGIFY_EXPANDED(__LINE__) ) -#pragma comment ( user, "comment:" "DEFINED :" DEFINED__MM_NO_INLINE ) -#pragma comment ( user, "comment:" "UNDEFINED:" UNDEFINED__MM_NO_INLINE ) - -#pragma message (__DATE__" " __TIME__ " - " __FILE__ ":" RW_STRINGIFY_EXPANDED(__LINE__) ) -#pragma message ("DEFINED :" DEFINED__MM_NO_INLINE ) -#pragma message ("UNDEFINED:" UNDEFINED__MM_NO_INLINE ) - -#else /* (defined(__ICL)) */ - -#define _MM_HINT_T0 1 -#define _MM_HINT_T1 2 -#define _MM_HINT_T2 3 -#define _MM_HINT_NTA 0 - -#if (defined(__R5900__)) -typedef RwInt128 Rt_m128; -#else /* (defined(__R5900__)) */ -#if (!defined(_PAIR__M64)) -struct Rt_m128 -{ - Rt_m64 lo; - Rt_m64 hi; -}; -#define _PAIR__M64 -typedef struct Rt_m128 Rt_m128; -#endif /* (!defined(_PAIR__M64)) */ -#endif /* (defined(__R5900__)) */ - -typedef Rt_m128 Rt_m128d; -typedef Rt_m128 Rt_m128i; -#endif /* (defined(__ICL)) */ - -typedef struct RtIntelV4d RtIntelV4d; -struct RtIntelV4d -{ - RwReal w; - RwV3d v3d; -}; - -typedef union _RpSSEOverlayM128 RpSSEOverlayM128; - -union _RpSSEOverlayM128 -{ - float _f[4]; - RwInt32 _d[4]; - RwUInt32 ud[4]; - RwInt16 _w[8]; - RwUInt16 uw[8]; - RwInt8 _b[16]; - RwUInt8 ub[16]; - Rt_m64 m64[2]; - Rt_m128 m128; - RtIntelV4d v4d; - RwSplitBits bits[4]; -}; - -typedef RpSSEOverlayM128 RpWNIOverlayM128; - -typedef union _RpWNIOverlayM128d RpWNIOverlayM128d; - -union _RpWNIOverlayM128d -{ - double df[2]; - float _f[4]; - RwInt32 _d[4]; - RwUInt32 ud[4]; - RwInt16 _w[8]; - RwUInt16 uw[8]; - RwInt8 _b[16]; - RwUInt8 ub[16]; - Rt_m64 m64[2]; - Rt_m128d m128d; - RtIntelV4d v4d; - RwSplitBits bits[4]; -}; - -typedef union _RpWNIOverlayM128i RpWNIOverlayM128i; - -union _RpWNIOverlayM128i -{ - double df[2]; - float _f[4]; - RwInt32 _d[4]; - RwUInt32 ud[4]; - RwInt16 _w[8]; - RwUInt16 uw[8]; - RwInt8 _b[16]; - RwUInt8 ub[16]; - Rt_m64 m64[2]; - Rt_m128i m128i; - RtIntelV4d v4d; - RwSplitBits bits[4]; -}; - -#define RWUNALIGNED16BYTE(ptr) (0x0000000FUL & ((RwUInt32)(ptr))) - -/*--- Plugin API Functions ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* - * MMX - */ - -/* General support intrinsics */ -extern void Rt_m_empty(void); -extern Rt_m64 Rt_m_from_int(int i); -extern int Rt_m_to_int(Rt_m64 m); -extern Rt_m64 Rt_m_packsswb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_packssdw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_packuswb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_punpckhbw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_punpckhwd(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_punpckhdq(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_punpcklbw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_punpcklwd(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_punpckldq(Rt_m64 m1, Rt_m64 m2); - -/* Packed arithmetic intrinsics */ -extern Rt_m64 Rt_m_paddb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_paddw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_paddd(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_paddsb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_paddsw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_paddusb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_paddusw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubd(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubsb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubsw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubusb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_psubusw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pmaddwd(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pmulhw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pmullw(Rt_m64 m1, Rt_m64 m2); - -/* Shift intrinsics */ -extern Rt_m64 Rt_m_psllw(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psllwi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_pslld(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_pslldi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_psllq(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psllqi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_psraw(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psrawi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_psrad(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psradi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_psrlw(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psrlwi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_psrld(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psrldi(Rt_m64 m, int count); -extern Rt_m64 Rt_m_psrlq(Rt_m64 m, Rt_m64 count); -extern Rt_m64 Rt_m_psrlqi(Rt_m64 m, int count); - -/* Logical intrinsics */ -extern Rt_m64 Rt_m_pand(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pandn(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_por(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pxor(Rt_m64 m1, Rt_m64 m2); - -/* Comparision intrinsics */ -extern Rt_m64 Rt_m_pcmpeqb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pcmpeqw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pcmpeqd(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pcmpgtb(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pcmpgtw(Rt_m64 m1, Rt_m64 m2); -extern Rt_m64 Rt_m_pcmpgtd(Rt_m64 m1, Rt_m64 m2); - -/* - * SSE - */ - -/* - * Arithmetic Operations - */ - -extern Rt_m128 Rt_mm_add_ss(Rt_m128 a, Rt_m128 b) /* ADDSS */ ; -extern Rt_m128 Rt_mm_add_ps(Rt_m128 a, Rt_m128 b) /* ADDPS */ ; -extern Rt_m128 Rt_mm_sub_ss(Rt_m128 a, Rt_m128 b) /* SUBSS */ ; -extern Rt_m128 Rt_mm_sub_ps(Rt_m128 a, Rt_m128 b) /* SUBPS */ ; -extern Rt_m128 Rt_mm_mul_ss(Rt_m128 a, Rt_m128 b) /* MULSS */ ; -extern Rt_m128 Rt_mm_mul_ps(Rt_m128 a, Rt_m128 b) /* MULPS */ ; -extern Rt_m128 Rt_mm_div_ss(Rt_m128 a, Rt_m128 b) /* DIVSS */ ; -extern Rt_m128 Rt_mm_div_ps(Rt_m128 a, Rt_m128 b) /* DIVPS */ ; -extern Rt_m128 Rt_mm_sqrt_ss(Rt_m128 a) /* SQRTSS */ ; -extern Rt_m128 Rt_mm_sqrt_ps(Rt_m128 a) /* SQRTPS */ ; -extern Rt_m128 Rt_mm_rcp_ss(Rt_m128 a) /* RCPSS */ ; -extern Rt_m128 Rt_mm_rcp_ps(Rt_m128 a) /* RCPPS */ ; -extern Rt_m128 Rt_mm_rsqrt_ss(Rt_m128 a) /* RSQRTSS */ ; -extern Rt_m128 Rt_mm_rsqrt_ps(Rt_m128 a) /* RSQRTPS */ ; -extern Rt_m128 Rt_mm_min_ss(Rt_m128 a, Rt_m128 b) /* MINSS */ ; -extern Rt_m128 Rt_mm_min_ps(Rt_m128 a, Rt_m128 b) /* MINPS */ ; -extern Rt_m128 Rt_mm_max_ss(Rt_m128 a, Rt_m128 b) /* MAXSS */ ; -extern Rt_m128 Rt_mm_max_ps(Rt_m128 a, Rt_m128 b) /* MAXPS */ ; - -/* - * Logical Operations - */ - -extern Rt_m128 Rt_mm_and_ps(Rt_m128 a, Rt_m128 b) /* ANDPS */ ; -extern Rt_m128 Rt_mm_andnot_ps(Rt_m128 a, - Rt_m128 b) /* ANDNPS */ ; -extern Rt_m128 Rt_mm_or_ps(Rt_m128 a, Rt_m128 b) /* ORPS */ ; -extern Rt_m128 Rt_mm_xor_ps(Rt_m128 a, Rt_m128 b) /* XORPS */ ; - -/* - * Comparisons - */ - -extern Rt_m128 Rt_mm_cmpeq_ss(Rt_m128 a, - Rt_m128 b) /* CMPEQSS */ ; -extern Rt_m128 Rt_mm_cmpeq_ps(Rt_m128 a, - Rt_m128 b) /* CMPEQPS */ ; -extern Rt_m128 Rt_mm_cmplt_ss(Rt_m128 a, - Rt_m128 b) /* CMPLTSS */ ; -extern Rt_m128 Rt_mm_cmplt_ps(Rt_m128 a, - Rt_m128 b) /* CMPLTPS */ ; -extern Rt_m128 Rt_mm_cmple_ss(Rt_m128 a, - Rt_m128 b) /* CMPLESS */ ; -extern Rt_m128 Rt_mm_cmple_ps(Rt_m128 a, - Rt_m128 b) /* CMPLEPS */ ; -extern Rt_m128 Rt_mm_cmpgt_ss(Rt_m128 a, Rt_m128 b) /* CMPLTSS r */ - ; -extern Rt_m128 Rt_mm_cmpgt_ps(Rt_m128 a, Rt_m128 b) /* CMPLTPS r */ - ; -extern Rt_m128 Rt_mm_cmpge_ss(Rt_m128 a, Rt_m128 b) /* CMPLESS r */ - ; -extern Rt_m128 Rt_mm_cmpge_ps(Rt_m128 a, Rt_m128 b) /* CMPLEPS r */ - ; -extern Rt_m128 Rt_mm_cmpneq_ss(Rt_m128 a, - Rt_m128 b) /* CMPNEQSS */ ; -extern Rt_m128 Rt_mm_cmpneq_ps(Rt_m128 a, - Rt_m128 b) /* CMPNEQPS */ ; -extern Rt_m128 Rt_mm_cmpnlt_ss(Rt_m128 a, - Rt_m128 b) /* CMPNLTSS */ ; -extern Rt_m128 Rt_mm_cmpnlt_ps(Rt_m128 a, - Rt_m128 b) /* CMPNLTPS */ ; -extern Rt_m128 Rt_mm_cmpnle_ss(Rt_m128 a, - Rt_m128 b) /* CMPNLESS */ ; -extern Rt_m128 Rt_mm_cmpnle_ps(Rt_m128 a, - Rt_m128 b) /* CMPNLEPS */ ; -extern Rt_m128 Rt_mm_cmpngt_ss(Rt_m128 a, Rt_m128 b) - /* CMPNLTSS r */ ; -extern Rt_m128 Rt_mm_cmpngt_ps(Rt_m128 a, Rt_m128 b) - /* CMPNLTPS r */ ; -extern Rt_m128 Rt_mm_cmpnge_ss(Rt_m128 a, Rt_m128 b) - /* CMPNLESS r */ ; -extern Rt_m128 Rt_mm_cmpnge_ps(Rt_m128 a, Rt_m128 b) - /* CMPNLEPS r */ ; -extern Rt_m128 Rt_mm_cmpord_ss(Rt_m128 a, - Rt_m128 b) /* CMPORDSS */ ; -extern Rt_m128 Rt_mm_cmpord_ps(Rt_m128 a, - Rt_m128 b) /* CMPORDPS */ ; -extern Rt_m128 Rt_mm_cmpunord_ss(Rt_m128 a, - Rt_m128 b) /* CMPUNORDSS */ ; -extern Rt_m128 Rt_mm_cmpunord_ps(Rt_m128 a, - Rt_m128 b) /* CMPUNORDPS */ ; -extern int Rt_mm_comieq_ss(Rt_m128 a, - Rt_m128 b) /* COMISS */ ; -extern int Rt_mm_comilt_ss(Rt_m128 a, - Rt_m128 b) /* COMISS */ ; -extern int Rt_mm_comile_ss(Rt_m128 a, - Rt_m128 b) /* COMISS */ ; -extern int Rt_mm_comigt_ss(Rt_m128 a, - Rt_m128 b) /* COMISS */ ; -extern int Rt_mm_comige_ss(Rt_m128 a, - Rt_m128 b) /* COMISS */ ; -extern int Rt_mm_comineq_ss(Rt_m128 a, - Rt_m128 b) /* COMISS */ ; -extern int Rt_mm_ucomieq_ss(Rt_m128 a, - Rt_m128 b) /* UCOMISS */ ; -extern int Rt_mm_ucomilt_ss(Rt_m128 a, - Rt_m128 b) /* UCOMISS */ ; -extern int Rt_mm_ucomile_ss(Rt_m128 a, - Rt_m128 b) /* UCOMISS */ ; -extern int Rt_mm_ucomigt_ss(Rt_m128 a, - Rt_m128 b) /* UCOMISS */ ; -extern int Rt_mm_ucomige_ss(Rt_m128 a, - Rt_m128 b) /* UCOMISS */ ; -extern int Rt_mm_ucomineq_ss(Rt_m128 a, - Rt_m128 b) /* UCOMISS */ ; - -/* - * Conversion Operations - */ - -extern int Rt_mm_cvt_ss2si(Rt_m128 a) /* CVTSS2SI */ ; -extern Rt_m64 Rt_mm_cvt_ps2pi(Rt_m128 a) /* CVTPS2PI */ ; -extern int Rt_mm_cvtt_ss2si(Rt_m128 a) /* CVTTSS2SI */ ; -extern Rt_m64 Rt_mm_cvtt_ps2pi(Rt_m128 a) /* CVTTPS2PI */ ; -extern Rt_m128 Rt_mm_cvt_si2ss(Rt_m128 a, - int b) /* CVTSI2SS */ ; -extern Rt_m128 Rt_mm_cvt_pi2ps(Rt_m128 a, - Rt_m64 b) /* CVTPI2PS */ ; - -/* - * Miscellaneous - */ - -extern Rt_m128 Rt_mm_shuffle_ps(Rt_m128 a, Rt_m128 b, - int i) /* SHUFPS */ ; -extern Rt_m128 Rt_mm_unpackhi_ps(Rt_m128 a, - Rt_m128 b) /* UNPCKHPS */ ; -extern Rt_m128 Rt_mm_unpacklo_ps(Rt_m128 a, - Rt_m128 b) /* UNPCKLPS */ ; -extern Rt_m128 Rt_mm_loadh_pi(Rt_m128 a, Rt_m64 * p) /* MOVHPS reg, mem */ - ; -extern void Rt_mm_storeh_pi(Rt_m64 * p, Rt_m128 a) /* MOVHPS mem, reg */ - ; -extern Rt_m128 Rt_mm_movehl_ps(Rt_m128 a, - Rt_m128 b) /* MOVHLPS */ ; -extern Rt_m128 Rt_mm_movelh_ps(Rt_m128 a, - Rt_m128 b) /* MOVLHPS */ ; -extern Rt_m128 Rt_mm_loadl_pi(Rt_m128 a, Rt_m64 * p) - /* MOVLPS reg, mem */ ; -extern void Rt_mm_storel_pi(Rt_m64 * p, Rt_m128 a) /* MOVLPS mem, reg */ - ; -extern int Rt_mm_movemask_ps(Rt_m128 a) /* MOVMSKPS */ ; -extern unsigned int Rt_mm_getcsr(void) /* STMXCSR */ ; -extern void Rt_mm_setcsr(unsigned int i) /* LDMXCSR */ ; - -/* - * Load Operations - */ - -extern Rt_m128 Rt_mm_load_ss(float *p) /* MOVSS */ ; -extern Rt_m128 Rt_mm_load_ps1(float *p) /* MOVSS + shuffling */ - ; -extern Rt_m128 Rt_mm_load_ps(float *p) /* MOVAPS */ ; -extern Rt_m128 Rt_mm_loadu_ps(float *p) /* MOVUPS */ ; -extern Rt_m128 Rt_mm_loadr_ps(float *p) - /* MOVAPS + shuffling */ ; - -/* - * Set Operations - */ - -extern Rt_m128 Rt_mm_set_ss(float w) /* (composite) */ ; -extern Rt_m128 Rt_mm_set_ps1(float w) /* (composite) */ ; -extern Rt_m128 Rt_mm_set_ps(float z, float y, float x, - float w) /* (composite) */ ; -extern Rt_m128 Rt_mm_setr_ps(float z, float y, float x, - float w) /* (composite) */ ; -extern Rt_m128 Rt_mm_setzero_ps(void) /* (composite) */ ; - -/* - * Store Operations - */ - -extern void Rt_mm_store_ss(float *p, - Rt_m128 a) /* MOVSS */ ; -extern void Rt_mm_store_ps1(float *p, Rt_m128 a) - /* MOVSS + shuffling */ ; -extern void Rt_mm_store_ps(float *p, - Rt_m128 a) /* MOVAPS */ ; -extern void Rt_mm_storeu_ps(float *p, - Rt_m128 a) /* MOVUPS */ ; -extern void Rt_mm_storer_ps(float *p, Rt_m128 a) - /* MOVAPS + shuffling */ ; -extern Rt_m128 Rt_mm_move_ss(Rt_m128 a, - Rt_m128 b) /* MOVSS */ ; - -/* - * Integer Intrinsics - */ - -extern int Rt_m_pextrw(Rt_m64 a, int n) /* PEXTRW */ ; -extern Rt_m64 Rt_m_pinsrw(Rt_m64 a, int d, - int n) /* PINSRW */ ; -extern Rt_m64 Rt_m_pmaxsw(Rt_m64 a, Rt_m64 b) /* PMAXSW */ ; -extern Rt_m64 Rt_m_pmaxub(Rt_m64 a, Rt_m64 b) /* PMAXUB */ ; -extern Rt_m64 Rt_m_pminsw(Rt_m64 a, Rt_m64 b) /* PMINSW */ ; -extern Rt_m64 Rt_m_pminub(Rt_m64 a, Rt_m64 b) /* PMINUB */ ; -extern int Rt_m_pmovmskb(Rt_m64 a) /* PMOVMSKB */ ; -extern Rt_m64 Rt_m_pmulhuw(Rt_m64 a, Rt_m64 b) /* PMULHUW */ ; -extern Rt_m64 Rt_m_pshufw(Rt_m64 a, int n) /* PSHUFW */ ; -extern void Rt_m_lwmaskmovq(Rt_m64 d, Rt_m64 n, - char *p) /* MASKMOVQ */ ; - -/* - * Cacheability Support - */ - -extern void Rt_mm_prefetch(char *p, int i) /* PREFETCH */ ; -extern void Rt_mm_stream_pi(Rt_m64 * p, - Rt_m64 a) /* MOVNTQ */ ; -extern void Rt_mm_stream_ps(float *p, - Rt_m128 a) /* MOVNTPS */ ; -extern void Rt_mm_sfence(void) /* SFENCE */ ; - -/* - * WNI - */ - -/* Arithmetic Operations */ - -extern Rt_m128d Rt_mm_add_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_add_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_div_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_div_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_max_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_max_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_min_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_min_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_mul_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_mul_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_sqrt_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_sqrt_pd(Rt_m128d a); -extern Rt_m128d Rt_mm_sub_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_sub_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_andnot_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_and_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_or_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_xor_pd(Rt_m128d a, Rt_m128d b); - -/* Comparisons */ - -extern Rt_m128d Rt_mm_cmpeq_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmplt_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmple_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpgt_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpge_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpord_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpunord_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpneq_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpnlt_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpnle_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpngt_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpnge_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpeq_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmplt_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmple_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpgt_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpge_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpord_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpunord_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpneq_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpnlt_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpnle_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpngt_sd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_cmpnge_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_comieq_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_comilt_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_comile_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_comigt_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_comige_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_comineq_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_ucomieq_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_ucomilt_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_ucomile_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_ucomigt_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_ucomige_sd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_ucomineq_sd(Rt_m128d a, Rt_m128d b); - -/* Conversion Operations */ - -extern Rt_m128 Rt_mm_cvtpd_ps(Rt_m128d a); -extern Rt_m128d Rt_mm_cvtps_pd(Rt_m128 a); -extern Rt_m128d Rt_mm_cvtepi32_pd(Rt_m128i a); -extern Rt_m128i Rt_mm_cvtpd_epi32(Rt_m128d a); -extern int Rt_mm_cvtsd_si32(Rt_m128d a); -extern Rt_m128 Rt_mm_cvtsd_ss(Rt_m128 a, Rt_m128d b); -extern Rt_m128d Rt_mm_cvtsi32_sd(Rt_m128d a, int b); -extern Rt_m128d Rt_mm_cvtss_sd(Rt_m128d a, Rt_m128 b); -extern Rt_m128i Rt_mm_cvttpd_epi32(Rt_m128d a); -extern int Rt_mm_cvttsd_si32(Rt_m128d a); -extern Rt_m128 Rt_mm_cvtepi32_ps(Rt_m128i a); -extern Rt_m128i Rt_mm_cvtps_epi32(Rt_m128 a); -extern Rt_m128i Rt_mm_cvttps_epi32(Rt_m128 a); -extern Rt_m64 Rt_mm_cvtpd_pi32(Rt_m128d a); -extern Rt_m64 Rt_mm_cvttpd_pi32(Rt_m128d a); -extern Rt_m128d Rt_mm_cvtpi32_pd(Rt_m64 a); - -/* Miscellaneous Operations */ - -extern Rt_m128d Rt_mm_unpackhi_pd(Rt_m128d a, Rt_m128d b); -extern Rt_m128d Rt_mm_unpacklo_pd(Rt_m128d a, Rt_m128d b); -extern int Rt_mm_movemask_pd(Rt_m128d a); -extern Rt_m128d Rt_mm_shuffle_pd(Rt_m128d a, Rt_m128d b, int i); -extern Rt_m128d Rt_mm_load_pd(const double *p); -extern Rt_m128d Rt_mm_load1_pd(const double *p); -extern Rt_m128d Rt_mm_loadr_pd(const double *p); -extern Rt_m128d Rt_mm_loadu_pd(const double *p); -extern Rt_m128d Rt_mm_load_sd(const double *p); -extern Rt_m128d Rt_mm_loadh_pd(Rt_m128d a, const double *p); -extern Rt_m128d Rt_mm_loadl_pd(Rt_m128d a, const double *p); -extern Rt_m128d Rt_mm_set_sd(double w); -extern Rt_m128d Rt_mm_set1_pd(double w); -extern Rt_m128d Rt_mm_set_pd(double w, double x); -extern Rt_m128d Rt_mm_setr_pd(double w, double x); -extern Rt_m128d Rt_mm_setzero_pd(void); -extern Rt_m128d Rt_mm_move_sd(Rt_m128d a, Rt_m128d b); -extern void Rt_mm_stream_pd(double *p, Rt_m128d a); -extern void Rt_mm_store_sd(double *p, Rt_m128d a); -extern void Rt_mm_store1_pd(double *p, Rt_m128d a); -extern void Rt_mm_store_pd(double *p, Rt_m128d a); -extern void Rt_mm_storeu_pd(double *p, Rt_m128d a); -extern void Rt_mm_storer_pd(double *p, Rt_m128d a); -extern void Rt_mm_storeh_pd(double *p, Rt_m128d a); -extern void Rt_mm_storel_pd(double *p, Rt_m128d a); -extern Rt_m128i Rt_mm_add_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_add_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_add_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m64 Rt_mm_add_si64(Rt_m64 a, Rt_m64 b); -extern Rt_m128i Rt_mm_add_epi64(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_adds_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_adds_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_adds_epu8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_adds_epu16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_avg_epu8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_avg_epu16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_madd_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_max_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_max_epu8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_min_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_min_epu8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_mulhi_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_mulhi_epu16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_mullo_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m64 Rt_mm_mul_su32(Rt_m64 a, Rt_m64 b); -extern Rt_m128i Rt_mm_mul_epu32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_sad_epu8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_sub_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_sub_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_sub_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m64 Rt_mm_sub_si64(Rt_m64 a, Rt_m64 b); -extern Rt_m128i Rt_mm_sub_epi64(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_subs_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_subs_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_subs_epu8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_subs_epu16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_and_si128(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_andnot_si128(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_or_si128(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_xor_si128(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_slli_si128(Rt_m128i a, int imm); -extern Rt_m128i Rt_mm_slli_epi16(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_sll_epi16(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_slli_epi32(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_sll_epi32(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_slli_epi64(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_sll_epi64(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_srai_epi16(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_sra_epi16(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_srai_epi32(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_sra_epi32(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_srli_si128(Rt_m128i a, int imm); -extern Rt_m128i Rt_mm_srli_epi16(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_srl_epi16(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_srli_epi32(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_srl_epi32(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_srli_epi64(Rt_m128i a, int count); -extern Rt_m128i Rt_mm_srl_epi64(Rt_m128i a, Rt_m128i count); -extern Rt_m128i Rt_mm_cmpeq_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmpeq_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmpeq_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmpgt_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmpgt_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmpgt_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmplt_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmplt_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cmplt_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_cvtsi32_si128(int a); -extern int Rt_mm_cvtsi128_si32(Rt_m128i a); - -/* Miscellaneous Operations */ - -extern Rt_m64 Rt_mm_movepi64_pi64(Rt_m128i a); -extern Rt_m128i Rt_mm_movpi64_epi64(Rt_m64 a); -extern Rt_m128i Rt_mm_move_epi64(Rt_m128i a); -extern Rt_m128i Rt_mm_packs_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_packs_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_packus_epi16(Rt_m128i a, Rt_m128i b); -extern int Rt_mm_extract_epi16(Rt_m128i a, int imm); -extern Rt_m128i Rt_mm_insert_epi16(Rt_m128i a, int b, int imm); -extern int Rt_mm_movemask_epi8(Rt_m128i a); -extern Rt_m128i Rt_mm_shuffle_epi32(Rt_m128i a, int imm); -extern Rt_m128i Rt_mm_shufflehi_epi16(Rt_m128i a, int imm); -extern Rt_m128i Rt_mm_shufflelo_epi16(Rt_m128i a, int imm); -extern Rt_m128i Rt_mm_unpackhi_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpackhi_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpackhi_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpackhi_epi64(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpacklo_epi8(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpacklo_epi16(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpacklo_epi32(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_unpacklo_epi64(Rt_m128i a, Rt_m128i b); -extern Rt_m128i Rt_mm_loadl_epi64(Rt_m128i const *p); -extern Rt_m128i Rt_mm_load_si128(const Rt_m128i * p); -extern Rt_m128i Rt_mm_loadu_si128(const Rt_m128i * p); -extern Rt_m128i Rt_mm_set_epi64(Rt_m64 q1, Rt_m64 q0); -extern Rt_m128i Rt_mm_set_epi32(int i3, int i2, int i1, int i0); -extern Rt_m128i - Rt_mm_set_epi16(short w7, short w6, - short w5, short w4, short w3, short w2, - short w1, short w0); -extern Rt_m128i Rt_mm_set_epi8(char b15, char b14, - char b13, char b12, - char b11, char b10, - char b9, char b8, - char b7, char b6, - char b5, char b4, - char b3, char b2, - char b1, char b0); -extern Rt_m128i Rt_mm_set1_epi64(Rt_m64 q); -extern Rt_m128i Rt_mm_set1_epi32(int i); -extern Rt_m128i Rt_mm_set1_epi16(short w); -extern Rt_m128i Rt_mm_set1_epi8(char b); -extern Rt_m128i Rt_mm_setr_epi64(Rt_m64 q0, Rt_m64 q1); -extern Rt_m128i Rt_mm_setr_epi32(int i0, int i1, int i2, - int i3); -extern Rt_m128i Rt_mm_setr_epi16(short w0, short w1, - short w2, short w3, - short w4, short w5, - short w6, short w7); -extern Rt_m128i Rt_mm_setr_epi8(char b0, char b1, - char b2, char b3, - char b4, char b5, - char b6, char b7, - char b8, char b9, - char b10, char b11, - char b12, char b13, - char b14, char b15); -extern Rt_m128i Rt_mm_setzero_si128(void); - -/* Store Operations */ - -extern void Rt_mm_store_si128(Rt_m128i * p, Rt_m128i a); -extern void Rt_mm_storeu_si128(Rt_m128i * p, Rt_m128i a); -extern void Rt_mm_maskmoveu_si128(Rt_m128i s, Rt_m128i n, - char *p); -extern void Rt_mm_storel_epi64(Rt_m128i * p, Rt_m128i a); -extern void Rt_mm_stream_si128(Rt_m128i * p, Rt_m128i a); -extern void Rt_mm_stream_si32(int *p, int a); -extern void Rt_mm_clflush(void const *p); -extern void Rt_mm_lfence(void); -extern void Rt_mm_mfence(void); - -/* - * API - */ -extern RwUInt32 RtIntelRDTSC(void); -extern RwUInt32 RtIntelToggleEFLAGS(int mask); -extern RwUInt32 RtIntelCPUID(RwUInt32 level, - void *pb, void *pc, void *pd); -extern RwUInt32 RtIntelHaveCPUID(void); -extern RwUInt32 RtIntelHaveRDTSC(void); -extern RwUInt32 RtIntelHaveMMX(void); -extern RwUInt32 RtIntelHaveSSE(void); -extern RwUInt32 RtIntelHaveWNI(void); -extern RwUInt32 RtIntelCpuType(void); - -extern RwBool RtIntelStartTiming(void * data); -extern RwBool RtIntelStopTiming(void *data); -extern RwBool RtIntelTime(RwFixed64 * result, - RtIntelTimeFunction func, - void *data); - -extern RwBool RtIntelPluginAttach(void); - -extern RtIntelOverload *_rtIntelOverloadGetHandle(void); - -extern RxNodeDefinition *RxNodeDefinitionGetSSETransformCSL(void); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/* - * LEGACY-SUPPORT -- e.g. - * rwsdk/driver/d3d/baintd3d.c - * is locked at time of writing - */ - -#define RpIntelRDTSC() RtIntelRDTSC() -#define RpIntelToggleEFLAGS(_mask) RtIntelToggleEFLAGS(_mask) -#define RpIntelCPUID(_level, _pb, _pc, _pd) \ - RtIntelCPUID(_level, _pb, _pc, _pd) -#define RpIntelHaveCPUID() RtIntelHaveCPUID() -#define RpIntelHaveRDTSC() RtIntelHaveRDTSC() -#define RpIntelHaveMMX() RtIntelHaveMMX() -#define RpIntelHaveSSE() RtIntelHaveSSE() -#define RpIntelHaveWNI() RtIntelHaveWNI() -#define RpIntelCpuType() RtIntelCpuType() -#define RpIntelStartTiming(_data) RtIntelStartTiming(_data) -#define RpIntelStopTiming(_data) RtIntelStopTiming(_data) -#define RpIntelTime(_result, _func, _data) \ - RtIntelTime(_result, _func, _data) -#define RpIntelPluginAttach() RtIntelPluginAttach() -#define RpNodeDefinitionGetSSETransformCSL() \ - RxNodeDefinitionGetSSETransformCSL() - -typedef RtIntelOverload RwIntelOverload; -typedef RtIntelOverload RpIntelOverload; - -#define _rwIntelOverloadGetHandle() _rtIntelOverloadGetHandle() -#define _rpIntelOverloadGetHandle() _rtIntelOverloadGetHandle() -#define RwIntelHaveSSE() RtIntelHaveSSE() -#define RpIntelHaveSSE() RtIntelHaveSSE() - -#if (defined(RWEMULATEINTELSIMD) || !defined(__ICL)) - -/* - * MMX - */ - -/* General support intrinsics */ -#define _m_empty() Rt_m_empty() -#define _m_from_int(i) Rt_m_from_int(i) -#define _m_to_int(m) Rt_m_to_int(m) -#define _m_packsswb(m1, m2) Rt_m_packsswb(m1, m2) -#define _m_packssdw(m1, m2) Rt_m_packssdw(m1, m2) -#define _m_packuswb(m1, m2) Rt_m_packuswb(m1, m2) -#define _m_punpckhbw(m1, m2) Rt_m_punpckhbw(m1, m2) -#define _m_punpckhwd(m1, m2) Rt_m_punpckhwd(m1, m2) -#define _m_punpckhdq(m1, m2) Rt_m_punpckhdq(m1, m2) -#define _m_punpcklbw(m1, m2) Rt_m_punpcklbw(m1, m2) -#define _m_punpcklwd(m1, m2) Rt_m_punpcklwd(m1, m2) -#define _m_punpckldq(m1, m2) Rt_m_punpckldq(m1, m2) - -/* Packed arithmetic intrinsics */ -#define _m_paddb(m1, m2) Rt_m_paddb(m1, m2) -#define _m_paddw(m1, m2) Rt_m_paddw(m1, m2) -#define _m_paddd(m1, m2) Rt_m_paddd(m1, m2) -#define _m_paddsb(m1, m2) Rt_m_paddsb(m1, m2) -#define _m_paddsw(m1, m2) Rt_m_paddsw(m1, m2) -#define _m_paddusb(m1, m2) Rt_m_paddusb(m1, m2) -#define _m_paddusw(m1, m2) Rt_m_paddusw(m1, m2) -#define _m_psubb(m1, m2) Rt_m_psubb(m1, m2) -#define _m_psubw(m1, m2) Rt_m_psubw(m1, m2) -#define _m_psubd(m1, m2) Rt_m_psubd(m1, m2) -#define _m_psubsb(m1, m2) Rt_m_psubsb(m1, m2) -#define _m_psubsw(m1, m2) Rt_m_psubsw(m1, m2) -#define _m_psubusb(m1, m2) Rt_m_psubusb(m1, m2) -#define _m_psubusw(m1, m2) Rt_m_psubusw(m1, m2) -#define _m_pmaddwd(m1, m2) Rt_m_pmaddwd(m1, m2) -#define _m_pmulhw(m1, m2) Rt_m_pmulhw(m1, m2) -#define _m_pmullw(m1, m2) Rt_m_pmullw(m1, m2) - -/* Shift intrinsics */ -#define _m_psllw(m, count) Rt_m_psllw(m, count) -#define _m_psllwi(m, count) Rt_m_psllwi(m, count) -#define _m_pslld(m, count) Rt_m_pslld(m, count) -#define _m_pslldi(m, count) Rt_m_pslldi(m, count) -#define _m_psllq(m, count) Rt_m_psllq(m, count) -#define _m_psllqi(m, count) Rt_m_psllqi(m, count) -#define _m_psraw(m, count) Rt_m_psraw(m, count) -#define _m_psrawi(m, count) Rt_m_psrawi(m, count) -#define _m_psrad(m, count) Rt_m_psrad(m, count) -#define _m_psradi(m, count) Rt_m_psradi(m, count) -#define _m_psrlw(m, count) Rt_m_psrlw(m, count) -#define _m_psrlwi(m, count) Rt_m_psrlwi(m, count) -#define _m_psrld(m, count) Rt_m_psrld(m, count) -#define _m_psrldi(m, count) Rt_m_psrldi(m, count) -#define _m_psrlq(m, count) Rt_m_psrlq(m, count) -#define _m_psrlqi(m, count) Rt_m_psrlqi(m, count) - -/* Logical intrinsics */ -#define _m_pand(m1, m2) Rt_m_pand(m1, m2) -#define _m_pandn(m1, m2) Rt_m_pandn(m1, m2) -#define _m_por(m1, m2) Rt_m_por(m1, m2) -#define _m_pxor(m1, m2) Rt_m_pxor(m1, m2) - -/* Comparison intrinsics */ -#define _m_pcmpeqb(m1, m2) Rt_m_pcmpeqb(m1, m2) -#define _m_pcmpeqw(m1, m2) Rt_m_pcmpeqw(m1, m2) -#define _m_pcmpeqd(m1, m2) Rt_m_pcmpeqd(m1, m2) -#define _m_pcmpgtb(m1, m2) Rt_m_pcmpgtb(m1, m2) -#define _m_pcmpgtw(m1, m2) Rt_m_pcmpgtw(m1, m2) -#define _m_pcmpgtd(m1, m2) Rt_m_pcmpgtd(m1, m2) - -/* - * SSE - */ - -/* - * Arithmetic Operations - */ - -#define _mm_add_ss(a, b) Rt_mm_add_ss(a, b) -#define _mm_add_ps(a, b) Rt_mm_add_ps(a, b) -#define _mm_sub_ss(a, b) Rt_mm_sub_ss(a, b) -#define _mm_sub_ps(a, b) Rt_mm_sub_ps(a, b) -#define _mm_mul_ss(a, b) Rt_mm_mul_ss(a, b) -#define _mm_mul_ps(a, b) Rt_mm_mul_ps(a, b) -#define _mm_div_ss(a, b) Rt_mm_div_ss(a, b) -#define _mm_div_ps(a, b) Rt_mm_div_ps(a, b) -#define _mm_sqrt_ss(a) Rt_mm_sqrt_ss(a) -#define _mm_sqrt_ps(a) Rt_mm_sqrt_ps(a) -#define _mm_rcp_ss(a) Rt_mm_rcp_ss(a) -#define _mm_rcp_ps(a) Rt_mm_rcp_ps(a) -#define _mm_rsqrt_ss(a) Rt_mm_rsqrt_ss(a) -#define _mm_rsqrt_ps(a) Rt_mm_rsqrt_ps(a) -#define _mm_min_ss(a, b) Rt_mm_min_ss(a, b) -#define _mm_min_ps(a, b) Rt_mm_min_ps(a, b) -#define _mm_max_ss(a, b) Rt_mm_max_ss(a, b) -#define _mm_max_ps(a, b) Rt_mm_max_ps(a, b) - -/* - * Logical Operations - */ - -#define _mm_and_ps(a, b) Rt_mm_and_ps(a, b) -#define _mm_andnot_ps(a, b) Rt_mm_andnot_ps(a, b) -#define _mm_or_ps(a, b) Rt_mm_or_ps(a, b) -#define _mm_xor_ps(a, b) Rt_mm_xor_ps(a, b) - -/* - * Comparisons - */ - -#define _mm_cmpeq_ss(a, b) Rt_mm_cmpeq_ss(a, b) -#define _mm_cmpeq_ps(a, b) Rt_mm_cmpeq_ps(a, b) -#define _mm_cmplt_ss(a, b) Rt_mm_cmplt_ss(a, b) -#define _mm_cmplt_ps(a, b) Rt_mm_cmplt_ps(a, b) -#define _mm_cmple_ss(a, b) Rt_mm_cmple_ss(a, b) -#define _mm_cmple_ps(a, b) Rt_mm_cmple_ps(a, b) -#define _mm_cmpgt_ss(a, b) Rt_mm_cmpgt_ss(a, b) -#define _mm_cmpgt_ps(a, b) Rt_mm_cmpgt_ps(a, b) -#define _mm_cmpge_ss(a, b) Rt_mm_cmpge_ss(a, b) -#define _mm_cmpge_ps(a, b) Rt_mm_cmpge_ps(a, b) -#define _mm_cmpneq_ss(a, b) Rt_mm_cmpneq_ss(a, b) -#define _mm_cmpneq_ps(a, b) Rt_mm_cmpneq_ps(a, b) -#define _mm_cmpnlt_ss(a, b) Rt_mm_cmpnlt_ss(a, b) -#define _mm_cmpnlt_ps(a, b) Rt_mm_cmpnlt_ps(a, b) -#define _mm_cmpnle_ss(a, b) Rt_mm_cmpnle_ss(a, b) -#define _mm_cmpnle_ps(a, b) Rt_mm_cmpnle_ps(a, b) -#define _mm_cmpngt_ss(a, b) Rt_mm_cmpngt_ss(a, b) -#define _mm_cmpngt_ps(a, b) Rt_mm_cmpngt_ps(a, b) -#define _mm_cmpnge_ss(a, b) Rt_mm_cmpnge_ss(a, b) -#define _mm_cmpnge_ps(a, b) Rt_mm_cmpnge_ps(a, b) -#define _mm_cmpord_ss(a, b) Rt_mm_cmpord_ss(a, b) -#define _mm_cmpord_ps(a, b) Rt_mm_cmpord_ps(a, b) -#define _mm_cmpunord_ss(a, b) Rt_mm_cmpunord_ss(a, b) -#define _mm_cmpunord_ps(a, b) Rt_mm_cmpunord_ps(a, b) -#define _mm_comieq_ss(a, b) Rt_mm_comieq_ss(a, b) -#define _mm_comilt_ss(a, b) Rt_mm_comilt_ss(a, b) -#define _mm_comile_ss(a, b) Rt_mm_comile_ss(a, b) -#define _mm_comigt_ss(a, b) Rt_mm_comigt_ss(a, b) -#define _mm_comige_ss(a, b) Rt_mm_comige_ss(a, b) -#define _mm_comineq_ss(a, b) Rt_mm_comineq_ss(a, b) -#define _mm_ucomieq_ss(a, b) Rt_mm_ucomieq_ss(a, b) -#define _mm_ucomilt_ss(a, b) Rt_mm_ucomilt_ss(a, b) -#define _mm_ucomile_ss(a, b) Rt_mm_ucomile_ss(a, b) -#define _mm_ucomigt_ss(a, b) Rt_mm_ucomigt_ss(a, b) -#define _mm_ucomige_ss(a, b) Rt_mm_ucomige_ss(a, b) -#define _mm_ucomineq_ss(a, b) Rt_mm_ucomineq_ss(a, b) - -/* - * Conversion Operations - */ - -#define _mm_cvt_ss2si(a) Rt_mm_cvt_ss2si(a) -#define _mm_cvt_ps2pi(a) Rt_mm_cvt_ps2pi(a) -#define _mm_cvtt_ss2si(a) Rt_mm_cvtt_ss2si(a) -#define _mm_cvtt_ps2pi(a) Rt_mm_cvtt_ps2pi(a) -#define _mm_cvt_si2ss(a, b) Rt_mm_cvt_si2ss(a, b) -#define _mm_cvt_pi2ps(a, b) Rt_mm_cvt_pi2ps(a, b) - -/* - * Miscellaneous - */ - -#define _mm_shuffle_ps(a, b, i) Rt_mm_shuffle_ps(a, b, i) -#define _mm_unpackhi_ps(a, b) Rt_mm_unpackhi_ps(a, b) -#define _mm_unpacklo_ps(a, b) Rt_mm_unpacklo_ps(a, b) -#define _mm_loadh_pi(a, p) Rt_mm_loadh_pi(a, p) -#define _mm_storeh_pi(p, a) Rt_mm_storeh_pi(p, a) -#define _mm_movehl_ps(a, b) Rt_mm_movehl_ps(a, b) -#define _mm_movelh_ps(a, b) Rt_mm_movelh_ps(a, b) -#define _mm_loadl_pi(a, p) Rt_mm_loadl_pi(a, p) -#define _mm_storel_pi(p, a) Rt_mm_storel_pi(p, a) -#define _mm_movemask_ps(a) Rt_mm_movemask_ps(a) -#define _mm_getcsr() Rt_mm_getcsr() -#define _mm_setcsr(i) Rt_mm_setcsr(i) - -/* - *Load Operations - */ - -#define _mm_load_ss(p) Rt_mm_load_ss(p) -#define _mm_load_ps1(p) Rt_mm_load_ps1(p) -#define _mm_load_ps(p) Rt_mm_load_ps(p) -#define _mm_loadu_ps(p) Rt_mm_loadu_ps(p) -#define _mm_loadr_ps(p) Rt_mm_loadr_ps(p) - -/* - * Set Operations - */ - -#define _mm_set_ss(w) Rt_mm_set_ss(w) -#define _mm_set_ps1(w) Rt_mm_set_ps1(w) -#define _mm_set_ps(z, y, x, w) Rt_mm_set_ps(z, y, x, w) -#define _mm_setr_ps(z, y, x, w) Rt_mm_setr_ps(z, y, x, w) -#define _mm_setzero_ps() Rt_mm_setzero_ps() - -/* - * Store Operations - */ - -#define _mm_store_ss(p, a) Rt_mm_store_ss(p, a) -#define _mm_store_ps1(p, a) Rt_mm_store_ps1(p, a) -#define _mm_store_ps(p, a) Rt_mm_store_ps(p, a) -#define _mm_storeu_ps(p, a) Rt_mm_storeu_ps(p, a) -#define _mm_storer_ps(p, a) Rt_mm_storer_ps(p, a) -#define _mm_move_ss(a, b) Rt_mm_move_ss(a, b) - -/* - * Integer Intrinsics - */ - -#define _m_pextrw(a, n) Rt_m_pextrw(a, n) -#define _m_pinsrw(a, d, n) Rt_m_pinsrw(a, d, n) -#define _m_pmaxsw(a, b) Rt_m_pmaxsw(a, b) -#define _m_pmaxub(a, b) Rt_m_pmaxub(a, b) -#define _m_pminsw(a, b) Rt_m_pminsw(a, b) -#define _m_pminub(a, b) Rt_m_pminub(a, b) -#define _m_pmovmskb(a) Rt_m_pmovmskb(a) -#define _m_pmulhuw(a, b) Rt_m_pmulhuw(a, b) -#define _m_pshufw(a, n) Rt_m_pshufw(a, n) -#define _m_lwmaskmovq(d, n, p) Rt_m_lwmaskmovq(d, n, p) - -/* - * Cacheability Support - */ - -#define _mm_prefetch(p, i) Rt_mm_prefetch(p, i) -#define _mm_stream_pi(p, a) Rt_mm_stream_pi(p, a) -#define _mm_stream_ps(p, a) Rt_mm_stream_ps(p, a) -#define _mm_sfence() Rt_mm_sfence() - -#endif /* (defined(RWEMULATEINTELSIMD) || !defined(__ICL)) */ - -#endif /* RTINTEL_H */ diff --git a/rwsdk/include/d3d8/rtintel.rpe b/rwsdk/include/d3d8/rtintel.rpe deleted file mode 100644 index bf297ca0..00000000 --- a/rwsdk/include/d3d8/rtintel.rpe +++ /dev/null @@ -1,645 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -enum e_rwdb_CriterionIntel -{ - - - - e_rwdb_CriterionIntelLAST = RWFORCEENUMSIZEINT -}; - -typedef enum e_rwdb_CriterionIntel e_rwdb_CriterionIntel; - - diff --git a/rwsdk/include/d3d8/rtintsec.h b/rwsdk/include/d3d8/rtintsec.h index cb482b17..a2e4c3d6 100644 --- a/rwsdk/include/d3d8/rtintsec.h +++ b/rwsdk/include/d3d8/rtintsec.h @@ -10,8 +10,8 @@ #define RTINTSEC_H /** - * \defgroup rtintersect RtIntersection - * \ingroup rttool + * \defgroup rtintersection RtIntersection + * \ingroup mathtools * * Object Intersection Toolkit for RenderWare. */ diff --git a/rwsdk/include/d3d8/rtintsec.rpe b/rwsdk/include/d3d8/rtintsec.rpe index 7b2ce6e1..3c7f7bf3 100644 --- a/rwsdk/include/d3d8/rtintsec.rpe +++ b/rwsdk/include/d3d8/rtintsec.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionIntsec { diff --git a/rwsdk/include/d3d8/rtltmap.h b/rwsdk/include/d3d8/rtltmap.h index 1a53b185..8ee15a43 100644 --- a/rwsdk/include/d3d8/rtltmap.h +++ b/rwsdk/include/d3d8/rtltmap.h @@ -1,7 +1,7 @@ /** * \defgroup rtltmap RtLtMap - * \ingroup rttool + * \ingroup lighting * * Lightmap Generation Toolkit for RenderWare. */ @@ -21,7 +21,6 @@ /** * \ingroup rtltmap - * \typedef RtLtMapIlluminateSampleCallBack * \ref RtLtMapIlluminateSampleCallBack is the callback to be called, from * within \ref RtLtMapIlluminate, for groups of samples in the objects * currently being illuminated. @@ -32,7 +31,7 @@ * * This callback will receive an array of color values to fill in, each * representing one sample in the current object - this may correspond to - * a texel in the current object's lightmap or the prelight colour of a + * a texel in the current object's lightmap or the prelight color of a * vertex, depending on whether the object is lightmapped and/or vertex-lit. * It will receive positions (in world-space) for each sample and the normal * vector (again, in world-space) of each sample (normals are interpolated @@ -44,7 +43,7 @@ * The barycentric coordinates may be used, for example, to allow a callback * to easily import existing lighting data (e.g from previously generated * lightmaps in a different format, or from an art package with lighting - * functionality). + * functionality). * * NOTE: The alpha channel of the RwRGBA results array must NOT be modified. * These values are used internally and their modification may result in @@ -82,7 +81,6 @@ typedef RwRGBA *(*RtLtMapIlluminateSampleCallBack)(RwRGBA *results, /** * \ingroup rtltmap - * \typedef RtLtMapIlluminateVisCallBack * \ref RtLtMapIlluminateVisCallBack is the callback to be called, from * within \ref RtLtMapIlluminate, to determine the visibility between a * sample and a light. @@ -94,7 +92,7 @@ typedef RwRGBA *(*RtLtMapIlluminateSampleCallBack)(RwRGBA *results, * Each sample may represent a texel in the current object's lightmap * or the prelight color of a vertex, depending on whether the object * is lightmapped and/or vertex-lit (see \ref RtLtMapObjectFlags). - * + * * The callback will receive a pointer to the world of the current * \ref RtLtMapLightingSession (this may be used to perform intersection * tests), the world-space position of the sample, the world-space @@ -111,15 +109,15 @@ typedef RwRGBA *(*RtLtMapIlluminateSampleCallBack)(RwRGBA *results, * expressed by modifying the RwRGBAReal value. This defaults to bright * white but may be reduced to signify that the light from the light * source should be attenuated. This could be used to take into account - * light-filtering objects in the scene (such as coloured glass or fog). + * light-filtering objects in the scene (such as colored glass or fog). * * The default RtLtMapIlluminateVisCallBack supplied with RtLtMap is * \ref RtLtMapDefaultVisCallBack. This callback performs visibility - * tests using the line-intersection tests from \ref rtintersect. It tests + * tests using the line-intersection tests from \ref rtintersection. It tests * for occlusion by RpWorldSectors and RpAtomics and it respects the * relevant \ref RtLtMapObjectFlags and \ref RtLtMapMaterialFlags but it * does not filter light; visibility is determined to be either one or zero. - * + * * \param world The world of the current RtLtMapLightingSession * \param result An RwRGBAReal value to attentuate this light's * contribution to the current sample @@ -141,7 +139,6 @@ typedef RwBool (*RtLtMapIlluminateVisCallBack)(RpWorld *world, /** * \ingroup rtltmap - * \typedef RtLtMapIlluminateProgressCallBack * \ref RtLtMapIlluminateProgressCallBack is the callback to be called, from * within \ref RtLtMapIlluminate, to allow a user to track lighting progress. * @@ -214,17 +211,17 @@ typedef enum RtLtMapProgressMessage RtLtMapProgressMessage; typedef struct RtLtMapLightingSession RtLtMapLightingSession; /** * \ingroup rtltmap - * \typedef RtLtMapLightingSession - * The \ref RtLtMapLightingSession structure holds information to be passed to + * \struct RtLtMapLightingSession + * The RtLtMapLightingSession structure holds information to be passed to * \ref RtLtMapIlluminate. It is used to parameterize the lighting process. * - * The \ref RtLtMapLightingSession structure encapsulates a set of objects and + * The RtLtMapLightingSession structure encapsulates a set of objects and * keeps track of the proportion of samples, within that set, that have already * been lit by calls to \ref RtLtMapIlluminate. Each call performs lighting for * one 'slice' of the whole 'session'. If the camera member is non-NULL, it is * important that the camera is not moved between lighting slices. * - * The \ref RtLtMapLightingSession is also passed to + * The RtLtMapLightingSession is also passed to * \ref RtLtMapLightMapsCreate, \ref RtLtMapLightMapsClear, * \ref RtLtMapLightMapsDestroy and \ref RtLtMapAreaLightGroupCreate, * though not all of the session structure's member will be used in @@ -327,7 +324,7 @@ typedef enum RtLtMapMaterialFlags RtLtMapMaterialFlags; /** * \ingroup rtltmap - * \ref RtLtMapObjectFlags is an enumerated type specifying the different + * RtLtMapObjectFlags is an enumerated type specifying the different * lightmap-related flags which may be applied to world sectors and * atomics. These values will be taken into consideration within * \ref RtLtMapLightMapsCreate and \ref RtLtMapIlluminate. @@ -345,11 +342,11 @@ enum RtLtMapObjectFlags rtLTMAPOBJECTNAFLAG = 0, rtLTMAPOBJECTLIGHTMAP = 1, /**< This object is to be lightmapped */ - rtLTMAPOBJECTVERTEXLIGHT = 2, /**< This object's vertex prelight colours should - * be lit within \ref RtLtMapIlluminate. */ + rtLTMAPOBJECTVERTEXLIGHT = 2, /**< This object's vertex prelight colors should + be lit within \ref RtLtMapIlluminate. */ rtLTMAPOBJECTNOSHADOW = 4, /**< This object does not cast shadows (useful, for - * example, for moving objects for which dynamic - * shadows are to be rendered - such as doors) */ + example, for moving objects for which dynamic + shadows are to be rendered - such as doors) */ rtLTMAPOBJECTFLAGFORCEENUMSIZEINT = 0x7FFFFFFF }; @@ -358,10 +355,13 @@ typedef enum RtLtMapObjectFlags RtLtMapObjectFlags; /* Area-lighting stuff:* ***********************/ + +typedef struct RtLtMapAreaLightGroup RtLtMapAreaLightGroup; + /** * \ingroup rtltmap - * \typedef RtLtMapAreaLightGroup - * \ref RtLtMapAreaLightGroup is a structure which acts as a container + * \struct RtLtMapAreaLightGroup + * RtLtMapAreaLightGroup is a structure which acts as a container * for area lights created by a call to \ref RtLtMapAreaLightGroupCreate. * The containers may be chained and passed to \ref RtLtMapIlluminate. * Each container has an optional pointer to a RwFrame which is used to @@ -376,7 +376,6 @@ typedef enum RtLtMapObjectFlags RtLtMapObjectFlags; * \see RtLtMapIlluminate * \see RtLtMapIlluminateVisCallBack */ -typedef struct RtLtMapAreaLightGroup RtLtMapAreaLightGroup; struct RtLtMapAreaLightGroup { RwSList *meshes; /**< A list of hierarchically-grouped area lights */ @@ -388,13 +387,15 @@ struct RtLtMapAreaLightGroup /* Area light triangles are grouped by source mesh (this may change) */ typedef struct LtMapAreaLightMesh LtMapAreaLightMesh; + +#if (!defined(DOXYGEN)) struct LtMapAreaLightMesh { RwUInt32 flags; /* To hold hierarchical visibility culling flags, * relevant to the object/triangle *currently* being lit. */ - RpMaterial *material; /* The emitter material, containing colour, etc */ + RpMaterial *material; /* The emitter material, containing color, etc */ RwSphere sphere; /* Each mesh has an associated center and radius */ - RwReal ROI; /* Centred on the above sphere, the R.O.I. of the + RwReal ROI; /* Centered on the above sphere, the R.O.I. of the * samples in this mesh (a conservative estimate) */ RwSList *triangles; /* A list of the area light triangles in this mesh */ }; @@ -412,6 +413,37 @@ struct LtMapAreaLight * not worth storing 3 points, coarse culling is fine) */ RwV3d *lights; /* Array of area light sample positions (in world-space) */ }; +#endif /* (!defined(DOXYGEN)) */ + +#if (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H)) + +/** + * \ingroup rtltmapps2 + * \ref RtLtMapSkyLumCalcCallBack is the callback to be called, from + * within \ref RtLtMapSkyBaseTextureProcess, to allow a user to select the + * function to process the textures for rendering on the PlayStation 2. + * + * The function is called for each span of a full color image, or for the + * CLUT in a palettised image, to compute the luminance and stores it in + * the alpha component of the texel. + * + * \param scanline A pointer to a scanline of \ref RwRGBA data. + * \param width Width of the scanline, in pixels. + * + * \return A pointer to the scanline on success, NULL otherwise. + * + * \see RtLtMapSkyBaseTextureProcess + * \see RtLtMapSkyLightingSessionBaseTexturesProcess + * \see RtLtMapSkyLightMapMakeDarkMap + * \see RtLtMapSkyLumCalcMaxCallBack + * \see RtLtMapSkyLumCalcSigmaCallBack + * \see RtLtMapSkySetLumCalcCallBack + * \see RtLtMapSkyGetLumCalcCallBack + */ +typedef RwRGBA *(*RtLtMapSkyLumCalcCallBack)(RwRGBA *scanline, + RwUInt32 width ); + +#endif /* (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H)) */ #ifdef __cplusplus @@ -487,6 +519,12 @@ RtLtMapDefaultVisCallBack(RpWorld *world, RwV3d *lightPos, RpLight __RWUNUSED__ *light); +extern void +RtLtMapSetVisCallBackCollisionScalar(RwReal scalar); + +extern RwReal +RtLtMapGetVisCallBackCollisionScalar(void); + extern RtLtMapLightingSession * RtLtMapLightingSessionInitialize(RtLtMapLightingSession *session, RpWorld *world); @@ -562,7 +600,6 @@ extern RwBool RtLtMapSetAreaLightErrorCutoff(RwReal tolerance); - /* Texture-saving functionality: */ extern RwTexDictionary * RtLtMapTexDictionaryCreate(RtLtMapLightingSession *session); @@ -588,7 +625,13 @@ extern RpAtomic *RtLtMapSkyAtomicBaseTexturesProcess(RpAtomic *atomic); extern RpWorldSector * RtLtMapSkyWorldSectorBaseTexturesProcess(RpWorldSector *sector); extern RtLtMapLightingSession * -RtLtMapSkyBaseTexturesProcess(RtLtMapLightingSession *session); +RtLtMapSkyLightingSessionBaseTexturesProcess(RtLtMapLightingSession *session); + +extern RwRGBA *RtLtMapSkyLumCalcMaxCallBack( RwRGBA *scanline, RwUInt32 width ); +extern RwRGBA *RtLtMapSkyLumCalcSigmaCallBack( RwRGBA *scanline, RwUInt32 width ); + +extern RwBool RtLtMapSkySetLumCalcCallBack(RtLtMapSkyLumCalcCallBack cback); +extern RtLtMapSkyLumCalcCallBack RtLtMapSkyGetLumCalcCallBack( void ); #endif /* (defined(SKY2_DRVMODEL_H) || defined(NULLSKY_DRVMODEL_H)) */ diff --git a/rwsdk/include/d3d8/rtltmap.rpe b/rwsdk/include/d3d8/rtltmap.rpe index e510d78b..fb171c51 100644 --- a/rwsdk/include/d3d8/rtltmap.rpe +++ b/rwsdk/include/d3d8/rtltmap.rpe @@ -159,472 +159,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionLTMAPTOOL { diff --git a/rwsdk/include/d3d8/rtmipk.h b/rwsdk/include/d3d8/rtmipk.h index c06a3879..6c777b41 100644 --- a/rwsdk/include/d3d8/rtmipk.h +++ b/rwsdk/include/d3d8/rtmipk.h @@ -15,9 +15,9 @@ /** * \defgroup rtmipk RtMipmapK - * \ingroup rttool + * \ingroup mipmapping * - * Ps2/Mipmap K Value Toolkit for RenderWare. + * PlayStation 2 / Mipmap K Value Toolkit for RenderWare. */ /**************************************************************************** diff --git a/rwsdk/include/d3d8/rtmipk.rpe b/rwsdk/include/d3d8/rtmipk.rpe index 24e1fd33..04500e1d 100644 --- a/rwsdk/include/d3d8/rtmipk.rpe +++ b/rwsdk/include/d3d8/rtmipk.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionMipmapK { diff --git a/rwsdk/include/d3d8/rtpick.h b/rwsdk/include/d3d8/rtpick.h index 5ea78058..62f564a3 100644 --- a/rwsdk/include/d3d8/rtpick.h +++ b/rwsdk/include/d3d8/rtpick.h @@ -11,7 +11,7 @@ /** * \defgroup rtpick RtPick - * \ingroup rttool + * \ingroup collisiondetection * * Picking Toolkit for RenderWare. */ diff --git a/rwsdk/include/d3d8/rtpick.rpe b/rwsdk/include/d3d8/rtpick.rpe index 055ea9ff..779e2f9a 100644 --- a/rwsdk/include/d3d8/rtpick.rpe +++ b/rwsdk/include/d3d8/rtpick.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionPick { diff --git a/rwsdk/include/d3d8/rtpitexd.h b/rwsdk/include/d3d8/rtpitexd.h index 39287bcd..602c608a 100644 --- a/rwsdk/include/d3d8/rtpitexd.h +++ b/rwsdk/include/d3d8/rtpitexd.h @@ -11,7 +11,7 @@ /** * \defgroup rtpitexd RtPITexD - * \ingroup rttool + * \ingroup texturedictionaries * * Platform Independent Texture Dictionaries * diff --git a/rwsdk/include/d3d8/rtpitexd.rpe b/rwsdk/include/d3d8/rtpitexd.rpe index 0650ea5c..290ac864 100644 --- a/rwsdk/include/d3d8/rtpitexd.rpe +++ b/rwsdk/include/d3d8/rtpitexd.rpe @@ -203,472 +203,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionPITexDict { diff --git a/rwsdk/include/d3d8/rtpng.h b/rwsdk/include/d3d8/rtpng.h index 694c8400..4ba8cf0f 100644 --- a/rwsdk/include/d3d8/rtpng.h +++ b/rwsdk/include/d3d8/rtpng.h @@ -12,7 +12,7 @@ /** * \defgroup rtpng RtPNG - * \ingroup rttool + * \ingroup imageconversiontools * * PNG/Portable Network Graphics Image Format Toolkit for RenderWare. * diff --git a/rwsdk/include/d3d8/rtpng.rpe b/rwsdk/include/d3d8/rtpng.rpe index 7a6b6cc2..e3f6f0d7 100644 --- a/rwsdk/include/d3d8/rtpng.rpe +++ b/rwsdk/include/d3d8/rtpng.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionPNG { diff --git a/rwsdk/include/d3d8/rtquat.h b/rwsdk/include/d3d8/rtquat.h index 05e971d0..a0a6e89d 100644 --- a/rwsdk/include/d3d8/rtquat.h +++ b/rwsdk/include/d3d8/rtquat.h @@ -10,7 +10,7 @@ /** * \defgroup rtquat RtQuat - * \ingroup rttool + * \ingroup mathtools * * Quaternion Toolkit for RenderWare. * @@ -392,7 +392,7 @@ MACRO_START \ \ /* Matrix is orthogonal */ \ rwMatrixSetFlags((mpMatrix), \ - (rwMATRIXTYPEORTHOGANAL & \ + (rwMATRIXTYPEORTHOGONAL & \ ~rwMATRIXINTERNALIDENTITY) ); \ \ } \ diff --git a/rwsdk/include/d3d8/rtquat.rpe b/rwsdk/include/d3d8/rtquat.rpe index e43bb50c..b239aba0 100644 --- a/rwsdk/include/d3d8/rtquat.rpe +++ b/rwsdk/include/d3d8/rtquat.rpe @@ -166,472 +166,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionQuat { diff --git a/rwsdk/include/d3d8/rtras.h b/rwsdk/include/d3d8/rtras.h index 0a9064a8..957e21e6 100644 --- a/rwsdk/include/d3d8/rtras.h +++ b/rwsdk/include/d3d8/rtras.h @@ -11,7 +11,7 @@ /** * \defgroup rtras RtRAS - * \ingroup rttool + * \ingroup imageconversiontools * * RAS/Sun Raster Fule Format Image Format Toolkit for RenderWare. * diff --git a/rwsdk/include/d3d8/rtras.rpe b/rwsdk/include/d3d8/rtras.rpe index 3398c3cc..a242ef49 100644 --- a/rwsdk/include/d3d8/rtras.rpe +++ b/rwsdk/include/d3d8/rtras.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionRAS { diff --git a/rwsdk/include/d3d8/rtray.h b/rwsdk/include/d3d8/rtray.h index 4bf0a343..b2f3d4bc 100644 --- a/rwsdk/include/d3d8/rtray.h +++ b/rwsdk/include/d3d8/rtray.h @@ -11,7 +11,7 @@ /** * \defgroup rtray RtRay - * \ingroup rttool + * \ingroup mathtools * * Line Toolkit for RenderWare. */ @@ -46,7 +46,9 @@ extern "C" /* Line intersections */ extern RwReal RtLineTriangleIntersectionTest(RwLine *line, RwV3d *normal, RwV3d *v0, RwV3d *v1, RwV3d *v2); -extern RwReal RtLineSphereIntersectionTest(RwLine *line, RwSphere *sphere); +extern RwBool RtLineSphereIntersectionTest(RwLine *line, + RwSphere *sphere, + RwReal *centerDist); /* Line clipping */ extern RwLine *RtLineClipPlane(RwLine *line, RwPlane *plane); diff --git a/rwsdk/include/d3d8/rtray.rpe b/rwsdk/include/d3d8/rtray.rpe index 27788d94..c1ff4458 100644 --- a/rwsdk/include/d3d8/rtray.rpe +++ b/rwsdk/include/d3d8/rtray.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionRay { diff --git a/rwsdk/include/d3d8/rtslerp.h b/rwsdk/include/d3d8/rtslerp.h index ec41752c..4262b894 100644 --- a/rwsdk/include/d3d8/rtslerp.h +++ b/rwsdk/include/d3d8/rtslerp.h @@ -18,7 +18,7 @@ /** * \defgroup rtslerp RtSlerp - * \ingroup rttool + * \ingroup mathtools * * Slerp/Spherical Linear Interpolations Toolkit for RenderWare. * diff --git a/rwsdk/include/d3d8/rtslerp.rpe b/rwsdk/include/d3d8/rtslerp.rpe index 847ccb00..64bd7571 100644 --- a/rwsdk/include/d3d8/rtslerp.rpe +++ b/rwsdk/include/d3d8/rtslerp.rpe @@ -167,472 +167,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionSlerp { diff --git a/rwsdk/include/d3d8/rtsplpvs.h b/rwsdk/include/d3d8/rtsplpvs.h index 38ae118f..419717a1 100644 --- a/rwsdk/include/d3d8/rtsplpvs.h +++ b/rwsdk/include/d3d8/rtsplpvs.h @@ -12,7 +12,7 @@ /** * \defgroup rtsplinepvs RtSplinePVS - * \ingroup rttool + * \ingroup pvs * * Spline PVS Toolkit for RenderWare. */ diff --git a/rwsdk/include/d3d8/rtsplpvs.rpe b/rwsdk/include/d3d8/rtsplpvs.rpe index d436b610..9736cbbc 100644 --- a/rwsdk/include/d3d8/rtsplpvs.rpe +++ b/rwsdk/include/d3d8/rtsplpvs.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionSplinePVS { diff --git a/rwsdk/include/d3d8/rttiff.h b/rwsdk/include/d3d8/rttiff.h index 9dbf22c8..b5d0ec00 100644 --- a/rwsdk/include/d3d8/rttiff.h +++ b/rwsdk/include/d3d8/rttiff.h @@ -11,7 +11,7 @@ /** * \defgroup rttiff RtTIFF - * \ingroup rttool + * \ingroup imageconversiontools * * TIFF/Tag Image File Format Image Format Toolkit for RenderWare. * diff --git a/rwsdk/include/d3d8/rttiff.rpe b/rwsdk/include/d3d8/rttiff.rpe index f82c7d82..260b2329 100644 --- a/rwsdk/include/d3d8/rttiff.rpe +++ b/rwsdk/include/d3d8/rttiff.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionTIFF { diff --git a/rwsdk/include/d3d8/rttilerd.h b/rwsdk/include/d3d8/rttilerd.h index f11b703b..7cb8f887 100644 --- a/rwsdk/include/d3d8/rttilerd.h +++ b/rwsdk/include/d3d8/rttilerd.h @@ -11,7 +11,7 @@ /** * \defgroup rttilerender RtTileRender - * \ingroup rttool + * \ingroup cameras * * Tile renderer - e.g. grabbing screen shots - Toolkit for RenderWare. */ diff --git a/rwsdk/include/d3d8/rttilerd.rpe b/rwsdk/include/d3d8/rttilerd.rpe index 78222d06..15c929f9 100644 --- a/rwsdk/include/d3d8/rttilerd.rpe +++ b/rwsdk/include/d3d8/rttilerd.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionTileRend { diff --git a/rwsdk/include/d3d8/rttoc.h b/rwsdk/include/d3d8/rttoc.h index 02893aa8..88926062 100644 --- a/rwsdk/include/d3d8/rttoc.h +++ b/rwsdk/include/d3d8/rttoc.h @@ -1,37 +1,38 @@ -/*************************************************************************** - * * - * Module : rttoc.h * - * * - * Purpose : Table Of Contents (TOC) * - * * - **************************************************************************/ +/****************************************************************************** + * * + * Module : rttoc.h * + * * + * Purpose : Table Of Contents (TOC) * + * * + ******************************************************************************/ #ifndef RTTOC_H #define RTTOC_H /** * \defgroup rttoc RtTOC - * \ingroup rttool + * \ingroup streaming * - * Table Of Contents (TOC) - e.g. creating a TOC for a RwStream. + * Table Of Contents (TOC) - creating a TOC for a stream. */ -/**************************************************************************** +/****************************************************************************** Includes */ #include "rwcore.h" #include "rpcriter.h" -/**************************************************************************** +/****************************************************************************** Defines */ -/**************************************************************************** +/****************************************************************************** Global Types */ typedef struct _rtTOCGUID _rtTOCGUID; +#if (!defined(DOXYGEN)) struct _rtTOCGUID { RwUInt32 data1; @@ -39,20 +40,22 @@ struct _rtTOCGUID RwUInt16 data3; RwUInt8 data4[8]; }; +#endif /* (!defined(DOXYGEN)) */ typedef struct RtTOCEntry RtTOCEntry; /** * \ingroup rttoc * \struct RtTOCEntry * - * BLAH + * A Table Of Contents (TOC) entry structure. */ struct RtTOCEntry { - RwCorePluginID id; /**< Chunk ID */ - RwUInt32 offset;/**< Offset of chunk from the start of the file - * including TOC */ - _rtTOCGUID guid; /**< GUID */ + RwCorePluginID id; /**< Chunk ID */ + RwUInt32 gid; /**< Game ID */ + RwUInt32 offset; /**< Offset of chunk from the start of the file + including TOC */ + _rtTOCGUID guid; /**< GUID */ }; typedef struct RtTOC RtTOC; @@ -60,16 +63,16 @@ typedef struct RtTOC RtTOC; /** * \ingroup rttoc * \struct RtTOC - * - * BLAH + * + * Table Of Contents (TOC) structure. */ struct RtTOC { - RwInt32 numEntries; /**< Number of entries*/ - RtTOCEntry entry[1]; /**< Entry*/ + RwInt32 numEntries; /**< Number of entries */ + RtTOCEntry entry[1]; /**< Entry */ }; -/**************************************************************************** +/****************************************************************************** Function prototypes */ diff --git a/rwsdk/include/d3d8/rttoc.rpe b/rwsdk/include/d3d8/rttoc.rpe index 796f8de5..706372f2 100644 --- a/rwsdk/include/d3d8/rttoc.rpe +++ b/rwsdk/include/d3d8/rttoc.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionTOC { diff --git a/rwsdk/include/d3d8/rtvcat.rpe b/rwsdk/include/d3d8/rtvcat.rpe index 464ca886..ef5e286e 100644 --- a/rwsdk/include/d3d8/rtvcat.rpe +++ b/rwsdk/include/d3d8/rtvcat.rpe @@ -150,472 +150,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionVextexCacheStrip { diff --git a/rwsdk/include/d3d8/rtworld.h b/rwsdk/include/d3d8/rtworld.h index fef3e17c..727d8122 100644 --- a/rwsdk/include/d3d8/rtworld.h +++ b/rwsdk/include/d3d8/rtworld.h @@ -14,7 +14,7 @@ /** * \defgroup rtworld RtWorld - * \ingroup rttool + * \ingroup basicgeometry * * World Import Toolkit for RenderWare. */ diff --git a/rwsdk/include/d3d8/rtworld.rpe b/rwsdk/include/d3d8/rtworld.rpe index bc20947e..83449720 100644 --- a/rwsdk/include/d3d8/rtworld.rpe +++ b/rwsdk/include/d3d8/rtworld.rpe @@ -149,472 +149,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enum e_rwdb_CriterionTlWorld { diff --git a/rwsdk/include/d3d8/rwcore.h b/rwsdk/include/d3d8/rwcore.h index b9214c63..583de35f 100644 --- a/rwsdk/include/d3d8/rwcore.h +++ b/rwsdk/include/d3d8/rwcore.h @@ -22,7 +22,7 @@ /************************************************************************* * * Filename: <C:/daily/rwsdk/include/d3d8/rwcore.h> - * Automatically Generated on: Wed Jul 10 10:45:00 2002 + * Automatically Generated on: Thu Jan 23 11:06:24 2003 * ************************************************************************/ @@ -94,6 +94,7 @@ typedef struct rxHeapSuperBlockDescriptor rxHeapSuperBlockDescriptor; typedef struct RxHeap RxHeap; typedef struct rxHeapBlockHeader rxHeapBlockHeader; +#if (!defined(DOXYGEN)) struct rxHeapFreeBlock { RwUInt32 size; @@ -106,6 +107,7 @@ struct rxHeapSuperBlockDescriptor RwUInt32 size; rxHeapSuperBlockDescriptor *next; }; +#endif /* (!defined(DOXYGEN)) */ /** * \ingroup rwcoregeneric @@ -124,6 +126,7 @@ struct RxHeap * the heap needs resetting or not. */ }; +#if (!defined(DOXYGEN)) struct rxHeapBlockHeader { /* present in all blocks (used & unused) */ @@ -132,6 +135,7 @@ struct rxHeapBlockHeader rxHeapFreeBlock *freeEntry; /* (or null) */ RwUInt32 pad[4]; /* alignment padding to 32 bytes */ }; +#endif /* (!defined(DOXYGEN)) */ /* This wrapper cheaply early-outs when a heap doesn't *need* resetting */ #define RxHeapReset(heap) \ @@ -356,8 +360,7 @@ struct RxIoSpec /** * \ingroup rwcoregeneric - * \typedef RxNodeBodyFn - * is the callback to be + * \ref RxNodeBodyFn is the callback to be * called during pipeline execution -- and, typically, process * \ref RxPacket's -- for the owning pipeline node. * @@ -373,7 +376,7 @@ typedef RwBool (*RxNodeBodyFn) (RxPipelineNode * self, /** * \ingroup rwcoregeneric - * \typedef RxNodeInitFn + * \ref RxNodeInitFn * is the callback to be called, * for the owning node definition, the first time an \ref RxPipeline * referencing that node definition is unlocked. @@ -388,7 +391,7 @@ typedef RwBool (*RxNodeInitFn) (RxNodeDefinition * self); /** * \ingroup rwcoregeneric - * \typedef RxNodeTermFn + * \ref RxNodeTermFn * is the callback to be called, * for the owning node definition, the last time an \ref RxPipeline * referencing that node definition is destroyed or locked. @@ -403,7 +406,7 @@ typedef void (*RxNodeTermFn) (RxNodeDefinition * self); /** * \ingroup rwcoregeneric - * \typedef RxPipelineNodeInitFn + * \ref RxPipelineNodeInitFn * is the callback to be called, for the owning pipeline node, whenever a * \ref RxPipeline containing that that pipeline node is unlocked. * @@ -417,7 +420,7 @@ typedef RwBool (*RxPipelineNodeInitFn) (RxPipelineNode * self); /** * \ingroup rwcoregeneric - * \typedef RxPipelineNodeTermFn + * \ref RxPipelineNodeTermFn * is the callback to be called, for the owning pipeline node, whenever a * \ref RxPipeline containing that that pipeline node is locked or * destroyed. @@ -432,14 +435,14 @@ typedef void (*RxPipelineNodeTermFn) (RxPipelineNode * self); /** * \ingroup rwcoregeneric - * \typedef RxPipelineNodeConfigFn + * \ref RxPipelineNodeConfigFn * is the callback to be called, for the owning pipeline node, whenever a * \ref RxPipeline containing that that pipeline node is unlocked, * *after* all \ref RxPipelineNodeInitFn's have been called for the * pipeline in question. This func is to be used as described in * RxPipelineNodeSendConfigMsg. * - * \param self A pointer to the pipeline node + * \param self A pointer to the pipeline node * \param pipeline A pointer to the containing pipeline * * \return TRUE on success, FALSE otherwise. @@ -449,21 +452,22 @@ typedef void (*RxPipelineNodeTermFn) (RxPipelineNode * self); typedef RwBool (*RxPipelineNodeConfigFn) (RxPipelineNode * self, RxPipeline * pipeline); -/* - removed from the API Reference January 2002 - - typedef RxConfigMsgHandlerFn - is the callback to be called, for the owning pipeline node, whenever - a message is sent to it by the ref RxPipelineNodeConfigFn of another - pipeline node in the same pipeline. See ref RxPipelineNodeSendConfigMsg. - - param self A pointer to the pipeline node - param msg Message ID - param intparam Meaning is message-specific - param ptrparam Meaning is message-specific - - return A RwInt32 value, 0: unserviced; -ve: error; +ve: informative success - - see RxNodeMethods - */ +/** + * \ingroup rwcoregeneric + * \ref RxConfigMsgHandlerFn + * is the callback to be called, for the owning pipeline node, whenever + * a message is sent to it by the \ref RxPipelineNodeConfigFn of another + * pipeline node in the same pipeline. See \ref RxPipelineNodeSendConfigMsg. + * + * \param self A pointer to the pipeline node + * \param msg Message ID + * \param intparam Meaning is message-specific + * \param ptrparam Meaning is message-specific + * + * \return A RwInt32 value, 0: unserviced; -ve: error; +ve: informative success + * + * \see RxNodeMethods + */ typedef RwUInt32 (*RxConfigMsgHandlerFn) (RxPipelineNode * self, RwUInt32 msg, RwUInt32 intparam, @@ -706,7 +710,7 @@ struct RxPipeline /** * \ingroup rwcoregeneric - * \typedef RxPipelineNodeOutputCallBack + * \ref RxPipelineNodeOutputCallBack * is the callback function supplied * to \ref RxPipelineNodeForAllConnectedOutputs. * @@ -716,11 +720,11 @@ struct RxPipeline * data structure (callbackdata). If no such structure was specified, this * will be NULL. * - * \param node A pointer to the pipeline node whose outputs - * are being traversed + * \param node A pointer to the pipeline node whose outputs + * are being traversed * \param outputnode A pointer to the current output - * pipeline node - * \param callbackdata A pointer to optional user-supplied data + * pipeline node + * \param callbackdata A pointer to optional user-supplied data * * \return Returns a pointer to the \ref RxPipelineNode whose outputs are being * traversed, or NULL to terminate traversal @@ -744,6 +748,9 @@ extern "C" { #endif /* __cplusplus */ +extern void +RxPipelineSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwBool _rxPipelineOpen(void); @@ -988,19 +995,19 @@ MACRO_STOP /** * \ingroup rwcoregeneric - * \typedef RxNodeOutput + * \ref RxNodeOutput * typedef for a reference to an output of a pipeline node */ typedef RwUInt32 *RxNodeOutput; /** * \ingroup rwcoregeneric - * \typedef RxNodeInput + * \ref RxNodeInput * typedef for a reference to the input of a pipeline node */ typedef RxPipelineNode *RxNodeInput; /** * \ingroup rwcoregeneric - * \typedef RxLockedPipe + * \ref RxLockedPipe * typedef for a reference to a locked pipeline */ typedef RxPipeline RxLockedPipe; @@ -1119,275 +1126,6 @@ RxPipelineInsertDebugNode(RxPipeline *pipeline, /*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2altmdl.h ---*/ -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeTransform.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetTransform(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeSubmitTriangle.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetSubmitTriangle(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeSubmitLine.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetSubmitLine(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeScatter.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetScatter(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeClone.h ---*/ - -typedef struct RxPacketCacheCluster RxPacketCacheCluster; - -/** - * \ingroup rwcoregeneric - * \struct RxPacketCacheCluster - * structure containing a cache of an \ref RxCluster's - * within an \ref RxPacketCache - */ -struct RxPacketCacheCluster -{ - RwUInt32 slot; /**< A \ref RwUInt32 index into the \ref RxPacketCache's - * array of RxPacketCacheCluster's */ - RwUInt16 flags; /**< A cache of the original cluster's flags */ - RwUInt16 stride; /**< A cache of the original cluster's stride */ - void *data; /**< A cache of the original cluster's data */ - RwUInt32 numAlloced; /**< A cache of the original cluster's numAlloced */ - RwUInt32 numUsed; /**< A cache of the original cluster's numUsed */ - RxPipelineCluster *clusterRef; /**< A cache of the original cluster's \ref RxPipelineCluster */ -}; -typedef struct RxPacketCache RxPacketCache; - -/** - * \ingroup rwcoregeneric - * \struct RxPacketCache - * structure containing a cache of a \ref RxPacket */ -struct RxPacketCache -{ - RwUInt16 packetFlags; /**< A cache of the original packet's flags */ - RwUInt16 pad[1]; /**< Alignment padding */ - RwUInt32 numClusters; /**< The number of present clusters in the - * original packet when it was cloned */ - RwBool lastCloneDone;/**< Once the cache has been cloned by \ref RxPacketCacheClone - * with (lastClone == TRUE), it should not be used again! */ - RwUInt32 pad2[1]; /**< Alignment padding */ - RxPacketCacheCluster clusters[1]; /**< An array of \ref RxPacketCacheCluster's, - * extending beyond 1 element */ -}; - - -typedef struct RxNodeCloneInitData RxNodeCloneInitData; -/** - * \ingroup rwcoregeneric - * \struct RxNodeCloneInitData - * structure with which to initialize - * clone a \ref RxNodeDefinition, - * through \ref RxNodeDefinitionCloneCreate and - * set up cloned \ref RxPipelineNode modes, through - * \ref RxPipelineNodeCloneDefineModes */ -struct RxNodeCloneInitData -{ - RwUInt32 numModes; /**< Specifies the number of modes in - which the node should operate */ - RwUInt32 numOutputs; /**< Specifies the number of outputs of this - Clone node, which is also the maximum - number of outputs to which any one mode - may dispatch packets */ - RwUInt32 *modeSizes; /**< Specifies the number of outputs to which - each mode dispatches packets */ - RwUInt32 **modes; /**< An array of numModes pointers to arrays - (of length numOutputs) specifying the - outputs, in order, to which each mode - should dispatch packets (output zero is - the first output) */ -}; - -/** - * \ingroup rwcoregeneric - * \struct RxNodeCloneData - * structure which is the private - * data of Clone nodes \ref RxPipelineNode */ -typedef struct RxNodeCloneData RxNodeCloneData; -struct RxNodeCloneData -{ - RwBool optimized; /**< \ref RwBool specifying whether \ref RxPipelineNodeCloneOptimize - * has been run on this \ref RxPipelineNode yet */ - RwUInt32 currentMode; /**< \ref RwUInt32 The current mode of operation */ - RxNodeCloneInitData *data;/**< A pointer to \ref RxNodeCloneInitData data - * specifying the modes of operation */ -}; - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionCloneCreate(RxNodeCloneInitData *data); -extern RwBool RxPipelineNodeCloneDefineModes( - RxPipeline *pipeline, - RxPipelineNode *node, - RxNodeCloneInitData *data); -extern RwBool RxNodeDefinitionCloneDestroy(RxNodeDefinition *def); -extern RwBool RxPipelineNodeCloneOptimize(RxPipeline *pipeline, - RxPipelineNode *node); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmStash.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetImmStash(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmRenderSetup.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetImmRenderSetup(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmMangleTriangleIndices.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetImmMangleTriangleIndices(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmMangleLineIndices.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetImmMangleLineIndices(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeImmInstance.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetImmInstance(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeCullTriangle.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetCullTriangle(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeClipTriangle.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetClipTriangle(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeClipLine.h ---*/ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetClipLine(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - /*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8texdic.h ---*/ /*--- Automatically derived from: C:/daily/rwsdk/driver/d3d8/d3d8rendst.h ---*/ @@ -1415,7 +1153,7 @@ extern RxNodeDefinition *RxNodeDefinitionGetClipLine(void); */ /** - * \ingroup datatypes + * \ingroup rwraster * \ref RwRasterLockMode represents the options available for locking * a raster so that it may be modified (see API function \ref RwRasterLock). An * application may wish to write to the raster, read from the raster or @@ -1445,7 +1183,7 @@ enum RwRasterLockMode typedef enum RwRasterLockMode RwRasterLockMode; /** - * \ingroup datatypes + * \ingroup rwraster * \ref RwRasterFlipMode represents * raster flip modes */ enum RwRasterFlipMode @@ -1457,7 +1195,7 @@ enum RwRasterFlipMode typedef enum RwRasterFlipMode RwRasterFlipMode; /** - * \ingroup datatypes + * \ingroup rwraster * RwRasterType * This type represents the options available for creating a new * raster (se API function \ref RwRasterCreate)*/ @@ -1476,7 +1214,7 @@ enum RwRasterType typedef enum RwRasterType RwRasterType; /** - * \ingroup datatypes + * \ingroup rwraster * \ref RwRasterFormat is a set of values and flags which may be combined to * specify a raster format. The format chosen for a particular raster depends * on the hardware device and the raster type specified at creation time @@ -1569,8 +1307,8 @@ typedef enum RwRasterPrivateFlag RwRasterPrivateFlag; */ /** - * \ingroup datatypes - * \typedef RwRaster + * \ingroup rwraster + * \struct RwRaster * Raster containing device-dependent pixels. * This should be considered an opaque type. * Use the RwRaster API functions to access. @@ -1661,6 +1399,8 @@ extern "C" #endif /* __cplusplus */ /* Creating destroying rasters */ +extern void RwRasterSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwRaster *RwRasterCreate(RwInt32 width, RwInt32 height, RwInt32 depth, RwInt32 flags); extern RwBool RwRasterDestroy(RwRaster * raster); @@ -1743,8 +1483,6 @@ extern RwBool RwRasterValidatePlugins(const RwRaster * raster); #endif /* (defined(__ICL)) */ -#include <windows.h> - #if (defined(RWDEBUG)) #if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) #define _CRTDBG_MAP_ALLOC @@ -1837,48 +1575,16 @@ MACRO_START \ } \ MACRO_STOP -/* LEGACY-SUPPORT macros */ -#define RWIM2DVERTEXSetCameraX(vert, camx) RwIm2DVertexSetCameraX(vert, camx) -#define RWIM2DVERTEXSetCameraY(vert, camy) RwIm2DVertexSetCameraY(vert, camy) -#define RWIM2DVERTEXSetCameraZ(vert, camz) RwIm2DVertexSetCameraZ(vert, camz) -#define RWIM2DVERTEXSetRecipCameraZ(vert, recipz) \ - RwIm2DVertexSetRecipCameraZ(vert, recipz) -#define RWIM2DVERTEXGetCameraX(vert) RwIm2DVertexGetCameraX(vert) -#define RWIM2DVERTEXGetCameraY(vert) RwIm2DVertexGetCameraY(vert) -#define RWIM2DVERTEXGetCameraZ(vert) RwIm2DVertexGetCameraZ(vert) -#define RWIM2DVERTEXGetRecipCameraZ(vert) RwIm2DVertexGetRecipCameraZ(vert) -#define RWIM2DVERTEXSetScreenX(vert, scrnx) RwIm2DVertexSetScreenX(vert, scrnx) -#define RWIM2DVERTEXSetScreenY(vert, scrny) RwIm2DVertexSetScreenY(vert, scrny) -#define RWIM2DVERTEXSetScreenZ(vert, scrnz) RwIm2DVertexSetScreenZ(vert, scrnz) -#define RWIM2DVERTEXGetScreenX(vert) RwIm2DVertexGetScreenX(vert) -#define RWIM2DVERTEXGetScreenY(vert) RwIm2DVertexGetScreenY(vert) -#define RWIM2DVERTEXGetScreenZ(vert) RwIm2DVertexGetScreenZ(vert) -#define RWIM2DVERTEXSetU(vert, u, recipz) RwIm2DVertexSetU(vert, u, recipz) -#define RWIM2DVERTEXSetV(vert, v, recipz) RwIm2DVertexSetV(vert, v, recipz) -#define RWIM2DVERTEXGetU(vert) RwIm2DVertexGetU(vert) -#define RWIM2DVERTEXGetV(vert) RwIm2DVertexGetV(vert) -#define RWIM2DVERTEXSetRealRGBA(vert, red, green, blue, alpha) \ - RwIm2DVertexSetRealRGBA(vert, red, green, blue, alpha) -#define RWIM2DVERTEXSetIntRGBA(vert, red, green, blue, alpha) \ - RwIm2DVertexSetIntRGBA(vert, red, green, blue, alpha) -#define RWIM2DVERTEXGetRed(vert) RwIm2DVertexGetRed(vert) -#define RWIM2DVERTEXGetGreen(vert) RwIm2DVertexGetGreen(vert) -#define RWIM2DVERTEXGetBlue(vert) RwIm2DVertexGetBlue(vert) -#define RWIM2DVERTEXGetAlpha(vert) RwIm2DVertexGetAlpha(vert) -#define RWIM2DVERTEXCopyRGBA(dst, src) RwIm2DVertexCopyRGBA(dst, src) -#define RWIM2DVERTEXClipRGBA(o, i, n, f) RwIm2DVertexClipRGBA(o, i, n, f) - /**************************************************************************** Global Types */ /* We use RwD3D8Vertex to drive the hardware in 2D mode */ -/** - * \ingroup rwcoredriverd3d8 - * \typedef RwD3D8Vertex +/* * D3D8 vertex structure definition for 2D geometry */ +#if !defined(RWADOXYGENEXTERNAL) typedef struct RwD3D8Vertex RwD3D8Vertex; /** * \ingroup rwcoredriverd3d8 @@ -1897,47 +1603,41 @@ struct RwD3D8Vertex RwReal u; /**< Texture coordinate U */ RwReal v; /**< Texture coordinate V */ }; +#endif /* !defined(RWADOXYGENEXTERNAL) */ /* Define types used */ +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 - * \typedef RwIm2DVertex + * \ref RwIm2DVertex * Typedef for a RenderWare Graphics Immediate Mode 2D Vertex */ typedef RwD3D8Vertex RwIm2DVertex; +#endif /* !defined(RWADOXYGENEXTERNAL) */ -/* LEGACY-SUPPORT macro */ +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 - * \def RWIM2DVERTEX - * RWIM2DVERTEX is a legacy macro for RwIm2DVertex - */ -#define RWIM2DVERTEX RwIm2DVertex - -/** - * \ingroup rwcoredriverd3d8 - * \typedef RxVertexIndex + * \ref RxVertexIndex * * Typedef for a RenderWare Graphics PowerPipe Immediate * Mode Vertex */ typedef RwUInt16 RxVertexIndex; +#endif /* !defined(RWADOXYGENEXTERNAL) */ + +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 - * \typedef RwImVertexIndex + * \ref RwImVertexIndex * Typedef for a RenderWare Graphics Immediate Mode Vertex. */ typedef RxVertexIndex RwImVertexIndex; +#endif /* !defined(RWADOXYGENEXTERNAL) */ -/* LEGACY-SUPPORT macro */ -/** - * \ingroup rwcoredriverd3d8 - * \def RWIMVERTEXINDEX - * RWIMVERTEXINDEX is a legacy macro for RwImVertexIndex - */ -#define RWIMVERTEXINDEX RwImVertexIndex +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 @@ -1950,8 +1650,10 @@ typedef struct RwUInt32 numTextureStageStateChanges; /**< Number of Texture Stage States changed */ RwUInt32 numMaterialChanges; /**< Number of Material changes */ RwUInt32 numLightsChanged; /**< Number of Lights changed */ + RwUInt32 numVBSwitches; /**< Number of Vertex Buffer switches */ } RwD3D8Metrics; +#endif /* !defined(RWADOXYGENEXTERNAL) */ #endif /* D3D8_DRVMODEL_H */ @@ -1973,15 +1675,13 @@ RwD3D8Metrics; /* We use D3D8 formats for the instanced versions, to allow hardware T&L */ -/** - * \ingroup corep2d3d8 - * \typedef RxObjSpace3DVertex +/* * Typedef for an RxObjSpace3DVertex. */ typedef struct RxObjSpace3DVertex RxObjSpace3DVertex; /** - * \ingroup corep2d3d8 + * \ingroup cored3d8 * \struct RxObjSpace3DVertex * Structure representing object space vertex. */ @@ -2000,21 +1700,25 @@ struct RxObjSpace3DVertex #define RxObjSpace3DVertexFullSize (sizeof(RxObjSpace3DVertex)) /** - * \ingroup corep2d3d8 - * \typedef RxObjSpace3DLitVertex + * \ingroup cored3d8 + * \ref RxObjSpace3DLitVertex * Typedef for an RxObjSpace3DLitVertex. */ typedef RxObjSpace3DVertex RxObjSpace3DLitVertex; /** - * \ingroup corep2d3d8 - * \typedef RwIm3DVertex + * \ingroup cored3d8 + * \ref RwIm3DVertex * Typedef for an RwIm3DVertex. */ typedef RxObjSpace3DLitVertex RwIm3DVertex; /* LEGACY-SUPPORT macro */ -#define RWIM3DVERTEX RwIm3DVertex +/** + * \ingroup cored3d8 + * \ref RxScrSpace2DVertex + * Typedef for an RxScrSpace2DVertex structure + */ typedef RwIm2DVertex RxScrSpace2DVertex; /**************************************************************************** @@ -2161,55 +1865,6 @@ MACRO_STOP #define RwIm3DVertexCopyRGBA(_dst, _src) (((_dst)->color) = ((_src)->color)) -/* LEGACY-SUPPORT macros */ -#define RWIM2DCAMERAVERTEXSetU(_devvert, _camvert, _u, _recipz) \ - RwIm2DCameraVertexSetU(_devvert, _camvert, _u, _recipz) -#define RWIM2DCAMERAVERTEXSetV(_devvert, _camvert, _v, _recipz) \ - RwIm2DCameraVertexSetV(_devvert, _camvert, _v, _recipz) -#define RWIM3DVERTEXGetNext(vert) RwIm3DVertexGetNext(vert) -#define RWIM3DVERTEXSetPos(vert, imx, imy, imz) RwIm3DVertexSetPos(vert, imx, imy, imz) -#define RWIM3DVERTEXGetPos(vert) RwIm3DVertexGetPos(vert) -#define RWIM3DVERTEXSetU(vert, imu) RwIm3DVertexSetU(vert, imu) -#define RWIM3DVERTEXSetV(vert, imv) RwIm3DVertexSetV(vert, imv) -#define RWIM3DVERTEXSetRGBA(vert, r, g, b, a) RwIm3DVertexSetRGBA(vert, r, g, b, a) -#define RWIM3DVERTEXSetNormal(vert, imx, imy, imz) RwIm3DVertexSetNormal(vert, imx, imy, imz) -#define RWIM3DVERTEXCopyRGBA(dst,src) RwIm3DVertexCopyRGBA(dst,src) -#define RXOBJSPACE3DVERTEXGetPos(_vert, _pos) \ - RxObjSpace3DVertexGetPos(_vert, _pos) -#define RXOBJSPACE3DVERTEXSetPos(_vert, _pos) \ - RxObjSpace3DVertexSetPos(_vert, _pos) -#define RXOBJSPACE3DVERTEXGetPreLitColor(_vert, _col) \ - RxObjSpace3DVertexGetPreLitColor(_vert, _col) -#define RXOBJSPACE3DVERTEXSetPreLitColor(_vert, _col) \ - RxObjSpace3DVertexSetPreLitColor(_vert, _col) -#define RXOBJSPACE3DVERTEXGetColor RxObjSpace3DVertexGetColor -#define RXOBJSPACE3DVERTEXGetNormal(_vert, _normal) \ - RxObjSpace3DVertexGetNormal(_vert, _normal) -#define RXOBJSPACE3DVERTEXSetNormal(_vert, _normal) \ - RxObjSpace3DVertexSetNormal(_vert, _normal) -#define RXOBJSPACE3DVERTEXGetU(_vert) RxObjSpace3DVertexGetU(_vert) -#define RXOBJSPACE3DVERTEXGetV(_vert) RxObjSpace3DVertexGetV(_vert) -#define RXOBJSPACE3DVERTEXSetU(_vert, _imu) \ - RxObjSpace3DVertexSetU(_vert, _imu) -#define RXOBJSPACE3DVERTEXSetV(_vert, _imv) \ - RxObjSpace3DVertexSetV(_vert, _imv) -#define RXOBJSPACE3DLITVERTEXGetPos(vert, pos) \ - RxObjSpace3DLitVertexGetPos(vert, pos) -#define RXOBJSPACE3DLITVERTEXSetPos(vert, pos) \ - RxObjSpace3DLitVertexSetPos(vert, pos) -#define RXOBJSPACE3DLITVERTEXGetColor(vert, col) \ - RxObjSpace3DLitVertexGetColor(vert, col) -#define RXOBJSPACE3DLITVERTEXSetColor(vert, col) \ - RxObjSpace3DLitVertexSetColor(vert, col) -#define RXOBJSPACE3DLITVERTEXGetU(vert) \ - RxObjSpace3DLitVertexGetU(vert) -#define RXOBJSPACE3DLITVERTEXGetV(vert) \ - RxObjSpace3DLitVertexGetV(vert) -#define RXOBJSPACE3DLITVERTEXSetU(vert, imu) \ - RxObjSpace3DLitVertexSetU(vert, imu) -#define RXOBJSPACE3DLITVERTEXSetV(vert, imv) \ - RxObjSpace3DLitVertexSetV(vert, imv) - /*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2renderstate.h ---*/ @@ -2224,7 +1879,6 @@ enum RxRenderStateFlag rxRENDERSTATEFLAG_ZWRITEENABLE = 0x00000004, /**<Z-Buffer writing is to be enabled */ rxRENDERSTATEFLAG_VERTEXALPHAENABLE = 0x00000008, /**<Vertex alpha is to be enabled */ rxRENDERSTATEFLAG_FOGENABLE = 0x00000010, /**<Fog is to be enabled */ - rxRENDERSTATEFLAG_ALPHAPRIMITIVEBUFFER = 0x00000020, /**<Alpha primitive buffering is to be enabled */ rxRENDERSTATEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RxRenderStateFlag RxRenderStateFlag; @@ -2248,7 +1902,6 @@ struct RxRenderStateVector RwRGBA BorderColor; /**< Border color for texturing address mode border */ RwFogType FogType; /**< Select the type of fogging to use */ RwRGBA FogColor; /**< Color used for fogging */ - RwUInt8 *FogTable; /**< A 256 entry fog table */ }; #if (!defined(RxRenderStateVectorAssign)) @@ -2274,52 +1927,6 @@ extern RxRenderStateVector *RxRenderStateVectorLoadDriverState(RxRenderSta #endif /* __cplusplus */ -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/p2clpcom.h ---*/ - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeRGBAInterp.h ---*/ - -struct NodeRGBAInterpData -{ - RwBool rgbaInterpOn; - RxRenderStateVector state; -}; -typedef struct NodeRGBAInterpData NodeRGBAInterpData; - - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition *RxNodeDefinitionGetRGBAInterp(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -/*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/nodeUVInterp.h ---*/ - -typedef struct RxNodeUVInterpSettings RxNodeUVInterpSettings; -struct RxNodeUVInterpSettings -{ - RwBool uvInterpOn; - RxRenderStateVector state; -}; - - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -extern RxNodeDefinition * RxNodeDefinitionGetUVInterp(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - /*--- Automatically derived from: C:/daily/rwsdk/src/baimage.h ---*/ /**************************************************************************** @@ -2342,8 +1949,8 @@ typedef enum RwImageFlag RwImageFlag; */ /** - * \ingroup datatypes - * \typedef RwImage + * \ingroup rwimage + * \struct RwImage * Image containing device-independent pixels. * This should be considered an opaque type. * Use the RwImage API functions to access. @@ -2367,7 +1974,7 @@ struct RwImage #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup datatypes + * \ingroup rwimage * \ref RwImageCallBackRead * is the function registered with \ref RwImageRegisterImageFormat that is used, * for example by \ref RwImageRead and \ref RwImageReadMaskedImage, @@ -2375,13 +1982,15 @@ struct RwImage * * \param imageName Pointer to a string containing the file name of the image. * + * \return Returns a pointer to the image read. + * * \see RwImageRegisterImageFormat * */ typedef RwImage *(*RwImageCallBackRead)(const RwChar * imageName); /** - * \ingroup datatypes + * \ingroup rwimage * \ref RwImageCallBackWrite * is the function registered with \ref RwImageRegisterImageFormat that is used, * for example by \ref RwImageWrite, @@ -2474,6 +2083,11 @@ extern "C" #endif /* __cplusplus */ /* Creating and destroying */ + +extern void RwImageSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + +extern void RwImageFormatSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwImage *RwImageCreate(RwInt32 width, RwInt32 height, RwInt32 depth); extern RwBool RwImageDestroy(RwImage * image); @@ -2505,6 +2119,8 @@ extern RwImage *RwImageWrite(RwImage * image, /* Setting and getting the default path for images */ extern RwChar *RwImageGetPath(void); extern const RwChar *RwImageSetPath(const RwChar * path); + /* Fast image path change */ +extern void _rwImageSwapPath(RwChar **path, RwInt32 *size); /* Setting */ #if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) @@ -2593,8 +2209,8 @@ extern const RwImage *RwImageStreamWrite(const RwImage * image, */ /** - * \ingroup datatypes - * \typedef RwTexDictionary + * \ingroup rwtexdict + * \struct RwTexDictionary * is a texture dictionary containing textures. * This should be considered an opaque type. * Use the RwTexDictionary API functions to access. @@ -2615,8 +2231,8 @@ struct RwTexDictionary /* Parent is the dictionary */ /** - * \ingroup datatypes - * \typedef RwTexture + * \ingroup rwtexture + * \struct RwTexture * is a texture object. * This should be considered an opaque type. * Use the RwTexture API functions to access. @@ -2641,7 +2257,7 @@ struct RwTexture #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup datatypes + * \ingroup rwtexture * \ref RwTextureCallBackRead * represents the function used by \ref RwTextureRead to read the specified * texture from a disk file. This function should return a pointer to the @@ -2662,7 +2278,7 @@ typedef RwTexture *(*RwTextureCallBackRead)(const RwChar *name, const RwChar *maskName); /** - * \ingroup datatypes + * \ingroup rwtexture * \ref RwTextureCallBack * represents the function called from \ref RwTexDictionaryForAllTextures * for all textures in a given texture dictionary. This function should @@ -2681,7 +2297,7 @@ typedef RwTexture *(*RwTextureCallBack)(RwTexture *texture, void *pData); /** - * \ingroup datatypes + * \ingroup rwtexdict * \ref RwTexDictionaryCallBack * represents the function called from \ref RwTexDictionaryForAllTexDictionaries * for all texture dictionaries that currently exist. This function should @@ -2702,7 +2318,7 @@ typedef RwTexDictionary *(*RwTexDictionaryCallBack)(RwTexDictionary *dict, void /** - * \ingroup datatypes + * \ingroup rwtexture * \ref RwTextureCallBackMipmapGeneration * is the callback function supplied to \ref RwTextureSetMipmapGenerationCallBack * and returned from \ref RwTextureGetMipmapGenerationCallBack. @@ -2726,7 +2342,7 @@ typedef RwRaster *(*RwTextureCallBackMipmapGeneration)(RwRaster * raster, RwImage * image); /** - * \ingroup datatypes + * \ingroup rwtexture * \ref RwTextureCallBackMipmapName * is the callback function supplied to \ref RwTextureSetMipmapNameCallBack and * returned from \ref RwTextureGetMipmapNameCallBack. @@ -2926,10 +2542,14 @@ extern RwTexture *RwTextureSetMaskName(RwTexture * texture, const RwChar * maskName); /* Creating/destroying dictionaries */ +extern void RwTexDictionarySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwTexDictionary *RwTexDictionaryCreate(void); extern RwBool RwTexDictionaryDestroy(RwTexDictionary * dict); /* Textures */ +void RwTextureSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwTexture *RwTextureCreate(RwRaster * raster); extern RwBool RwTextureDestroy(RwTexture * texture); @@ -3071,13 +2691,11 @@ enum RwClipFlag rwCLIPFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; -typedef enum RwClipFlag RwClipFlag; - -/** - * \ingroup rwcoregeneric - * \typedef RwClipFlag +/* * Typedef for RwClipFlag enumeration specifying the clipping status of a vertex */ +typedef enum RwClipFlag RwClipFlag; + typedef struct RxCamSpace3DVertex RxCamSpace3DVertex; @@ -3094,8 +2712,8 @@ struct RxCamSpace3DVertex /* Clip flags on this vertex */ RwUInt8 clipFlags; /**< Clip flags for the vertex generated during transformation into camera-space, see \ref RwClipFlag */ RwUInt8 pad[3]; /**< Alignment padding */ - /* Lit colour */ - RwRGBAReal col; /**< Accumulated \ref RwReal light values (initialized to zero or prelight colours) */ + /* Lit color */ + RwRGBAReal col; /**< Accumulated \ref RwReal light values (initialized to zero or prelight colors) */ /* Only used by the clipper */ RwReal u; /**< Texture U coordinate */ RwReal v; /**< Texture V coordinate */ @@ -3103,8 +2721,8 @@ struct RxCamSpace3DVertex /* Supports pipeline1 apps: */ /** - * \ingroup datatypes - * \typedef RwCameraVertex + * \ingroup rwcoregeneric + * \ref RwCameraVertex * typedef for a structure describing a camera-space 3D vertex. */ typedef RxCamSpace3DVertex RwCameraVertex; @@ -3159,9 +2777,7 @@ enum RxGeometryFlag rxGEOMETRYFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; -/** - * \ingroup rwcoregeneric - * \typedef RxGeometryFlag +/* * Typedef for RxGeometryFlag enumeration describing geometry properties */ typedef enum RxGeometryFlag RxGeometryFlag; @@ -3186,7 +2802,7 @@ struct RxMeshStateVector /* We can't necessarily reference an RpMaterial in here (i.e with Im3D), * because RpMaterials are defined in RpWorld not RwCore */ RwTexture *Texture; /**< A pointer to a \ref RwTexture */ - RwRGBA MatCol; /**< \ref RwRGBA material colour */ + RwRGBA MatCol; /**< \ref RwRGBA material color */ RxPipeline *Pipeline; /**< A pointer to the material pipeline where appropriate */ /* rwPRIMTYPETRILIST/TRIFAN/TRISTRIP/LINELIST/POLYLINE */ RwPrimitiveType PrimType; /**< \ref RwPrimitiveType primitive type */ @@ -3295,7 +2911,7 @@ struct RxVStep /* CamNorms.csl */ /** * \ingroup rwcoregeneric - * \typedef RxCamNorm + * \ref RxCamNorm * typedef for \ref RwV3d used by the RxClVStep cluster */ typedef RwV3d RxCamNorm; @@ -3342,7 +2958,7 @@ extern RxClusterDefinition RxClTriPlanes; /*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/baim3d.h ---*/ /** - * \ingroup datatypes + * \ingroup rwim3d * RwIm3DTransformFlags * The bit-field type RwIm3DTransformFlags * specifies options available for controlling execution of the 3D immediate @@ -3373,6 +2989,8 @@ typedef struct rwIm3DVertexCache RwIm3DVertexCache; #endif /* (0&& defined(SKY2)) */ /* complete information to reconstruct post-transform Im3D "mesh" packet */ + +#if (!defined(DOXYGEN)) struct _rwIm3DPoolStash { RwUInt32 flags; /* rwIM3D_VERTEXUV, rwIM3D_ALLOPAQUE, rwIM3D_NOCLIP etc */ @@ -3413,14 +3031,11 @@ struct rwIm3DRenderPipelines struct rwImmediGlobals { - RxPipeline *genericIm3DTransformPipeline; - rwIm3DRenderPipelines genericIm3DRenderPipelines; - RxPipeline *im3DTransformPipeline; rwIm3DRenderPipelines im3DRenderPipelines; /* Platforms that have their own non-generic pipelines - * (OPENGL, D3D7, SKY2, KAMUI2, DOLPHIN) put them here: */ + * (OPENGL, D3D8, SKY2, KAMUI2, DOLPHIN) put them here: */ RxPipeline *platformIm3DTransformPipeline; rwIm3DRenderPipelines platformIm3DRenderPipelines; @@ -3431,12 +3046,11 @@ struct rwImmediGlobals /* The line PS2All render pipe automatically * calls this PS2AllMat pipeline: */ RxPipeline *ps2AllMatIm3DLinePipeline; - /* PS2Manager pipelines */ - RxPipeline *ps2ManagerIm3DRenderPipeline; #endif /* (defined(SKY2_DRVMODEL_H)) */ rwIm3DPool curPool; /* The current cache of transformed vertices */ }; +#endif /* (!defined(DOXYGEN)) */ #ifdef __cplusplus @@ -3458,9 +3072,6 @@ extern RwBool RwIm3DRenderIndexedPrimitive(RwPrimitiveType primType, RwInt32 numIndices); extern RwBool RwIm3DRenderPrimitive(RwPrimitiveType primType); -extern RxPipeline *RwIm3DGetGenericTransformPipeline(void); -extern RxPipeline *RwIm3DGetGenericRenderPipeline(RwPrimitiveType primType); - extern RxPipeline *RwIm3DGetTransformPipeline(void); extern RxPipeline *RwIm3DGetRenderPipeline( RwPrimitiveType primType); extern RxPipeline *RwIm3DSetTransformPipeline(RxPipeline *pipeline); @@ -3670,8 +3281,23 @@ extern RwBool RwD3D8CameraIsBBoxFullyInsideFrustum(const void *camera, const voi * Cheking the CPU capabilities */ -extern RwBool _rwIntelSSEsupported(void); +#if (defined(RWDEBUG) || defined(RWSUPPRESSINLINE)) extern RwBool _rwIntelMMXsupported(void); +extern RwBool _rwIntelSSEsupported(void); +extern RwBool _rwIntelSSE2supported(void); +extern RwBool _rwAMD3DNowSupported(void); + +#else +extern RwBool _rwD3D8CPUSupportsMMX; +extern RwBool _rwD3D8CPUSupportsSSE; +extern RwBool _rwD3D8CPUSupportsSSE2; +extern RwBool _rwD3D8CPUSupports3DNow; + +#define _rwIntelMMXsupported() _rwD3D8CPUSupportsMMX +#define _rwIntelSSEsupported() _rwD3D8CPUSupportsSSE +#define _rwIntelSSE2supported() _rwD3D8CPUSupportsSSE2 +#define _rwAMD3DNowSupported() _rwD3D8CPUSupports3DNow +#endif /* * Enabling texture format conversions when loading textures from a texture @@ -3680,6 +3306,8 @@ extern RwBool _rwIntelMMXsupported(void); extern void _rwD3D8TexDictionaryEnableRasterFormatConversion(RwBool enable); +/* Called from RwEngineInit to give the driver a chance to register plugins */ +extern RwBool _rwDeviceRegisterPlugin(void); #ifdef __cplusplus } @@ -3689,7 +3317,7 @@ _rwD3D8TexDictionaryEnableRasterFormatConversion(RwBool enable); /* LEGACY-MACRO */ /** * \ingroup rwcoredriverd3d8 - * \ref RwD3DLoadNativeTexture is a legacy macro for compatability with + * \ref RwD3DLoadNativeTexture is a legacy macro for compatibility with * RWD3D7 applications that can be used to read a compressed texture from * the specified DDS file on disk. * @@ -3820,17 +3448,16 @@ struct RwFrame #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup datatypes - * \typedef RwFrame - Frame for defining object position and orientation. + * \ingroup rwframe + * \struct RwFrame + * Frame for defining object position and orientation. * This should be considered an opaque type. * Use the RwFrame API functions to access. */ typedef struct RwFrame RWALIGN(RwFrame, rwFRAMEALIGNMENT); /** - * \ingroup datatypes - * \typedef RwFrameCallBack + * \ingroup rwframe * \ref RwFrameCallBack type represents the function * called from \ref RwFrameForAllChildren for all child frames linked to a given frame. * This function should return a pointer to the current frame to indicate success. @@ -3840,6 +3467,8 @@ typedef struct RwFrame RWALIGN(RwFrame, rwFRAMEALIGNMENT); * iterator. * \param data Pointer to developer-defined data structure. * + * \return + * * \see RwFrameForAllChildren * */ @@ -3867,6 +3496,9 @@ extern "C" { #endif /* __cplusplus */ +extern void RwFrameSetFreeListCreateParams(RwInt32 blockSize, + RwInt32 numBlocksToPrealloc ); + /* Finding what is attached to a frame */ extern RwFrame * RwFrameForAllObjects(RwFrame * frame, @@ -3945,6 +3577,9 @@ extern RwFrame * RwFrameUpdateObjects(RwFrame * frame); /* Creating destroying frames */ +extern void +RwFrameSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwFrame * RwFrameCreate(void); @@ -4030,12 +3665,15 @@ _rwFramePurgeClone(RwFrame *root); typedef struct RwObjectHasFrame RwObjectHasFrame; typedef RwObjectHasFrame * (*RwObjectHasFrameSyncFunction)(RwObjectHasFrame *object); + +#if (!defined(DOXYGEN)) struct RwObjectHasFrame { RwObject object; RwLLLink lFrame; RwObjectHasFrameSyncFunction sync; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** Function prototypes @@ -4082,12 +3720,15 @@ MACRO_STOP Global types */ typedef struct rpTextureChunkInfo RwTextureChunkInfo; + +#if (!defined(DOXYGEN)) struct rpTextureChunkInfo { RwTextureFilterMode filtering; RwTextureAddressMode addressingU; RwTextureAddressMode addressingV; }; +#endif /* (!defined(DOXYGEN)) */ /* Bit flags defining properties of textures when stream */ enum RwTextureStreamFlags @@ -4169,11 +3810,14 @@ _rwTextureChunkInfoRead(RwStream *stream, */ typedef struct rwFrameList rwFrameList; + +#if (!defined(DOXYGEN)) struct rwFrameList { RwFrame **frames; RwInt32 numFrames; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** Global Variables @@ -4257,7 +3901,7 @@ _rwFrameListStreamWrite(const rwFrameList *frameList, typedef struct RwBBox RwBBox; /** - * \ingroup datatypes + * \ingroup rwbbox * \struct RwBBox * This type represents a 3D axis-aligned bounding-box * specified by the positions of two corners which lie on a diagonal. @@ -4442,7 +4086,7 @@ MACRO_STOP */ /** - * \ingroup datatypes + * \ingroup rwcamera * RwCameraClearMode * Camera clear flags */ enum RwCameraClearMode @@ -4458,7 +4102,7 @@ enum RwCameraClearMode typedef enum RwCameraClearMode RwCameraClearMode; /** - * \ingroup datatypes + * \ingroup rwcamera * RwCameraProjection * This type represents the options available for * setting the camera projection model, either perspective projection or @@ -4473,7 +4117,7 @@ enum RwCameraProjection typedef enum RwCameraProjection RwCameraProjection; /** - * \ingroup datatypes + * \ingroup rwcamera * RwFrustumTestResult * This type represents the results from a * camera frustum test on a given sphere (see API function @@ -4489,8 +4133,8 @@ typedef enum RwFrustumTestResult RwFrustumTestResult; /** - * \ingroup datatypes - * \typedef RwCamera + * \ingroup rwcamera + * \struct RwCamera * Camera object for rendering a view. * This should be considered an opaque type. * Use the RwCamera API functions to access. @@ -4502,6 +4146,8 @@ typedef RwCamera *(*RwCameraBeginUpdateFunc) (RwCamera * camera); typedef RwCamera *(*RwCameraEndUpdateFunc) (RwCamera * camera); typedef struct RwFrustumPlane RwFrustumPlane; + +#if (!defined(DOXYGEN)) /* * Structure describing a frustrum plane. */ @@ -4514,7 +4160,7 @@ struct RwFrustumPlane RwUInt8 pad; }; -#if (!defined(DOXYGEN)) + struct RwCamera { RwObjectHasFrame object; @@ -4560,8 +4206,7 @@ struct RwCamera #endif /* (!defined(DOXYGEN)) */ /** - * \ingroup datatypes - * \typedef RwCameraCallBack + * \ingroup rwcamera * \ref RwCameraCallBack type represents a function called from any camera * iterator that may be implemented in plugins. This function should return a * pointer to the current camera to indicate success. The callback may return @@ -4569,6 +4214,8 @@ struct RwCamera * * \param camera Pointer to the current camera, supplied by iterator. * \param data Pointer to developer-defined data structure. + * + * \return */ typedef RwCamera *(*RwCameraCallBack)(RwCamera *camera, void *data); @@ -4594,6 +4241,8 @@ extern RwCamera *RwCameraShowRaster(RwCamera * camera, void *pDev, RwUInt32 flags); /* Creation and destruction */ +extern void RwCameraSetFreeListCreateParams( RwInt32 blockSize, + RwInt32 numBlocksToPrealloc ); extern RwBool RwCameraDestroy(RwCamera * camera); extern RwCamera *RwCameraCreate(void); extern RwCamera *RwCameraClone(RwCamera * camera); @@ -4669,10 +4318,9 @@ extern RwFrame *RwCameraGetFrame(const RwCamera *camera); /*--- Automatically derived from: C:/daily/rwsdk/driver/common/barwtyp.h ---*/ -/*--- Automatically derived from: C:/daily/rwsdk/src/bacamval.h ---*/ - /*--- Automatically derived from: C:/daily/rwsdk/src/pipe/p2/bapipe.h ---*/ +#if (!defined(DOXYGEN)) struct rwPipeGlobals { RwFreeList *pipesFreeList; /* Save mallocs, use a freelist */ @@ -4695,24 +4343,12 @@ struct rwPipeGlobals RxPipeline *genericWorldSectorPipeline; RxPipeline *genericMaterialPipeline; /* Platforms that have their own non-generic pipelines - * (OPENGL, D3D7, SKY2, KAMUI2, DOLPHIN) put them here: */ + * (OPENGL, D3D8, SKY2, KAMUI2, DOLPHIN) put them here: */ RxPipeline *platformAtomicPipeline; RxPipeline *platformWorldSectorPipeline; RxPipeline *platformMaterialPipeline; -#if (defined(SKY2_DRVMODEL_H)) - /* We have extra flavours of pipe under SKY2. - * PS2All and PS2AllMat are the defaults. - * - see RpWorldSectorSkyGetPS2AllPipeline, etc */ - RxPipeline *ps2ManagerAtomicPipeline; - RxPipeline *allInOneAtomicPipeline; - RxPipeline *vanillaAtomicPipeline; - RxPipeline *ps2ManagerWorldSectorPipeline; - RxPipeline *allInOneWorldSectorPipeline; - RxPipeline *vanillaWorldSectorPipeline; - RxPipeline *vanillaMaterialPipeline; -#endif /* (SKY2_DRVMODEL_H) */ - }; +#endif /* (!defined(DOXYGEN)) */ typedef struct rwPipeGlobals rwPipeGlobals; @@ -4740,9 +4376,7 @@ extern RwInt32 _rxPipelineGlobalsOffset; /* Camera stream format */ /** - * \ingroup datatypes - * \typedef RwCameraChunkInfo - * + * \ingroup rwcamera * \ref RwCameraChunkInfo is typedef'd to a structure that holds camera * data. This should be considered an opaque type. Use the RwCamera * API functions to access it. @@ -4750,6 +4384,8 @@ extern RwInt32 _rxPipelineGlobalsOffset; typedef struct rwStreamCamera RwCameraChunkInfo; typedef struct rwStreamCamera rwStreamCamera; + +#if (!defined(DOXYGEN)) struct rwStreamCamera { RwV2d viewWindow; @@ -4758,6 +4394,7 @@ struct rwStreamCamera RwReal fogPlane; RwUInt32 projection; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** Function prototypes diff --git a/rwsdk/include/d3d8/rwplcore.h b/rwsdk/include/d3d8/rwplcore.h index b0ff7dfa..3740ae60 100644 --- a/rwsdk/include/d3d8/rwplcore.h +++ b/rwsdk/include/d3d8/rwplcore.h @@ -22,7 +22,7 @@ /************************************************************************* * * Filename: <C:/daily/rwsdk/include/d3d8/rwplcore.h> - * Automatically Generated on: Wed Jul 10 10:45:00 2002 + * Automatically Generated on: Thu Jan 23 11:06:23 2003 * ************************************************************************/ @@ -68,6 +68,7 @@ typedef struct _RwUInt64 RwUInt64; typedef struct _RwInt64 RwInt64; /* We'll do it with structures (can't do maths on these, but OK for allocation): */ +#if (!defined(DOXYGEN)) #ifdef rwBIGENDIAN struct _RwUInt64 { @@ -99,6 +100,7 @@ struct _RwInt64 #error "ENDIAN-ness undefined!" #endif /* rwLITTLEENDIAN */ #endif /* rwBIGENDIAN */ +#endif /* (!defined(DOXYGEN)) */ #define RWZERO64 { (RwUInt32)0, (RwUInt32)0 } #endif /* _MSC_VER */ @@ -108,7 +110,8 @@ typedef struct _RwInt128 RwInt128; /* We'll do it with structures * (can't do maths on these, but OK for allocation): */ -#ifdef rwBIGENDIAN +#if (!defined(DOXYGEN)) +#ifdef rwBIGENDIAN struct _RwUInt128 { RwUInt64 top; @@ -139,6 +142,7 @@ struct _RwInt128 #error "ENDIAN-ness undefined!" #endif /* rwLITTLEENDIAN */ #endif /* rwBIGENDIAN */ +#endif /* (!defined(DOXYGEN)) */ #define RWZERO128 { RWZERO64, RWZERO64 } @@ -160,6 +164,10 @@ struct _RwInt128 #define rwFRAMEALIGNMENT sizeof(RwUInt32) #define rwV4DALIGNMENT sizeof(RwUInt32) +#if (!defined(rwMALLOCALIGNMENT)) +#define rwMALLOCALIGNMENT sizeof(RwUInt32) +#endif /* (!defined(rwMALLOCALIGNMENT) */ + #if (defined(_MSC_VER)) #if (defined(RWVERBOSE)) @@ -501,7 +509,7 @@ int32fromreal(RwReal x) #if (!defined(NOASM)) static __inline RwUInt32 -RwFastRealToUInt32(RwReal x) +RwFastRealToUInt32Inline(RwReal x) { RwUInt32 res; @@ -510,6 +518,9 @@ RwFastRealToUInt32(RwReal x) return(res); } + +#define RwFastRealToUInt32 RwFastRealToUInt32Inline + #endif /* (defined(NOASM)) */ #endif /* (defined(_MSC_VER)) */ @@ -627,11 +638,14 @@ do \ while(0) typedef union _rwIEEEFloatShapeType _rwIEEEFloatShapeType; + +#if (!defined(DOXYGEN)) union _rwIEEEFloatShapeType { float value; unsigned int word; }; +#endif /* (!defined(DOXYGEN)) */ #define _RW_GET_FLOAT_WORD(i,d) \ do { \ @@ -949,13 +963,13 @@ while(0) #if (!defined(rwSqrt)) /* NOTE: this is overloaded in drvmodel.h for some targets (SKY2 and XBOX atm) * [we do in fact do overload w/ sqrtf there, if RW_USE_SPF, - * for D3D7, D3D8, OpenGL and SoftRas] */ + * for D3D8, OpenGL and SoftRas] */ #define rwSqrt(_result, _x) rwSqrtMacro(_result, _x) #endif /* (!defined(rwSqrt)) */ #if (!defined(rwInvSqrt)) /* NOTE: this is overloaded in drvmodel.h for some targets (SKY2 and XBOX atm) * [we do in fact do overload w/ (1 / sqrtf) there, if RW_USE_SPF, - * for D3D7, D3D8, OpenGL and SoftRas] */ + * for D3D8, OpenGL and SoftRas] */ #define rwInvSqrt(_recip, _x) rwInvSqrtMacro(_recip, _x) #endif /* (!defined(rwInvSqrt)) */ #if (!defined(RwTan)) @@ -977,7 +991,22 @@ while(0) /*--- Automatically derived from: C:/daily/rwsdk/src/plcore/batypes.h ---*/ #define rwLIBRARYBASEVERSION 0x31000 -#define rwLIBRARYCURRENTVERSION 0x33002 +#define rwLIBRARYCURRENTVERSION 0x34005 + +#define rwLIBRARYVERSION31000 0x31000 +#if (rwLIBRARYVERSION31000 < rwLIBRARYBASEVERSION) +#error "Time to remove all rwLIBRARYVERSION31000 code" +#endif + +#define rwLIBRARYVERSION34001 0x34001 +#if (rwLIBRARYVERSION34001 < rwLIBRARYBASEVERSION) +#error "Time to remove all rwLIBRARYVERSION34001 code" +#endif + +#define rwLIBRARYVERSION34002 0x34002 +#if (rwLIBRARYVERSION34002 < rwLIBRARYBASEVERSION) +#error "Time to remove all rwLIBRARYVERSION34002 code" +#endif /* * RWBUILDNUMBER @@ -993,14 +1022,16 @@ while(0) * The following Doxygen comment MUST be copied into RwCore.h, * so don't move it from here. */ +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup rwcore - * \page rwcoreoverview Core Library Overview + * \ingroup fundamentaltypes + * \page fundtypesoverview Fundamental Types Overview * - * LIBRARY: rwcore.lib - * HEADER: rwcore.h + * \par Requirements + * \li \b Headers: rwcore.h + * \li \b Libraries: rwcore.lib * - * This library provides the fundamental RenderWare features. + * The rwcore.lib library provides the fundamental RenderWare features. * * When creating a RenderWare application, this library must always be * linked. @@ -1024,7 +1055,7 @@ while(0) * supplied User Guide. The RenderWare Engine \ref rwengine API is * usually the starting point for new developers. */ - +#endif /* RWADOXYGENEXTERNAL */ #if (!defined(RWFORCEENUMSIZEINT)) #define RWFORCEENUMSIZEINT ((RwInt32)((~((RwUInt32)0))>>1)) @@ -1157,7 +1188,6 @@ while(0) #if (defined(RWDEBUG) && defined(RWVERBOSE)) -/* #include <windows.h> */ #if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) #define _CRTDBG_MAP_ALLOC #endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */ @@ -1189,6 +1219,8 @@ while(0) /* NB volatile keyword required for VC5.0 to ensure a reload - AMB */ typedef union RwSplitBits RwSplitBits; + +#if (!defined(DOXYGEN)) union RwSplitBits { RwReal nReal; @@ -1219,6 +1251,7 @@ struct RwSplitFixed #endif /* rwBIGENDIAN */ typedef union RwUnionReal RwUnionReal; + union RwUnionReal /* MSB is sign bit in any circumstance */ { RwReal real; /* 4 bytes interpreted as RwReal */ @@ -1226,6 +1259,7 @@ union RwUnionReal /* MSB is sign bit in any circumstance */ RwFixed fixed; /* 4 bytes interpreted as 16:16 fixed */ RwSplitFixed splitfixed; /* 4 bytes interpreted as 16:16 fixed */ }; +#endif /* (!defined(DOXYGEN)) */ /*****************/ @@ -1233,14 +1267,9 @@ union RwUnionReal /* MSB is sign bit in any circumstance */ /*****************/ -/** - * \ingroup datatypes - * \typedef RwV2d - * typedef for struct RwV2d - */ typedef struct RwV2d RwV2d; /** - * \ingroup datatypes + * \ingroup rwv2d * \struct RwV2d * This type represents points in a 2D space, such as device * space, specified by the (x, y) coordinates of the point. @@ -1251,14 +1280,9 @@ struct RwV2d RwReal y; /**< Y vlaue */ }; -/** - * \ingroup datatypes - * \typedef RwV3d - * typedef for struct RwV3d - */ typedef struct RwV3d RwV3d; /** - * \ingroup datatypes + * \ingroup rwv3d * \struct RwV3d * This type represents 3D points and vectors specified by * the (x, y, z) coordinates of a 3D point or the (x, y, z) components of a @@ -1274,13 +1298,16 @@ struct RwV3d #define RWV4DALIGNMENT(_v4d) \ (! (((rwV4DALIGNMENT)-1) & ((RwUInt32)(_v4d)))) +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwv4d * \struct RwV4d * This type represents 4D points and vectors specified by * the (x, y, z, w) coordinates of a 4D point or the (x, y, z, w) components of a * 4D vector. */ +#endif /* RWADOXYGENEXTERNAL */ + struct RwV4d { RwReal x; /**< X value */ @@ -1289,27 +1316,21 @@ struct RwV4d RwReal w; /**< W value */ }; -/** - * \ingroup datatypes - * \typedef RwV4d - * typedef for struct RwV4d - */ typedef struct RwV4d RWALIGN(RwV4d, rwV4DALIGNMENT); -/** - * \ingroup datatypes - * \typedef RwRect - * typedef for struct RwRect - */ typedef struct RwRect RwRect; + +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup geometricaltypes * \struct RwRect * This type represents a 2D device space rectangle specified * by the position of the top-left corner (the offset x, y) and its width (w) * and height (h). */ +#endif /* RWADOXYGENEXTERNAL */ + struct RwRect { RwInt32 x; /**< X value of the top-left corner */ @@ -1318,18 +1339,15 @@ struct RwRect RwInt32 h; /**< Height of the rectangle */ }; -/** - * \ingroup datatypes - * \typedef RwSphere - * typedef for struct RwSphere - */ typedef struct RwSphere RwSphere; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup geometricaltypes * \struct RwSphere * This type represents a sphere specified by the position * of its center and its radius */ +#endif /* RWADOXYGENEXTERNAL */ struct RwSphere { RwV3d center; /**< Sphere center */ @@ -1341,18 +1359,16 @@ struct RwSphere ( *(_target) = *(_source) ) #endif /* (!defined(RwSphereAssign)) */ -/** - * \ingroup datatypes - * \typedef RwLine - * typedef for struct RwLine - */ typedef struct RwLine RwLine; + +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup geometricaltypes * \struct RwLine * This type represents a 3D line specified by the position * of its start and end points. */ +#endif /* RWADOXYGENEXTERNAL */ struct RwLine { RwV3d start; /**< Line start */ @@ -1367,11 +1383,13 @@ struct RwLine /* The maximum number of texture coordinates */ #define rwMAXTEXTURECOORDS 8 +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup fundtypesdatatypes * RwTextureCoordinateIndex * This type represents the index for texture coordinates. */ +#endif /* RWADOXYGENEXTERNAL */ enum RwTextureCoordinateIndex { rwNARWTEXTURECOORDINATEINDEX = 0, @@ -1387,18 +1405,16 @@ enum RwTextureCoordinateIndex }; typedef enum RwTextureCoordinateIndex RwTextureCoordinateIndex; -/** - * \ingroup datatypes - * \typedef RwTexCoords - * typedef for struct RwTexCoords - */ typedef struct RwTexCoords RwTexCoords; + +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup fundtypesdatatypes * \struct RwTexCoords * This type represents the the u and v texture * coordinates of a particular vertex. */ +#endif /* RWADOXYGENEXTERNAL */ struct RwTexCoords { RwReal u; /**< U value */ @@ -1409,10 +1425,13 @@ struct RwTexCoords /* Singley linked list macros. End marked as NULL */ typedef struct RwSLLink RwSLLink; /*** RwSLLink ***/ + +#if (!defined(DOXYGEN)) struct RwSLLink { RwSLLink *next; }; +#endif /* (!defined(DOXYGEN)) */ #define rwSLLinkGetData(link,type,entry) \ ((type *)(((RwUInt8 *)(link))-offsetof(type,entry))) @@ -1427,10 +1446,13 @@ struct RwSLLink ((linkvar)->next) typedef struct RwSingleList RwSingleList; + +#if (!defined(DOXYGEN)) struct RwSingleList { RwSLLink link; }; +#endif /* (!defined(DOXYGEN)) */ #define rwSingleListInitialize(list) \ (list)->link.next= NULL; @@ -1446,11 +1468,14 @@ struct RwSingleList /* Doubly linked list. End marked as start (its a ring) */ typedef struct RwLLLink RwLLLink; /*** RwLLLink ***/ + +#if (!defined(DOXYGEN)) struct RwLLLink { RwLLLink *next; RwLLLink *prev; }; +#endif /* (!defined(DOXYGEN)) */ #define rwLLLinkGetData(linkvar,type,entry) \ ((type *)(((RwUInt8 *)(linkvar))-offsetof(type,entry))) @@ -1472,10 +1497,13 @@ struct RwLLLink ((linkvar)->next) typedef struct RwLinkList RwLinkList; + +#if (!defined(DOXYGEN)) struct RwLinkList { RwLLLink link; }; +#endif /* (!defined(DOXYGEN)) */ #define rwLinkListInitialize(list) \ ( (list)->link.next = ((RwLLLink *)(list)), \ @@ -1497,19 +1525,17 @@ struct RwLinkList #define rwLinkListGetTerminator(list) \ (&((list)->link)) -/** - * \ingroup datatypes - * \typedef RwSurfaceProperties - * typedef for struct RwSurfaceProperties - */ typedef struct RwSurfaceProperties RwSurfaceProperties; + +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup fundtypesdatatypes * \struct RwSurfaceProperties * This type represents the ambient, diffuse and * specular reflection coefficients of a particular geometry. Each coefficient * is specified in the range 0.0 (no reflection) to 1.0 (maximum reflection). */ +#endif /* RWADOXYGENEXTERNAL */ struct RwSurfaceProperties { RwReal ambient; /**< ambient reflection coefficient */ @@ -1541,10 +1567,10 @@ struct RwSurfaceProperties */ #define RWFIX_MIN (1) #define RWFIX_MAX (0x7fffffff) -#define RwFixedCast(A) (RwInt32FromRealMacro((A) * 65536.0f)) -#define RwFixedToInt(A) ((A) >> 16) -#define RwFixedToFloat(A) ((float)(((float)(A)) * (1.0f / 65536.0f))) +#define RwFixedToInt(a) ((a) >> 16) +#define RwFixedToFloat(a) ((float)(((float)(a)) * (1.0f / 65536.0f))) #define RwFixedToReal(a) ((RwReal)(((RwReal)(a)) * (1.0f / 65536.0f))) +#define RwIntToFixed(a) ((a) << 16) #define RwRealToFixed(a) (RwInt32FromRealMacro((a) * 65536.0f)) #define RwRealAbs(a) ((RwReal)((a) >= (RwReal)(0.0) ? (a) : (-(a)))) #define RwRealMin2(a,b) ((RwReal)( ((a) <= (b)) ? (a) : (b))) @@ -1555,7 +1581,6 @@ struct RwSurfaceProperties #ifndef NORWREALSHORTCUT #define RToFixed RwRealToFixed #define RAbs RwRealAbs -#define FxCast RwFixedCast #define FxToInt RwFixedToInt #define FxToFloat RwFixedToFloat #define FxToReal RwFixedToFloat @@ -1580,6 +1605,8 @@ struct RwSurfaceProperties * typedef for struct RwPlane */ typedef struct RwPlane RwPlane; + +#if (!defined(DOXYGEN)) /* * This type represents a plane */ @@ -1588,7 +1615,7 @@ struct RwPlane RwV3d normal; /**< Normal to the plane */ RwReal distance; /**< Distance to plane from origin in normal direction*/ }; - +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** Defines @@ -1613,7 +1640,7 @@ typedef enum RwPlaneType RwPlaneType; (*(const RwReal *)(((const RwUInt8 *)(&((vect).x)))+(RwInt32)(y))) #define SETCOORD(vect,y,value) \ (((*(RwReal *)(((RwUInt8 *)(&((vect).x)))+(RwInt32)(y))))=(value)) -#define SETCONTCOORD(vect,y,value) \ +#define SETCONSTCOORD(vect,y,value) \ (((*(const RwReal *) \ (((const RwUInt8 *) \ (&((vect).x)))+(RwInt32)(y))))=(value)) @@ -1624,7 +1651,7 @@ typedef enum RwPlaneType RwPlaneType; /** - * \ingroup rwcore + * \ingroup integertypes * \page inttypes Integer Types * * RenderWare supports a number of integer types: @@ -1661,7 +1688,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup realtypes * \typedef RwReal * * RenderWare supports a single RwReal floating-point type to aid portability @@ -1683,7 +1710,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup realtypes * \typedef RwFixed * * RenderWare supports a single RwFixed fixed-point type. @@ -1696,15 +1723,15 @@ typedef enum RwPlaneType RwPlaneType; * RWFIX_MAX and RWFIX_MIN respectively. * * The following macros are provided to help you work with RwFixed datatypes: - * \li RwFixedCast(x) Cast the integer portion of an RwFixed to another type. * \li RwFixedToInt(x) Convert an RwFixed to an integer. (The fractional portion is lost.) * \li RwFixedToFloat(x) Convert an RwFixed to a float. * \li RwFixedToReal(x) Convert an RwFixed to an RwReal. * \li RwRealToFixed(x) Convert an RwReal to an RwFixed. (Some precision may be lost.) + * \li RwIntToFixed(x) Convert an RwInt32 to an RwFixed. (Some precision may be lost.) */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwInt8 * * Signed 8 bit integer type. @@ -1712,7 +1739,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwUInt8 * * Unsigned 8bit integer type. @@ -1720,7 +1747,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwChar * * Character type. @@ -1728,7 +1755,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwInt16 * * Signed 16 bit integer type. @@ -1736,7 +1763,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwUInt16 * * Unsigned 16 bit integer type. @@ -1744,7 +1771,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwInt32 * * Signed 32 bit integer type. @@ -1752,7 +1779,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwUInt32 * * Unsigned 32 bit integer type. @@ -1760,7 +1787,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwInt64 * * Signed 64 bit integer type. @@ -1768,7 +1795,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwUInt64 * * Unsigned 64 bit integer type. @@ -1776,7 +1803,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwInt128 * * Signed 128 bit integer type. @@ -1784,7 +1811,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwUInt128 * * Unsigned 128 bit integer type. @@ -1792,7 +1819,7 @@ typedef enum RwPlaneType RwPlaneType; */ /** - * \ingroup datatypes + * \ingroup integertypes * \typedef RwBool * * Boolean type. @@ -1894,8 +1921,10 @@ enum RwCorePluginID rwID_PITEXDICTIONARY = 0x23, rwID_TOC = 0x24, rwID_PRTSTDGLOBALDATA = 0x25, + rwID_ALTPIPE = 0x26, + rwID_PIPEDS = 0x27, /* Insert before MAX and increment MAX */ - rwID_COREPLUGINIDMAX = 0x26, + rwID_COREPLUGINIDMAX = 0x28, rwCOREPLUGINIDFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwCorePluginID RwCorePluginID ; @@ -1944,12 +1973,15 @@ typedef enum RwPlatformID RwPlatformID; */ typedef struct RwObject RwObject; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwobject * \struct RwObject * This should be considered an opaque type. Use * the RwObject API functions to access. */ +#endif /* RWADOXYGENEXTERNAL */ + struct RwObject { RwUInt8 type; /**< Internal Use */ @@ -1960,20 +1992,23 @@ struct RwObject /* Often a Frame */ }; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * \typedef RwObjectCallBack + * \ingroup rwobject + * \ref RwObjectCallBack * callback function supplied for object callback functions. * - * \return Pointer to the current object - * * \param object Pointer to the current object, supplied by - * iterator. - * \param data Pointer to developer-defined data structure. + * iterator. + * \param data Pointer to developer-defined data structure. + * + * \return Pointer to the current object * * \see RwFrameForAllObjects * */ +#endif /* RWADOXYGENEXTERNAL */ + typedef RwObject *(*RwObjectCallBack)(RwObject *object, void *data); /**************************************************************************** @@ -2128,6 +2163,8 @@ typedef int (*vecSscanfFunc)(const RwChar *buffer, ...) /* __RWFORMAT__(scanf, 2, 3) */; typedef struct RwStringFunctions RwStringFunctions; + +#if (!defined(DOXYGEN)) struct RwStringFunctions { vecSprintfFunc vecSprintf ; @@ -2147,6 +2184,7 @@ struct RwStringFunctions vecStrtokFunc vecStrtok; vecSscanfFunc vecSscanf; }; +#endif /* (!defined(DOXYGEN)) */ /*--- Automatically derived from: C:/daily/rwsdk/src/plcore/rwdbgerr.h ---*/ @@ -2203,32 +2241,32 @@ typedef enum RwErrorCodePlugin_errcore RwErrorCodePlugin_errcore; #endif /* (!defined(rwFREELISTCLEANLANDFILL)) */ #define RWFREELISTALIGNED(_pData, _freelist) \ - (! (((RwUInt32)(_pData)) & ((_freelist)->alignmentMinusOne)) ) + (! (((RwUInt32)(_pData)) & ((_freelist)->alignment - 1)) ) /***************************** * REGULAR MEMORY ALLOCATION * *****************************/ /** - * \ingroup rwmem + * \ingroup memoryfileinterface * \def RwMalloc * RwMalloc(_s) is a macro for malloc(_s). */ /** - * \ingroup rwmem + * \ingroup memoryfileinterface * \def RwFree * RwFree(_p) is a macro for free(_p). */ /** - * \ingroup rwmem + * \ingroup memoryfileinterface * \def RwCalloc * RwCalloc(_n, _s) is a macro for calloc(_n, _s). */ /** - * \ingroup rwmem + * \ingroup memoryfileinterface * \def RwRealloc * RwRealloc(_p, _s) is a macro for realloc(_p, _s). */ @@ -2252,8 +2290,6 @@ typedef enum RwErrorCodePlugin_errcore RwErrorCodePlugin_errcore; # if (defined(_MSC_VER)) # if ((_MSC_VER>=1000) && defined(_DEBUG)) -/* Pick up _ASSERTE() macro */ -/* #include <windows.h> */ #if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) #define _CRTDBG_MAP_ALLOC #endif /* defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) */ @@ -2556,12 +2592,12 @@ typedef enum RwErrorCodePlugin_errcore RwErrorCodePlugin_errcore; typedef struct RwMemoryFunctions RwMemoryFunctions; /** - * \ingroup datatypes + * \ingroup memoryfileinterface * \struct RwMemoryFunctions * This type represents the memory functions used * by RenderWare. By default, the standard ANSI functions are used. The * application may install an alternative interface providing that it is ANSI - * compliant (see API function \ref RwEngineInit): + * compliant (in RenderWare Graphics see API function RwEngineInit): */ struct RwMemoryFunctions { @@ -2574,60 +2610,44 @@ struct RwMemoryFunctions void *(*rwcalloc)(size_t numObj, size_t sizeObj); /**< calloc calloc */ }; -typedef struct RwFreeBlock RwFreeBlock; -/* - * Freelists -- from Page 131 - * Advanced Animation and Rendering Techniques - * Alan Watt and Mark Watt - * Addison-Wesley 1993, - * ISBN 0-201-54412-1: + /** + * \ingroup rwfreelist + * The free list was statically allocated * - * "Lastly, on a more general note concerning speedups for renderers, the - * implementor should be aware that a lot of suggestions for improving - * efficiency fall into the category of ingenious, but complex, - * algorithms for very specific contexts that may save a few microseconds - * but which make your code unreadable. A more general computer science - * perspective that takes a `global view' of the renderer can be more - * fruitful. For example, the renderer devotes a lot of time to - * allocating and deallocating chunks of memory for storing data. A lot - * of these chunks are always the same size - such as those that are - * continually required to store the data structure for fragment lists. - * Using memory management techniques that recognize this fact can yield - * considerable dividends. One such scheme would be to hold a series of - * empty lists in memory for all the commonly used data structures. An - * empty list for fragments, say, would contain a list of previously - * allocated, but no longer needed, fragment structures. When the - * renderer needs memory for a new fragment, it looks first at this empty - * list. If there is nothing there it allocates space directly, - * otherwise it takes a fragments off the end of the list and uses that. - * Conversely, when the renderer no longer needs a fragment, instead of - * freeing it, it goes onto the end of the empty list. In the authors' - * experience, replacing the naive allocate/deallocate scheme with this - * way of managing memory can result in 100% speedup. " - */ -struct RwFreeBlock -{ - RwFreeBlock *nextBlock; -}; - -typedef struct RwFreeList RwFreeList; -struct RwFreeList -{ - void **freeListStack; /* Stack of unused entries */ - void **freeListStackTop; /* Pointer to the top of the stack */ + * \see RwFreeListSetFlags + */ +#define rwFREELISTFLAG_STATIC 0x00000001 - RwFreeBlock *firstBlock; /* Data start */ +/** + * \ingroup rwfreelist + * \hideinitializer + * Free blocks as soon as they are empty + * + * \see RwFreeListSetFlags + */ +#define rwFREELISTFLAG_FREEBLOCKS 0x00000002 - RwInt32 blockSize; /* Size of block in bytes */ - RwInt32 entrySize; /* Entry size */ - RwInt32 alignmentMinusOne; /* Entry alignment minus 1 */ - RwInt32 entriesPerBlock; /* Amount of space in a block */ - RwInt32 entriesAllocated; /* Total slots allocated - * (but not necessarily being used */ +typedef struct RwFreeList RwFreeList; - /* All freelists */ - RwLLLink lFreeList; +/** + * \ingroup rwfreelist + * Holds free list info, should be considered opaque. Use API functions to access. + */ +struct RwFreeList +{ + RwUInt32 entrySize; /**<size of an entry in the free list */ +#if (defined(RWDEBUG) && !defined(DOXYGEN)) + RwUInt32 nonAlignedEntrySize; +#endif /* (defined(RWDEBUG) && !defined(DOXYGEN)) */ + RwUInt32 entriesPerBlock; /**<number of entries per free list block */ + RwUInt32 heapSize; /**<size of the heap */ + RwUInt32 alignment; /**<alignment of a free list entry */ + RwLinkList blockList; /**<list of data blocks */ + RwUInt32 flags; /**<flags which affect the behavior of the + free list <BR> + rwFREELISTFLAG_FREEBLOCKS */ + RwLLLink link; /**<link to the free list linked list */ #if (defined(RWDEBUG) && !defined(DOXYGEN)) const RwChar *fileCreate; @@ -2635,8 +2655,9 @@ struct RwFreeList #endif /* (defined(RWDEBUG) && !defined(DOXYGEN)) */ }; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwfreelist * \ref RwFreeListCallBack represents * the function called from \ref RwFreeListForAllUsed for all used entries in a * given free list. @@ -2648,6 +2669,8 @@ struct RwFreeList * \see RwFreeListForAllUsed * */ +#endif /* RWADOXYGENEXTERNAL */ + typedef void (*RwFreeListCallBack) (void *pMem, void *pData); typedef void *(*RwMemoryAllocFn) (RwFreeList * fl); typedef RwFreeList *(*RwMemoryFreeFn) (RwFreeList * fl, void *pData); @@ -2684,12 +2707,25 @@ extern RwFreeList *_rwFreeListCreate(RwInt32 entrySize, __LINE__) #else /* (defined(RWDEBUG) && !defined(DOXYGEN)) */ +/* legacy freelist create */ + extern RwFreeList *RwFreeListCreate(RwInt32 entrySize, RwInt32 entriesPerBlock, RwInt32 alignment); #endif /* (defined(RWDEBUG) && !defined(DOXYGEN)) */ +extern RwFreeList* +RwFreeListCreateAndPreallocateSpace(RwInt32 entrySize, + RwInt32 entriesPerBlock, + RwInt32 alignment, + RwInt32 numBlocksToPreallocate, + RwFreeList *inPlaceSpaceForFreeListStruct ); + extern RwBool RwFreeListDestroy(RwFreeList * freelist); + +extern void RwFreeListSetFlags( RwFreeList *freeList, RwUInt32 flags ); +extern RwUInt32 RwFreeListGetFlags( RwFreeList *freeList ); + /* Garbage collection/enumeration */ extern RwInt32 RwFreeListPurge(RwFreeList * freelist); extern RwFreeList *RwFreeListForAllUsed(RwFreeList * freelist, @@ -2712,7 +2748,7 @@ extern RwInt32 RwFreeListPurgeAllFreeLists(void); #include <rtdbmalloc.h> #define RwFreeListAlloc(_f) \ - memalign((1 + (_f)->alignmentMinusOne), (_f)->entrySize) + memalign(((_f)->alignment), (_f)->entrySize) #else /* ((defined(__MWERKS__) || defined(__GNUC__)) && defined(__R5900__)) */ @@ -2750,7 +2786,7 @@ extern RwInt32 RwFreeListPurgeAllFreeLists(void); */ /** - * \ingroup datatypes + * \ingroup rwstream * \ref RwStreamType * This type represents the different types of stream that * can be used. @@ -2768,7 +2804,7 @@ enum RwStreamType typedef enum RwStreamType RwStreamType; /** - * \ingroup datatypes + * \ingroup rwstream * \ref RwStreamAccessType * This type represents the options available for * accessing a stream when it is opened. @@ -2785,8 +2821,8 @@ typedef enum RwStreamAccessType RwStreamAccessType; /* Memory stream */ /** - * \ingroup datatypes - * \typedef RwStreamMemory + * \ingroup rwstream + * \struct RwStreamMemory * This should be considered an opaque type. * Use the RwStream API functions to access. */ @@ -2803,7 +2839,7 @@ struct RwStreamMemory typedef union RwStreamFile RwStreamFile; /** - * \ingroup datatypes + * \ingroup rwstream * \union RwStreamFile * This type is used to represent a file pointer for * accessing data on disk through the stream mechanism. @@ -2829,8 +2865,8 @@ typedef RwBool(*rwCustomStreamFnSkip) (void *data, /* Custom stream */ /** - * \ingroup datatypes - * \typedef RwStreamCustom + * \ingroup rwstream + * \struct RwStreamCustom * This should be considered an opaque type. * Use the RwStream API functions to access. */ @@ -2850,7 +2886,7 @@ struct RwStreamCustom typedef union RwStreamUnion RwStreamUnion; /** - * \ingroup datatypes + * \ingroup rwstream * \union RwStreamUnion * The union of all supported stream types */ @@ -2862,8 +2898,8 @@ union RwStreamUnion }; /** - * \ingroup datatypes - * \typedef RwStream + * \ingroup rwstream + * \struct RwStream * Binary stream for reading or writing object data. * This should be considered an opaque type. * Use the RwStream API functions to access. @@ -2883,7 +2919,7 @@ struct RwStream typedef struct RwMemory RwMemory; /** - * \ingroup datatypes + * \ingroup rwstream * \struct RwMemory * This type represents a block of allocated memory. * It is used to specify an area of memory connected to a stream of type @@ -2905,6 +2941,9 @@ extern "C" { #endif /* __cplusplus */ +extern void +RwStreamSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + /* Open/Close streams */ extern RwStream * @@ -2953,8 +2992,9 @@ RwStreamSkip(RwStream * stream, Global Types */ +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginDataChunkWriteCallBack represents the function * registered by \ref RwCameraRegisterPluginStream, etc. as the function that * writes extension data to a binary stream. @@ -2979,7 +3019,7 @@ RwStreamSkip(RwStream * stream, typedef RwStream *(*RwPluginDataChunkWriteCallBack)(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginDataChunkReadCallBack represents the function * registered by \ref RwCameraRegisterPluginStream, etc. as the function that * reads extension data from a binary stream. @@ -3004,7 +3044,7 @@ typedef RwStream *(*RwPluginDataChunkWriteCallBack)(RwStream *stream, RwInt32 bi typedef RwStream *(*RwPluginDataChunkReadCallBack)(RwStream *stream, RwInt32 binaryLength, void *object, RwInt32 offsetInObject, RwInt32 sizeInObject); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginDataChunkGetSizeCallBack represents the callback * registered by \ref RwCameraRegisterPluginStream, etc. as the function that * determines the binary size of the extension data. @@ -3022,7 +3062,7 @@ typedef RwStream *(*RwPluginDataChunkReadCallBack)(RwStream *stream, RwInt32 bin typedef RwInt32(*RwPluginDataChunkGetSizeCallBack)(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginDataChunkAlwaysCallBack represents the callback * registered by \ref RwCameraSetStreamAlwaysCallBack, etc. as the * function that is called after the reading of plugin stream data is @@ -3037,11 +3077,13 @@ typedef RwInt32(*RwPluginDataChunkGetSizeCallBack)(const void *object, RwInt32 o * * \param sizeInObject A RwInt32 value equal to the size * (in bytes) of the extension data. + * + * \return Returns TRUE if successful, FALSE otherwise. */ typedef RwBool(*RwPluginDataChunkAlwaysCallBack)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginDataChunkRightsCallBack represents the callback * registered by RwCameraSetStreamRightsCallBack, etc. as the * function that is called after the reading of plugin stream data is @@ -3058,11 +3100,13 @@ typedef RwBool(*RwPluginDataChunkAlwaysCallBack)(void *object, RwInt32 offsetInO * (in bytes) of the extension data. * * \param extraData An RwUInt32 writen with the plugin id. + * + * \return Returns TRUE if successful, FALSE otherwise. */ typedef RwBool(*RwPluginDataChunkRightsCallBack)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject, RwUInt32 extraData); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginObjectConstructor represents the callback * registered by \ref RwEngineRegisterPlugin, \ref RwCameraRegisterPlugin, etc. * as the function that initializes either the global extension data (in the @@ -3083,7 +3127,7 @@ typedef RwBool(*RwPluginDataChunkRightsCallBack)(void *object, RwInt32 offsetInO typedef void *(*RwPluginObjectConstructor)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginObjectCopy represents the callback registered by * \ref RwCameraRegisterPlugin, etc. as the function that copies the object * extension data when an object is duplicated. @@ -3105,7 +3149,7 @@ typedef void *(*RwPluginObjectConstructor)(void *object, RwInt32 offsetInObject, typedef void *(*RwPluginObjectCopy)(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject); /** - * \ingroup datatypes + * \ingroup rwplugin * \ref RwPluginObjectDestructor represents the callback registered * by \ref RwEngineRegisterPlugin, \ref RwCameraRegisterPlugin, etc. as the * function that destroys either the global extension data (in the case of @@ -3123,6 +3167,8 @@ typedef void *(*RwPluginObjectCopy)(void *dstObject, const void *srcObject, RwIn * * \return Pointer to the object. */ +#endif /* RWADOXYGENEXTERNAL */ + typedef void *(*RwPluginObjectDestructor)(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject); typedef void *(*RwPluginErrorStrCallBack)(void *); @@ -3130,6 +3176,7 @@ typedef void *(*RwPluginErrorStrCallBack)(void *); typedef struct RwPluginRegistry RwPluginRegistry; typedef struct RwPluginRegEntry RwPluginRegEntry; +#if (!defined(DOXYGEN)) struct RwPluginRegistry { RwInt32 sizeOfStruct; @@ -3158,6 +3205,7 @@ struct RwPluginRegEntry RwPluginRegEntry *prevRegEntry; RwPluginRegistry *parentRegistry; }; +#endif /* (!defined(DOXYGEN)) */ @@ -3172,6 +3220,9 @@ extern "C" /* Registering toolkits and allocating memory */ +extern void +RwPluginRegistrySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwBool _rwPluginRegistrySetStaticPluginsSize(RwPluginRegistry * reg, RwInt32 size); @@ -3355,14 +3406,17 @@ MACRO_STOP #define RWMATRIXPRINT(_matrix) /* No op */ #endif /* (!(defined(RWMATRIXPRINT))) */ +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwmatrix * enum RwOpCombineType * This type represents a combination operator which * can be applied to frames and matrices. * The operator determines the order * in which one object is combined with another */ +#endif /* RWADOXYGENEXTERNAL */ + enum RwOpCombineType { rwCOMBINEREPLACE = 0, /**<Replace - @@ -3376,9 +3430,8 @@ enum RwOpCombineType rwOPCOMBINETYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; -/** - * \ingroup datatypes - * \typedef RwOpCombineType typedef for enum RwOpCombineType +/* + * RwOpCombineType typedef for enum RwOpCombineType */ typedef enum RwOpCombineType RwOpCombineType; @@ -3388,7 +3441,7 @@ typedef enum RwOpCombineType RwOpCombineType; enum RwMatrixType { rwMATRIXTYPENORMAL = 0x00000001, - rwMATRIXTYPEORTHOGANAL = 0x00000002, + rwMATRIXTYPEORTHOGONAL = 0x00000002, rwMATRIXTYPEORTHONORMAL = 0x00000003, rwMATRIXTYPEMASK = 0x00000003, rwMATRIXTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT @@ -3442,8 +3495,8 @@ typedef struct RwMatrixTag RWALIGN(RwMatrix, rwMATRIXALIGNMENT); */ /** - * \ingroup datatypes - * \typedef RwMatrix + * \ingroup rwmatrix + * \struct RwMatrix * Matrix to define transformations. * This should be considered an opaque type. * Use the RwMatrix API functions to access. @@ -3476,18 +3529,15 @@ typedef void (RWASMCALL * rwMatrixMultFn) (RwMatrix * dstMat, const RwMatrix * matA, const RwMatrix * matB); -/* - * \ingroup datatypes - * \typedef RwMatrixTolerance - * Typedef for RwMatrixTolerance structure - */ typedef struct RwMatrixTolerance RwMatrixTolerance; -/* - * \ingroup datatypes +#ifndef RWADOXYGENEXTERNAL +/** + * \ingroup rwmatrix * \struct RwMatrixTolerance * Holds tolerances for matrix optimizations with \ref RwMatrixOptimize */ +#endif /* RWADOXYGENEXTERNAL */ struct RwMatrixTolerance { RwReal Normal; @@ -3522,6 +3572,9 @@ RwEngineSetMatrixTolerances(const RwMatrixTolerance * const tolerance); #define rwMatrixTestFlags(m, flagsbit) ((m)->flags & (RwInt32)(flagsbit)) /* Creation/destruction */ +extern void +RwMatrixSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc ); + extern RwBool RwMatrixDestroy(RwMatrix * mpMat); @@ -3693,7 +3746,7 @@ MACRO_STOP rwMATRIXTYPENORMAL) ) || /* ... or actually is */ \ rwMatrixIsNormal(_matrix, _epsilon)) && \ ( ( !( rwMatrixGetFlags(_matrix) & /* not flagged as orthogonal */ \ - rwMATRIXTYPEORTHOGANAL) ) || /* ... or actually is */ \ + rwMATRIXTYPEORTHOGONAL) ) || /* ... or actually is */ \ rwMatrixIsOrthogonal(_matrix, _epsilon)) ) #define rwMat01Det(_mAA) \ @@ -3906,8 +3959,6 @@ MACRO_STOP #pragma warning( disable : 344 ) #endif /* (defined(__ICL)) */ -//nobody needed that - AAP -//#include <windows.h> #if (defined(RWDEBUG)) #if (defined(RWMEMDEBUG) && !defined(_CRTDBG_MAP_ALLOC)) @@ -4001,48 +4052,16 @@ MACRO_START \ } \ MACRO_STOP -/* LEGACY-SUPPORT macros */ -#define RWIM2DVERTEXSetCameraX(vert, camx) RwIm2DVertexSetCameraX(vert, camx) -#define RWIM2DVERTEXSetCameraY(vert, camy) RwIm2DVertexSetCameraY(vert, camy) -#define RWIM2DVERTEXSetCameraZ(vert, camz) RwIm2DVertexSetCameraZ(vert, camz) -#define RWIM2DVERTEXSetRecipCameraZ(vert, recipz) \ - RwIm2DVertexSetRecipCameraZ(vert, recipz) -#define RWIM2DVERTEXGetCameraX(vert) RwIm2DVertexGetCameraX(vert) -#define RWIM2DVERTEXGetCameraY(vert) RwIm2DVertexGetCameraY(vert) -#define RWIM2DVERTEXGetCameraZ(vert) RwIm2DVertexGetCameraZ(vert) -#define RWIM2DVERTEXGetRecipCameraZ(vert) RwIm2DVertexGetRecipCameraZ(vert) -#define RWIM2DVERTEXSetScreenX(vert, scrnx) RwIm2DVertexSetScreenX(vert, scrnx) -#define RWIM2DVERTEXSetScreenY(vert, scrny) RwIm2DVertexSetScreenY(vert, scrny) -#define RWIM2DVERTEXSetScreenZ(vert, scrnz) RwIm2DVertexSetScreenZ(vert, scrnz) -#define RWIM2DVERTEXGetScreenX(vert) RwIm2DVertexGetScreenX(vert) -#define RWIM2DVERTEXGetScreenY(vert) RwIm2DVertexGetScreenY(vert) -#define RWIM2DVERTEXGetScreenZ(vert) RwIm2DVertexGetScreenZ(vert) -#define RWIM2DVERTEXSetU(vert, u, recipz) RwIm2DVertexSetU(vert, u, recipz) -#define RWIM2DVERTEXSetV(vert, v, recipz) RwIm2DVertexSetV(vert, v, recipz) -#define RWIM2DVERTEXGetU(vert) RwIm2DVertexGetU(vert) -#define RWIM2DVERTEXGetV(vert) RwIm2DVertexGetV(vert) -#define RWIM2DVERTEXSetRealRGBA(vert, red, green, blue, alpha) \ - RwIm2DVertexSetRealRGBA(vert, red, green, blue, alpha) -#define RWIM2DVERTEXSetIntRGBA(vert, red, green, blue, alpha) \ - RwIm2DVertexSetIntRGBA(vert, red, green, blue, alpha) -#define RWIM2DVERTEXGetRed(vert) RwIm2DVertexGetRed(vert) -#define RWIM2DVERTEXGetGreen(vert) RwIm2DVertexGetGreen(vert) -#define RWIM2DVERTEXGetBlue(vert) RwIm2DVertexGetBlue(vert) -#define RWIM2DVERTEXGetAlpha(vert) RwIm2DVertexGetAlpha(vert) -#define RWIM2DVERTEXCopyRGBA(dst, src) RwIm2DVertexCopyRGBA(dst, src) -#define RWIM2DVERTEXClipRGBA(o, i, n, f) RwIm2DVertexClipRGBA(o, i, n, f) - /**************************************************************************** Global Types */ /* We use RwD3D8Vertex to drive the hardware in 2D mode */ -/** - * \ingroup rwcoredriverd3d8 - * \typedef RwD3D8Vertex +/* * D3D8 vertex structure definition for 2D geometry */ +#if !defined(RWADOXYGENEXTERNAL) typedef struct RwD3D8Vertex RwD3D8Vertex; /** * \ingroup rwcoredriverd3d8 @@ -4061,47 +4080,41 @@ struct RwD3D8Vertex RwReal u; /**< Texture coordinate U */ RwReal v; /**< Texture coordinate V */ }; +#endif /* !defined(RWADOXYGENEXTERNAL) */ /* Define types used */ +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 - * \typedef RwIm2DVertex + * \ref RwIm2DVertex * Typedef for a RenderWare Graphics Immediate Mode 2D Vertex */ typedef RwD3D8Vertex RwIm2DVertex; +#endif /* !defined(RWADOXYGENEXTERNAL) */ -/* LEGACY-SUPPORT macro */ +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 - * \def RWIM2DVERTEX - * RWIM2DVERTEX is a legacy macro for RwIm2DVertex - */ -#define RWIM2DVERTEX RwIm2DVertex - -/** - * \ingroup rwcoredriverd3d8 - * \typedef RxVertexIndex + * \ref RxVertexIndex * * Typedef for a RenderWare Graphics PowerPipe Immediate * Mode Vertex */ typedef RwUInt16 RxVertexIndex; +#endif /* !defined(RWADOXYGENEXTERNAL) */ + +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 - * \typedef RwImVertexIndex + * \ref RwImVertexIndex * Typedef for a RenderWare Graphics Immediate Mode Vertex. */ typedef RxVertexIndex RwImVertexIndex; +#endif /* !defined(RWADOXYGENEXTERNAL) */ -/* LEGACY-SUPPORT macro */ -/** - * \ingroup rwcoredriverd3d8 - * \def RWIMVERTEXINDEX - * RWIMVERTEXINDEX is a legacy macro for RwImVertexIndex - */ -#define RWIMVERTEXINDEX RwImVertexIndex +#if !defined(RWADOXYGENEXTERNAL) /** * \ingroup rwcoredriverd3d8 @@ -4114,8 +4127,10 @@ typedef struct RwUInt32 numTextureStageStateChanges; /**< Number of Texture Stage States changed */ RwUInt32 numMaterialChanges; /**< Number of Material changes */ RwUInt32 numLightsChanged; /**< Number of Lights changed */ + RwUInt32 numVBSwitches; /**< Number of Vertex Buffer switches */ } RwD3D8Metrics; +#endif /* !defined(RWADOXYGENEXTERNAL) */ #endif /* D3D8_DRVMODEL_H */ @@ -4125,7 +4140,7 @@ RwD3D8Metrics; * Typedef for pointer to Vector multiplication by Matrix function */ -typedef RwV3d *(*rwVectorMultFn) (RwV3d * pointsOut, +typedef RwV3d *(*rwVectorMultFn) (RwV3d * pointsOut, const RwV3d * pointsIn, RwInt32 numPoints, const RwMatrix * matrix); @@ -4136,7 +4151,7 @@ typedef RwV3d *(*rwVectorMultFn) (RwV3d * pointsOut, * currently applies to SKY2 and XBOX - IDBS [2/11/2001] * [and, if using the intel compiler version 400 or above, * we will use the single-precision float "sqrtf" under - * D3D7, D3D8, OpenGL or SoftRas] */ + * D3D8, OpenGL or SoftRas] */ #if (defined(rwSqrtMacro)) #define RWNOSQRTTABLE #endif /* (defined(rwSqrtMacro)) */ @@ -4198,7 +4213,7 @@ MACRO_STOP #define RwV2dDotProductMacro(a,b) \ (( ((((a)->x) * ( (b)->x))) + \ - ( (((a)->y) * ( (b)->y))))) \ + ( (((a)->y) * ( (b)->y))))) #define _rwV2dNormalizeMacro(_result, _out, _in) \ MACRO_START \ @@ -4303,7 +4318,7 @@ MACRO_STOP #define RwV3dDotProductMacro(a, b) \ ((((( (((a)->x) * ((b)->x))) + \ ( (((a)->y) * ((b)->y))))) + \ - ( (((a)->z) * ((b)->z))))) \ + ( (((a)->z) * ((b)->z))))) #define RwV3dCrossProductMacro(o, a, b) \ MACRO_START \ @@ -4375,7 +4390,7 @@ MACRO_STOP #endif /* (!defined(rw4OVERPISQ)) */ #if (!defined(rwPI3)) -#define rwPI3 (rwPI * (RwReal)3) +#define rwPI3 (rwPI * (RwReal)3) #endif /* (!defined(rwPI3)) */ #if (!defined(rwPI3OVER2)) @@ -4463,7 +4478,7 @@ extern void RwV3dSub(RwV3d * out, const RwV3d * ina, const RwV3d * inb); extern void RwV3dScale(RwV3d * out, const RwV3d * in, RwReal scalar); -extern void RwV3dIncrementScaled(RwV3d * out, +extern void RwV3dIncrementScaled(RwV3d * out, const RwV3d * in, RwReal scalar); extern void RwV3dNegate(RwV3d * out, const RwV3d * in); extern RwReal RwV3dDotProduct(const RwV3d * ina, const RwV3d * inb); @@ -4513,6 +4528,8 @@ extern RwReal _rwV3dNormalize(RwV3d * out, const RwV3d * in); */ typedef struct RwSList RwSList; + +#if (!defined(DOXYGEN)) struct RwSList { RwUInt8 *listElements; @@ -4520,7 +4537,7 @@ struct RwSList RwInt32 numElementsAlloced; RwInt32 entrySize; }; - +#endif /* (!defined(DOXYGEN) */ /**************************************************************************** @@ -4595,99 +4612,169 @@ extern void *_rwSListToArray(RwSList *sList); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwRenderState - * This type represents the various render states that - * can be set using the API function \ref RwRenderStateSet. This function also - * takes a render state value or pointer to an object depending on the type. - * For render states that are toggles, the value should be TRUE to switch the - * state on and FALSE to turn it off. + * \ingroup rwrenderstate + * RwRenderState represents the global state variables that control + * rendering. These may be set and queried using the + * \ref RwRenderStateSet and \ref RwRenderStateGet functions respectively. + * + * Refer to the \ref rwrenderstateoverview for an overview of this system. * - * Note that many of these render states may not be supported on certain - * platforms. The \ref RwRenderStateSet functions will return FALSE in such cases. + * \note The texture render states (raster, address & filter modes) would + * normally just be used when rendering in immediate mode and should be + * specificied completely every time a texture is used. Retained mode + * pipelines will frequently set theses states internally, usually based on + * \ref RwTexture objects. */ +#endif /* RWADOXYGENEXTERNAL */ enum RwRenderState { rwRENDERSTATENARENDERSTATE = 0, - rwRENDERSTATETEXTURERASTER, /**<Raster to texture with. \ref RwRenderStateSet - * takes a pointer to an \ref RwRaster */ - rwRENDERSTATETEXTUREADDRESS, /**<\ref RwTextureAddressMode: wrap, clamp, mirror or border */ - rwRENDERSTATETEXTUREADDRESSU, /**<\ref RwTextureAddressMode in u only */ - rwRENDERSTATETEXTUREADDRESSV, /**<\ref RwTextureAddressMode in v only */ - rwRENDERSTATETEXTUREPERSPECTIVE, /**<Perspective correction on/off */ - rwRENDERSTATEZTESTENABLE, /**<Z-buffer test on/off */ - rwRENDERSTATESHADEMODE, /**<\ref RwShadeMode: flat or gouraud shading */ - rwRENDERSTATEZWRITEENABLE, /**<Z-buffer write on/off */ - rwRENDERSTATETEXTUREFILTER, /**<\ref RwTextureFilterMode: point sample, bilinear, trilinear, etc */ - rwRENDERSTATESRCBLEND, /**<Source alpha \ref RwBlendFunction: src alpha, 1-src alpha, etc */ - rwRENDERSTATEDESTBLEND, /**<Destination alpha \ref RwBlendFunction */ - rwRENDERSTATEVERTEXALPHAENABLE, /**<Vertex alpha transparency on/off */ - rwRENDERSTATEBORDERCOLOR, /**<Border color for \ref RwTextureAddressMode rwTEXTUREADDRESSBORDER. - * The value should be a packed RwUInt32 in ARGB form. The macro - * RWRGBALONG(r, g, b, a) may be used to construct this using 8-bit - * color components. */ - rwRENDERSTATEFOGENABLE, /**<Fogging on/off (all polygons will be fogged) */ - rwRENDERSTATEFOGCOLOR, /**<Color used for fogging. The value should be a packed RwUInt32 - * in ARGB form. The macro RWRGBALONG(r, g, b, a) may be used to - * construct this using 8-bit color components */ - rwRENDERSTATEFOGTYPE, /**<Sets \ref RwFogType, the type of fogging to use */ - rwRENDERSTATEFOGDENSITY, /**<Select the fog density for \ref RwFogType of rwFOGTYPEEXPONENTIAL - * or rwFOGTYPEEXPONENTIAL2. The value should be a pointer to - * an RwReal in the range 0 to 1. */ - rwRENDERSTATEFOGTABLE, /**<Install a 256 entry fog table placed between fog distance and far - * clip-plane */ - rwRENDERSTATEALPHAPRIMITIVEBUFFER, /**<Render transparent alpha polygons last - on/off. \e Not \e supported - * \e on \e any \e platform.*/ - rwRENDERSTATECULLMODE, /**<Sets \ref RwCullMode, for selecting face culling. */ - rwRENDERSTATESTENCILENABLE, /**< TRUE to enable stenciling, or FALSE to disable stenciling. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only. */ - rwRENDERSTATESTENCILFAIL, /**< Stencil test operator for the fail case. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ - rwRENDERSTATESTENCILZFAIL, /**< Stencil operation to perform if the stencil test passes - * and the depth test (z-test) fails. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ - rwRENDERSTATESTENCILPASS, /**< Stencil operation to perform if both the stencil and the - * depth (z) tests pass. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ - rwRENDERSTATESTENCILFUNCTION, /**< Comparison function for the stencil test. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ - rwRENDERSTATESTENCILFUNCTIONREF, /**< Integer reference value for the stencil test. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ - rwRENDERSTATESTENCILFUNCTIONMASK, /**< Mask applied to the reference value and each stencil buffer - * entry to determine the significant bits for the stencil test. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ - rwRENDERSTATESTENCILFUNCTIONWRITEMASK, /**< Write mask applied to values written into the stencil buffer. - * \e Supported \e on \e Xbox, \e D3D8, \e and \e OpenGL \e only */ + + rwRENDERSTATETEXTURERASTER, + /**<Raster used for texturing (normally used in immediate mode). + * The value is a pointer to an \ref RwRaster. + */ + rwRENDERSTATETEXTUREADDRESS, + /**<\ref RwTextureAddressMode: wrap, clamp, mirror or border. + */ + rwRENDERSTATETEXTUREADDRESSU, + /**<\ref RwTextureAddressMode in u only. + */ + rwRENDERSTATETEXTUREADDRESSV, + /**<\ref RwTextureAddressMode in v only. + */ + rwRENDERSTATETEXTUREPERSPECTIVE, + /**<Perspective correction on/off (always enabled on many platforms). + */ + rwRENDERSTATEZTESTENABLE, + /**<Z-buffer test on/off. + */ + rwRENDERSTATESHADEMODE, + /**<\ref RwShadeMode: flat or gouraud shading. + */ + rwRENDERSTATEZWRITEENABLE, + /**<Z-buffer write on/off. + */ + rwRENDERSTATETEXTUREFILTER, + /**<\ref RwTextureFilterMode: point sample, bilinear, trilinear, etc. + */ + rwRENDERSTATESRCBLEND, + /**<\ref RwBlendFunction used to modulate the source pixel color + * when blending to the frame buffer. + */ + rwRENDERSTATEDESTBLEND, + /**<\ref RwBlendFunction used to modulate the destination pixel + * color in the frame buffer when blending. The resulting pixel + * color is given by the formula + * (SRCBLEND * srcColor + DESTBLEND * destColor) for each RGB + * component. For a particular platform, not all combinations + * of blend function are allowed (see platform specific + * restrictions). + */ + rwRENDERSTATEVERTEXALPHAENABLE, + /**<Alpha blending on/off (always enabled on some platforms). + * This is normally used in immediate mode to enable alpha blending + * when vertex colors or texture rasters have transparency. Retained + * mode pipelines will usually set this state based on material colors + * and textures. + */ + rwRENDERSTATEBORDERCOLOR, + /**<Border color for \ref RwTextureAddressMode + * \ref rwTEXTUREADDRESSBORDER. The value should be a packed + * RwUInt32 in a platform specific format. The macro + * RWRGBALONG(r, g, b, a) may be used to construct this using + * 8-bit color components. + */ + rwRENDERSTATEFOGENABLE, + /**<Fogging on/off (all polygons will be fogged). + */ + rwRENDERSTATEFOGCOLOR, + /**<Color used for fogging. The value should be a packed RwUInt32 + * in a platform specific format. The macro RWRGBALONG(r, g, b, a) + * may be used to construct this using 8-bit color components. + */ + rwRENDERSTATEFOGTYPE, + /**<\ref RwFogType, the type of fogging to use. + */ + rwRENDERSTATEFOGDENSITY, + /**<Fog density for \ref RwFogType of + * \ref rwFOGTYPEEXPONENTIAL or \ref rwFOGTYPEEXPONENTIAL2. + * The value should be a pointer to an RwReal in the + * range 0 to 1. + */ + rwRENDERSTATECULLMODE = 20, + /**<\ref RwCullMode, for selecting front/back face culling, or + * no culling. + */ + rwRENDERSTATESTENCILENABLE, + /**<Stenciling on/off. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILFAIL, + /**<\ref RwStencilOperation used when the stencil test passes. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILZFAIL, + /**<\ref RwStencilOperation used when the stencil test passes and + * the depth test (z-test) fails. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILPASS, + /**<Stencil operation used when both the stencil and the depth + * (z) tests pass. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILFUNCTION, + /**<\ref RwStencilFunction for the stencil test. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILFUNCTIONREF, + /**<Integer reference value for the stencil test. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILFUNCTIONMASK, + /**<Mask applied to the reference value and each stencil buffer + * entry to determine the significant bits for the stencil test. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ + rwRENDERSTATESTENCILFUNCTIONWRITEMASK, + /**<Write mask applied to values written into the stencil buffer. + * <i> Supported on Xbox, D3D8, and OpenGL only. </i> + */ rwRENDERSTATEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwRenderState RwRenderState; - +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwShadeMode - * This type represents the options available for setting the - * rwRENDERSTATESHADEMODE render state */ + * \ingroup rwrenderstate + * RwShadeMode represents the available shading modes that may be + * set using the \ref RwRenderState \ref rwRENDERSTATESHADEMODE. + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwShadeMode { - rwSHADEMODENASHADEMODE = 0, /**<Invalid shading mode */ + rwSHADEMODENASHADEMODE = 0, rwSHADEMODEFLAT, /**<Flat shading */ rwSHADEMODEGOURAUD, /**<Gouraud shading */ rwSHADEMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwShadeMode RwShadeMode; - +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwTextureFilterMode - * This type represents the options available for texture - * filtering (see API functions \ref RwTextureSetFilterMode and \ref RwRenderStateSet)*/ + * \ingroup rwrenderstate + * RwTextureFilterMode represents the texture filtering modes that may + * be set using the \ref RwRenderState \ref rwRENDERSTATETEXTUREFILTER in + * immediate mode, or \ref RwTextureSetFilterMode in retained mode. + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwTextureFilterMode { - rwFILTERNAFILTERMODE = 0, /**<Invalid filter mode */ + rwFILTERNAFILTERMODE = 0, rwFILTERNEAREST, /**<Point sampled */ rwFILTERLINEAR, /**<Bilinear */ rwFILTERMIPNEAREST, /**<Point sampled per pixel mip map */ @@ -4698,15 +4785,18 @@ enum RwTextureFilterMode }; typedef enum RwTextureFilterMode RwTextureFilterMode; - +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwFogType - * This type represents the options available to the - * rwRENDERSTATEFOGTYPE render state (see \ref RwRenderState);*/ + * \ingroup rwrenderstate + * RwFogType represents the fog modes available when setting the + * \ref RwRenderState \ref rwRENDERSTATEFOGTYPE. Note that a particular + * platform may not support all of these modes (see platform specific + * restrictions). + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwFogType { - rwFOGTYPENAFOGTYPE = 0, /**<Invalid fog type */ + rwFOGTYPENAFOGTYPE = 0, rwFOGTYPELINEAR, /**<Linear fog */ rwFOGTYPEEXPONENTIAL, /**<Exponential fog */ rwFOGTYPEEXPONENTIAL2, /**<Exponential^2 fog */ @@ -4714,18 +4804,28 @@ enum RwFogType }; typedef enum RwFogType RwFogType; - +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwBlendFunction - * This type represents the options available - * to the rwRENDERSTATESRCBLEND and rwRENDERSTATEDESTBLEND render states - * (see \ref RwRenderState). In the following description, - * a subscript s refers to a source value while subscript d refers to a - * destination value.*/ + * \ingroup rwrenderstate + * RwBlendFunction represents the options available when changing the + * \ref RwRenderState setting for \ref rwRENDERSTATESRCBLEND and + * \ref rwRENDERSTATEDESTBLEND. The values are factors used to modulate + * either the source or destination pixel color when blending to + * the frame buffer. Note the some combinations are not allowed on + * certain platforms (see platform specific restrictions). + * + * In the following list, the factors applied to each color component are + * listed explicitly. A subscript s refers to a source value while a subscript + * d refers to a destination value. Note that blending in the alpha channel is + * only applicable when the frame buffer actually contains alpha, and that + * the precise operation is platform specific. For instance, the + * source alpha value might simply be written to the alpha channel with + * no blending. + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwBlendFunction { - rwBLENDNABLEND = 0, /**<Invalid blend mode */ + rwBLENDNABLEND = 0, rwBLENDZERO, /**<(0, 0, 0, 0 ) */ rwBLENDONE, /**<(1, 1, 1, 1 ) */ rwBLENDSRCCOLOR, /**<(Rs, Gs, Bs, As ) */ @@ -4741,93 +4841,139 @@ enum RwBlendFunction }; typedef enum RwBlendFunction RwBlendFunction; - +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwTextureAddressMode - * This type represents the options available for - * applying textures to polygons (see API functions \ref RwTextureSetAddressing - * and \ref RwRenderStateSet, and the \ref RwRenderState type) */ + * \ingroup rwrenderstate + * RwTextureAddressMode represents the addressing modes available + * when mapping textures to polygons using UV texture coordinates. + * This may be set in immediate mode via the \ref RwRenderState + * \ref rwRENDERSTATETEXTUREADDRESS, or via \ref RwTextureSetAddressing + * for an \ref RwTexture object. + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwTextureAddressMode { - rwTEXTUREADDRESSNATEXTUREADDRESS = 0, /**<Invalid addressing mode */ - rwTEXTUREADDRESSWRAP, /**<UV wraps (tiles) */ - rwTEXTUREADDRESSMIRROR, /**<Alternate UV is flipped */ - rwTEXTUREADDRESSCLAMP, /**<UV is clamped to 0-1 */ - rwTEXTUREADDRESSBORDER, /**<Border colour takes effect outside of 0-1 */ + rwTEXTUREADDRESSNATEXTUREADDRESS = 0, + rwTEXTUREADDRESSWRAP, /**<UV wraps (tiles) */ + rwTEXTUREADDRESSMIRROR, /**<Alternate UV is flipped */ + rwTEXTUREADDRESSCLAMP, /**<UV is clamped to 0-1 */ + rwTEXTUREADDRESSBORDER, /**<Border color takes effect outside of 0-1 */ rwTEXTUREADDRESSMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwTextureAddressMode RwTextureAddressMode; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwStencilOperation - * This type represents the stencil operations to perform - * based on the results of the - * \ref rwRENDERSTATESTENCILFAIL, \ref rwRENDERSTATESTENCILZFAIL - * and \ref rwRENDERSTATESTENCILPASS tests. + * \ingroup rwrenderstate + * RwStencilOperation represents the stencil operations that may be + * performed depending on the results of stencil/z-buffer tests. + * The operation may be set for the various tests + * via the \ref RwRenderState settings \ref rwRENDERSTATESTENCILFAIL, + * \ref rwRENDERSTATESTENCILZFAIL and \ref rwRENDERSTATESTENCILPASS. */ +#endif /* RWADOXYGENEXTERNAL */ enum RwStencilOperation { rwSTENCILOPERATIONNASTENCILOPERATION = 0, - rwSTENCILOPERATIONKEEP, /* Do not update the entry in the stencil buffer */ - rwSTENCILOPERATIONZERO, /* Set the stencil-buffer entry to 0 */ - rwSTENCILOPERATIONREPLACE, /* Replace the stencil-buffer entry with reference value */ - rwSTENCILOPERATIONINCRSAT, /* Increment the stencil-buffer entry, clamping to the maximum value */ - rwSTENCILOPERATIONDECRSAT, /* Decrement the stencil-buffer entry, clamping to zero */ - rwSTENCILOPERATIONINVERT, /* Invert the bits in the stencil-buffer entry */ - rwSTENCILOPERATIONINCR, /* Increment the stencil-buffer entry, wrapping to zero if the new value exceeds the maximum value */ - rwSTENCILOPERATIONDECR, /* Decrement the stencil-buffer entry, wrapping to the maximum value if the new value is less than zero */ + + rwSTENCILOPERATIONKEEP, + /**<Do not update the entry in the stencil buffer */ + rwSTENCILOPERATIONZERO, + /**<Set the stencil-buffer entry to 0 */ + rwSTENCILOPERATIONREPLACE, + /**<Replace the stencil-buffer entry with reference value */ + rwSTENCILOPERATIONINCRSAT, + /**<Increment the stencil-buffer entry, clamping to the + * maximum value */ + rwSTENCILOPERATIONDECRSAT, + /**<Decrement the stencil-buffer entry, clamping to zero */ + rwSTENCILOPERATIONINVERT, + /**<Invert the bits in the stencil-buffer entry */ + rwSTENCILOPERATIONINCR, + /**<Increment the stencil-buffer entry, wrapping to zero if + * the new value exceeds the maximum value */ + rwSTENCILOPERATIONDECR, + /**<Decrement the stencil-buffer entry, wrapping to the maximum + * value if the new value is less than zero */ + rwSTENCILOPERATIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwStencilOperation RwStencilOperation; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwStencilFunction - * This type represents the options available for - * the comparison function for the stencil test \ref rwRENDERSTATESTENCILFUNCTION. + * \ingroup rwrenderstate + * RwStencilFunction represents the comparison functions available for + * a stencil test. The function may be selected via the + * \ref RwRenderState setting \ref rwRENDERSTATESTENCILFUNCTION. */ +#endif /* RWADOXYGENEXTERNAL */ enum RwStencilFunction { rwSTENCILFUNCTIONNASTENCILFUNCTION = 0, - rwSTENCILFUNCTIONNEVER, /* Always fail the test */ - rwSTENCILFUNCTIONLESS, /* Accept the new pixel if its value is less than the value of the current pixel */ - rwSTENCILFUNCTIONEQUAL, /* Accept the new pixel if its value equals the value of the current pixel */ - rwSTENCILFUNCTIONLESSEQUAL, /* Accept the new pixel if its value is less than or equal to the value of the current pixel */ - rwSTENCILFUNCTIONGREATER, /* Accept the new pixel if its value is greater than the value of the current pixel */ - rwSTENCILFUNCTIONNOTEQUAL, /* Accept the new pixel if its value does not equal the value of the current pixel */ - rwSTENCILFUNCTIONGREATEREQUAL, /* Accept the new pixel if its value is greater than or equal to the value of the current pixel */ - rwSTENCILFUNCTIONALWAYS, /* Always pass the test */ + + rwSTENCILFUNCTIONNEVER, + /**<Always fail the test */ + rwSTENCILFUNCTIONLESS, + /**<Accept the new pixel if its value is less than the value of + * the current pixel */ + rwSTENCILFUNCTIONEQUAL, + /**<Accept the new pixel if its value equals the value of the + * current pixel */ + rwSTENCILFUNCTIONLESSEQUAL, + /**<Accept the new pixel if its value is less than or equal to + * the value of the current pixel */ + rwSTENCILFUNCTIONGREATER, + /**<Accept the new pixel if its value is greater than the value + * of the current pixel */ + rwSTENCILFUNCTIONNOTEQUAL, + /**<Accept the new pixel if its value does not equal the value of + * the current pixel */ + rwSTENCILFUNCTIONGREATEREQUAL, + /**<Accept the new pixel if its value is greater than or equal + * to the value of the current pixel */ + rwSTENCILFUNCTIONALWAYS, + /**<Always pass the test */ + rwSTENCILFUNCTIONFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwStencilFunction RwStencilFunction; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * RwCullMode - * This type represents the options available for culling polygons during rendering. - * and \ref RwRenderStateSet, and the \ref RwRenderState type) */ + * \ingroup rwrenderstate + * RwCullMode represents the options available for culling polygons + * during rendering. The cull mode may be set via the \ref RwRenderState + * setting \ref rwRENDERSTATECULLMODE. + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwCullMode { rwCULLMODENACULLMODE = 0, - rwCULLMODECULLNONE, /**< Both front and back-facing triangles are drawn. */ - rwCULLMODECULLBACK, /**< Just front-facing triangles are drawn */ - rwCULLMODECULLFRONT, /**< Just rear-facing triangles are drawn */ + + rwCULLMODECULLNONE, + /**<Both front and back-facing triangles are drawn. */ + rwCULLMODECULLBACK, + /**<Only front-facing triangles are drawn */ + rwCULLMODECULLFRONT, + /**<Only back-facing triangles are drawn */ rwCULLMODEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT }; typedef enum RwCullMode RwCullMode; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup immediatemodedatatypes * RwPrimitiveType * This type represents the different types of indexed * line and indexed triangle primitives that are available when rendering 2D * and 3D immediate mode objects (see API functions \ref RwIm2DRenderIndexedPrimitive, * \ref RwIm2DRenderPrimitive, \ref RwIm3DRenderIndexedPrimitive and \ref RwIm3DRenderPrimitive). * Indices are into a vertex list and must be defined in a counter-clockwise order - * (as seen from the camera) to be visible.*/ + * (as seen from the camera) to be visible. + */ +#endif /* RWADOXYGENEXTERNAL */ enum RwPrimitiveType { rwPRIMTYPENAPRIMTYPE = 0, /**<Invalid primative type */ @@ -4994,8 +5140,9 @@ typedef RwBool (*RwStandardFunc)(void *pOut,void *pInOut,RwInt32 nI); typedef struct RwEngineOpenParams RwEngineOpenParams; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwengine * \struct RwEngineOpenParams * This type is used to specify device dependent parameters * for use by the API function \ref RwEngineOpen. @@ -5003,6 +5150,7 @@ typedef struct RwEngineOpenParams RwEngineOpenParams; * should be set to the window's handle (of type HWND). * For NULL and sky libraries displayID=0: */ +#endif /* RWADOXYGENEXTERNAL */ struct RwEngineOpenParams { void *displayID; /**< Display Identifier */ @@ -5066,37 +5214,41 @@ typedef RwBool typedef struct RwDevice RwDevice; -/** - * \ingroup datatypes - * \struct RwDevice + +#if (!defined(DOXYGEN)) +/* + * struct RwDevice * Structure describing a display device */ struct RwDevice { - RwReal gammaCorrection; /**<Gamma correction */ - RwSystemFunc fpSystem; /**< System handler */ - RwReal zBufferNear; /**< Near Z buffer value */ - RwReal zBufferFar; /**< Far Z buffer value */ + RwReal gammaCorrection; /* Gamma correction */ + RwSystemFunc fpSystem; /* System handler */ + RwReal zBufferNear; /* Near Z buffer value */ + RwReal zBufferFar; /* Far Z buffer value */ /* Immediate mode functions */ - RwRenderStateSetFunction fpRenderStateSet; /**< Internal Use */ - RwRenderStateGetFunction fpRenderStateGet; /**< Internal Use */ + RwRenderStateSetFunction fpRenderStateSet; /* Internal Use */ + RwRenderStateGetFunction fpRenderStateGet; /* Internal Use */ /* Render functions */ - RwIm2DRenderLineFunction fpIm2DRenderLine; /**< Internal Use */ - RwIm2DRenderTriangleFunction fpIm2DRenderTriangle; /**< Internal Use */ - RwIm2DRenderPrimitiveFunction fpIm2DRenderPrimitive; /**< Internal Use */ - RwIm2DRenderIndexedPrimitiveFunction fpIm2DRenderIndexedPrimitive; /**< Internal Use */ - - RwIm3DRenderLineFunction fpIm3DRenderLine; /**< Internal Use */ - RwIm3DRenderTriangleFunction fpIm3DRenderTriangle; /**< Internal Use */ - RwIm3DRenderPrimitiveFunction fpIm3DRenderPrimitive; /**< Internal Use */ - RwIm3DRenderIndexedPrimitiveFunction fpIm3DRenderIndexedPrimitive; /**< Internal Use */ + RwIm2DRenderLineFunction fpIm2DRenderLine; /* Internal Use */ + RwIm2DRenderTriangleFunction fpIm2DRenderTriangle; /* Internal Use */ + RwIm2DRenderPrimitiveFunction fpIm2DRenderPrimitive; /* Internal Use */ + RwIm2DRenderIndexedPrimitiveFunction fpIm2DRenderIndexedPrimitive; /* Internal Use */ + + RwIm3DRenderLineFunction fpIm3DRenderLine; /* Internal Use */ + RwIm3DRenderTriangleFunction fpIm3DRenderTriangle; /* Internal Use */ + RwIm3DRenderPrimitiveFunction fpIm3DRenderPrimitive; /* Internal Use */ + RwIm3DRenderIndexedPrimitiveFunction fpIm3DRenderIndexedPrimitive; /* Internal Use */ }; +#endif /* (!defined(DOXYGEN)) */ + typedef struct RwMetrics RwMetrics; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwengine * \struct RwMetrics * This structure provides information about the performance * of the application. The metrics are recorded only in the metrics @@ -5109,6 +5261,7 @@ typedef struct RwMetrics RwMetrics; * be considered as bad news and will indicate a significantly * reduced rendering performance. */ +#endif /* RWADOXYGENEXTERNAL */ struct RwMetrics { RwUInt32 numTriangles; /**< Number of triangles processed */ @@ -5123,13 +5276,15 @@ struct RwMetrics #define SUBSYSTEMNAME_MAXLEN 80 typedef struct RwSubSystemInfo RwSubSystemInfo; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwengine * \struct RwSubSystemInfo * This type is used to represent information about a device. * The only available field specifies a character string * which identifies the subsystem * (see API function \ref RwEngineGetSubSystemInfo). */ +#endif /* RWADOXYGENEXTERNAL */ struct RwSubSystemInfo { RwChar name[SUBSYSTEMNAME_MAXLEN]; /**< Sub system string */ @@ -5139,13 +5294,15 @@ struct RwSubSystemInfo /* Video modes */ /* These are flag bits which may be ORd */ +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwengine * RwVideoModeFlag * These flags specify the type of display that RenderWare * will use. The flags may be OR'd together to build composite modes. * Note that not all modes are supported on all platforms. */ +#endif /* RWADOXYGENEXTERNAL */ enum RwVideoModeFlag { rwVIDEOMODEEXCLUSIVE = 0x1, /**<Exclusive (i.e. full-screen) */ @@ -5162,13 +5319,16 @@ enum RwVideoModeFlag typedef enum RwVideoModeFlag RwVideoModeFlag; typedef struct RwVideoMode RwVideoMode; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwengine * \struct RwVideoMode * This type represents a video mode available on a device specified * by the frame buffer resolution (width and height) and depth, * and a flag indicating whether the device has exclusive use of - * the mode (see API function \ref RwEngineGetVideoModeInfo): */ + * the mode (see API function \ref RwEngineGetVideoModeInfo): + */ +#endif /* RWADOXYGENEXTERNAL */ struct RwVideoMode { RwInt32 width; /**< Width */ @@ -5177,8 +5337,9 @@ struct RwVideoMode RwVideoModeFlag flags; /**< Flags */ }; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwengine * RwEngineInitFlag * Engine initialization flags. An application can use * these to control the memory manager that RenderWare uses for dynamic @@ -5190,6 +5351,7 @@ struct RwVideoMode * RwMalloc and RwFree. This will result in more memory management * related calls. */ +#endif /* RWADOXYGENEXTERNAL */ enum RwEngineInitFlag { rwENGINEINITFREELISTS = 0, /**<Use Freelists */ @@ -5211,7 +5373,9 @@ extern "C" extern RwInt32 RwEngineGetVersion(void); /* Sequence of events to get RenderWare up and running */ -extern RwBool RwEngineInit(RwMemoryFunctions *memFuncs, RwUInt32 initFlags, RwUInt32 resArenaSize); +extern RwBool RwEngineInit(const RwMemoryFunctions *memFuncs, + RwUInt32 initFlags, + RwUInt32 resArenaSize); extern RwInt32 RwEngineRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor initCB, RwPluginObjectDestructor termCB); @@ -5256,80 +5420,75 @@ extern RwMetrics *RwEngineGetMetrics(void); */ /* - * \typedef rwFnFexist + * rwFnFexist * Returns TRUE if file with given name exists, FALSE if it doesn't. */ typedef RwBool (*rwFnFexist)(const RwChar *name); /* - * \typedef rwFnFopen + * rwFnFopen * Mimics ANSI C Standard Library fopen. */ typedef void *(*rwFnFopen)(const RwChar *name, const RwChar *mode); /* - * \typedef rwFnFclose + * rwFnFclose * Mimics ANSI C Standard Library fclose. */ typedef int (*rwFnFclose)(void *fptr); /* - * \typedef rwFnFread + * rwFnFread * Mimics ANSI C Standard Library fread. */ typedef size_t (*rwFnFread)(void *addr, size_t size, size_t count, void *fptr); /* - * \typedef rwFnFwrite + * rwFnFwrite * Mimics ANSI C Standard Library fwrite. */ typedef size_t (*rwFnFwrite)(const void *addr, size_t size, size_t count, void *fptr); /* - * \typedef rwFnFgets + * rwFnFgets * Mimics ANSI C Standard Library fgets. */ typedef RwChar *(*rwFnFgets)(RwChar *buffer, int maxLen, void *fptr); /* - * \typedef rwFnFputs + * rwFnFputs * Mimics ANSI C Standard Library fputs. */ typedef int (*rwFnFputs)(const RwChar *buffer, void *fptr); /* - * \typedef rwFnFeof + * rwFnFeof * Mimics ANSI C Standard Library feof. */ typedef int (*rwFnFeof)(void *fptr); /* - * \typedef rwFnFseek + * rwFnFseek * Mimics ANSI C Standard Library fseek. */ typedef int (*rwFnFseek)(void *fptr, long offset, int origin); /* - * \typedef rwFnFflush + * rwFnFflush * Mimics ANSI C Standard Library fflush. */ typedef int (*rwFnFflush)(void *fptr); /* - * \typedef rwFnFtell + * rwFnFtell * Mimics ANSI C Standard Library ftell. */ typedef int (*rwFnFtell)(void *fptr); -/** - * \ingroup datatypes - * \typedef RwFileFunctions - * typedef for struct RwFileFunctions - */ typedef struct RwFileFunctions RwFileFunctions; /** - * \ingroup datatypes + * \ingroup memoryfileinterface * \struct RwFileFunctions * This type is used to specify the file access * functions used by RenderWare. The default file system uses the standard @@ -5390,8 +5549,9 @@ extern RwFileFunctions *RwOsGetFileInterface(void); */ typedef struct RwError RwError; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwerror * \struct RwError * This type represents a RenderWare error specified by the * ID of the plugin that the error was issued from (pluginID) and the error @@ -5399,6 +5559,7 @@ typedef struct RwError RwError; * \param pluginID The ID of the plugin that issued the error. * \param errorCode A value representing the error code. */ +#endif /* RWADOXYGENEXTERNAL */ struct RwError { RwInt32 pluginID; /**< Internal Use */ @@ -5444,7 +5605,7 @@ extern RwInt32 _rwerror(RwInt32 code, ...); */ /** - * \ingroup datatypes + * \ingroup rwdebug * RwDebugType * This type represents the different types of debug and * trace messages that can be sent to the currently installed debug handler @@ -5461,7 +5622,7 @@ enum RwDebugType typedef enum RwDebugType RwDebugType; /** - * \ingroup datatypes + * \ingroup rwdebug * \ref RwDebugHandler * This type represents the * function called from \ref RwDebugSendMessage for sending a message to the @@ -5508,9 +5669,12 @@ extern void _rwDebugSendMessage(RwDebugType type, /* Sending a message */ extern RwChar *_rwdberrcommon(RwInt32 code, ...); + +#if (!defined(DOXYGEN)) +/* Doxy doesn't appear to like the __RWFORMAT__ attribute */ extern RwChar *_rwdbsprintf(const RwChar * format, ...) __RWFORMAT__(printf, 1, 2); - +#endif /* (!defined(DOXYGEN)) */ #ifdef __cplusplus } @@ -5574,6 +5738,8 @@ enum RwEngineStatus typedef enum RwEngineStatus RwEngineStatus; typedef struct RwGlobals RwGlobals; + +#if (!defined(DOXYGEN)) struct RwGlobals { #ifdef RWDEBUG @@ -5632,6 +5798,7 @@ struct RwModuleInfo RwInt32 globalsOffset; RwInt32 numInstances; }; +#endif /* (!defined(DOXYGEN)) */ @@ -5648,7 +5815,13 @@ extern "C" extern RwUInt32 ourGlobals[RWGLOBALSIZE / sizeof(RwUInt32)]; #define RwEngineInstance ourGlobals #else /* RWGLOBALSIZE */ + +#ifdef _RWDLL +__declspec(dllimport) extern void *RwEngineInstance; +#else extern void *RwEngineInstance; +#endif + #endif /* RWGLOBALSIZE */ extern RwInt8 _rwMsbBit[]; @@ -5663,39 +5836,45 @@ extern RwInt8 _rwMsbBit[]; #define RWRESOURCESGLOBAL(var) (RWPLUGINOFFSET(rwResourcesGlobals, \ RwEngineInstance, resourcesModule.globalsOffset)->var) +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * \typedef RwResEntry + * \ingroup rwresources + * \struct RwResEntry * RwResEntry object. Instanced data block in resources arena. * This should be considered an opaque * type. Use the RwResEntry API functions to access. */ +#endif /* RWADOXYGENEXTERNAL */ + typedef struct RwResEntry RwResEntry; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes - * \typedef RwResEntryDestroyNotify - * This type represents the function + * \ingroup rwresources + * \ref RwResEntryDestroyNotify type represents the function * called from \ref RwResourcesFreeResEntry (and indirectly from * \ref RwResourcesEmptyArena) immediately before the memory used by the * specified resources entry is released. * * \param resEntry Pointer to the instanced data. */ +#endif /* RWADOXYGENEXTERNAL */ typedef void (*RwResEntryDestroyNotify) (RwResEntry * resEntry); #if (!defined(DOXYGEN)) struct RwResEntry { - RwLLLink link; /**< Node in the list of resource elements */ - RwInt32 size; /**< Size of this node */ - void *owner; /**< Owner of this node */ - RwResEntry **ownerRef; /**< Pointer to pointer to this (enables de-alloc) */ - RwResEntryDestroyNotify destroyNotify; /**< This is called right before destruction */ + RwLLLink link; /* Node in the list of resource elements */ + RwInt32 size; /* Size of this node */ + void *owner; /* Owner of this node */ + RwResEntry **ownerRef; /* Pointer to pointer to this (enables de-alloc) */ + RwResEntryDestroyNotify destroyNotify; /* This is called right before destruction */ }; #endif /* (!defined(DOXYGEN)) */ typedef struct rwResources rwResources; + +#if (!defined(DOXYGEN)) struct rwResources { RwInt32 maxSize; @@ -5711,11 +5890,13 @@ struct rwResources RwLinkList *usedEntries; }; + typedef struct rwResourcesGlobals rwResourcesGlobals; struct rwResourcesGlobals { rwResources res; }; +#endif /* (!defined(DOXYGEN)) */ #ifdef __cplusplus @@ -5768,8 +5949,9 @@ extern RwModuleInfo resourcesModule; */ typedef struct RwRGBAReal RwRGBAReal; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwrgba * \struct RwRGBAReal * This structure represents a RGBA color which has * components specified as real values. @@ -5785,6 +5967,7 @@ typedef struct RwRGBAReal RwRGBAReal; * value 0 generally corresponds to the associcated component in an * RwRGBAReal with the value 0.0. */ +#endif /* RWADOXYGENEXTERNAL */ struct RwRGBAReal { RwReal red; /**< red component */ @@ -5799,11 +5982,14 @@ struct RwRGBAReal #endif /* (!defined(RwRGBARealAssign)) */ typedef struct RwRGBA RwRGBA; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwrgba * \struct RwRGBA * This structure represents a RGBA color - * which has integer components specified in the range 0 to 255. */ + * which has integer components specified in the range 0 to 255. + */ +#endif /* RWADOXYGENEXTERNAL */ struct RwRGBA { RwUInt8 red; /**< red component */ @@ -5947,6 +6133,7 @@ extern void RwRGBARealFromRwRGBA(RwRGBAReal *result, /* Matrix stream format */ typedef struct rwStreamMatrix RwMatrixChunkInfo; typedef struct rwStreamMatrix rwStreamMatrix; +#if (!defined(DOXYGEN)) struct rwStreamMatrix { RwV3d right; @@ -5955,6 +6142,7 @@ struct rwStreamMatrix RwV3d pos; RwInt32 type; }; +#endif /* (!defined(DOXYGEN)) */ /**************************************************************************** @@ -6009,11 +6197,14 @@ extern RwMatrixChunkInfo *RwMatrixChunkInfoRead(RwStream * stream, */ typedef struct RwChunkHeaderInfo RwChunkHeaderInfo; +#ifndef RWADOXYGENEXTERNAL /** - * \ingroup datatypes + * \ingroup rwstream * \struct RwChunkHeaderInfo * Holds data for a chunk header read from a - * stream with \ref RwStreamReadChunkHeaderInfo. */ + * stream with \ref RwStreamReadChunkHeaderInfo. + */ +#endif /* RWADOXYGENEXTERNAL */ struct RwChunkHeaderInfo { RwUInt32 type; /**< chunk ID - see \ref RwStreamFindChunk */ diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp index 4694920a..f682964f 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -238,14 +238,14 @@ AnimAssocDesc aMeleeAnimDescs[] = { { ANIM_MELEE_ATTACK_2ND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, { ANIM_MELEE_ATTACK_START, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, { ANIM_MELEE_IDLE_FIGHTMODE, ASSOC_REPEAT }, - { ANIM_WEAPON_SPECIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, // TODO(Miami): Overload that name for melee/swing + { ANIM_MELEE_ATTACK_FINISH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, }; AnimAssocDesc aSwingAnimDescs[] = { { ANIM_MELEE_ATTACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, { ANIM_MELEE_ATTACK_2ND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, { ANIM_MELEE_ATTACK_START, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, { ANIM_MELEE_IDLE_FIGHTMODE, ASSOC_REPEAT }, - { ANIM_WEAPON_SPECIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, // TODO(Miami): Overload that name for melee/swing + { ANIM_MELEE_ATTACK_FINISH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aWeaponAnimDescs[] = { { ANIM_WEAPON_FIRE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, diff --git a/src/animation/AnimationId.h b/src/animation/AnimationId.h index ddf36b23..f2ef3dfd 100644 --- a/src/animation/AnimationId.h +++ b/src/animation/AnimationId.h @@ -234,6 +234,7 @@ enum AnimationId ANIM_MELEE_ATTACK_2ND, ANIM_MELEE_ATTACK_START, ANIM_MELEE_IDLE_FIGHTMODE, + ANIM_MELEE_ATTACK_FINISH, ANIM_THROWABLE_THROW = ANIM_WEAPON_FIRE, ANIM_THROWABLE_THROWU, ANIM_THROWABLE_START_THROW, diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index 8671e95d..6739f56a 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -169,7 +169,11 @@ RpAnimBlendClumpInitSkinned(RpClump *clump) for(i = 0; i < numBones; i++){ frames[i].nodeID = HIERNODEID(hier, i); frames[i].resetPos = boneTab[i]; +#ifdef LIBRW frames[i].hanimFrame = (RpHAnimStdKeyFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i); +#else + frames[i].hanimFrame = (RpHAnimStdKeyFrame*)rtANIMGETINTERPFRAME(hier->currentAnim, i); +#endif } clumpData->ForAllFrames(FrameInitCBskin, nil); clumpData->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION; diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 0c36cf17..c6d7b5a4 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -1096,7 +1096,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) relativeGearChange = Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); if (traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE && - params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) { + params->m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) { traction = 0.7f; } relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange; @@ -1109,7 +1109,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) relativeChange = automobile->m_fGasPedalAudio; } modificator = relativeChange; - if (currentGear || !automobile->m_nWheelsOnGround) + if (currentGear != 0 || automobile->m_nWheelsOnGround == 0) freq = 1200 * currentGear + 18000.f * modificator + 14000; else freq = 13000.f * modificator + 14000; @@ -1395,7 +1395,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * SampleManager.StopChannel(m_nActiveSamples); bAccelSampleStopped = true; } - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) + if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction) gasPedalAudio = automobile->m_fGasPedalAudio; else gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); @@ -1408,8 +1408,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * bAccelSampleStopped = true; } nCruising = 0; - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || - params->m_fVelocityChange >= 0.01f && automobile->m_fGasPedalAudio > 0.2f) { + if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || + params->m_fVelocityChange < 0.01f && automobile->m_fGasPedalAudio > 0.2f) { automobile->m_fGasPedalAudio *= 0.6f; gasPedalAudio = automobile->m_fGasPedalAudio; } @@ -1429,11 +1429,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * CurrentPretendGear = Max(1, currentGear); } else { while (nCruising == 0) { - if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs - if (!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) { - if (!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround || - (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround) { + if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction) { + if (automobile->m_nWheelsOnGround == 0 && automobile->m_nDriveWheelsOnGround != 0 || + (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround != 0) { automobile->m_fGasPedalAudio *= 0.6f; } freqModifier = 0; @@ -1497,11 +1497,11 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * } if (nCruising != 0) { bAccelSampleStopped = true; - if (accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction || + if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || currentGear < params->m_pTransmission->nNumberOfGears - 1) { nCruising = 0; } else { - if (accelerateState >= 220 && 0.001f + params->m_fVelocityChange < automobile->m_fVelocityChangeForAudio) { + if (accelerateState >= 220 && params->m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) { if (nCruising < 800) ++nCruising; } else if (nCruising > 3) { @@ -1520,7 +1520,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * bLostTractionLastFrame = lostTraction; } -void +bool cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) { const float SOUND_INTENSITY = 40.0f; @@ -1532,10 +1532,10 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) float skidVal = 0.0f; if (params->m_fDistance >= SQR(SOUND_INTENSITY)) - return; + return false; automobile = (CAutomobile *)params->m_pVehicle; - if (!automobile->m_nWheelsOnGround) - return; + if (automobile->m_nWheelsOnGround == 0) + return true; CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING) @@ -1575,6 +1575,8 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) emittingVol /= 4; m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f; m_sQueueSample.m_nVolume /= 4; + if (m_sQueueSample.m_nVolume == 0) + return true; break; case SURFACE_GRAVEL: case SURFACE_MUD_DRY: @@ -1606,43 +1608,40 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params) AddSampleToRequestedQueue(); } } + return true; } float cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange) { - tWheelState wheelState; - float relativeVelChange; + float relativeVelChange = 0.0f; float gasPedalAudio = automobile->m_fGasPedalAudio; - float modificator; float velChange; float relativeVel; - wheelState = automobile->m_aWheelState[wheel]; - if (wheelState == WHEEL_STATE_SPINNING && gasPedalAudio > 0.4f) { - relativeVelChange = (gasPedalAudio - 0.4f) * 1.25f; - - } else if (wheelState == WHEEL_STATE_SKIDDING) { + switch (automobile->m_aWheelState[wheel]) + { + case WHEEL_STATE_SPINNING: + if (gasPedalAudio > 0.4f) + relativeVelChange = (gasPedalAudio - 0.4f) * 1.6666666f * 0.75f; + break; + case WHEEL_STATE_SKIDDING: relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); - } else if (wheelState == WHEEL_STATE_FIXED) { - modificator = 0.4f; - relativeVelChange = gasPedalAudio; - if (relativeVelChange > 0.4f) { - relativeVelChange = relativeVelChange - 0.4f; - modificator = 5.f / 3.f; - } + break; + case WHEEL_STATE_FIXED: + relativeVel = gasPedalAudio; + if (relativeVel > 0.4f) + relativeVel = (gasPedalAudio - 0.4f) * 1.6666666f; + velChange = Abs(velocityChange); - if (relativeVelChange > 0.4f) - relativeVelChange = relativeVelChange * modificator; - if (velChange > 0.04f) { - relativeVel = Min(1.0f, velChange / transmission->fMaxVelocity); - } else { - relativeVel = 0.0f; - } - if (relativeVel >= relativeVelChange) + if (velChange > 0.04f) + relativeVelChange = Min(1.0f, velChange / transmission->fMaxVelocity); + if (relativeVel > relativeVelChange) relativeVelChange = relativeVel; - } else { - relativeVelChange = 0.0f; + + break; + default: + break; } return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); @@ -1651,12 +1650,10 @@ cAudioManager::GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobil float cAudioManager::GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange) { - float relativeVelChange; + float relativeVelChange = 0.0f; if (automobile->m_aWheelState[wheel] == WHEEL_STATE_SKIDDING) relativeVelChange = Min(1.0f, Abs(velocityChange) / transmission->fMaxVelocity); - else - relativeVelChange = 0.0f; return Max(relativeVelChange, Min(1.0f, Abs(automobile->m_vecTurnSpeed.z) * 20.0f)); } @@ -5724,6 +5721,8 @@ cAudioManager::ClearMissionAudio(uint8 slot) m_sMissionAudio.m_bIsPlayed[slot] = false; m_sMissionAudio.m_bPredefinedProperties[slot] = true; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; + m_sMissionAudio.m_bIsMobile[slot] = false; + SampleManager.StopStreamedFile(slot + 1); } } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 88cfc16a..5b0b4907 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -169,11 +169,11 @@ cAudioManager::SetEntityStatus(int32 id, uint8 status) void cAudioManager::PlayOneShot(int32 index, int16 sound, float vol) { - static const uint8 OneShotPriority[] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 4, 4, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 3, 2, 2, 2, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9, - 2, 2, 0, 0, 0, 0, 3, 3, 5, 1, 1, 1, 1, 3, 4, 7, 6, 6, 6, 6, 1, 3, 4, 3, 4, 2, 1, 3, 5, 4, 6, 6, 1, 3, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + static const uint8 OneShotPriority[] = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 4, 2, 5, 5, 3, 5, 2, 2, 1, 1, 3, 1, 3, 3, 1, 1, 1, 1, 4, 4, 4, 3, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 3, 4, 2, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 3, 1, 1, 1, 9, 0, 0, 0, 1, 2, 2, 0, 0, 2, 3, 3, 3, 5, 1, 1, + 1, 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 7, 1, 4, 3, 4, 2, 2, 2, 3, 1, 2, 1, 3, 5, 3, 4, 6, 4, 6, 3, 0, 0, 0, 0, 0, + 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 0, 0, 0, 0, 0, 3, 3, 1, 0 }; if (m_bIsInitialised) { if (index >= 0 && index < NUM_AUDIOENTITIES) { diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 16487d21..b34dbed0 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -362,7 +362,7 @@ public: bool ProcessVehicleReverseWarning(cVehicleParams *params); bool ProcessVehicleRoadNoise(cVehicleParams *params); bool ProcessVehicleSirenOrAlarm(cVehicleParams *params); - void ProcessVehicleSkidding(cVehicleParams *params); + bool ProcessVehicleSkidding(cVehicleParams *params); void ProcessWaterCannon(int32); void ProcessWeather(int32 id); bool ProcessWetRoadNoise(cVehicleParams *params); diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 7581114d..6859cba3 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -112,25 +112,69 @@ cDMAudio::Get3DProviderName(uint8 id) return AudioManager.Get3DProviderName(id); } +// TODO(Miami): Content of this moved to cSampleManager or cAudioManager int8 cDMAudio::AutoDetect3DProviders(void) { + if (!AudioManager.IsAudioInitialised()) + return -1; + + int eax = -1, eax2 = -1, eax3 = -1, ds3dh = -1, ds3ds = -1; + for ( int32 i = 0; i < GetNum3DProvidersAvailable(); i++ ) { - wchar buff[64]; - - char *name = Get3DProviderName(i); - AsciiToUnicode(name, buff); - char *providername = UnicodeToAscii(buff); + char *providername = Get3DProviderName(i); strupr(providername); -#if defined(AUDIO_MSS) - if ( !strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") ) - return i; -#elif defined(AUDIO_OAL) - if ( !strcmp(providername, "OPENAL SOFT") ) - return i; + +#if defined(AUDIO_OAL) + if (!strcmp(providername, "OPENAL SOFT")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + return i; + } +#else + if (!strcmp(providername, "CREATIVE LABS EAX 3 (TM)")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) { + eax3 = i; + } + } + + if (!strcmp(providername, "CREATIVE LABS EAX 2 (TM)")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + eax2 = i; + } + + if (!strcmp(providername, "CREATIVE LABS EAX (TM)")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + eax = i; + } + + if (!strcmp(providername, "DIRECTSOUND3D HARDWARE SUPPORT")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + ds3dh = i; + } + + if (!strcmp(providername, "DIRECTSOUND3D SOFTWARE EMULATION")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + ds3ds = i; + } #endif } + if (eax3 != -1) + return eax3; + if (eax2 != -1) + return eax2; + if (eax != -1) + return eax; + if (ds3dh != -1) + return ds3dh; + if (ds3ds != -1) + return ds3ds; return -1; } diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index bb1454c9..e7d3a23b 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -7,6 +7,9 @@ #define AEHANDLE_IS_FAILED(h) ((h)<0) #define AEHANDLE_IS_OK(h) ((h)>=0) +#define NO_AUDIO_PROVIDER -3 +#define AUDIO_PROVIDER_NOT_DETERMINED -99 + class cAudioScriptObject; class CEntity; diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 9fb1991e..ae2e97ac 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -714,15 +714,17 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh) { switch (veh->GetModelIndex()) { - case MI_FBICAR: - case MI_POLICE: - case MI_ENFORCER: - case MI_PREDATOR: + case MI_VCNMAV: + case MI_POLMAV: + case MI_COASTG: case MI_RHINO: case MI_BARRACKS: return true; + case MI_MRWHOOP: + case MI_HUNTER: + return false; } - return false; + return veh->UsesSiren(); } void diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 5893ea64..d6bb1975 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1012,6 +1012,15 @@ cSampleManager::Initialise(void) } +#ifdef AUDIO_CACHE + TRACE("cache"); + FILE *cacheFile = fopen("audio\\sound.cache", "rb"); + if (cacheFile) { + fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); + fclose(cacheFile); + m_bInitialised = true; + }else { +#endif TRACE("cdrom"); S32 tatalms; @@ -1168,7 +1177,13 @@ cSampleManager::Initialise(void) _bUseHDDAudio = false; } #endif - +#ifdef AUDIO_CACHE + cacheFile = fopen("audio\\sound.cache", "wb"); + fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); + fclose(cacheFile); + } +#endif + TRACE("stream"); { for ( int32 i = 0; i < MAX_STREAMS; i++ ) diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index de55c2ed..bf2eca7d 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -604,7 +604,13 @@ cSampleManager::Initialise(void) return false; } } - +#ifdef AUDIO_CACHE + FILE *cacheFile = fopen("audio\\sound.cache", "rb"); + if (cacheFile) { + fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); + fclose(cacheFile); + } else +#endif { for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ ) @@ -622,6 +628,11 @@ cSampleManager::Initialise(void) else USERERROR("Can't open '%s'\n", StreamedNameTable[i]); } +#ifdef AUDIO_CACHE + cacheFile = fopen("audio\\sound.cache", "wb"); + fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); + fclose(cacheFile); +#endif } LoadSampleBank(SAMPLEBANK_MAIN); diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index 7e517a83..a3fcbf9a 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -80,7 +80,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) if (FindSwitchDistanceClose(pVehicle) > (FindPlayerCoors() - pVehicle->GetPosition()).Magnitude2D() || pVehicle->AutoPilot.m_bIgnorePathfinding) { pVehicle->AutoPilot.m_nCarMission = MISSION_RAMPLAYER_CLOSE; - if (pVehicle->UsesSiren(pVehicle->GetModelIndex())) + if (pVehicle->UsesSiren()) pVehicle->m_bSirenOrAlarm = true; } BackToCruisingIfNoWantedLevel(pVehicle); @@ -136,7 +136,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) if (FindSwitchDistanceClose(pVehicle) > (FindPlayerCoors() - pVehicle->GetPosition()).Magnitude2D() || pVehicle->AutoPilot.m_bIgnorePathfinding) { pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_CLOSE; - if (pVehicle->UsesSiren(pVehicle->GetModelIndex())) + if (pVehicle->UsesSiren()) pVehicle->m_bSirenOrAlarm = true; } BackToCruisingIfNoWantedLevel(pVehicle); @@ -294,7 +294,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) if ((pVehicle->AutoPilot.m_pTargetCar->GetPosition() - pVehicle->GetPosition()).Magnitude2D() < FindSwitchDistanceClose(pVehicle) || pVehicle->AutoPilot.m_bIgnorePathfinding){ pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKCAR_CLOSE; - if (pVehicle->UsesSiren(pVehicle->GetModelIndex())) + if (pVehicle->UsesSiren()) pVehicle->m_bSirenOrAlarm = true; } }else{ @@ -540,7 +540,7 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle) return; pVehicle->bOccupantsHaveBeenGenerated = true; switch (pVehicle->GetModelIndex()){ - case MI_FBICAR: + case MI_FBIRANCH: case MI_ENFORCER: pVehicle->SetUpDriver(); for (int i = 0; i < 3; i++) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 514150a6..cd08753d 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -366,7 +366,7 @@ CCarCtrl::GenerateOneRandomCar() pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS; pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE; } - if (carModel == MI_FBICAR){ + if (carModel == MI_FBIRANCH){ pVehicle->m_currentColour1 = 0; pVehicle->m_currentColour2 = 0; } @@ -874,9 +874,9 @@ CCarCtrl::ChoosePoliceCarModel(void) CStreaming::HasModelLoaded(MI_POLICE)) return ((CGeneral::GetRandomNumber() & 0xF) == 0) ? MI_ENFORCER : MI_POLICE; if (FindPlayerPed()->m_pWanted->AreFbiRequired() && - CStreaming::HasModelLoaded(MI_FBICAR) && + CStreaming::HasModelLoaded(MI_FBIRANCH) && CStreaming::HasModelLoaded(MI_FBI)) - return MI_FBICAR; + return MI_FBIRANCH; if (FindPlayerPed()->m_pWanted->AreArmyRequired() && CStreaming::HasModelLoaded(MI_RHINO) && CStreaming::HasModelLoaded(MI_BARRACKS) && diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index f00486e8..bbb35080 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -27,6 +27,7 @@ int32 CDarkel::KillsNeeded; int8 CDarkel::InterruptedWeapon; /* + * TODO: Collect timer/kill counter RGBA colors on top like in Hud/Frontend. * bStandardSoundAndMessages is a completely beta thing, * makes game handle sounds & messages instead of SCM (just like in GTA2) * but it's never been used in the game. Has unused sliding text when frenzy completed etc. @@ -102,7 +103,7 @@ CDarkel::DrawMessages() if (timeLeft > 4000 || CTimer::GetFrameCounter() & 1) { CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(109.0f), gUString); - CFont::SetColor(CRGBA(150, 100, 255, 255)); + CFont::SetColor(CRGBA(0, 207, 133, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(108.0f), gUString); } } @@ -110,7 +111,7 @@ CDarkel::DrawMessages() AsciiToUnicode(gString, gUString); CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(35.0f), SCREEN_SCALE_Y(144.0f), gUString); - CFont::SetColor(CRGBA(255, 128, 128, 255)); + CFont::SetColor(CRGBA(156, 91, 40, 255)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f), SCREEN_SCALE_Y(143.0f), gUString); break; } diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index af1680ae..2af9464c 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -155,8 +155,8 @@ CGameLogic::Update() CCarCtrl::ClearInterestingVehicleList(); CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); - CRestart::OverrideHospitalLevel = LEVEL_NONE; - CRestart::OverridePoliceStationLevel = LEVEL_NONE; + CRestart::OverrideHospitalLevel = LEVEL_GENERIC; + CRestart::OverridePoliceStationLevel = LEVEL_GENERIC; PassTime(720); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); AfterDeathArrestSetUpShortCutTaxi(); @@ -261,8 +261,8 @@ CGameLogic::Update() CCarCtrl::ClearInterestingVehicleList(); CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); - CRestart::OverrideHospitalLevel = LEVEL_NONE; - CRestart::OverridePoliceStationLevel = LEVEL_NONE; + CRestart::OverrideHospitalLevel = LEVEL_GENERIC; + CRestart::OverridePoliceStationLevel = LEVEL_GENERIC; PassTime(720); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); AfterDeathArrestSetUpShortCutTaxi(); @@ -313,8 +313,8 @@ CGameLogic::Update() CCarCtrl::ClearInterestingVehicleList(); CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); - CRestart::OverridePoliceStationLevel = LEVEL_NONE; - CRestart::OverrideHospitalLevel = LEVEL_NONE; + CRestart::OverridePoliceStationLevel = LEVEL_GENERIC; + CRestart::OverrideHospitalLevel = LEVEL_GENERIC; RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); SortOutStreamingAndMemory(pPlayerInfo.GetPos()); TheCamera.m_fCamShakeForce = 0.0f; diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 66f1851d..6b4ceb80 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1386,6 +1386,7 @@ bool CGarages::IsCarSprayable(CVehicle * pVehicle) case MI_BARRACKS: case MI_DODO: case MI_COACH: + case MI_FBIRANCH: return false; default: break; diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp index 4f1703f2..71f6c8e5 100644 --- a/src/control/Phones.cpp +++ b/src/control/Phones.cpp @@ -284,6 +284,7 @@ CPhoneInfo::Initialise(void) CBuilding *building = pool->GetSlot(i); if (building) { if (building->GetModelIndex() == MI_PHONEBOOTH1) { + assert(m_nMax < ARRAY_SIZE(m_aPhones) && "NUMPHONES should be increased"); CPhone *maxPhone = &m_aPhones[m_nMax]; maxPhone->m_nState = PHONE_STATE_FREE; maxPhone->m_vecPos = building->GetPosition(); diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 95abe2c5..6576be7f 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -269,12 +269,12 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId) return true; case PICKUP_COLLECTABLE1: CWorld::Players[playerId].m_nCollectedPackages++; - CWorld::Players[playerId].m_nMoney += 1000; + CWorld::Players[playerId].m_nMoney += 100; if (CWorld::Players[playerId].m_nCollectedPackages == CWorld::Players[playerId].m_nTotalPackages) { printf("All collectables have been picked up\n"); CGarages::TriggerMessage("CO_ALL", -1, 5000, -1); - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 1000000; + CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 100000; } else CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages); diff --git a/src/control/Record.h b/src/control/Record.h index 7af733ba..8b55b1f4 100644 --- a/src/control/Record.h +++ b/src/control/Record.h @@ -17,13 +17,13 @@ public: int8 forwardY; int8 forwardZ; int8 wheel; - uint8 gas; - uint8 brake; + int8 gas; + int8 brake; bool handbrake; CVector pos; }; -extern char gString[256];; +extern char gString[256]; class CRecordDataForChase { diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 4407254c..8b34cc3b 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -170,7 +170,7 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi void PrintElementsInPtrList(void) { - for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_NONE).first; node; node = node->next) { + for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) { /* Most likely debug print was present here */ } } @@ -1143,7 +1143,7 @@ void CReplay::StoreStuffInMem(void) pWorld1 = new uint8[sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y]; memcpy(pWorld1, CWorld::GetSector(0, 0), NUMSECTORS_X * NUMSECTORS_Y * sizeof(CSector)); WorldPtrList = CWorld::GetMovingEntityList().first; // why - BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE).first; + BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; pPickups = new uint8[sizeof(CPickup) * NUMPICKUPS]; memcpy(pPickups, CPickups::aPickUps, NUMPICKUPS * sizeof(CPickup)); pReferences = new uint8[(sizeof(CReference) * NUMREFERENCES)]; @@ -1189,7 +1189,7 @@ void CReplay::RestoreStuffFromMem(void) delete[] pWorld1; pWorld1 = nil; CWorld::GetMovingEntityList().first = WorldPtrList; - CWorld::GetBigBuildingList(LEVEL_NONE).first = BigBuildingPtrList; + CWorld::GetBigBuildingList(LEVEL_GENERIC).first = BigBuildingPtrList; memcpy(CPickups::aPickUps, pPickups, sizeof(CPickup) * NUMPICKUPS); delete[] pPickups; pPickups = nil; diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp index 64cabf5d..8fa018d6 100644 --- a/src/control/Restart.cpp +++ b/src/control/Restart.cpp @@ -24,8 +24,8 @@ uint16 CRestart::NumberOfPoliceRestarts; void CRestart::Initialise() { - OverridePoliceStationLevel = LEVEL_NONE; - OverrideHospitalLevel = LEVEL_NONE; + OverridePoliceStationLevel = LEVEL_GENERIC; + OverrideHospitalLevel = LEVEL_GENERIC; bFadeInAfterNextArrest = true; bFadeInAfterNextDeath = true; OverrideHeading = 0.0f; @@ -86,7 +86,7 @@ CRestart::FindClosestHospitalRestartPoint(const CVector &pos, CVector *outPos, f // find closest point on this level for (int i = 0; i < NumberOfHospitalRestarts; i++) { - if (CTheZones::GetLevelFromPosition(&HospitalRestartPoints[i]) == (OverrideHospitalLevel != LEVEL_NONE ? OverrideHospitalLevel : curlevel)) { + if (CTheZones::GetLevelFromPosition(&HospitalRestartPoints[i]) == (OverrideHospitalLevel != LEVEL_GENERIC ? OverrideHospitalLevel : curlevel)) { float dist = (pos - HospitalRestartPoints[i]).MagnitudeSqr(); if (fMinDist >= dist) { fMinDist = dist; @@ -133,7 +133,7 @@ CRestart::FindClosestPoliceRestartPoint(const CVector &pos, CVector *outPos, flo // find closest point on this level for (int i = 0; i < NumberOfPoliceRestarts; i++) { - if (CTheZones::GetLevelFromPosition(&PoliceRestartPoints[i]) == (OverridePoliceStationLevel != LEVEL_NONE ? OverridePoliceStationLevel : curlevel)) { + if (CTheZones::GetLevelFromPosition(&PoliceRestartPoints[i]) == (OverridePoliceStationLevel != LEVEL_GENERIC ? OverridePoliceStationLevel : curlevel)) { float dist = (pos - PoliceRestartPoints[i]).MagnitudeSqr(); if (fMinDist >= dist) { fMinDist = dist; diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 5d466be2..010dec3f 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -67,7 +67,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType eCopType copType = COP_STREET; switch (pVehicle->GetModelIndex()) { - case MI_FBICAR: + case MI_FBIRANCH: modelInfoId = MI_FBI; copType = COP_FBI; break; @@ -236,7 +236,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = 0; pVehicle->AutoPilot.m_nCruiseSpeed = pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0; pVehicle->bExtendedRange = true; - if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1) + if (pVehicle->UsesSiren() && CGeneral::GetRandomNumber() & 1) pVehicle->m_bSirenOrAlarm = true; if (pVehicle->GetUp().z > 0.94f) { CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index c3ca25a6..e1ab0310 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2292,7 +2292,7 @@ void CTheScripts::Init() dbg_log = fopen("SCRDBG.LOG", "w"); static const char* init_msg = "Starting debug script log\n\n"; PrintToLog(init_msg); - CFileMgr::SetDir("\\"); + CFileMgr::SetDir(""); #endif } @@ -2401,7 +2401,7 @@ void CTheScripts::Process() dbg_log = fopen("SCRDBG.LOG", "w"); static const char* init_msg = "Starting debug script log\n\n"; PrintToLog(init_msg); - CFileMgr::SetDir("\\"); + CFileMgr::SetDir(""); #endif PrintToLog("------------------------\n"); PrintToLog("CTheScripts::Process started, CTimer::GetTimeInMilliseconds == %u\n", CTimer::GetTimeInMilliseconds()); @@ -3806,9 +3806,8 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2)); else UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2)); - if (!ScriptParams[5]) - return 0; - CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); + if (ScriptParams[5]) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); return 0; @@ -3833,9 +3832,8 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); else UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2)); - if (!ScriptParams[7]) - return 0; - CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2); + if (ScriptParams[7]) + CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2); if (CTheScripts::DbgFlag) CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2); return 0; @@ -9145,7 +9143,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) CEntity* apEntities[16]; CWorld::FindObjectsOfTypeInRange(mi, pos, range, true, &total, 16, apEntities, true, false, false, true, true); if (total == 0) - CWorld::FindObjectsOfTypeInRangeSectorList(mi, CWorld::GetBigBuildingList(LEVEL_NONE), pos, range, true, &total, 16, apEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(mi, CWorld::GetBigBuildingList(LEVEL_GENERIC), pos, range, true, &total, 16, apEntities); if (total == 0) CWorld::FindObjectsOfTypeInRangeSectorList(mi, CWorld::GetBigBuildingList(CTheZones::GetLevelFromPosition(&pos)), pos, range, true, &total, 16, apEntities); CEntity* pClosestEntity = nil; @@ -9935,7 +9933,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CEntity* apEntities[16]; CWorld::FindObjectsOfTypeInRange(mi1, pos, radius, true, &total, 16, apEntities, true, false, false, false, false); if (total == 0) - CWorld::FindObjectsOfTypeInRangeSectorList(mi1, CWorld::GetBigBuildingList(LEVEL_NONE), pos, radius, true, &total, 16, apEntities); + CWorld::FindObjectsOfTypeInRangeSectorList(mi1, CWorld::GetBigBuildingList(LEVEL_GENERIC), pos, radius, true, &total, 16, apEntities); if (total == 0) CWorld::FindObjectsOfTypeInRangeSectorList(mi1, CWorld::GetBigBuildingList(CTheZones::GetLevelFromPosition(&pos)), pos, radius, true, &total, 16, apEntities); CEntity* pClosestEntity = nil; @@ -10595,11 +10593,15 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; +#ifndef NO_ISLAND_LOADING CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#endif CCollision::SortOutCollisionAfterLoad(); +#ifndef NO_ISLAND_LOADING CStreaming::RequestIslands(CGame::currLevel); CStreaming::LoadAllRequestedModels(true); +#endif CTimer::Update(); return 0; } @@ -10628,7 +10630,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) if (ScriptParams[1]) pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition()); else - pVehicle->m_nZoneLevel = LEVEL_NONE; + pVehicle->m_nZoneLevel = LEVEL_GENERIC; return 0; } case COMMAND_SET_CHAR_STAYS_IN_CURRENT_LEVEL: @@ -10639,7 +10641,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) if (ScriptParams[1]) pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition()); else - pPed->m_nZoneLevel = LEVEL_NONE; + pPed->m_nZoneLevel = LEVEL_GENERIC; return 0; } */ @@ -10722,12 +10724,9 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(CGame::germanGame); return 0; case COMMAND_CLEAR_MISSION_AUDIO: - { CollectParameters(&m_nIp, 1); - debug("CLEAR_MISSION_AUDIO not implemented\n"); - //DMAudio.ClearMissionAudio(ScriptParams[0]); + DMAudio.ClearMissionAudio(ScriptParams[0] - 1); return 0; - } /* case COMMAND_SET_FADE_IN_AFTER_NEXT_ARREST: CollectParameters(&m_nIp, 1); @@ -11280,18 +11279,24 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; if (CGame::currLevel != CCollision::ms_collisionInMemory) { +#ifndef NO_ISLAND_LOADING DMAudio.SetEffectsFadeVol(0); CPad::StopPadsShaking(); CCollision::LoadCollisionScreen(CGame::currLevel); DMAudio.Service(); +#endif CPopulation::DealWithZoneChange(CCollision::ms_collisionInMemory, CGame::currLevel, false); +#ifndef NO_ISLAND_LOADING CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#endif CCollision::SortOutCollisionAfterLoad(); +#ifndef NO_ISLAND_LOADING CStreaming::RequestIslands(CGame::currLevel); CStreaming::RequestBigBuildings(CGame::currLevel); CStreaming::LoadAllRequestedModels(true); DMAudio.SetEffectsFadeVol(127); +#endif } CTimer::Update(); return 0; @@ -13565,12 +13570,8 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) break; case COMMAND_WANTED_STARS_ARE_FLASHING: { - static bool bShowed = false; - if (!bShowed) { - debug("WANTED_STARS_ARE_FLASHING not implemented, default to FALSE\n"); - bShowed = true; - } - UpdateCompareFlag(false); + CWanted *pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted; + UpdateCompareFlag(pWanted->m_nMinWantedLevel - pWanted->m_nWantedLevel > 0); return 0; } case COMMAND_SET_ALLOW_HURRICANES: @@ -13622,7 +13623,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_DISPLAY_RADAR: CollectParameters(&m_nIp, 1); - debug("DISPLAY_RADAR not implemented\n"); + CHud::m_HideRadar = ScriptParams[0] == 0; return 0; case COMMAND_REGISTER_BEST_POSITION: CollectParameters(&m_nIp, 2); @@ -14421,7 +14422,7 @@ void CRunningScript::LocateCharCommand(int32 command, uint32* pIp) CollectParameters(pIp, b3D ? 8 : 6); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); script_assert(pPed); - CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + CVector pos = pPed->InVehicle() ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); switch (command) { case COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_2D: case COMMAND_LOCATE_STOPPED_CHAR_ANY_MEANS_3D: @@ -15181,7 +15182,7 @@ void CRunningScript::CharInAreaCheckCommand(int32 command, uint32* pIp) CollectParameters(pIp, b3D ? 8 : 6); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); script_assert(pPed); - CVector pos = pPed->bInVehicle ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); + CVector pos = pPed->InVehicle() ? pPed->m_pMyVehicle->GetPosition() : pPed->GetPosition(); switch (command) { case COMMAND_IS_CHAR_STOPPED_IN_AREA_3D: case COMMAND_IS_CHAR_STOPPED_IN_AREA_ON_FOOT_3D: @@ -15466,7 +15467,7 @@ void CRunningScript::DoDeatharrestCheck() if (!CTheScripts::IsPlayerOnAMission()) return; CPlayerInfo* pPlayer = &CWorld::Players[CWorld::PlayerInFocus]; - if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest() && !CTheScripts::UpsideDownCars.AreAnyCarsUpsideDown()) + if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest()) return; #ifdef MISSION_REPLAY if (AllowMissionReplay != 0) @@ -15478,6 +15479,7 @@ void CRunningScript::DoDeatharrestCheck() while (m_nStackPointer > 1) --m_nStackPointer; m_nIp = m_anStack[--m_nStackPointer]; + CMessages::ClearSmallMessagesOnly(); *(int32*)&CTheScripts::ScriptSpace[CTheScripts::OnAMissionFlag] = 0; m_bDeatharrestExecuted = true; m_nWakeTime = 0; @@ -15914,22 +15916,24 @@ void CTheScripts::HighlightImportantAngledArea(uint32 id, float x1, float y1, fl bool CTheScripts::IsPedStopped(CPed* pPed) { - if (pPed->bInVehicle) + if (pPed->InVehicle()) return IsVehicleStopped(pPed->m_pMyVehicle); - return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL; + return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) && + !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; } bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer) { CPed* pPed = pPlayer->m_pPed; - if (pPed->bInVehicle) + if (pPed->InVehicle()) return IsVehicleStopped(pPed->m_pMyVehicle); if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP) || RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP_R) || RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) || RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE)) return false; - return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL; + return (pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL) && + !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; } bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index df36270a..3b11e16f 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -39,7 +39,7 @@ extern float fRangePlayerRadius; extern float fCloseNearClipLimit; #ifdef FREE_CAM -bool CCamera::bFreeCam; +bool CCamera::bFreeCam = false; int nPreviousMode = -1; #endif diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index d558e3ad..eeb8630a 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -193,8 +193,8 @@ CCamera::Init(void) m_bMusicFading = false; m_fTimeToFadeMusic = 0.0f; m_fFLOATingFadeMusic = 0.0f; - m_fMouseAccelHorzntl = 0.003f; - m_fMouseAccelVertical = 0.0025f; + m_fMouseAccelVertical = 0.003f; + m_fMouseAccelHorzntl = 0.0025f; } if(FrontEndMenuManager.m_bWantToRestart) m_fTimeToFadeMusic = 0.0f; @@ -4031,7 +4031,7 @@ bool CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat) { RwV3d c; - c = *(RwV3d*)¢er; + c = center; RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix); if(c.y < CDraw::GetNearClipZ()) return false; if(c.y > CDraw::GetFarClipZ()) return false; @@ -4046,7 +4046,7 @@ bool CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat) { RwV3d c; - c = *(RwV3d*)¢er; + c = center; RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix); if(c.y + radius < CDraw::GetNearClipZ()) return false; if(c.y - radius > CDraw::GetFarClipZ()) return false; diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 76019c2f..fd172cb8 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -41,7 +41,7 @@ void CCollision::Init(void) { ms_colModelCache.Init(NUMCOLCACHELINKS); - ms_collisionInMemory = LEVEL_NONE; + ms_collisionInMemory = LEVEL_GENERIC; CColStore::Initialise(); } @@ -70,10 +70,10 @@ GetCollisionInSectorList(CPtrList &list) for(node = list.first; node; node = node->next){ e = (CEntity*)node->item; level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level; - if(level != LEVEL_NONE) + if(level != LEVEL_GENERIC) return (eLevelName)level; } - return LEVEL_NONE; + return LEVEL_GENERIC; } //--MIAMI: unused @@ -84,15 +84,15 @@ GetCollisionInSector(CSector §) int level; level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_BUILDINGS]); - if(level == LEVEL_NONE) + if(level == LEVEL_GENERIC) level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_BUILDINGS_OVERLAP]); - if(level == LEVEL_NONE) + if(level == LEVEL_GENERIC) level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_OBJECTS]); - if(level == LEVEL_NONE) + if(level == LEVEL_GENERIC) level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_OBJECTS_OVERLAP]); - if(level == LEVEL_NONE) + if(level == LEVEL_GENERIC) level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_DUMMIES]); - if(level == LEVEL_NONE) + if(level == LEVEL_GENERIC) level = GetCollisionInSectorList(sect.m_lists[ENTITYLIST_DUMMIES_OVERLAP]); return (eLevelName)level; } diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index c3e4e872..d194cebb 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -131,6 +131,7 @@ void CControllerConfigManager::SaveSettings(int32 file) void CControllerConfigManager::LoadSettings(int32 file) { bool bValid = true; + int nVersion = 0; if (file) { @@ -139,11 +140,13 @@ void CControllerConfigManager::LoadSettings(int32 file) if (!strncmp(buff, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1)) bValid = false; - else + else { CFileMgr::Seek(file, 0, 0); + CFileMgr::Read(file, (char*)&nVersion, sizeof(nVersion)); + } } - if (bValid) + if (bValid && nVersion >= 3) { ControlsManager.MakeControllerActionsBlank(); @@ -202,6 +205,8 @@ void CControllerConfigManager::InitDefaultControlConfiguration() SetControllerKeyAssociatedWithAction (GO_BACK, rsDOWN, KEYBOARD); SetControllerKeyAssociatedWithAction (GO_BACK, 'S', OPTIONAL_EXTRA); + + SetControllerKeyAssociatedWithAction (NETWORK_TALK, 'T', KEYBOARD); SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsPADEND, KEYBOARD); SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsCAPSLK, OPTIONAL_EXTRA); @@ -436,6 +441,7 @@ void CControllerConfigManager::InitialiseControllerActionNameArray() SETACTIONNAME(PED_SPRINT); SETACTIONNAME(PED_CYCLE_TARGET_LEFT); SETACTIONNAME(PED_CYCLE_TARGET_RIGHT); + SETACTIONNAME(PED_LOCK_TARGET); // duplicate SETACTIONNAME(PED_CENTER_CAMERA_BEHIND_PLAYER); SETACTIONNAME(VEHICLE_LOOKBEHIND); SETACTIONNAME(PED_DUCK); @@ -1808,23 +1814,23 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio { switch (action) { - case CAMERA_CHANGE_VIEW_ALL_SITUATIONS: case PED_FIREWEAPON: case GO_LEFT: case GO_RIGHT: + case CAMERA_CHANGE_VIEW_ALL_SITUATIONS: case NETWORK_TALK: - case SWITCH_DEBUG_CAM_ON: case TOGGLE_DPAD: + case SWITCH_DEBUG_CAM_ON: case TAKE_SCREEN_SHOT: case SHOW_MOUSE_POINTER_TOGGLE: return ACTIONTYPE_COMMON; break; - case PED_LOOKBEHIND: - case PED_CYCLE_WEAPON_LEFT: case PED_CYCLE_WEAPON_RIGHT: + case PED_CYCLE_WEAPON_LEFT: case PED_JUMPING: case PED_SPRINT: + case PED_LOOKBEHIND: case PED_DUCK: case PED_ANSWER_PHONE: case PED_CYCLE_TARGET_LEFT: @@ -1853,13 +1859,13 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio return ACTIONTYPE_VEHICLE_3RDPERSON; break; - case PED_LOCK_TARGET: case GO_FORWARD: case GO_BACK: case PED_1RST_PERSON_LOOK_LEFT: case PED_1RST_PERSON_LOOK_RIGHT: - case PED_1RST_PERSON_LOOK_DOWN: + case PED_LOCK_TARGET: case PED_1RST_PERSON_LOOK_UP: + case PED_1RST_PERSON_LOOK_DOWN: return ACTIONTYPE_1RST3RDPERSON; break; diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h index 5f0b6862..05c37c22 100644 --- a/src/core/ControllerConfig.h +++ b/src/core/ControllerConfig.h @@ -61,6 +61,7 @@ enum e_ControllerAction SWITCH_DEBUG_CAM_ON, TAKE_SCREEN_SHOT, SHOW_MOUSE_POINTER_TOGGLE, + UNKNOWN_ACTION, MAX_CONTROLLERACTIONS, }; diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 08126081..a29d26fa 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -106,7 +106,9 @@ CFileLoader::LoadLevel(const char *filename) LoadingScreenLoadingFile(line + 4); LoadScene(line + 4); }else if(strncmp(line, "SPLASH", 6) == 0){ +#ifndef DISABLE_LOADING_SCREEN LoadSplash(GetRandomSplashScreen()); +#endif }else if(strncmp(line, "CDIMAGE", 7) == 0){ CdStreamAddImage(line + 8); } @@ -393,6 +395,16 @@ CFileLoader::FindRelatedModelInfoCB(RpAtomic *atomic, void *data) return atomic; } +#ifdef LIBRW +void +InitClump(RpClump *clump) +{ + RpClumpForAllAtomics(clump, ConvertPlatformAtomic, nil); +} +#else +#define InitClump(clump) +#endif + void CFileLoader::LoadModelFile(const char *filename) { @@ -404,6 +416,7 @@ CFileLoader::LoadModelFile(const char *filename) if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){ clump = RpClumpStreamRead(stream); if(clump){ + InitClump(clump); RpClumpForAllAtomics(clump, FindRelatedModelInfoCB, clump); RpClumpDestroy(clump); } @@ -429,6 +442,7 @@ CFileLoader::LoadClumpFile(const char *filename) GetNameAndLOD(nodename, name, &n); mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(name, nil); if(mi){ + InitClump(clump); assert(mi->IsClump()); mi->SetClump(clump); }else @@ -449,6 +463,7 @@ CFileLoader::LoadClumpFile(RwStream *stream, uint32 id) clump = RpClumpStreamRead(stream); if(clump == nil) return false; + InitClump(clump); mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(id); mi->SetClump(clump); return true; @@ -476,6 +491,7 @@ CFileLoader::FinishLoadClumpFile(RwStream *stream, uint32 id) clump = RpClumpGtaStreamRead2(stream); if(clump){ + InitClump(clump); mi = (CClumpModelInfo*)CModelInfo::GetModelInfo(id); mi->SetClump(clump); return true; @@ -496,6 +512,7 @@ CFileLoader::LoadAtomicFile(RwStream *stream, uint32 id) clump = RpClumpStreamRead(stream); if(clump == nil) return false; + InitClump(clump); gpRelatedModelInfo = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id); RpClumpForAllAtomics(clump, SetRelatedModelInfoCB, clump); RpClumpDestroy(clump); @@ -531,6 +548,8 @@ CFileLoader::LoadAtomicFile2Return(const char *filename) stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, filename); if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)) clump = RpClumpStreamRead(stream); + if(clump) + InitClump(clump); RwStreamClose(stream, nil); return clump; } diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index f6845920..4c205675 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -41,9 +41,6 @@ // TODO(Miami): Remove that!! That was my map implementation for III, instead use MAP_ENHACEMENTS on some places #define CUSTOM_MAP -// TODO(Miami): This is -3 on VC but still -1 on AudioManager?!? What the hell? -#define INVALID_AUDIO_PROVIDER -1 - // Similar story to Hud.cpp: // Game has colors inlined in code. // For easier modification we collect them here: @@ -55,6 +52,7 @@ CRGBA HEADER_COLOR(255, 150, 255, 255); CRGBA DARKMENUOPTION_COLOR(195, 90, 165, 255); CRGBA SLIDERON_COLOR(97, 194, 247, 255); CRGBA SLIDEROFF_COLOR(27, 89, 130, 255); +CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 255); #define TIDY_UP_PBP // ProcessButtonPresses #define MAX_VISIBLE_LIST_ROW 30 @@ -68,11 +66,7 @@ CRGBA SLIDEROFF_COLOR(27, 89, 130, 255); #define FEET_IN_METER 3.33f #endif -#ifdef SCROLLABLE_STATS_PAGE -#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS) -#else #define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS) -#endif #ifdef TRIANGLE_BACK_BUTTON #define GetBackJustUp GetTriangleJustUp @@ -97,7 +91,9 @@ int curBottomBarOption = -1; int hoveredBottomBarOption = -1; #endif -uint8 CMenuManager::m_PrefsStereoMono; // unused except restore settings +#ifdef CUTSCENE_BORDERS_SWITCH +bool CMenuManager::m_PrefsCutsceneBorders = true; +#endif // Originally that was PS2 option color, they forget it here and used in PrintBriefs once(but didn't use the output anyway) #ifdef PS2_LIKE_MENU @@ -360,7 +356,7 @@ CMenuManager::ThingsToDoBeforeLeavingPage() if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) { CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); } else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) { - if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) + if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex(); #ifdef TIDY_UP_PBP DMAudio.StopFrontEndTrack(); @@ -391,9 +387,9 @@ CMenuManager::CMenuManager() m_PrefsSfxVolume = 49; m_PrefsMusicVolume = 49; m_PrefsRadioStation = 0; - field_2C = 1; + m_PrefsStereoMono = 1; m_PrefsBrightness = 256; - m_PrefsLOD = 1.2f; + m_PrefsLOD = CRenderer::ms_lodDistScale; m_KeyPressedCode = -1; m_bFrontEnd_ReloadObrTxtGxt = false; m_PrefsMP3BoostVolume = 0; @@ -426,7 +422,7 @@ CMenuManager::CMenuManager() m_nScrollbarTopMargin = 0.0f; m_nSelectedListRow = 0; m_nSkinsTotal = 0; - m_nPrefsAudio3DProviderIndex = -99; + m_nPrefsAudio3DProviderIndex = AUDIO_PROVIDER_NOT_DETERMINED; m_bGameNotLoaded = true; m_nMousePosX = m_nMouseTempPosX; m_nMousePosY = m_nMouseTempPosY; @@ -634,31 +630,30 @@ CMenuManager::CheckSliderMovement(int value) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_BRIGHTNESS: - m_PrefsBrightness += value * (512/16); - m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 511); + m_PrefsBrightness += value * 24.19f; + m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 384); break; case MENUACTION_DRAWDIST: if(value > 0) - m_PrefsLOD += ((1.8f - 0.8f) / 16.0f); + m_PrefsLOD += ((1.8f - 0.925f) / 16.0f); else - m_PrefsLOD -= ((1.8f - 0.8f) / 16.0f); - m_PrefsLOD = clamp(m_PrefsLOD, 0.8f, 1.8f); + m_PrefsLOD -= ((1.8f - 0.925f) / 16.0f); + m_PrefsLOD = clamp(m_PrefsLOD, 0.925f, 1.8f); CRenderer::ms_lodDistScale = m_PrefsLOD; break; case MENUACTION_MUSICVOLUME: - m_PrefsMusicVolume += value * (128/16); - m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127); + m_PrefsMusicVolume += value * (128/32); + m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65); DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); break; case MENUACTION_SFXVOLUME: - m_PrefsSfxVolume += value * (128/16); - m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 127); + m_PrefsSfxVolume += value * (128/32); + m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65); DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); break; case MENUACTION_MOUSESENS: TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ??? TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f); - TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl; break; default: return; @@ -666,6 +661,7 @@ CMenuManager::CheckSliderMovement(int value) SaveSettings(); } +// --MIAMI: Done void CMenuManager::DisplayHelperText(char *text) { @@ -725,7 +721,7 @@ CMenuManager::DisplayHelperText(char *text) aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_SFXVOLUME) { CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(10.f), SCREEN_SCALE_FROM_BOTTOM(18.f), - m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG")); + m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG")); return; } @@ -742,7 +738,7 @@ CMenuManager::DisplayHelperText(char *text) aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_SPEAKERCONF) { CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(10.f), SCREEN_SCALE_FROM_BOTTOM(18.f), - m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG")); + m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG")); return; } @@ -751,7 +747,7 @@ CMenuManager::DisplayHelperText(char *text) if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_MP3VOLUMEBOOST) { CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(10.f), SCREEN_SCALE_FROM_BOTTOM(18.f), - m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG")); + m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG")); return; } @@ -798,10 +794,10 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR void CMenuManager::DoSettingsBeforeStartingAGame() { - CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD; +#ifdef LEGACY_MENU_OPTIONS if (m_PrefsVsyncDisp != m_PrefsVsync) m_PrefsVsync = m_PrefsVsyncDisp; - +#endif DMAudio.DestroyAllGameCreatedEntities(); DMAudio.Service(); m_bShutDownFrontEndRequested = true; @@ -838,7 +834,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(38.0f), MENU_Y(85.0f), MENU_X_LEFT_ALIGNED(615.0f), MENU_Y(75.0f), MENU_X_LEFT_ALIGNED(30.0f), MENU_Y(320.0f), - MENU_X_LEFT_ALIGNED(605.0f), MENU_Y(330.0f), CRGBA(49, 101, 148, FadeIn(130))); + MENU_X_LEFT_ALIGNED(605.0f), MENU_Y(330.0f), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(130))); break; /* // TODO(Miami) @@ -859,10 +855,10 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) PREPARE_MENU_HEADER CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X + 7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); } // Label @@ -983,7 +979,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) leftText = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName); } - if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER) { + if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER) { if (strncmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEO_AUD", 8) == 0) { CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255))); } @@ -1049,7 +1045,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) case MENUACTION_MUSICVOLUME: case MENUACTION_SFXVOLUME: - if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER) + if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER) rightText = TheText.Get("FEA_NAH"); break; @@ -1078,6 +1074,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) break; case MENUACTION_HUD: rightText = TheText.Get(m_PrefsShowHud ? "FEM_ON" : "FEM_OFF"); + break; #ifdef LEGACY_MENU_OPTIONS case MENUACTION_SETDBGFLAG: rightText = TheText.Get(CTheScripts::IsDebugOn() ? "FEM_ON" : "FEM_OFF"); @@ -1115,7 +1112,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) break; #endif case MENUACTION_AUDIOHW: - if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER) + if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER) rightText = TheText.Get("FEA_NAH"); else if (m_nPrefsAudio3DProviderIndex == -1) rightText = TheText.Get("FEA_ADP"); @@ -1133,7 +1130,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) } break; case MENUACTION_SPEAKERCONF: { - if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER) + if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER) rightText = TheText.Get("FEA_NAH"); else { switch (m_PrefsSpeakers) { @@ -1181,16 +1178,20 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) if (drawCurrScreen && i == m_nCurrOption && itemsAreSelectable && section == 0) { int leftXMax, rightXMin; - CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); + + // FIX: Let's don't scale those so GetStringWidth will give unscaled width, which will be handy to other calculations below that's done without scaling in mind. + // CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE)); + CFont::SetScale(BIGTEXT_X_SCALE, BIGTEXT_Y_SCALE); + wchar *curOptionName = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName); float curOptionWidth = CFont::GetStringWidth(curOptionName, true); if (CFont::Details.centre) { leftXMax = Max(0, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X - curOptionWidth / 2.f); - rightXMin = Min(SCREEN_WIDTH, curOptionWidth / 2.f + aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X); + rightXMin = Min(DEFAULT_SCREEN_WIDTH, curOptionWidth / 2.f + aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X); } else if (!CFont::Details.rightJustify) { leftXMax = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X; - rightXMin = Min(SCREEN_WIDTH, curOptionWidth + aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X); + rightXMin = Min(DEFAULT_SCREEN_WIDTH, curOptionWidth + aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X); } else { leftXMax = Max(0, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X - curOptionWidth); rightXMin = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X; @@ -1304,7 +1305,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) } if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) { if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0 - && m_nCurrScreen == MENUPAGE_SOUND_SETTINGS && m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) { + && m_nCurrScreen == MENUPAGE_SOUND_SETTINGS && m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex(); SetHelperText(3); @@ -1337,11 +1338,11 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH); break; case MENUACTION_MUSICVOLUME: - if(m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) + if(m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) ProcessSlider(m_PrefsMusicVolume / 64.0f, 70.0f, HOVEROPTION_INCREASE_MUSICVOLUME, HOVEROPTION_DECREASE_MUSICVOLUME, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH); break; case MENUACTION_SFXVOLUME: - if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) + if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) ProcessSlider(m_PrefsSfxVolume / 64.0f, 99.0f, HOVEROPTION_INCREASE_SFXVOLUME, HOVEROPTION_DECREASE_SFXVOLUME, MENU_X_LEFT_ALIGNED(170.0f), SCREEN_WIDTH); break; case MENUACTION_MOUSESENS: @@ -1386,7 +1387,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) DisplayHelperText(nil); break; case MENUPAGE_OPTIONS: - if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LOADRADIO) + if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LOADRADIO) DisplayHelperText("FEA_NAH"); break; } @@ -1850,25 +1851,25 @@ CMenuManager::DrawControllerSetupScreen() CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_UNK_X_MARGIN)); CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENU_UNK_WIDTH)); - PREPARE_MENU_HEADER - switch (m_ControlMethod) { case CONTROL_STANDARD: + PREPARE_MENU_HEADER CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X + 7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); - PREPARE_MENU_HEADER - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), + CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); break; case CONTROL_CLASSIC: + PREPARE_MENU_HEADER CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255))); - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X + 7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_CTI")); - PREPARE_MENU_HEADER - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), + CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255))); + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_CTI")); break; default: @@ -2485,9 +2486,9 @@ CMenuManager::DrawBackground(bool transitionCall) if (m_nCurrScreen != MENUPAGE_OUTRO) if (m_menuTransitionProgress == 255) { - m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255)); + m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255)); } else { - m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(27.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255))); + m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255))); } if (m_ShowEmptyBindingError) { @@ -2532,7 +2533,7 @@ CMenuManager::DrawPlayerSetupScreen() PREPARE_MENU_HEADER - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_PS")); + CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get("FET_PS")); // lstrcpy's changed with strcpy @@ -2935,7 +2936,7 @@ CMenuManager::FadeIn(int alpha) } void -CMenuManager::FilterOutColorMarkersFromString(wchar *str, CRGBA &newColor) +CMenuManager::FilterOutColorMarkersFromString(wchar *str) { int newIdx = 0; wchar copy[256], *c; @@ -2944,16 +2945,6 @@ CMenuManager::FilterOutColorMarkersFromString(wchar *str, CRGBA &newColor) for (c = copy; *c != '\0'; c++) { if (*c == '~') { c++; - switch (*c) { - case 'b': newColor = CRGBA(40, 40, 255, 255); break; - case 'g': newColor = CRGBA(40, 235, 40, 255); break; - // There is no case for "h", is that a mistake? - case 'l': newColor = CRGBA(0, 0, 0, 255); break; - case 'p': newColor = CRGBA(255, 0, 255, 255); break; - case 'r': newColor = CRGBA(255, 0, 0, 255); break; - case 'w': newColor = CRGBA(255, 255, 255, 255); break; - case 'y': newColor = CRGBA(255, 255, 0, 255); break; - } while (*c != '~') c++; } else { str[newIdx++] = *c; @@ -3094,28 +3085,32 @@ CMenuManager::LoadAllTextures() CTimer::Update(); } +// --MIAMI: Done void CMenuManager::LoadSettings() { CFileMgr::SetDirMyDocuments(); - int fileHandle = CFileMgr::OpenFile("gta3.set", "r"); + int fileHandle = CFileMgr::OpenFile("gta_vc.set", "r"); int32 prevLang = m_PrefsLanguage; -#ifdef GTA3_1_1_PATCH - CMBlur::BlurOn = (_dwOperatingSystemVersion != OS_WIN98); -#else - CMBlur::BlurOn = true; -#endif MousePointerStateHelper.bInvertVertically = true; + CMBlur::BlurOn = false; // 50 is silly - char Ver[50]; + char headerText[50]; + int someVersion = 0; + bool fileIsValid = true; if (fileHandle) { - CFileMgr::Read(fileHandle, Ver, 29); + CFileMgr::Read(fileHandle, headerText, 29); - if (strncmp(Ver, TopLineEmptyFile, sizeof(TopLineEmptyFile) - 1)) { + if (strncmp(headerText, TopLineEmptyFile, sizeof(TopLineEmptyFile) - 1) == 0) { + fileIsValid = false; + } else { CFileMgr::Seek(fileHandle, 0, 0); + CFileMgr::Read(fileHandle, (char*)&someVersion, sizeof(someVersion)); + } + if (fileIsValid && someVersion >= 3) { ControlsManager.LoadSettings(fileHandle); #ifdef IMPROVED_VIDEOMODE CFileMgr::Read(fileHandle, (char*)&m_nPrefsWidth, sizeof(m_nPrefsWidth)); @@ -3139,33 +3134,44 @@ CMenuManager::LoadSettings() CFileMgr::Read(fileHandle, gString, 20); CFileMgr::Read(fileHandle, gString, 4); CFileMgr::Read(fileHandle, gString, 4); +#ifdef FREE_CAM + CFileMgr::Read(fileHandle, (char*)&TheCamera.bFreeCam, 1); +#else CFileMgr::Read(fileHandle, gString, 1); +#endif + +#ifdef LEGACY_MENU_OPTIONS + CFileMgr::Read(fileHandle, (char*)&m_PrefsVsyncDisp, 1); + CFileMgr::Read(fileHandle, (char*)&CMBlur::BlurOn, 1); +#else CFileMgr::Read(fileHandle, gString, 1); CFileMgr::Read(fileHandle, gString, 1); +#endif CFileMgr::Read(fileHandle, (char*)&TheCamera.m_bHeadBob, 1); CFileMgr::Read(fileHandle, (char*)&TheCamera.m_fMouseAccelHorzntl, 4); - CFileMgr::Read(fileHandle, (char*)&TheCamera.m_fMouseAccelVertical, 4); CFileMgr::Read(fileHandle, (char*)&MousePointerStateHelper.bInvertVertically, 1); CFileMgr::Read(fileHandle, (char*)&CVehicle::m_bDisableMouseSteering, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsSfxVolume, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsMusicVolume, 1); + CFileMgr::Read(fileHandle, (char*)&m_PrefsMP3BoostVolume, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsRadioStation, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsSpeakers, 1); CFileMgr::Read(fileHandle, (char*)&m_nPrefsAudio3DProviderIndex, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsDMA, 1); - CFileMgr::Read(fileHandle, (char*)&m_PrefsBrightness, 1); - CFileMgr::Read(fileHandle, (char*)&m_PrefsLOD, 4); + CFileMgr::Read(fileHandle, (char*)&m_PrefsBrightness, 2); + CFileMgr::Read(fileHandle, (char*)&m_PrefsLOD, sizeof(m_PrefsLOD)); CFileMgr::Read(fileHandle, (char*)&m_PrefsShowSubtitles, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsUseWideScreen, 1); - CFileMgr::Read(fileHandle, (char*)&m_PrefsVsyncDisp, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsFrameLimiter, 1); CFileMgr::Read(fileHandle, (char*)&m_nDisplayVideoMode, 1); - CFileMgr::Read(fileHandle, (char*)&CMBlur::BlurOn, 1); CFileMgr::Read(fileHandle, m_PrefsSkinFile, 256); CFileMgr::Read(fileHandle, (char*)&m_ControlMethod, 1); CFileMgr::Read(fileHandle, (char*)&m_PrefsLanguage, 1); -#ifdef FREE_CAM - CFileMgr::Read(fileHandle, (char*)&TheCamera.bFreeCam, 1); + CFileMgr::Read(fileHandle, (char*)&m_PrefsShowHud, 1); + CFileMgr::Read(fileHandle, (char*)&m_PrefsRadarMode, 1); + CFileMgr::Read(fileHandle, (char*)&m_PrefsShowLegends, 1); +#ifdef CUTSCENE_BORDERS_SWITCH + CFileMgr::Read(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1); #endif } } @@ -3173,10 +3179,13 @@ CMenuManager::LoadSettings() CFileMgr::CloseFile(fileHandle); CFileMgr::SetDir(""); + CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD; +#ifdef LEGACY_MENU_OPTIONS m_PrefsVsync = m_PrefsVsyncDisp; +#endif CRenderer::ms_lodDistScale = m_PrefsLOD; - if (m_nPrefsAudio3DProviderIndex == INVALID_AUDIO_PROVIDER) + if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER) m_nPrefsAudio3DProviderIndex = -2; m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex; @@ -3212,15 +3221,18 @@ CMenuManager::LoadSettings() } } +// --MIAMI: Done void CMenuManager::SaveSettings() { static char RubbishString[48] = "stuffmorestuffevenmorestuff etc"; + static int SomeVersion = 3; CFileMgr::SetDirMyDocuments(); - int fileHandle = CFileMgr::OpenFile("gta3.set", "w+"); + int fileHandle = CFileMgr::OpenFile("gta_vc.set", "w+"); if (fileHandle) { + CFileMgr::Write(fileHandle, (char*)&SomeVersion, sizeof(SomeVersion)); ControlsManager.SaveSettings(fileHandle); #ifdef IMPROVED_VIDEOMODE CFileMgr::Write(fileHandle, (char*)&m_nPrefsWidth, sizeof(m_nPrefsWidth)); @@ -3234,33 +3246,44 @@ CMenuManager::SaveSettings() CFileMgr::Write(fileHandle, RubbishString, 20); CFileMgr::Write(fileHandle, RubbishString, 4); CFileMgr::Write(fileHandle, RubbishString, 4); +#ifdef FREE_CAM + CFileMgr::Write(fileHandle, (char*)&TheCamera.bFreeCam, 1); +#else CFileMgr::Write(fileHandle, RubbishString, 1); +#endif + +#ifdef LEGACY_MENU_OPTIONS + CFileMgr::Write(fileHandle, (char*)&m_PrefsVsyncDisp, 1); + CFileMgr::Write(fileHandle, (char*)&CMBlur::BlurOn, 1); +#else CFileMgr::Write(fileHandle, RubbishString, 1); CFileMgr::Write(fileHandle, RubbishString, 1); +#endif CFileMgr::Write(fileHandle, (char*)&TheCamera.m_bHeadBob, 1); CFileMgr::Write(fileHandle, (char*)&TheCamera.m_fMouseAccelHorzntl, 4); - CFileMgr::Write(fileHandle, (char*)&TheCamera.m_fMouseAccelVertical, 4); CFileMgr::Write(fileHandle, (char*)&MousePointerStateHelper.bInvertVertically, 1); CFileMgr::Write(fileHandle, (char*)&CVehicle::m_bDisableMouseSteering, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsSfxVolume, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsMusicVolume, 1); + CFileMgr::Write(fileHandle, (char*)&m_PrefsMP3BoostVolume, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsRadioStation, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsSpeakers, 1); CFileMgr::Write(fileHandle, (char*)&m_nPrefsAudio3DProviderIndex, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsDMA, 1); - CFileMgr::Write(fileHandle, (char*)&m_PrefsBrightness, 1); + CFileMgr::Write(fileHandle, (char*)&m_PrefsBrightness, 2); CFileMgr::Write(fileHandle, (char*)&m_PrefsLOD, sizeof(m_PrefsLOD)); CFileMgr::Write(fileHandle, (char*)&m_PrefsShowSubtitles, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsUseWideScreen, 1); - CFileMgr::Write(fileHandle, (char*)&m_PrefsVsyncDisp, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsFrameLimiter, 1); CFileMgr::Write(fileHandle, (char*)&m_nPrefsVideoMode, 1); - CFileMgr::Write(fileHandle, (char*)&CMBlur::BlurOn, 1); CFileMgr::Write(fileHandle, m_PrefsSkinFile, 256); CFileMgr::Write(fileHandle, (char*)&m_ControlMethod, 1); CFileMgr::Write(fileHandle, (char*)&m_PrefsLanguage, 1); -#ifdef FREE_CAM - CFileMgr::Write(fileHandle, (char*)&TheCamera.bFreeCam, 1); + CFileMgr::Write(fileHandle, (char*)&m_PrefsShowHud, 1); + CFileMgr::Write(fileHandle, (char*)&m_PrefsRadarMode, 1); + CFileMgr::Write(fileHandle, (char*)&m_PrefsShowLegends, 1); +#ifdef CUTSCENE_BORDERS_SWITCH + CFileMgr::Write(fileHandle, (char *)&CMenuManager::m_PrefsCutsceneBorders, 1); #endif } m_lastWorking3DAudioProvider = m_nPrefsAudio3DProviderIndex; @@ -3318,17 +3341,22 @@ CMenuManager::SmallMessageScreen(const char* text) CFont::PrintString(SCREEN_WIDTH / 2.f, y, TheText.Get(text)); } +// --MIAMI: Done, but FilterOutColorMarkersFromString is actually in CFont void CMenuManager::PrintBriefs() { - CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); - CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); CFont::SetRightJustifyOff(); - CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE)); + CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(80.0f)); + CFont::SetDropShadowPosition(0); - float nextY = BRIEFS_TOP_MARGIN; - CRGBA newColor; + float nextY = BRIEFS_BOTTOM_MARGIN; for (int i = 4; i >= 0; i--) { + if (nextY < BRIEFS_TOP_MARGIN) + break; + tPreviousBrief &brief = CMessages::PreviousBriefs[i]; if (brief.m_pText) { CMessages::InsertNumberInString(brief.m_pText, @@ -3337,127 +3365,125 @@ CMenuManager::PrintBriefs() brief.m_nNumber[4], brief.m_nNumber[5], gUString); CMessages::InsertStringInString(gUString, brief.m_pString); CMessages::InsertPlayerControlKeysInString(gUString); - newColor = TEXT_COLOR; - FilterOutColorMarkersFromString(gUString, newColor); + FilterOutColorMarkersFromString(gUString); -#ifdef PS2_LIKE_MENU - // This PS2 code was always here, but unused - bool rgSame = newColor.r == TEXT_COLOR.r && newColor.g == TEXT_COLOR.g; - bool bSame = rgSame && newColor.b == TEXT_COLOR.b; - bool colorNotChanged = bSame; /* && newColor.a == TEXT_COLOR.a; */ - - if (!colorNotChanged) { - newColor.r /= 2; - newColor.g /= 2; - newColor.b /= 2; - } - CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); // But this is from PS2 - CFont::SetDropShadowPosition(1); -#endif - -#if defined(FIX_BUGS) || defined(PS2_LIKE_MENU) - newColor.a = FadeIn(255); - CFont::SetColor(newColor); -#endif - CFont::PrintString(MENU_X_LEFT_ALIGNED(BRIEFS_LINE_X), nextY, gUString); - nextY += MENU_Y(BRIEFS_LINE_HEIGHT); + nextY -= CFont::GetNumberLines(MENU_X_LEFT_ALIGNED(BRIEFS_LINE_X), nextY, gUString) * BRIEFS_LINE_HEIGHT + BRIEFS_LINE_SPACING; + CFont::PrintString(MENU_X_LEFT_ALIGNED(BRIEFS_LINE_X), MENU_Y(nextY), gUString); } } - -#ifdef PS2_LIKE_MENU - CFont::SetDropShadowPosition(0); -#endif } +// --MIAMI: Done void CMenuManager::PrintStats() { + static uint8 pirateCheck = 0; + static float scrollY = 0; + int rowNum = ConstructStatLine(99999); -#ifdef GTA3_1_1_PATCH + CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(90.0f), MENU_Y(142.0f), + MENU_X_LEFT_ALIGNED(543.0f), MENU_Y(142.f), + MENU_X_LEFT_ALIGNED(107.0f), MENU_Y(316.f), + MENU_X_LEFT_ALIGNED(531.f), MENU_Y(299.f), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(130))); + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); -#endif - CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X * 0.7), MENU_Y(MENU_TEXT_SIZE_Y * 0.9)); // second mulipliers are double, idk why - float nextYChange, y, alphaMult; + CFont::SetPropOn(); + CFont::SetDropShadowPosition(0); - // Scroll stats with mouse -#ifdef SCROLLABLE_STATS_PAGE - static float scrollY = 0; - static PauseModeTime lastChange = m_LastScreenSwitch; - if (CPad::GetPad(0)->GetLeftMouse()) { - scrollY += (m_nMouseOldPosY - m_nMousePosY); - lastChange = CTimer::GetTimeInMillisecondsPauseMode(); - } else { - scrollY += MENU_Y(STATS_SLIDE_Y_PER_SECOND) / 1000.0f * (CTimer::GetTimeInMillisecondsPauseMode() - lastChange); - lastChange = CTimer::GetTimeInMillisecondsPauseMode(); + if (pirateCheck == 0) + // if not pirated game + pirateCheck = 46; + // else + // pirateCheck = 45; + + if (m_PrefsLanguage == LANGUAGE_AMERICAN) + CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f)); + else + CFont::SetScale(MENU_X(0.37f), MENU_Y(0.75f)); + + static PauseModeTime lastCheck = 0; + + if (CTimer::GetTimeInMillisecondsPauseMode() - lastCheck > 40) { + + if (m_StatsScrollSpeed > 0.f) { + if (m_StatsScrollDirection == 0) + scrollY -= MENU_Y(100.f) / m_StatsScrollSpeed; + else + scrollY += MENU_Y(100.f) / m_StatsScrollSpeed; + } + lastCheck = CTimer::GetTimeInMillisecondsPauseMode(); } -#else - // MENU_Y(30.0f) per second - float scrollY = MENU_Y(STATS_SLIDE_Y_PER_SECOND) * (CTimer::GetTimeInMillisecondsPauseMode() - m_LastScreenSwitch) / 1000.0f; -#endif + if (pirateCheck == 45) + return; + + float nextYChange, y, alpha; + + float totalHeight = (rowNum + 7) * STATS_ROW_HEIGHT; for (int row = 0; row < rowNum; ++row) { - // Put just got hidden text at the top back to the bottom, in circular fashion - for (y = MENU_Y(STATS_ROW_HEIGHT - 1) * row + SCREEN_HEIGHT - scrollY; MENU_Y(STATS_PUT_BACK_TO_BOTTOM_Y) > y; y += nextYChange) { - nextYChange = (MENU_Y(STATS_ROW_HEIGHT) + rowNum) * MENU_Y(STATS_ROW_HEIGHT - 1); + // Put faded away text at the top back to the bottom, in circular fashion + for (y = MENU_Y(STATS_ROW_HEIGHT) * row + MENU_Y(100.f) - scrollY; MENU_Y(STATS_FADING_AREA_LENGTH) > y; y += nextYChange) { + nextYChange = MENU_Y(totalHeight); + } + + // Put faded away text at the bottom back to the top + while (SCREEN_SCALE_FROM_BOTTOM(STATS_FADING_AREA_LENGTH) < y) { + y -= MENU_Y(totalHeight); } + alpha = 0.f; // If it's still on screen - if (y > 0.0f && SCREEN_HEIGHT > y) { + if (y > MENU_Y(STATS_VISIBLE_START_Y) && y < MENU_Y(STATS_VISIBLE_END_Y)) { ConstructStatLine(row); - // But about to dim from top - if (y - MENU_Y(STATS_BOTTOM_MARGIN) < MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH)) { - if ((y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f) - alphaMult = 0.0f; - else - alphaMult = (y - MENU_Y(STATS_BOTTOM_MARGIN)) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH); + // But about to dim from bottom + if (y < MENU_Y(STATS_BOTTOM_Y)) { + if (y > MENU_Y(STATS_BOTTOM_Y - STATS_FADING_AREA_LENGTH)) + alpha = (MENU_Y(STATS_BOTTOM_Y) - y) * 5.f; + } - // About to dim from bottom - } else if (y > SCREEN_SCALE_FROM_BOTTOM(STATS_TOP_DIMMING_AREA_LENGTH) - MENU_Y(STATS_BOTTOM_DIMMING_AREA_LENGTH)) { - if ((SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH) < 0.0f) - alphaMult = 0.0f; - else - alphaMult = (SCREEN_SCALE_FROM_BOTTOM(STATS_BOTTOM_DIMMING_AREA_LENGTH) - y) / MENU_Y(STATS_TOP_DIMMING_AREA_LENGTH); - } else - alphaMult = 1.0f; + // About to dim from top + if (y > MENU_Y(STATS_TOP_Y)) { + if (y < MENU_Y(STATS_TOP_Y + STATS_FADING_AREA_LENGTH)) + alpha = (y - MENU_Y(STATS_TOP_Y)) * 5.f; + } - CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255.0f * alphaMult))); + // Content + if (y >= MENU_Y(STATS_TOP_Y + STATS_FADING_AREA_LENGTH) && y <= MENU_Y(STATS_BOTTOM_Y - STATS_FADING_AREA_LENGTH)) + alpha = 255.0f; + + CFont::SetColor(CRGBA(0, 0, 0, FadeIn(Min(255.f, alpha)))); CFont::SetRightJustifyOff(); - CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString); + CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_ROW_LEFT_MARGIN), y, gUString); CFont::SetRightJustifyOn(); - CFont::PrintString(MENU_X_RIGHT_ALIGNED(STATS_ROW_X_MARGIN), y - MENU_Y(STATS_BOTTOM_MARGIN - STATS_TOP_MARGIN), gUString2); + CFont::PrintString(MENU_X_RIGHT_ALIGNED(STATS_ROW_RIGHT_MARGIN), y, gUString2); } } - // Game doesn't do that, but it's better - float nextX = MENU_X_LEFT_ALIGNED(STATS_RATING_X); + CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255))); + CFont::SetDropShadowPosition(2); + CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255))); + CFont::SetCentreOn(); + CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); + CFont::SetScale(MENU_X(0.65f), MENU_Y(1.05f)); + CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_RATING_X), MENU_Y(STATS_RATING_Y_1), TheText.Get("CRIMRA")); - CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255))); + CFont::SetCentreOff(); CFont::SetRightJustifyOff(); - CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), TheText.Get("CRIMRA")); -#ifdef MORE_LANGUAGES - if (CFont::IsJapanese()) - nextX += MENU_X(10.0f) + CFont::GetStringWidth_Jap(TheText.Get("CRIMRA")); - else -#endif - nextX += MENU_X(10.0f) + CFont::GetStringWidth(TheText.Get("CRIMRA"), true); - UnicodeStrcpy(gUString, CStats::FindCriminalRatingString()); - CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString); -#ifdef MORE_LANGUAGES - if (CFont::IsJapanese()) - nextX += MENU_X(6.0f) + CFont::GetStringWidth_Jap(gUString); - else -#endif - nextX += MENU_X(6.0f) + CFont::GetStringWidth(gUString, true); - sprintf(gString, "%d", CStats::FindCriminalRatingNumber()); + + // FIX: Game does that in a weird way, alignment and spacing is now ok + + sprintf(gString, "(%d)", CStats::FindCriminalRatingNumber()); AsciiToUnicode(gString, gUString); - CFont::PrintString(nextX, MENU_Y(STATS_RATING_Y), gUString); - // ::Draw already does that. - /* - PREPARE_MENU_HEADER - CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_FROM_BOTTOM(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName)); - */ - CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X), MENU_Y(MENU_TEXT_SIZE_Y)); + UnicodeStrcpy(gUString2, CStats::FindCriminalRatingString()); + UnicodeStrcat(gUString2, gUString); + + CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); + CFont::SetScale(MENU_X(0.5f), MENU_Y(0.9f)); + CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255))); + CFont::SetDropShadowPosition(0); + + CFont::PrintString(MENU_X_LEFT_ALIGNED(STATS_RATING_X) - CFont::GetStringWidth(gUString2, true) / 2.f, MENU_Y(STATS_RATING_Y_2), gUString2); } // --MIAMI: Done @@ -4083,13 +4109,11 @@ CMenuManager::ProcessButtonPresses(void) case HOVEROPTION_INCREASE_MOUSESENS: TheCamera.m_fMouseAccelHorzntl += (1.0f / 3000); TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); - TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl; SaveSettings(); break; case HOVEROPTION_DECREASE_MOUSESENS: TheCamera.m_fMouseAccelHorzntl -= (1.0f / 3000); TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); - TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl; SaveSettings(); break; } @@ -4416,9 +4440,11 @@ CMenuManager::ProcessButtonPresses(void) SwitchToNewScreen(MENUPAGE_OUTRO); break; case MENUACTION_RESUME: +#ifdef LEGACY_MENU_OPTIONS if (m_PrefsVsyncDisp != m_PrefsVsync) { m_PrefsVsync = m_PrefsVsyncDisp; } +#endif RequestFrontEndShutDown(); break; case MENUACTION_DONTCANCEL: @@ -4449,7 +4475,7 @@ CMenuManager::ProcessButtonPresses(void) case MENUACTION_AUDIOHW: { int selectedProvider = m_nPrefsAudio3DProviderIndex; - if (selectedProvider != INVALID_AUDIO_PROVIDER) { + if (selectedProvider != NO_AUDIO_PROVIDER) { if (selectedProvider == -1) selectedProvider = m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders(); m_nPrefsAudio3DProviderIndex = DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex); @@ -4462,7 +4488,7 @@ CMenuManager::ProcessButtonPresses(void) } case MENUACTION_SPEAKERCONF: #ifndef TIDY_UP_PBP - if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) { + if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { if (--m_PrefsSpeakers < 0) m_PrefsSpeakers = 2; DMAudio.SetSpeakerConfig(m_PrefsSpeakers); @@ -4480,42 +4506,41 @@ CMenuManager::ProcessButtonPresses(void) break; case MENUACTION_RESTOREDEF: if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) { - m_PrefsSfxVolume = 102; + m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders(); + DMAudio.SetCurrent3DProvider(m_nPrefsAudio3DProviderIndex); + m_PrefsSfxVolume = 49; + m_PrefsMusicVolume = 49; + m_PrefsRadioStation = EMOTION; + m_PrefsMP3BoostVolume = 0; + m_PrefsStereoMono = 1; m_PrefsSpeakers = 0; - m_PrefsMusicVolume = 102; - m_PrefsStereoMono = 0; - m_PrefsRadioStation = WILDSTYLE; - DMAudio.SetMusicMasterVolume(102); + // DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume); // TODO(Miami) + DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); SaveSettings(); } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { - m_PrefsFrameLimiter = true; m_PrefsBrightness = 256; - m_PrefsVsyncDisp = true; m_PrefsLOD = 1.2f; +#ifdef LEGACY_MENU_OPTIONS m_PrefsVsync = true; - CRenderer::ms_lodDistScale = 1.2f; +#endif + CRenderer::ms_lodDistScale = m_PrefsLOD; + m_PrefsShowSubtitles = false; m_PrefsUseWideScreen = false; - m_PrefsShowSubtitles = true; + m_PrefsShowLegends = true; + m_PrefsVsyncDisp = true; + m_PrefsFrameLimiter = true; + m_PrefsRadarMode = 0; + m_PrefsShowHud = true; m_nDisplayVideoMode = m_nPrefsVideoMode; -#ifdef GTA3_1_1_PATCH - if (_dwOperatingSystemVersion == OS_WIN98) { - CMBlur::BlurOn = false; - CMBlur::MotionBlurClose(); - } - else { - CMBlur::BlurOn = true; - CMBlur::MotionBlurOpen(Scene.camera); - } -#else - CMBlur::BlurOn = true; -#endif + CMBlur::BlurOn = false; SaveSettings(); } else if (m_nCurrScreen == MENUPAGE_CONTROLLER_PC) { ControlsManager.MakeControllerActionsBlank(); ControlsManager.InitDefaultControlConfiguration(); + MousePointerStateHelper.GetMouseSetUp(); ControlsManager.InitDefaultControlConfigMouse(MousePointerStateHelper.GetMouseSetUp()); #if !defined RW_GL3 if (AllValidWinJoys.m_aJoys[JOYSTICK1].m_bInitialised) { @@ -4531,11 +4556,12 @@ CMenuManager::ProcessButtonPresses(void) ControlsManager.InitDefaultControlConfigJoyPad(count); } #endif - m_ControlMethod = CONTROL_STANDARD; - MousePointerStateHelper.bInvertVertically = false; + MousePointerStateHelper.bInvertVertically = true; + TheCamera.m_bHeadBob = false; TheCamera.m_fMouseAccelHorzntl = 0.0025f; CVehicle::m_bDisableMouseSteering = true; - TheCamera.m_bHeadBob = false; + m_ControlMethod = CONTROL_STANDARD; + TheCamera.m_bUseMouse3rdPerson = true; SaveSettings(); } SetHelperText(2); @@ -4583,9 +4609,11 @@ CMenuManager::ProcessButtonPresses(void) if (m_nCurrScreen == MENUPAGE_PAUSE_MENU) { #endif if (!m_bGameNotLoaded) { +#ifdef LEGACY_MENU_OPTIONS if (m_PrefsVsyncDisp != m_PrefsVsync) { m_PrefsVsync = m_PrefsVsyncDisp; } +#endif RequestFrontEndShutDown(); } @@ -4748,14 +4776,14 @@ CMenuManager::ProcessButtonPresses(void) break; #endif case MENUACTION_AUDIOHW: - if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) { + if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { m_nPrefsAudio3DProviderIndex += changeValueBy; m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1); } DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); break; case MENUACTION_SPEAKERCONF: - if (m_nPrefsAudio3DProviderIndex != INVALID_AUDIO_PROVIDER) { + if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { m_PrefsSpeakers -= changeValueBy; m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2); DMAudio.SetSpeakerConfig(m_PrefsSpeakers); @@ -5429,13 +5457,9 @@ CMenuManager::ConstructStatLine(int rowIdx) if (CStats::Record4x4Mayhem > 0) { STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, false, nil); } - if (CStats::LongestFlightInDodo > 0) { - STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, false, nil); - } if (CStats::TimeTakenDefuseMission > 0) { STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, false, nil); } - STAT_LINE("CAR_CRU", &CStats::CarsCrushed, false, nil); if (CStats::HighestScores[0] > 0) { STAT_LINE("FEST_BB", nil, false, nil); @@ -5463,7 +5487,6 @@ CMenuManager::ConstructStatLine(int rowIdx) float fTemp; STAT_LINE("FEST_DF", &(fTemp = CStats::DistanceTravelledOnFoot * MILES_IN_METER), true, nil); STAT_LINE("FEST_DC", &(fTemp = CStats::DistanceTravelledInVehicle * MILES_IN_METER), true, nil); - STAT_LINE("MMRAIN", &CStats::mmRain, false, nil); STAT_LINE("MXCARD", &(fTemp = CStats::MaximumJumpDistance * FEET_IN_METER), true, nil); STAT_LINE("MXCARJ", &(fTemp = CStats::MaximumJumpHeight * FEET_IN_METER), true, nil); break; @@ -5479,7 +5502,6 @@ CMenuManager::ConstructStatLine(int rowIdx) #endif STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, true, nil); STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, true, nil); - STAT_LINE("MMRAIN", &CStats::mmRain, false, nil); STAT_LINE("MXCARDM", &CStats::MaximumJumpDistance, true, nil); STAT_LINE("MXCARJM", &CStats::MaximumJumpHeight, true, nil); break; diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 577e36db..327bf6fa 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -66,20 +66,23 @@ #define PLAYERSETUP_LIST_BODY_TOP 47 #define PLAYERSETUP_ROW_HEIGHT 9 -#define STATS_SLIDE_Y_PER_SECOND 30.0f -#define STATS_ROW_HEIGHT 20.0f -#define STATS_ROW_X_MARGIN 50.0f -#define STATS_BOTTOM_MARGIN 135.0f -#define STATS_TOP_MARGIN 40.0f -#define STATS_TOP_DIMMING_AREA_LENGTH (93.0f - STATS_TOP_MARGIN) -#define STATS_BOTTOM_DIMMING_AREA_LENGTH 55.0f -#define STATS_PUT_BACK_TO_BOTTOM_Y 50.0f -#define STATS_RATING_X 24.0f -#define STATS_RATING_Y 20.0f - -#define BRIEFS_TOP_MARGIN 40.0f -#define BRIEFS_LINE_X 50.0f -#define BRIEFS_LINE_HEIGHT 60.0f +#define STATS_ROW_HEIGHT 17.0f +#define STATS_ROW_LEFT_MARGIN 110.0f +#define STATS_ROW_RIGHT_MARGIN 113.0f +#define STATS_TOP_Y 135.0f // Just faded in +#define STATS_BOTTOM_Y 300.0f // Starts to fade out after that +#define STATS_FADING_AREA_LENGTH 50.0f +#define STATS_VISIBLE_START_Y (STATS_TOP_Y - 10.f) +#define STATS_VISIBLE_END_Y (STATS_BOTTOM_Y + 21.f) +#define STATS_RATING_X 320.0f +#define STATS_RATING_Y_1 85.0f +#define STATS_RATING_Y_2 110.0f + +#define BRIEFS_TOP_MARGIN 140.0f +#define BRIEFS_BOTTOM_MARGIN 280.0f +#define BRIEFS_LINE_X 100.0f +#define BRIEFS_LINE_HEIGHT 20.0f +#define BRIEFS_LINE_SPACING 10.0f #define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f #define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f @@ -477,10 +480,10 @@ public: int8 m_nPrefsAudio3DProviderIndex; int8 m_PrefsSpeakers; int8 m_PrefsDMA; - uint8 m_PrefsSfxVolume; - uint8 m_PrefsMusicVolume; + int8 m_PrefsSfxVolume; + int8 m_PrefsMusicVolume; uint8 m_PrefsRadioStation; - uint8 field_2C; + uint8 m_PrefsStereoMono; // unused except restore settings int32 m_nCurrOption; bool m_bQuitGameNoCD; bool m_bMenuMapActive; @@ -595,7 +598,9 @@ public: }; bool GetIsMenuActive() {return !!m_bMenuActive;} - static uint8 m_PrefsStereoMono; +#ifdef CUTSCENE_BORDERS_SWITCH + static bool m_PrefsCutsceneBorders; +#endif #ifndef MASTER static bool m_PrefsMarketing; @@ -625,7 +630,7 @@ public: void DrawBackground(bool transitionCall); void DrawPlayerSetupScreen(); int FadeIn(int alpha); - void FilterOutColorMarkersFromString(wchar*, CRGBA &); + void FilterOutColorMarkersFromString(wchar*); int GetStartOptionsCntrlConfigScreens(); void InitialiseChangedLanguageSettings(); void LoadAllTextures(); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 9d8e4ce7..b5ba5b69 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -245,23 +245,20 @@ void CGame::ShutdownRenderWare(void) bool CGame::InitialiseOnceAfterRW(void) { TheText.Load(); - DMAudio.Initialise(); CTimer::Initialise(); CTempColModels::Initialise(); mod_HandlingManager.Initialise(); CSurfaceTable::Initialise("DATA\\SURFACE.DAT"); CPedStats::Initialise(); CTimeCycle::Initialise(); - + DMAudio.Initialise(); if ( DMAudio.GetNum3DProvidersAvailable() == 0 ) - FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1; + FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = NO_AUDIO_PROVIDER; - if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) + if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == AUDIO_PROVIDER_NOT_DETERMINED || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) { FrontEndMenuManager.m_PrefsSpeakers = 0; - int8 provider = DMAudio.AutoDetect3DProviders(); - if ( provider != -1 ) - FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider; + FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = DMAudio.AutoDetect3DProviders(); } DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex); @@ -357,7 +354,7 @@ bool CGame::Initialise(const char* datFile) LoadingScreen("Loading the Game", "Setup streaming", nil); CStreaming::LoadInitialVehicles(); CStreaming::LoadInitialPeds(); - CStreaming::RequestBigBuildings(LEVEL_NONE); + CStreaming::RequestBigBuildings(LEVEL_GENERIC); CStreaming::LoadAllRequestedModels(false); printf("Streaming uses %dK of its memory", CStreaming::ms_memoryUsed / 1024); LoadingScreen("Loading the Game", "Load animations", GetRandomSplashScreen()); @@ -508,7 +505,7 @@ void CGame::ReInitGameObjectVariables(void) CTimeCycle::Initialise(); CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; - CStreaming::RequestBigBuildings(LEVEL_NONE); + CStreaming::RequestBigBuildings(LEVEL_GENERIC); CStreaming::LoadAllRequestedModels(false); CPed::Initialise(); CEventList::Initialise(); @@ -646,7 +643,7 @@ void CGame::InitialiseWhenRestarting(void) CTimer::Initialise(); FrontEndMenuManager.m_bWantToLoad = false; ReInitGameObjectVariables(); - currLevel = LEVEL_NONE; + currLevel = LEVEL_GENERIC; CCollision::SortOutCollisionAfterLoad(); } } diff --git a/src/core/Game.h b/src/core/Game.h index 49a3e67c..67d83c00 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -2,7 +2,7 @@ enum eLevelName { LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel - LEVEL_NONE = 0, + LEVEL_GENERIC = 0, LEVEL_BEACH, LEVEL_MAINLAND }; diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h index a7e1796d..3f9631c8 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.h @@ -4,7 +4,7 @@ CMenuScreen aScreens[] = { // MENUPAGE_STATS = 0 - { "FET_STA", MENUPAGE_NONE, 3, + { "FEH_STA", MENUPAGE_NONE, 3, MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 190, 320, MENUALIGN_RIGHT, }, diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 2511ce9a..3c01a176 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -560,7 +560,7 @@ CPlayerInfo::Process(void) veh->m_nZoneLevel = LEVEL_IGNORE; for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) { if (veh->pPassengers[i]) - veh->pPassengers[i]->m_nZoneLevel = LEVEL_NONE; + veh->pPassengers[i]->m_nZoneLevel = LEVEL_GENERIC; } CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled; } else { diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 3b581dea..c359793c 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -766,7 +766,8 @@ void CRadar::DrawMap() m_radarRange = RADAR_MIN_RANGE; vec2DRadarOrigin = CVector2D(FindPlayerCentreOfWorld_NoSniperShift()); - DrawRadarMap(); + if (FrontEndMenuManager.m_PrefsRadarMode != 1) + DrawRadarMap(); } } diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index b8ea0943..2e3a27b2 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -21,8 +21,8 @@ int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES]; int32 CStats::TimesDied; int32 CStats::TimesArrested; int32 CStats::KillsSinceLastCheckpoint; -int32 CStats::DistanceTravelledInVehicle; -int32 CStats::DistanceTravelledOnFoot; +float CStats::DistanceTravelledInVehicle; +float CStats::DistanceTravelledOnFoot; int32 CStats::ProgressMade; int32 CStats::TotalProgressInGame; int32 CStats::CarsExploded; @@ -49,7 +49,6 @@ int32 CStats::LivesSavedWithAmbulance; int32 CStats::CriminalsCaught; int32 CStats::HighestLevelAmbulanceMission; int32 CStats::FiresExtinguished; -int32 CStats::LongestFlightInDodo; int32 CStats::TimeTakenDefuseMission; int32 CStats::TotalNumberKillFrenzies; int32 CStats::TotalNumberMissions; @@ -58,8 +57,6 @@ int32 CStats::KgsOfExplosivesUsed; int32 CStats::InstantHitsFiredByPlayer; int32 CStats::InstantHitsHitByPlayer; int32 CStats::BestTimeBombDefusal; -int32 CStats::mmRain; -int32 CStats::CarsCrushed; int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES]; int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES]; int32 CStats::BestPositions[CStats::TOTAL_BEST_POSITIONS]; @@ -83,13 +80,11 @@ void CStats::Init() KgsOfExplosivesUsed = 0; InstantHitsFiredByPlayer = 0; InstantHitsHitByPlayer = 0; - CarsCrushed = 0; HeadsPopped = 0; TimesArrested = 0; TimesDied = 0; DaysPassed = 0; NumberOfUniqueJumpsFound = 0; - mmRain = 0; MaximumJumpFlips = 0; MaximumJumpSpins = 0; MaximumJumpDistance = 0; @@ -97,7 +92,6 @@ void CStats::Init() BestStuntJump = 0; TotalNumberOfUniqueJumps = 0; Record4x4One = 0; - LongestFlightInDodo = 0; Record4x4Two = 0; PassengersDroppedOffWithTaxi = 0; Record4x4Three = 0; @@ -202,11 +196,6 @@ void CStats::AnotherFireExtinguished() ++FiresExtinguished; } -void CStats::RegisterLongestFlightInDodo(int32 time) -{ - LongestFlightInDodo = Max(LongestFlightInDodo, time); -} - void CStats::RegisterTimeTakenDefuseMission(int32 time) { TimeTakenDefuseMission = (TimeTakenDefuseMission && TimeTakenDefuseMission < time) ? TimeTakenDefuseMission : time; @@ -296,12 +285,10 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) sizeof(KgsOfExplosivesUsed) + sizeof(InstantHitsFiredByPlayer) + sizeof(InstantHitsHitByPlayer) + - sizeof(CarsCrushed) + sizeof(HeadsPopped) + sizeof(TimesArrested) + sizeof(TimesDied) + sizeof(DaysPassed) + - sizeof(mmRain) + sizeof(MaximumJumpDistance) + sizeof(MaximumJumpHeight) + sizeof(MaximumJumpFlips) + @@ -327,7 +314,6 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) sizeof(CriminalsCaught) + sizeof(HighestLevelAmbulanceMission) + sizeof(FiresExtinguished) + - sizeof(LongestFlightInDodo) + sizeof(TimeTakenDefuseMission) + sizeof(NumberKillFrenziesPassed) + sizeof(TotalNumberKillFrenzies) + @@ -351,12 +337,10 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) CopyToBuf(buf, KgsOfExplosivesUsed); CopyToBuf(buf, InstantHitsFiredByPlayer); CopyToBuf(buf, InstantHitsHitByPlayer); - CopyToBuf(buf, CarsCrushed); CopyToBuf(buf, HeadsPopped); CopyToBuf(buf, TimesArrested); CopyToBuf(buf, TimesDied); CopyToBuf(buf, DaysPassed); - CopyToBuf(buf, mmRain); CopyToBuf(buf, MaximumJumpDistance); CopyToBuf(buf, MaximumJumpHeight); CopyToBuf(buf, MaximumJumpFlips); @@ -382,7 +366,6 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) CopyToBuf(buf, CriminalsCaught); CopyToBuf(buf, HighestLevelAmbulanceMission); CopyToBuf(buf, FiresExtinguished); - CopyToBuf(buf, LongestFlightInDodo); CopyToBuf(buf, TimeTakenDefuseMission); CopyToBuf(buf, NumberKillFrenziesPassed); CopyToBuf(buf, TotalNumberKillFrenzies); @@ -415,12 +398,10 @@ void CStats::LoadStats(uint8 *buf, uint32 size) CopyFromBuf(buf, KgsOfExplosivesUsed); CopyFromBuf(buf, InstantHitsFiredByPlayer); CopyFromBuf(buf, InstantHitsHitByPlayer); - CopyFromBuf(buf, CarsCrushed); CopyFromBuf(buf, HeadsPopped); CopyFromBuf(buf, TimesArrested); CopyFromBuf(buf, TimesDied); CopyFromBuf(buf, DaysPassed); - CopyFromBuf(buf, mmRain); CopyFromBuf(buf, MaximumJumpDistance); CopyFromBuf(buf, MaximumJumpHeight); CopyFromBuf(buf, MaximumJumpFlips); @@ -446,7 +427,6 @@ void CStats::LoadStats(uint8 *buf, uint32 size) CopyFromBuf(buf, CriminalsCaught); CopyFromBuf(buf, HighestLevelAmbulanceMission); CopyFromBuf(buf, FiresExtinguished); - CopyFromBuf(buf, LongestFlightInDodo); CopyFromBuf(buf, TimeTakenDefuseMission); CopyFromBuf(buf, NumberKillFrenziesPassed); CopyFromBuf(buf, TotalNumberKillFrenzies); diff --git a/src/core/Stats.h b/src/core/Stats.h index 8588fef1..7dd527ea 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -25,8 +25,8 @@ public: static int32 TimesDied; static int32 TimesArrested; static int32 KillsSinceLastCheckpoint; - static int32 DistanceTravelledInVehicle; - static int32 DistanceTravelledOnFoot; + static float DistanceTravelledInVehicle; + static float DistanceTravelledOnFoot; static int32 CarsExploded; static int32 PeopleKilledByPlayer; static int32 ProgressMade; @@ -53,7 +53,6 @@ public: static int32 CriminalsCaught; static int32 HighestLevelAmbulanceMission; static int32 FiresExtinguished; - static int32 LongestFlightInDodo; static int32 TimeTakenDefuseMission; static int32 TotalNumberKillFrenzies; static int32 TotalNumberMissions; @@ -62,8 +61,6 @@ public: static int32 InstantHitsFiredByPlayer; static int32 InstantHitsHitByPlayer; static int32 BestTimeBombDefusal; - static int32 mmRain; - static int32 CarsCrushed; static int32 FastestTimes[TOTAL_FASTEST_TIMES]; static int32 HighestScores[TOTAL_HIGHEST_SCORES]; static int32 BestPositions[TOTAL_BEST_POSITIONS]; @@ -90,7 +87,6 @@ public: static void RegisterLevelAmbulanceMission(int32); static void AnotherFireExtinguished(); static wchar *FindCriminalRatingString(); - static void RegisterLongestFlightInDodo(int32); static void RegisterTimeTakenDefuseMission(int32); static void AnotherKillFrenzyPassed(); static void SetTotalNumberKillFrenzies(int32); diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index d560a695..484155d6 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -723,7 +723,11 @@ CStreaming::RequestBigBuildings(eLevelName level, const CVector &pos) n = CPools::GetBuildingPool()->GetSize()-1; for(i = n; i >= 0; i--){ b = CPools::GetBuildingPool()->GetSlot(i); - if(b && b->bIsBIGBuilding && b->m_level == level) + if(b && b->bIsBIGBuilding +#ifndef NO_ISLAND_LOADING + && b->m_level == level +#endif + ) if(b->bStreamBIGBuilding){ if(CRenderer::ShouldModelBeStreamed(b, pos)) RequestModel(b->GetModelIndex(), 0); @@ -795,6 +799,7 @@ CStreaming::InstanceLoadedModels(const CVector &pos) void CStreaming::RequestIslands(eLevelName level) { +#ifndef NO_ISLAND_LOADING switch(level){ case LEVEL_MAINLAND: if(islandLODbeach != -1) @@ -806,6 +811,7 @@ CStreaming::RequestIslands(eLevelName level) break; default: break; } +#endif } //--MIAMI: TODO @@ -1010,10 +1016,12 @@ CStreaming::RemoveBuildings(eLevelName level) void CStreaming::RemoveUnusedBigBuildings(eLevelName level) { +#ifndef NO_ISLAND_LOADING if(level != LEVEL_BEACH) RemoveBigBuildings(LEVEL_BEACH); if(level != LEVEL_MAINLAND) RemoveBigBuildings(LEVEL_MAINLAND); +#endif RemoveIslandsNotUsed(level); } @@ -1035,6 +1043,7 @@ DeleteIsland(CEntity *island) void CStreaming::RemoveIslandsNotUsed(eLevelName level) { +#ifndef NO_ISLAND_LOADING int i; if(pIslandLODmainlandEntity == nil) for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){ @@ -1053,8 +1062,10 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level) break; case LEVEL_BEACH: DeleteIsland(pIslandLODbeachEntity); + break; } +#endif // !NO_ISLAND_LOADING } //--MIAMI: done @@ -1380,11 +1391,11 @@ CStreaming::StreamVehiclesAndPeds(void) } if(FindPlayerPed()->m_pWanted->AreFbiRequired()){ - RequestModel(MI_FBICAR, STREAMFLAGS_DONT_REMOVE); + RequestModel(MI_FBIRANCH, STREAMFLAGS_DONT_REMOVE); RequestModel(MI_FBI, STREAMFLAGS_DONT_REMOVE); }else{ - SetModelIsDeletable(MI_FBICAR); - if(!HasModelLoaded(MI_FBICAR)) + SetModelIsDeletable(MI_FBIRANCH); + if(!HasModelLoaded(MI_FBIRANCH)) SetModelIsDeletable(MI_FBI); } @@ -1594,7 +1605,7 @@ CStreaming::LoadBigBuildingsWhenNeeded(void) if(CCutsceneMgr::IsCutsceneProcessing()) return; - if(CTheZones::m_CurrLevel == LEVEL_NONE || + if(CTheZones::m_CurrLevel == LEVEL_GENERIC || CTheZones::m_CurrLevel == CGame::currLevel) return; @@ -1612,7 +1623,7 @@ CStreaming::LoadBigBuildingsWhenNeeded(void) CGame::TidyUpMemory(true, true); CReplay::EmptyReplayBuffer(); - if(CGame::currLevel != LEVEL_NONE) + if(CGame::currLevel != LEVEL_GENERIC) LoadSplash(GetLevelSplashScreen(CGame::currLevel)); CStreaming::RequestBigBuildings(CGame::currLevel, TheCamera.GetPosition()); @@ -2620,16 +2631,16 @@ CStreaming::LoadScene(const CVector &pos) } CRenderer::m_loadingPriority = false; DeleteAllRwObjects(); - if(level == LEVEL_NONE) + if(level == LEVEL_GENERIC) level = CGame::currLevel; CGame::currLevel = level; RemoveUnusedBigBuildings(level); RequestBigBuildings(level, pos); - RequestBigBuildings(LEVEL_NONE, pos); + RequestBigBuildings(LEVEL_GENERIC, pos); RemoveIslandsNotUsed(level); LoadAllRequestedModels(false); InstanceBigBuildings(level, pos); - InstanceBigBuildings(LEVEL_NONE, pos); + InstanceBigBuildings(LEVEL_GENERIC, pos); AddModelsToRequestList(pos); CRadar::StreamRadarSections(pos); diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp index c6a9d368..e12b48dd 100644 --- a/src/core/TempColModels.cpp +++ b/src/core/TempColModels.cpp @@ -37,19 +37,19 @@ CTempColModels::Initialise(void) #define SET_COLMODEL_SPHERES(colmodel, sphrs)\ colmodel.numSpheres = ARRAY_SIZE(sphrs);\ colmodel.spheres = sphrs;\ - colmodel.level = LEVEL_NONE;\ + colmodel.level = LEVEL_GENERIC;\ colmodel.ownsCollisionVolumes = false;\ int i; ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f)); - ms_colModelBBox.level = LEVEL_NONE; + ms_colModelBBox.level = LEVEL_GENERIC; for (i = 0; i < ARRAY_SIZE(ms_colModelCutObj); i++) { ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f)); ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f)); - ms_colModelCutObj[i].level = LEVEL_NONE; + ms_colModelCutObj[i].level = LEVEL_GENERIC; } // Ped Spheres diff --git a/src/core/World.cpp b/src/core/World.cpp index 8399161f..7126b26f 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1785,7 +1785,7 @@ CWorld::ClearForRestart(void) CWorld::Remove(pEntity); delete pEntity; } - for(CPtrNode *pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) { + for(CPtrNode *pNode = GetBigBuildingList(LEVEL_GENERIC).first; pNode; pNode = pNode->next) { CVehicle *pVehicle = (CVehicle *)pNode->item; if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { CWorld::Remove(pVehicle); diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 84b5ca29..87e85da5 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -93,7 +93,7 @@ CTheZones::Init(void) InfoZoneArray[0].maxx = 1600.0f; InfoZoneArray[0].maxy = 2000.0f; InfoZoneArray[0].maxz = 500.0f; - InfoZoneArray[0].level = LEVEL_NONE; + InfoZoneArray[0].level = LEVEL_GENERIC; InfoZoneArray[0].type = ZONE_INFO; strcpy(NavigationZoneArray[0].name, "VICE_C"); @@ -103,10 +103,10 @@ CTheZones::Init(void) NavigationZoneArray[0].maxx = 1600.0f; NavigationZoneArray[0].maxy = 2000.0f; NavigationZoneArray[0].maxz = 500.0f; - NavigationZoneArray[0].level = LEVEL_NONE; + NavigationZoneArray[0].level = LEVEL_GENERIC; NavigationZoneArray[0].type = ZONE_NAVIG; - m_CurrLevel = LEVEL_NONE; + m_CurrLevel = LEVEL_GENERIC; for(i = 0; i < NUMMAPZONES; i++){ memset(&MapZoneArray[i], 0, sizeof(CZone)); @@ -120,7 +120,7 @@ CTheZones::Init(void) MapZoneArray[0].maxx = 1600.0f; MapZoneArray[0].maxy = 2000.0f; MapZoneArray[0].maxz = 500.0f; - MapZoneArray[0].level = LEVEL_NONE; + MapZoneArray[0].level = LEVEL_GENERIC; } //--MIAMI: done diff --git a/src/core/config.h b/src/core/config.h index b5a6b343..14489491 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -214,7 +214,10 @@ enum Config { #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number +//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time +//#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU //#define USE_TEXTURE_POOL +#define CUTSCENE_BORDERS_SWITCH // Water & Particle #define PC_PARTICLE @@ -244,7 +247,6 @@ enum Config { #else //# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. # define MAP_ENHANCEMENTS // Adding waypoint etc. -# define SCROLLABLE_STATS_PAGE // only draggable by mouse atm # define TRIANGLE_BACK_BUTTON //# define CIRCLE_BACK_BUTTON //#define CUSTOM_FRONTEND_OPTIONS @@ -283,7 +285,11 @@ enum Config { #define VC_PED_PORTS // various ports from VC's CPed, mostly subtle // #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward #define CANCELLABLE_CAR_ENTER +//#define PEDS_REPORT_CRIMES_ON_PHONE // Camera #define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future #define FREE_CAM // Rotating cam + +// Audio +#define AUDIO_CACHE // cache sound lengths to speed up the cold boot diff --git a/src/core/main.cpp b/src/core/main.cpp index 8b4ad471..0ea95c6e 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -250,7 +250,11 @@ DoFade(void) } // This is CCamera::GetScreenRect in VC - if(TheCamera.m_WideScreenOn){ + if(TheCamera.m_WideScreenOn +#ifdef CUTSCENE_BORDERS_SWITCH + && CMenuManager::m_PrefsCutsceneBorders +#endif + ){ float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f; rect.left = 0.0f; rect.right = SCREEN_WIDTH; @@ -300,7 +304,12 @@ PluginAttach(void) return FALSE; } - +#ifndef LIBRW + if (!RtAnimInitialize()) + { + return FALSE; + } +#endif if( !RpHAnimPluginAttach() ) { printf("Couldn't attach RpHAnim plugin\n"); @@ -465,6 +474,11 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen) { CSprite2d *splash; +#ifdef DISABLE_LOADING_SCREEN + if (str1 && str2) + return; +#endif + #ifndef RANDOMSPLASH splashscreen = "LOADSC0"; #endif @@ -886,7 +900,11 @@ Render2dStuff(void) CReplay::Display(); CPickups::RenderPickUpText(); - if(TheCamera.m_WideScreenOn) + if(TheCamera.m_WideScreenOn +#ifdef CUTSCENE_BORDERS_SWITCH + && CMenuManager::m_PrefsCutsceneBorders +#endif + ) TheCamera.DrawBordersForWideScreen(); CPed *player = FindPlayerPed(); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 7058c812..b11fb5c7 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -134,6 +134,14 @@ void ToggleFreeCam(int8 action) } #endif +#ifdef CUTSCENE_BORDERS_SWITCH +void BorderModeChange(int8 displayedValue) +{ + CMenuManager::m_PrefsCutsceneBorders = !!displayedValue; + FrontEndMenuManager.SaveSettings(); +} +#endif + // Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind void CustomFrontendOptionsPopulate(void) @@ -158,6 +166,12 @@ CustomFrontendOptionsPopulate(void) FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1); FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil); #endif + +#ifdef CUTSCENE_BORDERS_SWITCH + static const wchar *off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") }; + FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 9); + FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil); +#endif } #endif diff --git a/src/entities/Building.cpp b/src/entities/Building.cpp index 3217e684..921055ce 100644 --- a/src/entities/Building.cpp +++ b/src/entities/Building.cpp @@ -17,7 +17,7 @@ CBuilding::ReplaceWithNewModel(int32 id) m_modelIndex = id; if(bIsBIGBuilding) - if(m_level == LEVEL_NONE || m_level == CGame::currLevel) + if(m_level == LEVEL_GENERIC || m_level == CGame::currLevel) CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE); } diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index fb59f791..f85dda21 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -360,8 +360,8 @@ CEntity::SetupBigBuilding(void) if(mi->m_lodDistances[0] <= 2000.0f) bStreamBIGBuilding = true; if(mi->m_lodDistances[0] > 2500.0f || mi->m_ignoreDrawDist) - m_level = LEVEL_NONE; - else if(m_level == LEVEL_NONE) + m_level = LEVEL_GENERIC; + else if(m_level == LEVEL_GENERIC) printf("%s isn't in a level\n", mi->GetName()); } diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 12345cc9..5fe29a79 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -75,7 +75,7 @@ CPhysical::CPhysical(void) #ifdef FIX_BUGS m_nSurfaceTouched = SURFACE_DEFAULT; #endif - m_nZoneLevel = LEVEL_NONE; + m_nZoneLevel = LEVEL_GENERIC; bIsFrozen = false; bDontLoadCollision = false; diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index a9caa867..8d07737f 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -110,7 +110,7 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump) max.x = max.y = 0.5f; max.z = 1.2f; colmodel->boundingBox.Set(min, max); - colmodel->level = LEVEL_NONE; + colmodel->level = LEVEL_GENERIC; m_hitColModel = colmodel; } diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index f80e908a..d5396d12 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -1091,7 +1091,7 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data) RpGeometry *geo; geo = RpAtomicGetGeometry(atomic); - fx = 0; + fx = rpMATFXEFFECTNULL; RpGeometryForAllMaterials(geo, GetMatFXEffectMaterialCB, &fx); if(fx != rpMATFXEFFECTNULL){ RpMatFXAtomicEnableEffects(atomic); diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index f5c45e0d..86423b0a 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -82,6 +82,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP) m_bZoneDisabled = false; field_628 = -1; m_nRoadblockNode = -1; // TODO(Miami): this will be nil + m_bThrowsSpikeTrap = false; field_5FF = 0; m_fAbseilPos = 0.0f; m_bBeatingSuspect = false; diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h index 07b09ffd..50d8165f 100644 --- a/src/peds/CopPed.h +++ b/src/peds/CopPed.h @@ -25,6 +25,7 @@ public: bool m_bZoneDisabled; float m_fAbseilPos; eCopType m_nCopType; + bool m_bThrowsSpikeTrap; int32 field_624; int8 field_628; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 3c3fd46a..557aafa3 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -412,7 +412,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bIsDrowning = false; bDrownsInWater = true; bHeadStuckInCollision = false; - b156_8 = false; + bHeldHostageInCar = false; bIsPlayerFriend = true; bDeadPedInFrontOfCar = false; @@ -461,7 +461,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) weapon.m_nTimer = 0; } - m_lastFightMove = m_lastHitState = 0; + m_curFightMove = m_lastFightMove = FIGHTMOVE_IDLE; GiveWeapon(WEAPONTYPE_UNARMED, 0, true); m_wepAccuracy = 60; m_lastWepDam = -1; @@ -576,7 +576,7 @@ CheckForPedsOnGroundToAttack(CPed *attacker, CPed **pedOnGround) currentPedState = currentPed->m_nPedState; - if (currentPedState == PED_FALL || currentPedState == PED_GETUP || currentPedState == PED_DIE || currentPedState == PED_DEAD) { + if (currentPed->OnGroundOrGettingUp()) { if (distance < 2.0f && angleDiff < DEGTORAD(65.0f)) { if (currentPedState == PED_DEAD) { foundDead = 1; @@ -1094,13 +1094,13 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg) return; } - if (currentWeapon->m_bUse2nd && ped->bIsAttacking && currentWeapon->m_AnimToPlay != ASSOCGRP_THROW) { + if (GetSecondFireAnim(currentWeapon) && ped->bIsAttacking && currentWeapon->m_AnimToPlay != ASSOCGRP_THROW) { AnimationId groundAnim = GetFireAnimGround(currentWeapon); CAnimBlendAssociation *groundAnimAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), groundAnim); if (!groundAnimAssoc || groundAnimAssoc->blendAmount <= 0.95f && groundAnimAssoc->blendDelta <= 0.0f) { if (attackAssoc && attackAssoc->animId == ANIM_MELEE_ATTACK) { newAnim = CAnimManager::BlendAnimation( - ped->GetClump(), currentWeapon->m_AnimToPlay, ANIM_MELEE_ATTACK_2ND, 8.0f); + ped->GetClump(), currentWeapon->m_AnimToPlay, GetSecondFireAnim(currentWeapon), 8.0f); } else { newAnim = CAnimManager::BlendAnimation( ped->GetClump(), currentWeapon->m_AnimToPlay, ANIM_MELEE_ATTACK, 8.0f); @@ -1231,7 +1231,7 @@ CPed::Attack(void) } if (!weaponAnimAssoc) { if (!!ourWeapon->m_bUse2nd) { - weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_FIRE_2ND); + weaponAnimAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetSecondFireAnim(ourWeapon)); if (weaponAnimAssoc) { animLoopStart = ourWeapon->m_fAnim2LoopStart; animLoopEnd = ourWeapon->m_fAnim2LoopEnd; @@ -1255,8 +1255,8 @@ CPed::Attack(void) if (bCrouchWhenShooting && bIsDucking && !!ourWeapon->m_bCrouchFire) { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetCrouchFireAnim(ourWeapon), 8.0f); - } else if(!!ourWeapon->m_bUse2nd && CGeneral::GetRandomNumber() & 1){ - weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, ANIM_WEAPON_FIRE_2ND, 8.0f); + } else if(GetSecondFireAnim(ourWeapon) && CGeneral::GetRandomNumber() & 1){ + weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetSecondFireAnim(ourWeapon), 8.0f); } else if (!CGame::nastyGame || (!ourWeapon->m_bGround2nd && !ourWeapon->m_bGround3rd) || ourWeaponFire != WEAPON_FIRE_MELEE || CheckForPedsOnGroundToAttack(this, nil) < PED_ON_THE_FLOOR) { @@ -1405,7 +1405,6 @@ CPed::Attack(void) weaponAnimTime = weaponAnimAssoc->currentTime; firePos = ourWeapon->m_vecFireOffset; - //TODO(Miami): Check if (weaponAnimTime > 1.0f && weaponAnimTime - weaponAnimAssoc->timeStep <= 1.0f && weaponAnimAssoc->IsRunning()) { TransformToNode(firePos, PED_HANDR); @@ -1494,10 +1493,10 @@ CPed::Attack(void) } weaponAnimAssoc->SetFinishCallback(FinishedAttackCB, this); } else if (!!ourWeapon->m_bUse2nd) { - if (weaponAnimAssoc->animId == ANIM_WEAPON_FIRE_2ND) { + if (weaponAnimAssoc->animId == GetSecondFireAnim(ourWeapon)) { weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, ANIM_WEAPON_FIRE, 8.0f); } else { - weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, ANIM_WEAPON_FIRE_2ND, 8.0f); + weaponAnimAssoc = CAnimManager::BlendAnimation(GetClump(), ourWeapon->m_AnimToPlay, GetSecondFireAnim(ourWeapon), 8.0f); } weaponAnimAssoc->SetFinishCallback(FinishedAttackCB, this); } else { @@ -3147,7 +3146,7 @@ CPed::SetObjective(eObjective newObj, void *entity) break; } } else { - if ((newObj == OBJECTIVE_LEAVE_CAR || newObj == OBJECTIVE_LEAVE_CAR_AND_DIE || newObj == OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT) + if (newObj != OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT && (newObj == OBJECTIVE_LEAVE_CAR || newObj == OBJECTIVE_LEAVE_CAR_AND_DIE) && !bInVehicle) return; } @@ -3319,7 +3318,7 @@ CPed::SetObjective(eObjective newObj) } */ - m_objective = newObj; + m_objective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE; } else if (m_prevObjective != newObj || m_prevObjective == OBJECTIVE_NONE) { SetObjectiveTimer(0); @@ -3436,8 +3435,7 @@ CPed::InformMyGangOfAttack(CEntity *attacker) CPed *nearPed = m_nearPeds[i]; if (nearPed && nearPed != this) { CPed *leader = nearPed->m_leader; - if (leader && leader == this && nearPed->m_pedStats->m_fear < nearPed->m_pedStats->m_temper) - { + if (leader && leader == this && nearPed->m_pedStats->m_fear < nearPed->m_pedStats->m_temper) { nearPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, attackerPed); nearPed->SetObjectiveTimer(30000); } @@ -3973,11 +3971,11 @@ CPed::ClearAttackByRemovingAnim(void) } if (!weaponAssoc) { if(!!weapon->m_bFinish3rd) - weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_SPECIAL); + weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetFinishingAttackAnim(weapon)); } if (!weaponAssoc) { if(!!weapon->m_bUse2nd) - weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCHFIRE); + weaponAssoc = RpAnimBlendClumpGetAssociation(GetClump(), GetSecondFireAnim(weapon)); } if (!weaponAssoc) { if(!!weapon->m_bCop3rd) @@ -4212,7 +4210,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi if (method != WEAPONTYPE_KATANA || damagedBy != FindPlayerPed() || FindPlayerPed()->m_nPedState != PED_FIGHT - || FindPlayerPed()->m_lastFightMove != FIGHTMOVE_MELEE1 && FindPlayerPed()->m_lastFightMove != FIGHTMOVE_MELEE2 + || FindPlayerPed()->m_curFightMove != FIGHTMOVE_MELEE1 && FindPlayerPed()->m_curFightMove != FIGHTMOVE_MELEE2 || CGeneral::GetRandomNumber() & 3) { if (m_nPedState == PED_FALL) { @@ -4226,8 +4224,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi dieDelta = dieDelta * 2.0f; dieSpeed = 0.5f; } - } else if (damagedBy != FindPlayerPed() || FindPlayerPed()->m_lastFightMove != FIGHTMOVE_MELEE2) { - if (damagedBy != FindPlayerPed() || FindPlayerPed()->m_lastFightMove != FIGHTMOVE_MELEE3) { + } else if (damagedBy != FindPlayerPed() || FindPlayerPed()->m_curFightMove != FIGHTMOVE_MELEE2) { + if (damagedBy != FindPlayerPed() || FindPlayerPed()->m_curFightMove != FIGHTMOVE_MELEE3) { switch (direction) { case 0: dieAnim = ANIM_KO_SKID_FRONT; @@ -4752,8 +4750,8 @@ CPed::ClearObjective(void) m_objective = OBJECTIVE_NONE; m_pedInObjective = nil; m_carInObjective = nil; - if (m_nPedState == PED_DRIVING && m_pMyVehicle) { + if (m_nPedState == PED_DRIVING && m_pMyVehicle) { if (m_pMyVehicle->pDriver != this) { if(!IsPlayer()) bWanderPathAfterExitingCar = true; @@ -4875,7 +4873,7 @@ CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) void CPed::RestorePreviousState(void) { - if(!CanSetPedState() || m_nPedState == PED_FALL) + if (!CanSetPedState() || m_nPedState == PED_FALL) return; if (m_nPedState == PED_GETUP && !bGetUpAnimStarted) @@ -5415,6 +5413,7 @@ CPed::SetAttack(CEntity *victim) SetLookTimer(100); } +// --MIAMI: Done void CPed::StartFightAttack(uint8 buttonPressure) { @@ -5434,53 +5433,71 @@ CPed::StartFightAttack(uint8 buttonPressure) RestoreHeadingRate(); } - m_nPedState = PED_FIGHT; - m_fightButtonPressure = 0; - RpAnimBlendClumpRemoveAssociations(GetClump(), ASSOC_REPEAT); - CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WALK_START); - - if (animAssoc) { - animAssoc->flags |= ASSOC_DELETEFADEDOUT; - animAssoc->blendDelta = -1000.0f; - } - - animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_RUN_STOP); + CAnimBlendAssociation* animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_RUN_STOP); if (!animAssoc) animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_RUN_STOP_R); if (animAssoc) { - animAssoc->flags |= ASSOC_DELETEFADEDOUT; - animAssoc->blendDelta = -1000.0f; RestoreHeadingRate(); } - SetMoveState(PEDMOVE_NONE); m_nStoredMoveState = PEDMOVE_NONE; + bool fightWithWeapon = false; + CAnimBlendAssociation *fightIdleAssoc; - CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_FIGHT_IDLE)->blendAmount = 1.0f; - - CPed *pedOnGround = nil; - if (IsPlayer() && CheckForPedsOnGroundToAttack(this, &pedOnGround) > PED_IN_FRONT_OF_ATTACKER) { - m_lastFightMove = FIGHTMOVE_GROUNDKICK; - } else if (m_pedStats->m_flags & STAT_SHOPPING_BAGS) { - m_lastFightMove = FIGHTMOVE_ROUNDHOUSE; + CWeaponInfo* weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); + if (GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED) { + if (GetFightIdleWithMeleeAnim(weaponInfo)) { + fightIdleAssoc = CAnimManager::BlendAnimation(GetClump(), weaponInfo->m_AnimToPlay, GetFightIdleWithMeleeAnim(weaponInfo), 1000.0f); + fightWithWeapon = true; + } else { + fightIdleAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FIGHT_IDLE, 1000.0f); + } } else { - m_lastFightMove = FIGHTMOVE_STDPUNCH; + fightIdleAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FIGHT_IDLE, 1000.0f); } + m_lastFightMove = FIGHTMOVE_IDLE; + m_curFightMove = IsPlayer() ? ChooseAttackPlayer(buttonPressure, fightWithWeapon) : ChooseAttackAI(buttonPressure, fightWithWeapon); - if (pedOnGround && IsPlayer()) { - m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints( - pedOnGround->GetPosition().x, pedOnGround->GetPosition().y, - GetPosition().x, GetPosition().y); + SetPedState(PED_FIGHT); + m_fightButtonPressure = 0; - m_fRotationDest = CGeneral::LimitRadianAngle(m_fRotationDest); - m_fRotationCur = m_fRotationDest; - m_lookTimer = 0; - SetLookFlag(pedOnGround, true); - SetLookTimer(1500); + if (m_curFightMove > FIGHTMOVE_NULL && m_curFightMove != FIGHTMOVE_IDLE) { + animAssoc = CAnimManager::BlendAnimation(GetClump(), m_curFightMove < FIGHTMOVE_MELEE1 ? ASSOCGRP_STD : weaponInfo->m_AnimToPlay, + tFightMoves[m_curFightMove].animId, 8.0f); + + if (weaponInfo->m_AnimToPlay != ASSOCGRP_KNIFE || m_curFightMove < FIGHTMOVE_MELEE1) { + if (m_curFightMove == FIGHTMOVE_BACKKICK) + animAssoc->speed = 1.15f; + else + animAssoc->speed = 0.8f; + } else { + switch (GetWeapon()->m_eWeaponType) { + case WEAPONTYPE_SCREWDRIVER: + case WEAPONTYPE_KNIFE: + animAssoc->speed = 1.05f; + break; + case WEAPONTYPE_GOLFCLUB: + case WEAPONTYPE_NIGHTSTICK: + case WEAPONTYPE_BASEBALLBAT: + case WEAPONTYPE_HAMMER: + case WEAPONTYPE_KATANA: + animAssoc->speed = 0.8f; + break; + case WEAPONTYPE_CLEAVER: + case WEAPONTYPE_MACHETE: + animAssoc->speed = 0.9f; + break; + } + } + if (IsPlayer()) + animAssoc->SetCurrentTime(0.08f); + + animAssoc->SetFinishCallback(FinishFightMoveCB, this); + } else { + m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 2000; } - animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 4.0f); - animAssoc->SetFinishCallback(FinishFightMoveCB, this); + m_fightState = FIGHTSTATE_NO_MOVE; m_takeAStepAfterAttack = false; bIsAttacking = true; @@ -5594,7 +5611,7 @@ CPed::GetLocalDirection(const CVector2D &posOffset) // --MIAMI: Done bool -CPed::FightStrike(CVector &touchedNodePos, bool unk = false) +CPed::FightStrike(CVector &touchedNodePos, bool fightWithWeapon) { CColModel *hisCol; CVector attackDistance; @@ -5603,8 +5620,8 @@ CPed::FightStrike(CVector &touchedNodePos, bool unk = false) CVector extendedTouchPoint; CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); - float radius = tFightMoves[m_lastFightMove].strikeRadius; - if (unk) + float radius = tFightMoves[m_curFightMove].strikeRadius; + if (fightWithWeapon) radius = weaponInfo->m_fRadius; if (m_fightState == FIGHTSTATE_JUST_ATTACKED) @@ -5615,7 +5632,7 @@ CPed::FightStrike(CVector &touchedNodePos, bool unk = false) for (int i = 0; i < m_numNearPeds; i++) { int8 pedFound = 0; nearPed = m_nearPeds[i]; - if (!unk && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE) + if (!fightWithWeapon && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE) maxDistanceToBeat = nearPed->GetBoundRadius() + radius + 0.1f; else maxDistanceToBeat = nearPed->GetBoundRadius() + radius; @@ -5646,14 +5663,14 @@ CPed::FightStrike(CVector &touchedNodePos, bool unk = false) } } } - if (!pedFound && !unk) { + if (!pedFound && !fightWithWeapon) { extendedTouchPoint = touchedNodePos - GetPosition(); if (DotProduct(touchedNodePos - GetPosition(), nearPed->GetPosition() - GetPosition()) > 0.f) { - if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) { + if (m_curFightMove == FIGHTMOVE_GROUNDKICK) { extendedTouchPoint += tFightMoves[FIGHTMOVE_GROUNDKICK].extendReachMultiplier * GetForward(); } else { - extendedTouchPoint.x *= tFightMoves[m_lastFightMove].extendReachMultiplier; - extendedTouchPoint.y *= tFightMoves[m_lastFightMove].extendReachMultiplier; + extendedTouchPoint.x *= tFightMoves[m_curFightMove].extendReachMultiplier; + extendedTouchPoint.y *= tFightMoves[m_curFightMove].extendReachMultiplier; } pedFound = -1; extendedTouchPoint += GetPosition(); @@ -5667,7 +5684,7 @@ CPed::FightStrike(CVector &touchedNodePos, bool unk = false) attackDistance = hisCol->spheres[j].center; attackDistance -= extendedTouchPoint; CColSphere* hisPieces = hisCol->spheres; - float maxDistanceToBeat2 = hisPieces[j].radius + tFightMoves[m_lastFightMove].strikeRadius; + float maxDistanceToBeat2 = hisPieces[j].radius + tFightMoves[m_curFightMove].strikeRadius; // We can beat him too if (sq(maxDistanceToBeat2) > attackDistance.MagnitudeSqr()) { @@ -5688,22 +5705,22 @@ CPed::FightStrike(CVector &touchedNodePos, bool unk = false) return false; } -// TODO(Miami) +// --MIAMI: Done void -CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dist, int16 piece) +CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dir, int16 piece) { if (victim->IsPlayer() && victim->m_nPedState == PED_GETUP) return; CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); bool fightingWithWeapon = false; - int damageMult = tFightMoves[m_lastFightMove].damage * ((CGeneral::GetRandomNumber() & 1) + 2) + 1; + int damageMult = tFightMoves[m_curFightMove].damage * ((CGeneral::GetRandomNumber() & 1) + 2) + 1; if (weaponInfo->m_bFightMode) { fightingWithWeapon = true; - if (m_lastFightMove >= FIGHTMOVE_MELEE1) { + if (m_curFightMove >= FIGHTMOVE_MELEE1) { damageMult = weaponInfo->m_nDamage; - if (m_lastFightMove == FIGHTMOVE_MELEE3 && GetWeapon()->m_eWeaponType != WEAPONTYPE_SCREWDRIVER) + if (m_curFightMove == FIGHTMOVE_MELEE3 && GetWeapon()->m_eWeaponType != WEAPONTYPE_SCREWDRIVER) damageMult *= 5; } } @@ -5716,56 +5733,83 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dist, int16 piece) } float oldVictimHealth = victim->m_fHealth; - CVector bloodPos = 0.5f * dist + touchPoint; + CVector bloodPos = 0.5f * dir + touchPoint; CVector2D diff(GetPosition() - victim->GetPosition()); int direction = victim->GetLocalDirection(diff); - /* - // Change direction if we used kick. - if (m_lastFightMove == FIGHTMOVE_KICK) { - if (CGeneral::GetRandomNumber() & 1) { - direction++; - if (direction > 3) - direction -= 4; - } - } */ + bool brassKnucklePunch = false; + if (GetWeapon()->m_eWeaponType == WEAPONTYPE_BRASSKNUCKLE) { + if (m_curFightMove == FIGHTMOVE_PUNCHHOOK || m_curFightMove == FIGHTMOVE_PUNCHJAB || m_curFightMove == FIGHTMOVE_BACKLEFT || + m_curFightMove == FIGHTMOVE_STDPUNCH || m_curFightMove == FIGHTMOVE_PUNCH) { + brassKnucklePunch = true; + damageMult *= 1.5f; + } + } victim->ReactToAttack(this); - // Mostly unused. if > 5, ANIM_HIT_WALK will be run, that's it. + // Mostly unused. if > 5, ANIM_HIT_BIGSTEP will be run, that's it. int unk2; - if (GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && !victim->IsPlayer()) + if (GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && + !victim->IsPlayer() && !fightingWithWeapon) unk2 = 101; else unk2 = damageMult; - victim->StartFightDefend(direction, tFightMoves[m_lastFightMove].hitLevel, unk2); + victim->StartFightDefend(direction, tFightMoves[m_curFightMove].hitLevel, unk2); PlayHitSound(victim); m_fightState = FIGHTSTATE_JUST_ATTACKED; - RpAnimBlendClumpGetAssociation(GetClump(), tFightMoves[m_lastFightMove].animId)->speed = 0.6f; + RpAnimBlendClumpGetAssociation(GetClump(), tFightMoves[m_curFightMove].animId)->speed = 0.6f; + if (!victim->DyingOrDead()) { - victim->InflictDamage(this, WEAPONTYPE_UNARMED, damageMult * 3.0f, (ePedPieceTypes)piece, direction); + if(fightingWithWeapon) + victim->InflictDamage(this, GetWeapon()->m_eWeaponType, damageMult, (ePedPieceTypes)piece, direction); + else + victim->InflictDamage(this, WEAPONTYPE_UNARMED, damageMult * 3.0f, (ePedPieceTypes)piece, direction); } - if (CGame::nastyGame - && tFightMoves[m_lastFightMove].hitLevel > HITLEVEL_MEDIUM - && victim->m_nPedState == PED_DIE + if (CGame::nastyGame && weaponInfo->m_AnimToPlay == ASSOCGRP_KNIFE && m_curFightMove >= FIGHTMOVE_MELEE1 && victim->GetIsOnScreen()) { - // Just for blood particle. We will restore it below. - dist /= (10.0f * dist.Magnitude()); - for(int i=0; i<4; i++) { - CParticle::AddParticle(PARTICLE_BLOOD, bloodPos, dist, nil, 0.0f, 0, 0, 0, 0); + static float particleRightLen = 0.05f; + static float particleUpLen = 0.05f; + + // Just for particles. We will restore it below. + dir /= (20.0f * dir.Magnitude()); + if (m_curFightMove == FIGHTMOVE_MELEE1) { + float rightMult = -particleRightLen; + dir += particleUpLen * GetUp() + rightMult * GetRight(); + + } else if (m_curFightMove == FIGHTMOVE_MELEE2) { + float upMult = 2.0f * particleUpLen; + dir += particleRightLen * GetRight() + upMult * GetUp(); + } + CParticle::AddParticle(PARTICLE_BLOOD_SPURT, bloodPos, dir, nil, 0.0f, 0, 0, 0, 0); + CParticle::AddParticle(PARTICLE_BLOOD_SPURT, bloodPos, dir, nil, 0.0f, 0, 0, 0, 0); + if (IsPlayer()) { + CParticle::AddParticle(PARTICLE_BLOOD_SPURT, bloodPos, dir, nil, 0.0f, 0, 0, 0, 0); + CParticle::AddParticle(PARTICLE_BLOOD_SPURT, bloodPos, dir, nil, 0.0f, 0, 0, 0, 0); + } + if (!(CGeneral::GetRandomNumber() & 3)) { + CParticle::AddParticle(PARTICLE_TEST, bloodPos, dir, nil, 0.0f, 0, 0, 0, 0); + } + } else if (CGame::nastyGame && (tFightMoves[m_curFightMove].hitLevel > HITLEVEL_MEDIUM || fightingWithWeapon) + && victim->GetIsOnScreen()) { + + // Just for particles. We will restore it below. + dir /= (10.0f * dir.Magnitude()); + for (int i = 0; i < 4; i++) { + CParticle::AddParticle(PARTICLE_BLOOD, bloodPos, dir, nil, 0.0f, 0, 0, 0, 0); } } eWeaponType weaponType = GetWeapon()->m_eWeaponType; if (!fightingWithWeapon) { - if (victim->m_nPedState != PED_FALL && victim->m_nPedState != PED_DIE && victim->m_nPedState != PED_DEAD) { + if (!victim->OnGround()) { float curVictimHealth = victim->m_fHealth; if (curVictimHealth > 0.0f && (curVictimHealth < 30.0f && oldVictimHealth > 30.0f || weaponType != WEAPONTYPE_UNARMED && weaponType != WEAPONTYPE_BRASSKNUCKLE && IsPlayer() - || victim->m_pedStats->m_flags & STAT_ONE_HIT_KNOCKDOWN)) { + || victim->m_pedStats->m_flags & STAT_ONE_HIT_KNOCKDOWN || brassKnucklePunch)) { victim->SetFall(0, (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0); if (victim->m_nPedState == PED_FALL) @@ -5775,15 +5819,15 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dist, int16 piece) } if (victim->m_nPedState == PED_DIE || !victim->bIsStanding) { - dist = victim->GetPosition() - GetPosition(); - dist.Normalise(); - dist.z = 1.0f; + dir = victim->GetPosition() - GetPosition(); + dir.Normalise(); + dir.z = 1.0f; victim->bIsStanding = false; float moveMult; if (fightingWithWeapon) { moveMult = Min(damageMult * 0.02f, 1.0f); - } else if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) { + } else if (m_curFightMove == FIGHTMOVE_GROUNDKICK) { moveMult = Min(damageMult * 0.6f, 4.0f); } else { if (victim->m_nPedState != PED_DIE || damageMult >= 20) { @@ -5793,7 +5837,7 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dist, int16 piece) } } - victim->ApplyMoveForce(moveMult * 0.6f * dist); + victim->ApplyMoveForce(moveMult * 0.6 * dir); } if (weaponType != WEAPONTYPE_KNIFE && weaponType != WEAPONTYPE_MACHETE @@ -5812,6 +5856,334 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dist, int16 piece) } // --MIAMI: Done +int32 +CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) +{ + CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); + const float maxAttackDist = 2.7f; + float weaponAttackDist = 2.0f; + CPed *victimPed = nil; + CPed *walkUpTo = nil; + CPed *groundAttackDeadPed = nil; + CPed *groundAttackAlivePed = nil; + if (fightWithWeapon) + weaponAttackDist = weaponInfo->m_fRange; + + bool willWalkUp = false; + PedFightMoves choosenMove = FIGHTMOVE_IDLE; + int numPedsWeCanReach = 0; + if (m_takeAStepAfterAttack) + willWalkUp = true; + + float groundAttackDeadAngle, groundAttackAliveAngle, walkAngle, victimAngle, distToVictim; + + for (int i = 0; i < m_numNearPeds; ++i) { + CPed *nearPed = m_nearPeds[i]; + CVector distVec(nearPed->GetPosition() - GetPosition()); + float dist = distVec.Magnitude(); + if (dist < maxAttackDist) { + float nearPedAngle = CGeneral::LimitRadianAngle(distVec.Heading()); + m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur); + float neededTurn = Abs(nearPedAngle - m_fRotationCur); + if (neededTurn > PI) + neededTurn = TWOPI - neededTurn; + + if (!nearPed->OnGroundOrGettingUp() && nearPed->m_nWaitState != WAITSTATE_SUN_BATHE_IDLE) { + if (!willWalkUp || neededTurn <= DEGTORAD(45.0f)) { + + if (neededTurn <= DEGTORAD(30.0f) || nearPed->m_pedInObjective == this + && (nearPed->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || nearPed->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS)) { + + if (dist < weaponAttackDist) { + if (!victimPed + || nearPed->m_attackTimer < victimPed->m_attackTimer && nearPed->m_attackTimer > CTimer::GetTimeInMilliseconds() - 100) { + victimPed = nearPed; + victimAngle = nearPedAngle; + distToVictim = dist; + } + ++numPedsWeCanReach; + + } else { + if (neededTurn < DEGTORAD(30.0f)) { + walkUpTo = nearPed; + walkAngle = nearPedAngle; + } + } + } + } + } else if (CGame::nastyGame && dist < 1.2f && neededTurn < DEGTORAD(55.0f)) { + if (!nearPed->DyingOrDead() || groundAttackDeadPed) { + if (!nearPed->IsPedHeadAbovePos(-0.3f)) { + groundAttackAlivePed = nearPed; + groundAttackAliveAngle = nearPedAngle; + } + } else { + groundAttackDeadPed = nearPed; + groundAttackDeadAngle = nearPedAngle; + } + ++numPedsWeCanReach; + + } else if (dist > 1.4f && dist < maxAttackDist && neededTurn < DEGTORAD(30.0f)) { + if (!walkUpTo) { + walkUpTo = nearPed; + walkAngle = nearPedAngle; + } +#ifdef FIX_BUGS + if(dist < 2.1f) +#endif + ++numPedsWeCanReach; + } + } + } + + if (victimPed) { + float adjustedAngleDiff = victimAngle - m_fRotationCur + DEGTORAD(30.0f); + if (adjustedAngleDiff < 0.0f) + adjustedAngleDiff = adjustedAngleDiff + TWOPI; + + int16 dir = floorf(adjustedAngleDiff / DEGTORAD(60.0f)); + + // Just focus on who we're fighting with, don't care peds on ground + if (numPedsWeCanReach < 2 || fightWithWeapon) { + float angleDiff = Abs(victimAngle - m_fRotationCur); + if (angleDiff > PI) + angleDiff = TWOPI - angleDiff; + + if (angleDiff < DEGTORAD(60.0f)) + dir = 0; // forward + } + int16 randVal = CGeneral::GetRandomNumber() & 3; + switch (dir) { + case 0: // forward + if (fightWithWeapon) { + if (distToVictim < 0.95f - 0.2f && m_nPedState == PED_FIGHT) { + choosenMove = FIGHTMOVE_KNEE; + } else { + if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CLEAVER) { + if (distToVictim < 0.85f * weaponInfo->m_fRange) + choosenMove = FIGHTMOVE_MELEE1; + else + choosenMove = FIGHTMOVE_SHUFFLE_F; + } else { + float weaponRange = weaponInfo->m_fRange; + if (distToVictim < 0.75f * weaponRange && GetWeapon()->m_eWeaponType != WEAPONTYPE_SCREWDRIVER) { + if (m_lastFightMove == FIGHTMOVE_MELEE1 && GetFinishingAttackAnim(weaponInfo)) { + choosenMove = FIGHTMOVE_MELEE2; + } else if (m_lastFightMove == FIGHTMOVE_MELEE2 && GetFinishingAttackAnim(weaponInfo)) { + choosenMove = FIGHTMOVE_MELEE3; + } else { + choosenMove = FIGHTMOVE_MELEE1; + } + } else if (distToVictim < weaponRange && GetFinishingAttackAnim(weaponInfo)) { + choosenMove = FIGHTMOVE_MELEE3; + } else { + choosenMove = FIGHTMOVE_SHUFFLE_F; + } + } + } + } else if (distToVictim < 0.95f && m_nPedState == PED_FIGHT) { + choosenMove = FIGHTMOVE_KNEE; + + } else if (distToVictim < 1.4f) { + if (m_curFightMove == FIGHTMOVE_PUNCHJAB) { + choosenMove = FIGHTMOVE_PUNCH; + + } else if (m_curFightMove != FIGHTMOVE_PUNCH || randVal != 1) { + if (randVal == 2) + choosenMove = FIGHTMOVE_PUNCH; + else + choosenMove = FIGHTMOVE_PUNCHJAB; + } else { + choosenMove = FIGHTMOVE_LONGKICK; + } + } else { + choosenMove = FIGHTMOVE_LONGKICK; + } + break; + case 1: + choosenMove = FIGHTMOVE_FWDLEFT; + break; + case 2: + choosenMove = FIGHTMOVE_BACKLEFT; + break; + case 3: + choosenMove = FIGHTMOVE_BACKKICK; + break; + case 4: + choosenMove = FIGHTMOVE_BACKRIGHT; + break; + default: + choosenMove = FIGHTMOVE_FWDRIGHT; + break; + } + + // forward + if (dir == 0) { + m_fRotationDest = CGeneral::LimitRadianAngle(victimAngle); + } else { + m_fRotationDest = victimAngle - dir * DEGTORAD(60.0f); + m_fRotationDest = CGeneral::LimitRadianAngle(m_fRotationDest); + } + + m_fRotationCur = m_fRotationDest; + Say(SOUND_PED_ATTACK); + + } else if (groundAttackAlivePed || groundAttackDeadPed) { + if (fightWithWeapon && weaponInfo->m_bGround2nd) { + choosenMove = FIGHTMOVE_MELEE2; + } else if (fightWithWeapon && weaponInfo->m_bGround3rd) { + choosenMove = FIGHTMOVE_MELEE3; + } else { + choosenMove = FIGHTMOVE_GROUNDKICK; + } + if (groundAttackAlivePed) + m_fRotationDest = groundAttackAliveAngle; + else + m_fRotationDest = groundAttackDeadAngle; + + m_fRotationCur = m_fRotationDest; + m_lookTimer = 0; + if (groundAttackAlivePed) + SetLookFlag(groundAttackAlivePed, 1, 0); + else + SetLookFlag(groundAttackDeadPed, 1, 0); + + SetLookTimer(1500u); + + } else if (walkUpTo) { + choosenMove = FIGHTMOVE_SHUFFLE_F; + m_fRotationCur = m_fRotationDest = walkAngle; + m_lookTimer = 0; + SetLookFlag(walkUpTo, true); + SetLookTimer(1500); + + } else if (fightWithWeapon) { + // No enemy, fight with space + if (GetWeapon()->m_eWeaponType == WEAPONTYPE_SCREWDRIVER) { + choosenMove = FIGHTMOVE_MELEE3; + } else { + if (m_lastFightMove == FIGHTMOVE_MELEE1 && GetFinishingAttackAnim(weaponInfo)) { + choosenMove = FIGHTMOVE_MELEE2; + } else if (m_lastFightMove == FIGHTMOVE_MELEE2 && GetFinishingAttackAnim(weaponInfo)) { + choosenMove = FIGHTMOVE_MELEE3; + } else { + choosenMove = FIGHTMOVE_MELEE1; + } + } + } else { + // Max number GetRandomNumberInRange returns is max-1 +#ifdef FIX_BUGS + switch (CGeneral::GetRandomNumberInRange(0,4)) { +#else + switch (CGeneral::GetRandomNumberInRange(0,3)) { +#endif + case 0: + choosenMove = FIGHTMOVE_PUNCHJAB; + break; + case 1: + choosenMove = FIGHTMOVE_PUNCH; + break; + case 2: + choosenMove = FIGHTMOVE_LONGKICK; + break; + case 3: + choosenMove = FIGHTMOVE_KNEE; + break; + default: + break; + } + } + return choosenMove; +} + +// --MIAMI: Done +int32 +CPed::ChooseAttackAI(uint8 buttonPressure, bool fightWithWeapon) +{ + eWeaponType weapon = GetWeapon()->m_eWeaponType; + CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(weapon); + if (!fightWithWeapon && weapon != WEAPONTYPE_UNARMED && weapon != WEAPONTYPE_BRASSKNUCKLE) { + return FIGHTMOVE_PUNCH; + } + + if (!m_pedInObjective) + return FIGHTMOVE_IDLE; + if (buttonPressure == 0) + return FIGHTMOVE_IDLE; + + uint16 pedFeatures = m_pedStats->m_flags; + bool punchOnly = !!(pedFeatures & STAT_PUNCH_ONLY); + bool canRoundhouse = !!(pedFeatures & STAT_CAN_ROUNDHOUSE); + bool canKneeHead = !!(pedFeatures & STAT_CAN_KNEE_HEAD); + bool canKick = !!(pedFeatures & STAT_CAN_KICK); + bool hasShoppingBags = !!(pedFeatures & STAT_SHOPPING_BAGS); + + CVector distVec(m_pedInObjective->GetPosition() - GetPosition()); + float dist = distVec.Magnitude(); + m_fRotationDest = CGeneral::LimitRadianAngle(distVec.Heading()); + m_fRotationCur = m_fRotationDest; + + if (fightWithWeapon) { + if (m_pedInObjective->OnGroundOrGettingUp()) { + if (!CGame::nastyGame || dist >= 1.2f || m_pedInObjective->IsPlayer() + || m_pedInObjective->m_nPedState != PED_DEAD && m_pedInObjective->IsPedHeadAbovePos(-0.3f)) { + return FIGHTMOVE_IDLE; + } + + if (weaponInfo->m_bGround2nd) + return FIGHTMOVE_MELEE2; + if (weaponInfo->m_bGround3rd) + return FIGHTMOVE_MELEE3; + + return FIGHTMOVE_GROUNDKICK; + } + if (dist < 2.f) { + if (m_curFightMove == FIGHTMOVE_MELEE1) { + if (GetSecondFireAnim(weaponInfo)) + return FIGHTMOVE_MELEE2; + } + if (m_curFightMove == FIGHTMOVE_MELEE2) { + if (GetFinishingAttackAnim(weaponInfo)) + return FIGHTMOVE_MELEE3; + } + return FIGHTMOVE_MELEE1; + } + return FIGHTMOVE_SHUFFLE_F; + } + if (!hasShoppingBags) { + if (punchOnly) { + if (dist < 1.4f) + return FIGHTMOVE_PUNCH; + } else { + if (m_pedInObjective->OnGroundOrGettingUp()) { + if (!CGame::nastyGame || dist >= 1.2f || m_pedInObjective->IsPlayer() + || m_pedInObjective->m_nPedState != PED_DEAD && m_pedInObjective->IsPedHeadAbovePos(-0.3f)) { + + return FIGHTMOVE_IDLE; + } else { + return FIGHTMOVE_GROUNDKICK; + } + } + if (dist < 0.95f && canKneeHead) + return FIGHTMOVE_KNEE; + if (dist < 1.4f) + return FIGHTMOVE_PUNCH; + if (dist < 2.f && canKick) { + int nextMove = FIGHTMOVE_LONGKICK; + if (canRoundhouse && CGeneral::GetRandomNumber() & 1) + nextMove = FIGHTMOVE_ROUNDHOUSE; + return nextMove; + } + } + return FIGHTMOVE_SHUFFLE_F; + } + if (dist < 2.f) + return FIGHTMOVE_ROUNDHOUSE; + else + return FIGHTMOVE_SHUFFLE_F; +} + +// --MIAMI: Done void CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl) { @@ -5877,6 +6249,7 @@ CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl) bFallenDown = true; } +// --MIAMI: Done void CPed::SetFlee(CEntity *fleeFrom, int time) { @@ -5884,7 +6257,7 @@ CPed::SetFlee(CEntity *fleeFrom, int time) return; SetStoredState(); - m_nPedState = PED_FLEE_ENTITY; + SetPedState(PED_FLEE_ENTITY); bUsePedNodeSeek = true; SetMoveState(PEDMOVE_RUN); m_fleeFrom = fleeFrom; @@ -5907,6 +6280,7 @@ CPed::SetFlee(CEntity *fleeFrom, int time) } } +// --MIAMI: Done void CPed::SetFlee(CVector2D const &from, int time) { @@ -5915,7 +6289,7 @@ CPed::SetFlee(CVector2D const &from, int time) if (m_nPedState != PED_FLEE_ENTITY) { SetStoredState(); - m_nPedState = PED_FLEE_POS; + SetPedState(PED_FLEE_POS); SetMoveState(PEDMOVE_RUN); m_fleeFromPosX = from.x; m_fleeFromPosY = from.y; @@ -6179,8 +6553,8 @@ CPed::PlayHitSound(CPed *hitTo) eWeaponType weapon = GetWeapon()->m_eWeaponType; CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(weapon); if (weaponInfo->m_AnimToPlay == ASSOCGRP_KNIFE) { - if (m_lastFightMove >= FIGHTMOVE_MELEE1) { - if (m_lastFightMove == FIGHTMOVE_MELEE3) { + if (m_curFightMove >= FIGHTMOVE_MELEE1) { + if (m_curFightMove == FIGHTMOVE_MELEE3) { DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_BAT_ATTACK, (weapon << 8) | 3); } else { DMAudio.PlayOneShot(m_audioEntityId, SOUND_WEAPON_KNIFE_ATTACK, (weapon << 8) | 3); @@ -6190,21 +6564,21 @@ CPed::PlayHitSound(CPed *hitTo) } // This is why first dimension is between FightMove 1 and 17. - if (m_lastFightMove <= FIGHTMOVE_NULL || m_lastFightMove >= FIGHTMOVE_HITFRONT) + if (m_curFightMove <= FIGHTMOVE_NULL || m_curFightMove >= FIGHTMOVE_HITFRONT) return; uint16 soundId; // And this is why second dimension is between 18 and 27. - if (hitTo->m_lastFightMove <= FIGHTMOVE_GROUNDKICK || hitTo->m_lastFightMove >= FIGHTMOVE_IDLE2NORM) { + if (hitTo->m_curFightMove <= FIGHTMOVE_GROUNDKICK || hitTo->m_curFightMove >= FIGHTMOVE_IDLE2NORM) { if (hitTo->m_nPedState == PED_DEAD || hitTo->UseGroundColModel()) { - soundId = hitSoundsByFightMoves[m_lastFightMove - FIGHTMOVE_STDPUNCH][FIGHTMOVE_HITONFLOOR - FIGHTMOVE_HITFRONT]; + soundId = hitSoundsByFightMoves[m_curFightMove - FIGHTMOVE_STDPUNCH][FIGHTMOVE_HITONFLOOR - FIGHTMOVE_HITFRONT]; } else { - soundId = hitSoundsByFightMoves[m_lastFightMove - FIGHTMOVE_STDPUNCH][FIGHTMOVE_HITFRONT - FIGHTMOVE_HITFRONT]; + soundId = hitSoundsByFightMoves[m_curFightMove - FIGHTMOVE_STDPUNCH][FIGHTMOVE_HITFRONT - FIGHTMOVE_HITFRONT]; } } else { - soundId = hitSoundsByFightMoves[m_lastFightMove - FIGHTMOVE_STDPUNCH][hitTo->m_lastFightMove - FIGHTMOVE_HITFRONT]; + soundId = hitSoundsByFightMoves[m_curFightMove - FIGHTMOVE_STDPUNCH][hitTo->m_curFightMove - FIGHTMOVE_HITFRONT]; } if (soundId != NO_SND) @@ -7020,7 +7394,7 @@ CPed::EndFight(uint8 endType) if (m_nPedState != PED_FIGHT) return; - m_lastFightMove = FIGHTMOVE_NULL; + m_curFightMove = FIGHTMOVE_NULL; RestorePreviousState(); CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE); if (!animAssoc) @@ -7354,30 +7728,57 @@ CPed::Fall(void) } } +// --MIAMI: Done void CPed::Fight(void) { - CAnimBlendAssociation *currentAssoc = nil, *animAssoc; - bool hasShoppingBags, punchOnly, canKick, canKneeHead, canRoundhouse; - float angleToFace, nextAngle; - bool goForward = false; - int nextFightMove; + CAnimBlendAssociation *currentAssoc, *animAssoc; + bool fightWithWeapon = false; - switch (m_lastFightMove) { + eWeaponType weapon = GetWeapon()->m_eWeaponType; + CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(weapon); + + if (weaponInfo->m_bFightMode && weapon != WEAPONTYPE_UNARMED) { + fightWithWeapon = true; + tFightMoves[FIGHTMOVE_MELEE1].startFireTime = weaponInfo->m_fAnimFrameFire; + tFightMoves[FIGHTMOVE_MELEE1].endFireTime = weaponInfo->m_fAnimLoopEnd; + tFightMoves[FIGHTMOVE_MELEE2].startFireTime = weaponInfo->m_fAnim2FrameFire; + tFightMoves[FIGHTMOVE_MELEE2].endFireTime = weaponInfo->m_fAnim2LoopEnd; + tFightMoves[FIGHTMOVE_MELEE3].startFireTime = weaponInfo->m_fAnim2FrameFire; + tFightMoves[FIGHTMOVE_MELEE3].endFireTime = weaponInfo->m_fAnim2LoopEnd; + } + + switch (m_curFightMove) { case FIGHTMOVE_NULL: return; case FIGHTMOVE_IDLE2NORM: - m_lastFightMove = FIGHTMOVE_NULL; + m_curFightMove = FIGHTMOVE_NULL; RestorePreviousState(); break; case FIGHTMOVE_IDLE: - // currentAssoc = nil; + currentAssoc = nil; break; default: - currentAssoc = RpAnimBlendClumpGetAssociation(GetClump(), tFightMoves[m_lastFightMove].animId); + currentAssoc = RpAnimBlendClumpGetAssociation(GetClump(), tFightMoves[m_curFightMove].animId); break; } + if (m_curFightMove == FIGHTMOVE_SHUFFLE_F && !currentAssoc) + currentAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_SH_BACK); + + if (IsPlayer() && currentAssoc && weapon == WEAPONTYPE_KATANA) { + if (m_curFightMove == FIGHTMOVE_MELEE1 || m_curFightMove == FIGHTMOVE_MELEE2) { + static float streakDelay = 0.2f; + + if (tFightMoves[m_curFightMove].startFireTime - streakDelay < currentAssoc->currentTime && + streakDelay + tFightMoves[m_curFightMove].endFireTime > currentAssoc->currentTime) { + + // TODO(Miami): AddWeaponStreak + // CSpecialFX::AddWeaponStreak(v2->m_weapons[(char)v2->m_currentWeapon].nWeaponId); + } + } + } + if (!bIsAttacking && IsPlayer()) { if (currentAssoc) { currentAssoc->blendDelta = -1000.0f; @@ -7391,291 +7792,145 @@ CPed::Fight(void) } else if (currentAssoc && m_fightState > FIGHTSTATE_MOVE_FINISHED) { float animTime = currentAssoc->currentTime; - FightMove &curMove = tFightMoves[m_lastFightMove]; + FightMove &curMove = tFightMoves[m_curFightMove]; if (curMove.hitLevel != HITLEVEL_NULL && animTime > curMove.startFireTime && animTime <= curMove.endFireTime && m_fightState >= FIGHTSTATE_NO_MOVE) { + if (animTime > curMove.startFireTime && animTime - currentAssoc->timeStep < curMove.startFireTime && + (IsPlayer() || weapon != WEAPONTYPE_UNARMED)) { + + DMAudio.PlayOneShot(m_audioEntityId, SOUND_MELEE_ATTACK_START, weapon << 8); + } + CVector touchingNodePos(0.0f, 0.0f, 0.0f); - switch (m_lastFightMove) { - case FIGHTMOVE_STDPUNCH: - case FIGHTMOVE_PUNCHHOOK: - case FIGHTMOVE_BODYBLOW: - TransformToNode(touchingNodePos, PED_HANDR); - break; - case FIGHTMOVE_IDLE: - case FIGHTMOVE_SHUFFLE_F: - break; + switch (m_curFightMove) { case FIGHTMOVE_KNEE: TransformToNode(touchingNodePos, PED_LOWERLEGR); break; + case FIGHTMOVE_PUNCHHOOK: case FIGHTMOVE_PUNCHJAB: TransformToNode(touchingNodePos, PED_HANDL); break; case FIGHTMOVE_LONGKICK: case FIGHTMOVE_ROUNDHOUSE: + case FIGHTMOVE_FWDLEFT: + case FIGHTMOVE_BACKRIGHT: case FIGHTMOVE_GROUNDKICK: TransformToNode(touchingNodePos, PED_FOOTR); break; + case FIGHTMOVE_FWDRIGHT: + TransformToNode(touchingNodePos, PED_HEAD); + break; + case FIGHTMOVE_BACKKICK: + case FIGHTMOVE_BACKFLIP: + TransformToNode(touchingNodePos, PED_FOOTL); + break; + case FIGHTMOVE_BACKLEFT: + TransformToNode(touchingNodePos, PED_UPPERARML); + break; + default: + TransformToNode(touchingNodePos, PED_HANDR); + break; } - if (m_lastFightMove == FIGHTMOVE_PUNCHJAB) { - touchingNodePos += 0.1f * GetForward(); - } else if (m_lastFightMove == FIGHTMOVE_PUNCHHOOK) { - touchingNodePos += 0.22f * GetForward(); - } - FightStrike(touchingNodePos); + FightStrike(touchingNodePos, fightWithWeapon); m_fightButtonPressure = 0; return; } if (curMove.hitLevel != HITLEVEL_NULL) { - if (animTime > curMove.endFireTime) { + if (animTime > curMove.endFireTime && weaponInfo->m_AnimToPlay != ASSOCGRP_KNIFE) { if (IsPlayer()) currentAssoc->speed = 1.0f; else currentAssoc->speed = 0.8f; } - if (IsPlayer() && !nPlayerInComboMove) { + if (IsPlayer() && !nPlayerInComboMove && !fightWithWeapon) { if (curMove.comboFollowOnTime > 0.0f && m_fightButtonPressure != 0 && animTime > curMove.comboFollowOnTime) { + m_lastFightMove = m_curFightMove; // Notice that it increases fight move index, because we're in combo! - animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[++m_lastFightMove].animId, 8.0f); + animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[++m_curFightMove].animId, 8.0f); animAssoc->SetFinishCallback(FinishFightMoveCB, this); animAssoc->SetCurrentTime(0.1f * animAssoc->hierarchy->totalLength); + animAssoc->speed = 0.8f; m_fightButtonPressure = 0; nPlayerInComboMove = 1; } } - } else { - if (curMove.startFireTime > 0.0f && m_lastFightMove != FIGHTMOVE_SHUFFLE_F && animTime > curMove.startFireTime) { - if (IsPlayer()) - currentAssoc->speed = 1.3f; - else - currentAssoc->speed = 0.8f; - } } - } else if (GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED) { + + } else if (GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && !fightWithWeapon) { EndFight(ENDFIGHT_FAST); } else if (m_fightButtonPressure != 0) { - bool canAffectMultiplePeople = true; - nextAngle = m_fRotationCur; - bool kickGround = false; - float angleForGroundKick = 0.0f; - CPed *pedOnGround = nil; - - Say(SOUND_PED_ATTACK); - - if (IsPlayer()) { - canRoundhouse = false; - punchOnly = false; - canKick = true; - nextFightMove = (m_fightButtonPressure > 190 ? FIGHTMOVE_BODYBLOW : FIGHTMOVE_KNEE); - hasShoppingBags = false; - canKneeHead = true; - nPlayerInComboMove = 0; - } else { - nextFightMove = (m_fightButtonPressure > 120 ? FIGHTMOVE_BODYBLOW : FIGHTMOVE_KNEE); - uint16 pedFeatures = m_pedStats->m_flags; - punchOnly = pedFeatures & STAT_PUNCH_ONLY; - canRoundhouse = pedFeatures & STAT_CAN_ROUNDHOUSE; - canKneeHead = pedFeatures & STAT_CAN_KNEE_HEAD; - canKick = pedFeatures & STAT_CAN_KICK; - hasShoppingBags = pedFeatures & STAT_SHOPPING_BAGS; - } - - // Attack isn't scripted, find the victim - if (IsPlayer() || !m_pedInObjective) { - - for (int i = 0; i < m_numNearPeds; i++) { - - CPed *nearPed = m_nearPeds[i]; - float nearPedDist = (nearPed->GetPosition() - GetPosition()).Magnitude(); - if (nearPedDist < 3.0f) { - float angleToFace = CGeneral::GetRadianAngleBetweenPoints( - nearPed->GetPosition().x, nearPed->GetPosition().y, - GetPosition().x, GetPosition().y); - - nextAngle = CGeneral::LimitRadianAngle(angleToFace); - m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur); - - float neededTurn = Abs(nextAngle - m_fRotationCur); - if (neededTurn > PI) - neededTurn = TWOPI - neededTurn; - - PedState nearPedState = nearPed->m_nPedState; - if (nearPedState != PED_FALL && nearPedState != PED_GETUP && nearPedState != PED_DIE && nearPedState != PED_DEAD) { - - if (nearPedDist < 0.8f && neededTurn < DEGTORAD(75.0f) && canKneeHead) { - canAffectMultiplePeople = false; - } else if (nearPedDist >= 1.3f || neededTurn >= DEGTORAD(55.0f) || hasShoppingBags) { - - if (nearPedDist < 1.7f - && neededTurn < DEGTORAD(35.0f) - && (canKick || hasShoppingBags)) { - - nextFightMove = FIGHTMOVE_LONGKICK; - if (hasShoppingBags) { - nextFightMove = FIGHTMOVE_ROUNDHOUSE; - } else if (canRoundhouse && CGeneral::GetRandomNumber() & 1) { - nextFightMove = FIGHTMOVE_ROUNDHOUSE; - } - canAffectMultiplePeople = false; - } else if (nearPedDist < 2.0f && neededTurn < DEGTORAD(30.0f) && canKick) { - canAffectMultiplePeople = false; - nextFightMove = FIGHTMOVE_LONGKICK; - } else if (neededTurn < DEGTORAD(30.0f)) { - goForward = true; - } - } else { - nextFightMove += 2; // Makes it 6 or 7 - if (punchOnly) - nextFightMove = FIGHTMOVE_PUNCHJAB; - - canAffectMultiplePeople = false; - } - } else if (!CGame::nastyGame - || nearPedDist >= 1.3f - || neededTurn >= DEGTORAD(55.0f) - || punchOnly) { - - if (nearPedDist > 0.8f - && nearPedDist < 3.0f - && neededTurn < DEGTORAD(30.0f)) { - goForward = true; - } + if (!IsPlayer()) + Say(SOUND_PED_ATTACK); - } else if (nearPedState != PED_DEAD || pedOnGround) { - if (!nearPed->IsPedHeadAbovePos(-0.3f)) { - canAffectMultiplePeople = false; - nextFightMove = FIGHTMOVE_GROUNDKICK; - } + if (m_curFightMove != FIGHTMOVE_IDLE) + m_lastFightMove = m_curFightMove; - } else { - pedOnGround = nearPed; - kickGround = true; - angleForGroundKick = nextAngle; - } - } + m_curFightMove = IsPlayer() ? ChooseAttackPlayer(m_fightButtonPressure, fightWithWeapon) : ChooseAttackAI(m_fightButtonPressure, fightWithWeapon); - if (!canAffectMultiplePeople) { - m_fRotationDest = nextAngle; - if (IsPlayer()) { - m_fRotationCur = m_fRotationDest; - m_lookTimer = 0; - SetLookFlag(nearPed, true); - SetLookTimer(1500); - } - break; - } - } - } else { - // Because we're in a scripted fight with some particular ped. - canAffectMultiplePeople = false; + if (m_curFightMove != FIGHTMOVE_IDLE) { - float fightingPedDist = (m_pedInObjective->GetPosition() - GetPosition()).Magnitude(); - if (hasShoppingBags) { - if (fightingPedDist >= 1.7f) - nextFightMove = FIGHTMOVE_SHUFFLE_F; - else - nextFightMove = FIGHTMOVE_ROUNDHOUSE; + animAssoc = CAnimManager::BlendAnimation(GetClump(), m_curFightMove < FIGHTMOVE_MELEE1 ? ASSOCGRP_STD : weaponInfo->m_AnimToPlay, + tFightMoves[m_curFightMove].animId, 8.0f); - } else if (punchOnly) { - if (fightingPedDist >= 1.3f) - nextFightMove = FIGHTMOVE_SHUFFLE_F; + if (weaponInfo->m_AnimToPlay != ASSOCGRP_KNIFE || m_curFightMove < FIGHTMOVE_MELEE1) { + if (m_curFightMove == FIGHTMOVE_BACKKICK) + animAssoc->speed = 1.15f; else - nextFightMove = FIGHTMOVE_PUNCHJAB; - - } else if (fightingPedDist >= 3.0f) { - nextFightMove = FIGHTMOVE_STDPUNCH; - + animAssoc->speed = 0.8f; } else { - angleToFace = CGeneral::GetRadianAngleBetweenPoints( - m_pedInObjective->GetPosition().x, - m_pedInObjective->GetPosition().y, - GetPosition().x, - GetPosition().y); - - nextAngle = CGeneral::LimitRadianAngle(angleToFace); - m_fRotationDest = nextAngle; - m_fRotationCur = m_fRotationDest; - PedState fightingPedState = m_pedInObjective->m_nPedState; - if (fightingPedState != PED_FALL && fightingPedState != PED_GETUP && fightingPedState != PED_DIE && fightingPedState != PED_DEAD) { - - if (fightingPedDist >= 0.8f || !canKneeHead) { - - if (fightingPedDist >= 1.3f) { - - if (fightingPedDist < 1.7f && canKick) { - nextFightMove = FIGHTMOVE_LONGKICK; - if (canRoundhouse && CGeneral::GetRandomNumber() & 1) - nextFightMove = FIGHTMOVE_ROUNDHOUSE; - - } else if (fightingPedDist < 2.0f && canKick) { - nextFightMove += 5; // Makes it 9 or 10 - - } else { - nextFightMove = FIGHTMOVE_SHUFFLE_F; - - } - } else { - nextFightMove += 2; // Makes it 6 or 7 - } - } - } else if (!CGame::nastyGame - || fightingPedDist >= 1.3f - || m_pedInObjective->IsPlayer() - || m_pedInObjective->m_nPedState != PED_DEAD && m_pedInObjective->IsPedHeadAbovePos(-0.3f)) { - nextFightMove = FIGHTMOVE_IDLE; - } else { - nextFightMove = FIGHTMOVE_GROUNDKICK; + switch (GetWeapon()->m_eWeaponType) { + case WEAPONTYPE_SCREWDRIVER: + case WEAPONTYPE_KNIFE: + animAssoc->speed = 1.05f; + break; + case WEAPONTYPE_GOLFCLUB: + case WEAPONTYPE_NIGHTSTICK: + case WEAPONTYPE_BASEBALLBAT: + case WEAPONTYPE_HAMMER: + case WEAPONTYPE_KATANA: + animAssoc->speed = 0.8f; + break; + case WEAPONTYPE_CLEAVER: + case WEAPONTYPE_MACHETE: + animAssoc->speed = 0.9f; + break; } } - } - - if (canAffectMultiplePeople) { - if (kickGround && IsPlayer()) { - m_fRotationDest = angleForGroundKick; - nextFightMove = FIGHTMOVE_GROUNDKICK; - m_fRotationCur = m_fRotationDest; - m_lookTimer = 0; - SetLookFlag(pedOnGround, true); - SetLookTimer(1500); - } else if (goForward) { - nextFightMove = FIGHTMOVE_SHUFFLE_F; - } else { - nextFightMove = FIGHTMOVE_STDPUNCH; - } - } - - if (nextFightMove != FIGHTMOVE_IDLE) { - m_lastFightMove = nextFightMove; - animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 4.0f); - animAssoc->SetFinishCallback(FinishFightMoveCB, this); if (m_fightState == FIGHTSTATE_MOVE_FINISHED && animAssoc->currentTime != 0.0f) { - animAssoc->SetCurrentTime(0.0f); animAssoc->SetRun(); + if (!IsPlayer()) + animAssoc->SetCurrentTime(0.0f); } + if (IsPlayer()) + animAssoc->SetCurrentTime(0.08f); + + animAssoc->SetFinishCallback(FinishFightMoveCB, this); m_fightButtonPressure = 0; } m_fightState = FIGHTSTATE_NO_MOVE; - } else if (m_takeAStepAfterAttack && m_lastFightMove != FIGHTMOVE_SHUFFLE_F + } else if (m_takeAStepAfterAttack && m_curFightMove != FIGHTMOVE_SHUFFLE_F #ifndef FIX_BUGS && CheckForPedsOnGroundToAttack(this, nil) == 4) { #else && CheckForPedsOnGroundToAttack(this, nil) == PED_IN_FRONT_OF_ATTACKER) { #endif - m_lastFightMove = FIGHTMOVE_SHUFFLE_F; - animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), tFightMoves[m_lastFightMove].animId); + m_lastFightMove = m_curFightMove; + m_curFightMove = FIGHTMOVE_SHUFFLE_F; + animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), tFightMoves[m_curFightMove].animId); if (animAssoc) { animAssoc->SetCurrentTime(0.0f); animAssoc->blendDelta = 4.0f; animAssoc->SetRun(); } else { - animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 32.0f); + animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_curFightMove].animId, 32.0f); } animAssoc->SetFinishCallback(FinishFightMoveCB, this); m_fightState = FIGHTSTATE_NO_MOVE; @@ -7685,13 +7940,14 @@ CPed::Fight(void) } else if (m_takeAStepAfterAttack) { EndFight(ENDFIGHT_FAST); - } else if (m_lastFightMove == FIGHTMOVE_IDLE) { + } else if (m_curFightMove == FIGHTMOVE_IDLE) { if (CTimer::GetTimeInMilliseconds() > m_nWaitTimer) { EndFight(ENDFIGHT_NORMAL); } } else { - m_lastFightMove = FIGHTMOVE_IDLE; + m_lastFightMove = m_curFightMove; + m_curFightMove = FIGHTMOVE_IDLE; if (IsPlayer()) m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 500; else @@ -7781,12 +8037,13 @@ CPed::FinishDieAnimCB(CAnimBlendAssociation *animAssoc, void *arg) ped->bIsPedDieAnimPlaying = false; } +// --MIAMI: Done void CPed::FinishFightMoveCB(CAnimBlendAssociation *animAssoc, void *arg) { CPed *ped = (CPed*)arg; - if (tFightMoves[ped->m_lastFightMove].animId == animAssoc->animId) { + if (tFightMoves[ped->m_curFightMove].animId == animAssoc->animId) { ped->m_fightState = FIGHTSTATE_MOVE_FINISHED; animAssoc->blendDelta = -1000.0f; } @@ -8519,6 +8776,7 @@ CPed::SeekFollowingPath(void) return &vecNextPathNode; } +// --MIAMI: Done void CPed::Flee(void) { @@ -8530,11 +8788,14 @@ CPed::Flee(void) } if (mayFinishFleeing) { + bMakeFleeScream = false; eMoveState moveState = m_nMoveState; ClearFlee(); - if (m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE || m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS) + if (m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE || m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS) { + bBeingChasedByPolice = false; RestorePreviousObjective(); + } if ((m_nPedState == PED_IDLE || m_nPedState == PED_WANDER_PATH) && CGeneral::GetRandomNumber() & 1) { SetWaitState(moveState <= PEDMOVE_WALK ? WAITSTATE_CROSS_ROAD_LOOK : WAITSTATE_FINISH_FLEE, nil); @@ -8544,6 +8805,11 @@ CPed::Flee(void) m_fleeTimer = CTimer::GetTimeInMilliseconds() + 5000; } + if (bMakeFleeScream && !((CTimer::GetFrameCounter() + m_randomSeed) & 7)) { + Say(SOUND_PED_FLEE_SPRINT); + bMakeFleeScream = false; + } + if (bUsePedNodeSeek) { CPathNode *realLastNode = nil; uint8 nextDirection = 0; @@ -8567,7 +8833,7 @@ CPed::Flee(void) } if (m_pNextPathNode) { - m_vecSeekPos = m_pNextPathNode->GetPosition(); + m_vecSeekPos = CPathFind::TakeWidthIntoAccountForWandering(m_pNextPathNode, m_randomSeed); if (m_nMoveState == PEDMOVE_RUN) bIsRunning = true; @@ -8621,32 +8887,15 @@ CPed::Flee(void) m_fRotationDest -= TWOPI; } - if (CTimer::GetTimeInMilliseconds() & 0x20) { - //CVector forwardPos = GetPosition(); - CMatrix forwardMat(GetMatrix()); - forwardMat.GetPosition() += Multiply3x3(forwardMat, CVector(0.0f, 4.0f, 0.0f)); - CVector forwardPos = forwardMat.GetPosition(); - - CEntity *foundEnt; - CColPoint foundCol; - bool found = CWorld::ProcessVerticalLine(forwardPos, forwardMat.GetPosition().z - 100.0f, foundCol, foundEnt, 1, 0, 0, 0, 1, 0, 0); - - if (!found || Abs(forwardPos.z - forwardMat.GetPosition().z) > 1.0f) { - m_fRotationDest += DEGTORAD(112.5f); - m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 2000; - } - } - if (CTimer::GetTimeInMilliseconds() >= m_collidingThingTimer) return; if (!m_collidingEntityWhileFleeing) return; - double damagingThingPriorityMult = (double)(m_collidingThingTimer - CTimer::GetTimeInMilliseconds()) * 2.0 / 2500; - - if (damagingThingPriorityMult <= 1.5) { + double collidingThingPriorityMult = (double)(m_collidingThingTimer - CTimer::GetTimeInMilliseconds()) * 2.0 / 2500; + if (collidingThingPriorityMult <= 1.5) { double angleToFleeEntity = CGeneral::GetRadianAngleBetweenPoints( GetPosition().x, GetPosition().y, @@ -8654,35 +8903,34 @@ CPed::Flee(void) m_collidingEntityWhileFleeing->GetPosition().y); angleToFleeEntity = CGeneral::LimitRadianAngle(angleToFleeEntity); - // It includes projectiles, but is everything collides with us included? - double angleToFleeDamagingThing = CGeneral::GetRadianAngleBetweenPoints( + double angleToFleeCollidingThing = CGeneral::GetRadianAngleBetweenPoints( m_vecDamageNormal.x, m_vecDamageNormal.y, 0.0f, 0.0f); - angleToFleeDamagingThing = CGeneral::LimitRadianAngle(angleToFleeDamagingThing); + angleToFleeCollidingThing = CGeneral::LimitRadianAngle(angleToFleeCollidingThing); - if (angleToFleeEntity - PI > angleToFleeDamagingThing) - angleToFleeDamagingThing += TWOPI; - else if (PI + angleToFleeEntity < angleToFleeDamagingThing) - angleToFleeDamagingThing -= TWOPI; + if (angleToFleeEntity - PI > angleToFleeCollidingThing) + angleToFleeCollidingThing += TWOPI; + else if (PI + angleToFleeEntity < angleToFleeCollidingThing) + angleToFleeCollidingThing -= TWOPI; - if (damagingThingPriorityMult <= 1.0f) { + if (collidingThingPriorityMult <= 1.0f) { // Range [0.0, 1.0] - float angleToFleeBoth = (angleToFleeDamagingThing + angleToFleeEntity) * 0.5f; + float angleToFleeBoth = (angleToFleeCollidingThing + angleToFleeEntity) * 0.5f; if (m_fRotationDest - PI > angleToFleeBoth) angleToFleeBoth += TWOPI; else if (PI + m_fRotationDest < angleToFleeBoth) angleToFleeBoth -= TWOPI; - m_fRotationDest = (1.0f - damagingThingPriorityMult) * m_fRotationDest + damagingThingPriorityMult * angleToFleeBoth; + m_fRotationDest = (1.0f - collidingThingPriorityMult) * m_fRotationDest + collidingThingPriorityMult * angleToFleeBoth; } else { // Range (1.0, 1.5] - double adjustedMult = (damagingThingPriorityMult - 1.0f) * 2.0f; - m_fRotationDest = angleToFleeEntity * (1.0 - adjustedMult) + adjustedMult * angleToFleeDamagingThing; + double adjustedMult = (collidingThingPriorityMult - 1.0f) * 2.0f; + m_fRotationDest = angleToFleeEntity * (1.0 - adjustedMult) + adjustedMult * angleToFleeCollidingThing; } } else { m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints( @@ -9726,8 +9974,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse) CPed::InflictDamage(car, WEAPONTYPE_RAMMEDBYCAR, damage, PEDPIECE_TORSO, fallDirection); CPed::SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true); - if ((m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD) - && !m_pCollidingEntity && + if (OnGround() && !m_pCollidingEntity && (!IsPlayer() || bHasHitWall || car->GetModelIndex() == MI_TRAIN || m_vecDamageNormal.z < -0.8f)) { m_pCollidingEntity = car; @@ -11394,7 +11641,7 @@ CPed::ProcessControl(void) break; case PED_FLEE_ENTITY: if (!m_fleeFrom) { - b157_10 = false; + bMakeFleeScream = false; SetIdle(); break; } @@ -11581,7 +11828,7 @@ CPed::ProcessControl(void) if (bInVehicle && !m_pMyVehicle) bInVehicle = false; - if (b156_8) { + if (bHeldHostageInCar) { if (m_pMyVehicle && m_pMyVehicle->pDriver && m_pMyVehicle->pDriver->IsPlayer()) { Say(SOUND_PED_FLEE_SPRINT); } @@ -12247,27 +12494,34 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg) } } +// --MIAMI: Done void CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg) { CPed* ped = (CPed*)arg; CVehicle* veh = ped->m_pMyVehicle; - if (animAssoc) + if (animAssoc) { + if ((animAssoc->animId == ANIM_CAR_ROLLOUT_LHS || animAssoc->animId == ANIM_CAR_ROLLOUT_RHS) && ped && ped->m_nPedState == PED_FALL) { + ped->RestoreHeadingRate(); + return; + } animAssoc->blendDelta = -1000.0f; + if (animAssoc->animId == ANIM_BIKE_GETOFF_BACK) + ped->RestoreHeadingRate(); + } if (!veh) { PedSetOutCarCB(nil, ped); return; } -#ifdef VC_PED_PORTS CVector posForZ = ped->GetPosition(); CPedPlacement::FindZCoorForPed(&posForZ); if (ped->GetPosition().z - 0.5f > posForZ.z) { PedSetOutCarCB(nil, ped); return; } -#endif + veh->m_nStaticFrames = 0; veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f); @@ -12340,10 +12594,8 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg) } } -#ifdef VC_PED_PORTS if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) closeDoor = false; -#endif if (!closeDoor) { if (!veh->IsDoorMissing(door) && !veh->bIsBus) { @@ -12664,7 +12916,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { for (int i = 0; i < veh->m_nNumMaxPassengers; ++i) { CPed *passenger = veh->pPassengers[i]; - if (passenger && !passenger->bStayInCarOnJack && !passenger->b156_8 && (passenger->m_leader != ped || !ped->bIsLeader)) { + if (passenger && !passenger->bStayInCarOnJack && !passenger->bHeldHostageInCar && (passenger->m_leader != ped || !ped->bIsLeader)) { passenger->SetObjective(OBJECTIVE_LEAVE_CAR, veh); passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds(); } @@ -13095,10 +13347,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) ped->RestartNonPartialAnims(); ped->m_pVehicleAnim = nil; - CVector posFromZ = ped->GetPosition(); - CPedPlacement::FindZCoorForPed(&posFromZ); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); - ped->SetPosition(posFromZ); veh = ped->m_pMyVehicle; if (veh) { if (ped->m_nPedType == PEDTYPE_PROSTITUTE) { @@ -13113,7 +13362,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) } } } - if (veh->IsBike()) + if (veh && veh->IsBike()) veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehEnterType); else veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); @@ -13168,6 +13417,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) if (createdBy == MISSION_CHAR && !startedToRun) ped->SetMoveState(PEDMOVE_WALK); } + ped->bHeldHostageInCar = false; } // --MIAMI: Done, but enumarate weapon slots @@ -14839,10 +15089,9 @@ CPed::ProcessObjective(void) // fall through case OBJECTIVE_LEAVE_CAR: if (CTimer::GetTimeInMilliseconds() > m_leaveCarTimer) { - if (InVehicle() - && (FindPlayerPed() != this || !CPad::GetPad(0)->GetAccelerate() - || bBusJacked) - ) { + if (InVehicle() && + (FindPlayerPed() != this || !CPad::GetPad(0)->GetAccelerate() || bBusJacked)) { + if (m_nPedState != PED_EXIT_CAR && m_nPedState != PED_DRAG_FROM_CAR && m_nPedState != PED_EXIT_TRAIN && (m_nPedType != PEDTYPE_COP || m_pMyVehicle->IsBoat() @@ -14861,7 +15110,7 @@ CPed::ProcessObjective(void) RestorePreviousObjective(); } } - if (b156_8) { + if (bHeldHostageInCar) { if (CTheScripts::IsPlayerOnAMission()) { CVehicle *playerVeh = FindPlayerVehicle(); if (playerVeh && playerVeh->IsPassenger(this)) { @@ -15088,7 +15337,12 @@ CPed::ProcessObjective(void) else { GetPedAttractorManager()->DeRegisterPed(this, m_attractor); SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pBus); - bDontDragMeOutCar = true; // TODO(MIAMI): check, add more flags + bDontDragMeOutCar = true; + b157_40 = true; + CPlayerPed *player = FindPlayerPed(); + if (pBus->IsPassenger(player) || pBus->IsDriver(player)) { + b158_10 = true; + } } } } @@ -16383,7 +16637,7 @@ CPed::PreRender(void) CVector speed = FindPlayerSpeed(); if (Abs(speed.x) <= 0.05f && Abs(speed.y) <= 0.05f) { - if (m_nPedState != PED_FALL && !DyingOrDead() && m_nPedState != PED_ATTACK && m_nPedState != PED_FIGHT) { + if (!OnGround() && m_nPedState != PED_ATTACK && m_nPedState != PED_FIGHT) { if (!IsPedHeadAbovePos(0.3f) || RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_TIRED)) { doSplashUp = false; } @@ -17141,13 +17395,27 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) uint32 optedDoorNode = wantedDoorNode; bool teleportNeeded = false; bool isLow = !!veh->bLowVehicle; -// TODO(MIAMI): argument - if (!veh->CanPedExitCar(false)) { - if (veh->pDriver && !veh->pDriver->IsPlayer()) { - veh->AutoPilot.m_nCruiseSpeed = 0; - veh->AutoPilot.m_nCarMission = MISSION_NONE; + + bool canJumpOut = false; + if (!veh->CanPedExitCar(false) && !bBusJacked) { + if (IsPlayer()) { + // TODO(Miami): Do jumping out of car + canJumpOut = false; + } + if (!canJumpOut) { + if (veh->pDriver) { + if (veh->pDriver->IsPlayer()) { + if (veh->pDriver != this) { + m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 5000; + bHeldHostageInCar = true; + } + } else { + veh->AutoPilot.m_nCruiseSpeed = 0; + veh->AutoPilot.m_nCarMission = MISSION_NONE; + } + } + return; } - return; } if (m_nPedState == PED_EXIT_CAR || m_nPedState == PED_DRAG_FROM_CAR) @@ -17312,9 +17580,9 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) SetPedState(PED_EXIT_CAR); if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL) m_pVehicleAnim->blendDelta = -1000.0f; + RemoveInCarAnims(); SetMoveState(PEDMOVE_NONE); CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f); - RemoveInCarAnims(); veh->AutoPilot.m_nCruiseSpeed = 0; if (teleportNeeded) { PedSetOutCarCB(nil, this); @@ -18051,7 +18319,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) Say(SOUND_PED_DEFEND); switch (hitLevel) { case HITLEVEL_GROUND: - m_lastFightMove = FIGHTMOVE_HITONFLOOR; + m_curFightMove = FIGHTMOVE_HITONFLOOR; break; case HITLEVEL_LOW: if (direction == 2 && (!IsPlayer() || ((CGeneral::GetRandomNumber() & 1) && m_fHealth < 30.0f))) { @@ -18063,52 +18331,52 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) Say(SOUND_PED_DEFEND); return; } - m_lastFightMove = FIGHTMOVE_HITBODY; + m_curFightMove = FIGHTMOVE_HITBODY; break; case HITLEVEL_HIGH: switch (direction) { case 1: - m_lastFightMove = FIGHTMOVE_HITLEFT; + m_curFightMove = FIGHTMOVE_HITLEFT; break; case 2: - m_lastFightMove = FIGHTMOVE_HITBACK; + m_curFightMove = FIGHTMOVE_HITBACK; break; case 3: - m_lastFightMove = FIGHTMOVE_HITRIGHT; + m_curFightMove = FIGHTMOVE_HITRIGHT; break; default: if (unk <= 5) - m_lastFightMove = FIGHTMOVE_HITHEAD; + m_curFightMove = FIGHTMOVE_HITHEAD; else - m_lastFightMove = FIGHTMOVE_HITBIGSTEP; + m_curFightMove = FIGHTMOVE_HITBIGSTEP; break; } break; default: switch (direction) { case 1: - m_lastFightMove = FIGHTMOVE_HITLEFT; + m_curFightMove = FIGHTMOVE_HITLEFT; break; case 2: - m_lastFightMove = FIGHTMOVE_HITBACK; + m_curFightMove = FIGHTMOVE_HITBACK; break; case 3: - m_lastFightMove = FIGHTMOVE_HITRIGHT; + m_curFightMove = FIGHTMOVE_HITRIGHT; break; default: if (unk <= 5) - m_lastFightMove = FIGHTMOVE_HITCHEST; + m_curFightMove = FIGHTMOVE_HITCHEST; else - m_lastFightMove = FIGHTMOVE_HITBIGSTEP; + m_curFightMove = FIGHTMOVE_HITBIGSTEP; break; } break; } if (m_nPedState == PED_GETUP && !IsPedHeadAbovePos(0.0f)) - m_lastFightMove = FIGHTMOVE_HITONFLOOR; + m_curFightMove = FIGHTMOVE_HITONFLOOR; if (m_nPedState == PED_FIGHT) { - CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 8.0f); + CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_curFightMove].animId, 8.0f); moveAssoc->SetCurrentTime(0.0f); moveAssoc->SetFinishCallback(FinishFightMoveCB, this); if (IsPlayer()) @@ -18119,7 +18387,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) } else if (IsPlayer() && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && !CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bFightMode) { - CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 4.0f); + CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_curFightMove].animId, 4.0f); moveAssoc->SetCurrentTime(0.0f); moveAssoc->speed = 1.2f; @@ -18133,7 +18401,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) } SetPedState(PED_FIGHT); m_fightButtonPressure = 0; - m_lastHitState = 2; + m_lastFightMove = FIGHTMOVE_IDLE; RpAnimBlendClumpRemoveAssociations(GetClump(), ASSOC_REPEAT); CAnimBlendAssociation *walkStartAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WALK_START); if (walkStartAssoc) { @@ -18163,7 +18431,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) fightIdleAssoc = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_FIGHT_IDLE); } fightIdleAssoc->blendAmount = 1.0f; - CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 8.0f); + CAnimBlendAssociation *moveAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_curFightMove].animId, 8.0f); moveAssoc->SetFinishCallback(FinishFightMoveCB, this); m_fightState = FIGHTSTATE_NO_MOVE; m_takeAStepAfterAttack = false; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index d5062ee1..c8621c82 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -98,7 +98,6 @@ enum PedFightMoves FIGHTMOVE_PUNCHHOOK, FIGHTMOVE_PUNCHJAB, FIGHTMOVE_PUNCH, - FIGHTMOVE_BODYBLOW = FIGHTMOVE_PUNCH, FIGHTMOVE_LONGKICK, FIGHTMOVE_ROUNDHOUSE, // Directionals @@ -457,7 +456,7 @@ public: uint32 bIsDrowning : 1; uint32 bDrownsInWater : 1; //uint32 b156_4 - uint32 b156_8 : 1; + uint32 bHeldHostageInCar : 1; uint32 bIsPlayerFriend : 1; uint32 bHeadStuckInCollision : 1; uint32 bDeadPedInFrontOfCar : 1; @@ -467,7 +466,7 @@ public: uint32 bDoomAim : 1; uint32 bCanBeShotInVehicle : 1; //uint32 b157_8 - uint32 b157_10 : 1; + uint32 bMakeFleeScream : 1; uint32 bPushedAlongByCar : 1; uint32 b157_40 : 1; uint32 bIgnoreThreatsBehindObjects : 1; @@ -482,7 +481,6 @@ public: //uint32 b158_80 // our own flags - uint32 m_ped_flagI40 : 1; // bMakePedsRunToPhonesToReportCrimes makes use of this as runover by car indicator uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle uint8 m_gangFlags; @@ -590,8 +588,8 @@ public: uint8 m_wepAccuracy; CEntity *m_pPointGunAt; CVector m_vecHitLastPos; + uint32 m_curFightMove; uint32 m_lastFightMove; - uint32 m_lastHitState; // TODO(Miami): What's this? uint8 m_fightButtonPressure; FightState m_fightState; bool m_takeAStepAfterAttack; @@ -757,6 +755,8 @@ public: void SetWaitState(eWaitState, void*); bool FightStrike(CVector&, bool); void FightHitPed(CPed*, CVector&, CVector&, int16); + int32 ChooseAttackPlayer(uint8, bool); + int32 ChooseAttackAI(uint8, bool); int GetLocalDirection(const CVector2D &); void StartFightDefend(uint8, uint8, uint8); void PlayHitSound(CPed*); @@ -960,6 +960,7 @@ public: bool Dying(void) { return m_nPedState == PED_DIE; } bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; } bool OnGround(void) { return m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD; } + bool OnGroundOrGettingUp(void) { return OnGround() || m_nPedState == PED_GETUP; } bool Driving(void) { return m_nPedState == PED_DRIVING; } bool InVehicle(void) { return bInVehicle && m_pMyVehicle; } // True when ped is sitting/standing in vehicle, not in enter/exit state. @@ -1028,6 +1029,20 @@ public: else return (AnimationId)0; } + + static AnimationId GetFinishingAttackAnim(CWeaponInfo* weapon) { + if (!!weapon->m_bFinish3rd) + return ANIM_MELEE_ATTACK_FINISH; + else + return (AnimationId)0; + } + + static AnimationId GetSecondFireAnim(CWeaponInfo* weapon) { + if (!!weapon->m_bUse2nd) + return ANIM_WEAPON_FIRE_2ND; // or ANIM_MELEE_ATTACK_2ND + else + return (AnimationId)0; + } // -- // My additions, because there were many, many instances of that. diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 35689e4e..98974bd3 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -784,6 +784,7 @@ CPlayerPed::PlayerControlM16(CPad *padUsed) GetWeapon()->Update(m_audioEntityId, nil); } +// --MIAMI: Done void CPlayerPed::PlayerControlFighter(CPad *padUsed) { @@ -809,6 +810,7 @@ CPlayerPed::PlayerControlFighter(CPad *padUsed) } } +// --MIAMI: Done void CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed) { diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 18a0c963..70caf1f2 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -353,7 +353,7 @@ CPopulation::FindCollisionZoneForCoors(CVector *coors, int *safeZoneOut, eLevelN } // Then it's transition area if (*safeZoneOut >= 0) - *levelOut = LEVEL_NONE; + *levelOut = LEVEL_GENERIC; else *levelOut = CTheZones::GetLevelFromPosition(coors); } @@ -559,16 +559,23 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree CZoneInfo zoneInfo; CPed *gangLeader = nil; bool addCop = false; + bool forceAddingCop = false; CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus]; CVector playerCentreOfWorld = FindPlayerCentreOfWorld(CWorld::PlayerInFocus); CTheZones::GetZoneInfoForTimeOfDay(&playerCentreOfWorld, &zoneInfo); CWanted *wantedInfo = playerInfo->m_pPed->m_pWanted; + if (wantedInfo->m_nWantedLevel > 2) { - if (ms_nNumCop < wantedInfo->m_MaxCops && !playerInfo->m_pPed->bInVehicle - && (CCarCtrl::NumLawEnforcerCars >= wantedInfo->m_MaximumLawEnforcerVehicles + if (!CGame::IsInInterior() && (CGeneral::GetRandomNumber() % 32 == 0) && FindPlayerVehicle()) + forceAddingCop = true; + + uint32 maxCops = CGame::IsInInterior() ? wantedInfo->m_MaxCops * 1.6f : wantedInfo->m_MaxCops; + if ((ms_nNumCop < maxCops || forceAddingCop) && + (!playerInfo->m_pPed->bInVehicle && + (CCarCtrl::NumLawEnforcerCars >= wantedInfo->m_MaximumLawEnforcerVehicles || CCarCtrl::NumRandomCars >= playerInfo->m_nTrafficMultiplier * CCarCtrl::CarDensityMultiplier || CCarCtrl::NumFiretrucksOnDuty + CCarCtrl::NumAmbulancesOnDuty + CCarCtrl::NumParkedCars - + CCarCtrl::NumMissionCars + CCarCtrl::NumLawEnforcerCars + CCarCtrl::NumRandomCars >= CCarCtrl::MaxNumberOfCarsInUse)) { + + CCarCtrl::NumMissionCars + CCarCtrl::NumLawEnforcerCars + CCarCtrl::NumRandomCars >= CCarCtrl::MaxNumberOfCarsInUse) || forceAddingCop)) { addCop = true; minDist = PedCreationDistMultiplier() * MIN_CREATION_DIST; maxDist = PedCreationDistMultiplier() * (MIN_CREATION_DIST + CREATION_RANGE); @@ -693,6 +700,9 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree if (!farEnoughToAdd) break; CPed *newPed = AddPed((ePedType)pedTypeToAdd, modelToAdd, generatedCoors); + if (forceAddingCop && newPed->m_nPedType == PEDTYPE_COP) + ((CCopPed*)newPed)->m_bThrowsSpikeTrap = true; + newPed->SetWanderPath(CGeneral::GetRandomNumberInRange(0, 8)); if (i != 0) { @@ -721,10 +731,11 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree } } +// TODO(Miami) CPed* CPopulation::AddPedInCar(CVehicle* car, bool isDriver) { - int defaultModel = MI_MALE01; + const int defaultModel = MI_MALE01; int miamiViceIndex = 0; bool imSureThatModelIsLoaded = true; CVector coors = FindPlayerCoors(); @@ -744,10 +755,6 @@ CPopulation::AddPedInCar(CVehicle* car, bool isDriver) preferredModel = 0; pedType = PEDTYPE_EMERGENCY; break; - case MI_FBICAR: - preferredModel = COP_FBI; - pedType = PEDTYPE_COP; - break; case MI_POLICE: case MI_PREDATOR: preferredModel = COP_STREET; @@ -762,24 +769,24 @@ CPopulation::AddPedInCar(CVehicle* car, bool isDriver) preferredModel = COP_ARMY; pedType = PEDTYPE_COP; break; - case MI_VICECHEE: // TODO(MIAMI): figure out new structure of the function - preferredModel = COP_MIAMIVICE; + case MI_FBIRANCH: + preferredModel = COP_FBI; pedType = PEDTYPE_COP; - miamiViceIndex = (isDriver ? 2 * CCarCtrl::MiamiViceCycle : 2 * CCarCtrl::MiamiViceCycle + 1); break; - case MI_TAXI: - case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: - if (CGeneral::GetRandomTrueFalse()) { - pedType = PEDTYPE_CIVMALE; - preferredModel = MI_TAXI_D; + default: + if (car->GetModelIndex() == MI_TAXI || car->GetModelIndex() == MI_CABBIE || car->GetModelIndex() == MI_ZEBRA || car->GetModelIndex() == MI_KAUFMAN) { + if (isDriver) { + pedType = PEDTYPE_CIVMALE; + preferredModel = MI_TAXI_D; + break; + } + } else if (car->GetModelIndex() == MI_VICECHEE && car->bIsLawEnforcer) { + preferredModel = COP_MIAMIVICE; + pedType = PEDTYPE_COP; + miamiViceIndex = (isDriver ? 2 * CCarCtrl::MiamiViceCycle : 2 * CCarCtrl::MiamiViceCycle + 1); break; } - defaultModel = MI_TAXI_D; - // fall through - default: int gangOfPed = 0; imSureThatModelIsLoaded = false; @@ -798,8 +805,12 @@ CPopulation::AddPedInCar(CVehicle* car, bool isDriver) if (preferredModel == -1) preferredModel = defaultModel; - if (((CPedModelInfo*)CModelInfo::GetModelInfo(preferredModel))->m_carsCanDrive & (1 << carModelInfo->m_vehicleClass)) - break; + if (((CPedModelInfo*)CModelInfo::GetModelInfo(preferredModel))->GetRwObject()) { + if (!car->IsPassenger(preferredModel) && !car->IsDriver(preferredModel)) { + if (((CPedModelInfo*)CModelInfo::GetModelInfo(preferredModel))->m_carsCanDrive & (1 << carModelInfo->m_vehicleClass)) + break; + } + } } if (i == -1) preferredModel = defaultModel; diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index 07d8e6e5..26b333fc 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -129,12 +129,12 @@ CCredits::Render(void) PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED041"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED043"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset); @@ -177,14 +177,14 @@ CCredits::Render(void) PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED061"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED063"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED064"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED065"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED066"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED067"), lineoffset, scrolloffset); @@ -192,16 +192,16 @@ CCredits::Render(void) PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED069"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED071"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED072"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED073"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED074"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED075"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED076"), lineoffset, scrolloffset); @@ -221,16 +221,16 @@ CCredits::Render(void) PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED085"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED087"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED088"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED089"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED090"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED091"), lineoffset, scrolloffset); @@ -250,7 +250,7 @@ CCredits::Render(void) PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED100"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED101"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED102"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED103"), lineoffset, scrolloffset); @@ -261,82 +261,82 @@ CCredits::Render(void) PrintCreditText(1.7f, 1.7f, TheText.Get("CRED269"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED107"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset); - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED109"), lineoffset, scrolloffset); + PrintCreditSpace(1.5f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED108"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED109"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED110"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), lineoffset, scrolloffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED112"), lineoffset, scrolloffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED112"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED113"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED113"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED114"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED114"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED115"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED115"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED116"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED116"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED117"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED117"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED118"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED118"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED119"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED119"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED120"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED120"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED121"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED121"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED122"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED122"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED123"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED123"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED124"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED124"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED125"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED125"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED126"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED126"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED127"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED127"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED128"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED128"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED129"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED129"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED130"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED130"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED131"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED131"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED132"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED132"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED133"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED133"), lineoffset, scrolloffset); if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN) - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED134"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED135"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED136"), lineoffset, scrolloffset); @@ -349,7 +349,7 @@ CCredits::Render(void) PrintCreditText(1.7f, 1.7f, TheText.Get("CRD138A"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRD138B"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED139"), lineoffset, scrolloffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED139"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED140"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140A"), lineoffset, scrolloffset); @@ -359,12 +359,12 @@ CCredits::Render(void) PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140E"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED141"), lineoffset, scrolloffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED142"), lineoffset, scrolloffset); - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED143"), lineoffset, scrolloffset); - PrintCreditSpace(1.0, lineoffset); - PrintCreditText(1.0, 1.0, TheText.Get("CRED144"), lineoffset, scrolloffset); - PrintCreditSpace(1.0, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED142"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED143"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); + PrintCreditText(1.0f, 1.0f, TheText.Get("CRED144"), lineoffset, scrolloffset); + PrintCreditSpace(1.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED145"), lineoffset, scrolloffset); PrintCreditText(1.4f, 1.4f, TheText.Get("CRED146"), lineoffset, scrolloffset); @@ -441,19 +441,19 @@ CCredits::Render(void) PrintCreditText(1.4f, 1.4f, TheText.Get("CRED241"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED217"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED218"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRD218A"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRD218B"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED219"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED220"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED221"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED222"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED223"), lineoffset, scrolloffset); @@ -462,7 +462,7 @@ CCredits::Render(void) PrintCreditText(1.7f, 1.7f, TheText.Get("CRED226"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED227"), lineoffset, scrolloffset); - PrintCreditSpace(1.5, lineoffset); + PrintCreditSpace(1.5f, lineoffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED228"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED229"), lineoffset, scrolloffset); PrintCreditSpace(2.0f, lineoffset); diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 3f7d89c7..ab360aac 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -3,6 +3,7 @@ #include "Draw.h" #include "Frontend.h" #include "Camera.h" +#include "CutsceneMgr.h" #ifdef ASPECT_RATIO_SCALE float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO; @@ -61,7 +62,10 @@ void CDraw::SetFOV(float fov) { #ifdef ASPECT_RATIO_SCALE - ms_fScaledFOV = ConvertFOV(fov); + if (!CCutsceneMgr::IsRunning()) + ms_fScaledFOV = ConvertFOV(fov); + else + ms_fScaledFOV = fov; #endif ms_fFOV = fov; } diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 53b06a46..fc6e6853 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -1,11 +1,14 @@ #include "common.h" #include "main.h" +#include "RenderBuffer.h" #include "Entity.h" #include "Fluff.h" #include "Camera.h" #include "Sprite.h" #include "Coronas.h" +#include "Rubbish.h" +#include "Timecycle.h" #include "General.h" #include "Timer.h" #include "Clock.h" @@ -18,6 +21,277 @@ #include "Bones.h" #include "World.h" +CPlaneTrail CPlaneTrails::aArray[6]; +RwImVertexIndex TrailIndices[32] = { + 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, + 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16 +}; + +void +CPlaneTrail::Init(void) +{ + int i; + for(i = 0; i < ARRAY_SIZE(m_time); i++) + m_time[i] = 0; +} + +void +CPlaneTrail::Render(float visibility) +{ + int i; + int numVerts = 0; + if(!TheCamera.IsSphereVisible(m_pos[0], 1000.0f)) + return; + + int alpha = visibility*110.0f; + if(alpha == 0) + return; + + for(i = 0; i < ARRAY_SIZE(m_pos); i++){ + int32 time = CTimer::GetTimeInMilliseconds() - m_time[i]; + if(time > 30000) + m_time[i] = 0; + if(m_time[i] != 0){ + float fade = (30000.0f - time) / 10000.0f; + fade = Min(fade, 1.0f); + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[numVerts], 255, 255, 255, (int)(alpha*fade)); + RwIm3DVertexSetPos(&TempBufferRenderVertices[numVerts], m_pos[i].x, m_pos[i].y, m_pos[i].z); + numVerts++; + } + } + if(numVerts > 1){ + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); + + if(RwIm3DTransform(TempBufferRenderVertices, numVerts, nil, rwIM3D_VERTEXXYZ|rwIM3D_VERTEXUV)){ + RwIm3DRenderIndexedPrimitive(rwPRIMTYPELINELIST, TrailIndices, (numVerts-1)*2); + RwIm3DEnd(); + } + } +} + +void +CPlaneTrail::RegisterPoint(CVector pos) +{ + int i; + bool bNewPoint = false; + if(m_time[0] != 0 && CTimer::GetTimeInMilliseconds() - m_time[0] > 2000){ + bNewPoint = true; + for(i = ARRAY_SIZE(m_pos)-1; i > 0; i--){ + m_pos[i] = m_pos[i-1]; + m_time[i] = m_time[i-1]; + } + } + m_pos[0] = pos; + if(bNewPoint || m_time[0] == 0) + m_time[0] = CTimer::GetTimeInMilliseconds(); +} + +void +CPlaneTrails::Init(void) +{ + int i; + for(i = 0; i < ARRAY_SIZE(aArray); i++) + aArray[i].Init(); +} + +void +CPlaneTrails::Update(void) +{ + CVector planePos; + + planePos.x = 1590.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI); + planePos.y = 1200.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI); + planePos.z = 550.0f; + RegisterPoint(planePos, 3); + if(CClock::GetHours() > 22 || CClock::GetHours() < 7){ + if(CTimer::GetTimeInMilliseconds() & 0x200) + CCoronas::RegisterCorona(101, 255, 0, 0, 255, planePos, 5.0f, 2000.0f, + CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + else + CCoronas::UpdateCoronaCoors(101, planePos, 2000.0f, 0.0f); + } + + planePos.x = 1000.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI); + planePos.y = -1600.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI); + planePos.z = 500.0f; + RegisterPoint(planePos, 4); + if(CClock::GetHours() > 22 || CClock::GetHours() < 7){ + if(CTimer::GetTimeInMilliseconds() & 0x200) + CCoronas::RegisterCorona(102, 255, 0, 0, 255, planePos, 5.0f, 2000.0f, + CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + else + CCoronas::UpdateCoronaCoors(102, planePos, 2000.0f, 0.0f); + } + + planePos.x = 1100.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI); + planePos.y = 700.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI); + planePos.z = 600.0f; + RegisterPoint(planePos, 5); + if(CClock::GetHours() > 22 || CClock::GetHours() < 7){ + if(CTimer::GetTimeInMilliseconds() & 0x200) + CCoronas::RegisterCorona(103, 255, 0, 0, 255, planePos, 5.0f, 2000.0f, + CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, + CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + else + CCoronas::UpdateCoronaCoors(103, planePos, 2000.0f, 0.0f); + } +} + +void +CPlaneTrails::Render(void) +{ + int i; + float visibility = Min(1.0f-CWeather::Foggyness, 1.0f-CWeather::CloudCoverage); + visibility = Min(visibility, 1.0f-CWeather::Rain); + visibility = Min(Max(Max(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen()), CTimeCycle::GetSkyTopBlue())/256.0f, visibility); + if(visibility > 0.0001f) + for(i = 0; i < ARRAY_SIZE(aArray); i++) + aArray[i].Render(visibility); +} + +void +CPlaneTrails::RegisterPoint(CVector pos, uint32 id) +{ + aArray[id].RegisterPoint(pos); +} + + + +CPlaneBanner CPlaneBanners::aArray[5]; + +void +CPlaneBanner::Init(void) +{ + int i; + for(i = 0; i < ARRAY_SIZE(m_pos); i++){ + m_pos[i].x = i; + m_pos[i].y = 0.0f; + m_pos[i].z = -60.0f; + } +} + +void +CPlaneBanner::Update(void) +{ + int i; + if(m_pos[0].z > -50.0f){ + m_pos[0].z -= 0.05f*CTimer::GetTimeStep(); + m_pos[0].z = Max(m_pos[0].z, -100.0f); + for(i = 1; i < ARRAY_SIZE(m_pos); i++){ + CVector dist = m_pos[i] - m_pos[i-1]; + float len = dist.Magnitude(); + if(len > 8.0f) + m_pos[i] = m_pos[i-1] + dist/len*8.0f; + } + } +} + +void +CPlaneBanner::Render(void) +{ + int i; + if(m_pos[0].z > -50.0f){ + float camDist = (TheCamera.GetPosition() - m_pos[0]).Magnitude(); + if(TheCamera.IsSphereVisible(m_pos[4], 32.0f) && camDist < 300.0f){ + TempBufferVerticesStored = 0; + TempBufferIndicesStored = 0; + int alpha = camDist < 250.0f ? 160 : (300.0f-camDist)/(300.0f-250.0f)*160; + + TempBufferVerticesStored += 2; + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], 255, 255, 255, alpha); + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], 255, 255, 255, alpha); + RwIm3DVertexSetPos(&TempBufferRenderVertices[0], m_pos[2].x, m_pos[2].y, m_pos[2].z); + RwIm3DVertexSetPos(&TempBufferRenderVertices[1], m_pos[2].x, m_pos[2].y, m_pos[2].z - 4.0f); + RwIm3DVertexSetU(&TempBufferRenderVertices[0], 0.0f); + RwIm3DVertexSetV(&TempBufferRenderVertices[0], 0.0f); + RwIm3DVertexSetU(&TempBufferRenderVertices[1], 0.0f); + RwIm3DVertexSetV(&TempBufferRenderVertices[1], 1.0f); + for(i = 2; i < 8; i++){ + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+0], 255, 255, 255, alpha); + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+1], 255, 255, 255, alpha); + RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+0], m_pos[i].x, m_pos[i].y, m_pos[i].z); + RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+1], m_pos[i].x, m_pos[i].y, m_pos[i].z - 4.0f); + RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+0], (i-2)/5.0f); + RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+0], 0.0f); + RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+1], (i-2)/5.0f); + RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+1], 1.0f); + TempBufferRenderIndexList[TempBufferIndicesStored+0] = TempBufferVerticesStored-2; + TempBufferRenderIndexList[TempBufferIndicesStored+1] = TempBufferVerticesStored-1; + TempBufferRenderIndexList[TempBufferIndicesStored+2] = TempBufferVerticesStored+1; + TempBufferRenderIndexList[TempBufferIndicesStored+3] = TempBufferVerticesStored-2; + TempBufferRenderIndexList[TempBufferIndicesStored+4] = TempBufferVerticesStored+1; + TempBufferRenderIndexList[TempBufferIndicesStored+5] = TempBufferVerticesStored; + TempBufferVerticesStored += 2; + TempBufferIndicesStored += 6; + } + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRubbishTexture[2])); + +#ifdef FIX_BUGS + if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXXYZ|rwIM3D_VERTEXUV)){ +#else + if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, 0)){ +#endif + RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored); + RwIm3DEnd(); + } + + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); + + TempBufferVerticesStored = 0; + TempBufferIndicesStored = 0; + } + } +} + +void +CPlaneBanner::RegisterPoint(CVector pos) +{ + m_pos[0] = pos; +} + +void +CPlaneBanners::Init(void) +{ + int i; + for(i = 0; i < ARRAY_SIZE(aArray); i++) + aArray[i].Init(); +} + +void +CPlaneBanners::Update(void) +{ + int i; + for(i = 0; i < ARRAY_SIZE(aArray); i++) + aArray[i].Update(); +} + +void +CPlaneBanners::Render(void) +{ + int i; + for(i = 0; i < ARRAY_SIZE(aArray); i++) + aArray[i].Render(); +} + +void +CPlaneBanners::RegisterPoint(CVector pos, uint32 id) +{ + aArray[id].RegisterPoint(pos); +} bool CSmokeTrails::CigOn = false; CSmokeTrail CSmokeTrails::aSmoke[3]; @@ -113,7 +387,9 @@ CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS]; void CMovingThings::Init() { + CPlaneTrails::Init(); CSmokeTrails::Init(); + CPlaneBanners::Init(); StartCloseList.m_pNext = &CMovingThings::EndCloseList; StartCloseList.m_pPrev = nil; @@ -162,14 +438,19 @@ void CMovingThings::Shutdown() int i; for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i) aScrollBars[i].SetVisibility(false); +/* for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i) aTowerClocks[i].SetVisibility(false); for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i) aDigitalClocks[i].SetVisibility(false); +*/ } void CMovingThings::Update() { + CPlaneBanners::Update(); + CPlaneTrails::Update(); + const int TIME_SPAN = 64; // frames to process all aMovingThings int16 i; @@ -214,6 +495,7 @@ void CMovingThings::Render() if (aScrollBars[i].IsVisible()) aScrollBars[i].Render(); } +/* for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i) { if (aTowerClocks[i].IsVisible()) @@ -224,8 +506,11 @@ void CMovingThings::Render() if (aDigitalClocks[i].IsVisible()) aDigitalClocks[i].Render(); } +*/ + CPlaneTrails::Render(); CSmokeTrails::Render(); + CPlaneBanners::Render(); } // ---------- CMovingThing ---------- @@ -934,7 +1219,6 @@ CSmokeTrails::Render(void) { void CSmokeTrail::Render(void) { int numVerts = 0; - RwIm3DVertex TempVertexBuffer[16]; if (TheCamera.IsSphereVisible(m_pos[0], 10.0f)) { for (int32 i = 0; i < 16; i++) { @@ -949,8 +1233,8 @@ CSmokeTrail::Render(void) { float posX = (m_pos[i].x + timeSinceSpawned * RandomSmoke[(i - m_seed) & 0xF] * 0.00001f) - offset; float posY = (m_pos[i].y + timeSinceSpawned * RandomSmoke[(i - m_seed + 5) & 0xF] * 0.00001f) - offset; float posZ = m_pos[i].z + timeSinceSpawned * 0.0004f; - RwIm3DVertexSetRGBA(&TempVertexBuffer[i], 200, 200, 200, alpha); - RwIm3DVertexSetPos(&TempVertexBuffer[i], posX, posY, posZ); + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[i], 200, 200, 200, alpha); + RwIm3DVertexSetPos(&TempBufferRenderVertices[i], posX, posY, posZ); numVerts++; } } @@ -962,7 +1246,7 @@ CSmokeTrail::Render(void) { RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); - if (RwIm3DTransform(TempVertexBuffer, numVerts, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) { + if (RwIm3DTransform(TempBufferRenderVertices, numVerts, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) { RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2 * (numVerts - 1)); RwIm3DEnd(); } @@ -994,13 +1278,12 @@ CSmokeTrails::Update(void) { RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); - RwIm3DVertex TempVertexBuffer[2]; - RwIm3DVertexSetRGBA(&TempVertexBuffer[0], 255, 255, 255, 255); - RwIm3DVertexSetPos(&TempVertexBuffer[0], startPos.x, startPos.y, startPos.z); - RwIm3DVertexSetRGBA(&TempVertexBuffer[1], 255, 255, 255, 255); - RwIm3DVertexSetPos(&TempVertexBuffer[1], endPos.x, endPos.y, endPos.z); + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], 255, 255, 255, 255); + RwIm3DVertexSetPos(&TempBufferRenderVertices[0], startPos.x, startPos.y, startPos.z); + RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], 255, 255, 255, 255); + RwIm3DVertexSetPos(&TempBufferRenderVertices[1], endPos.x, endPos.y, endPos.z); - if (RwIm3DTransform(TempVertexBuffer, 2, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) { + if (RwIm3DTransform(TempBufferRenderVertices, 2, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) { RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2); RwIm3DEnd(); } diff --git a/src/render/Fluff.h b/src/render/Fluff.h index 41db75ec..b8b529f3 100644 --- a/src/render/Fluff.h +++ b/src/render/Fluff.h @@ -2,6 +2,70 @@ #include "common.h" #include "Vector.h" +// TODO +class CScriptPath +{ +public: +}; + +// TODO +class CScriptPaths +{ +public: +}; + +class CPlaneTrail +{ + CVector m_pos[16]; + int32 m_time[16]; +public: + void Init(void); + void Render(float visibility); + void RegisterPoint(CVector pos); +}; + +class CPlaneTrails +{ + static CPlaneTrail aArray[6]; // NB: 3 CPlanes and 3 hardcoded far away ones +public: + static void Init(void); + static void Update(void); + static void Render(void); + static void RegisterPoint(CVector pos, uint32 id); +}; + +class CPlaneBanner +{ + CVector m_pos[8]; +public: + void Init(void); + void Update(void); + void Render(void); + void RegisterPoint(CVector pos); +}; + +class CPlaneBanners +{ + static CPlaneBanner aArray[5]; +public: + static void Init(void); + static void Update(void); + static void Render(void); + static void RegisterPoint(CVector pos, uint32 id); +}; + +// TODO +class CEscalators +{ +public: +}; + +// TODO +class CEscalator +{ +public: +}; + class CMovingThing { public: diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index d4cea597..6a3cdeaa 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -38,10 +38,10 @@ CRGBA TIMER_COLOR(97, 194, 247, 255); CRGBA COUNTER_COLOR(97, 194, 247, 255); CRGBA PAGER_COLOR(32, 162, 66, 205); CRGBA RADARDISC_COLOR(255, 255, 255, 255); -CRGBA BIGMESSAGE_COLOR(85, 119, 133, 255); -CRGBA WASTEDBUSTED_COLOR(255, 150, 225, 255); -CRGBA ODDJOB_COLOR(89, 115, 150, 255); -CRGBA ODDJOB2_COLOR(156, 91, 40, 255); +CRGBA BIGMESSAGE_COLOR(255, 150, 225, 255); +CRGBA WASTEDBUSTED_COLOR(0, 207, 133, 255); +CRGBA ODDJOB_COLOR(0, 207, 133, 255); +CRGBA ODDJOB2_COLOR(97, 194, 247, 255); CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255); wchar CHud::m_HelpMessage[256]; @@ -70,6 +70,7 @@ bool CHud::m_Wants_To_Draw_Hud; bool CHud::m_Wants_To_Draw_3dMarkers; wchar CHud::m_BigMessage[6][128]; int16 CHud::m_ItemToFlash; +bool CHud::m_HideRadar; // These aren't really in CHud float CHud::BigMessageInUse[6]; @@ -902,20 +903,25 @@ void CHud::Draw() /* DrawRadar */ - if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) { + if (FrontEndMenuManager.m_PrefsRadarMode != 2 && + !m_HideRadar && (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR)) { + + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST); CRadar::DrawMap(); - CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); + if (FrontEndMenuManager.m_PrefsRadarMode != 1) { + CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); #ifdef FIX_BUGS - rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); #else - rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); #endif - rect.Grow(6.0f); - rect.Translate(0.0f, 2.0f); - Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); - rect.Translate(0.0f, -2.0f); - Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); + rect.Grow(6.0f); + rect.Translate(0.0f, 2.0f); + Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); + rect.Translate(0.0f, -2.0f); + Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); + } CRadar::DrawBlips(); } } @@ -1570,6 +1576,7 @@ void CHud::Initialise() m_WeaponFadeTimer = 0; m_WeaponTimer = 0; + m_HideRadar = false; m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney; m_LastWanted = 0; @@ -1617,6 +1624,7 @@ void CHud::ReInitialise() { m_WeaponFadeTimer = 0; m_WeaponTimer = 0; + m_HideRadar = false; m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney; m_LastWanted = 0; } diff --git a/src/render/Hud.h b/src/render/Hud.h index f8ca4f6d..c6aff654 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -85,6 +85,7 @@ public: static bool m_Wants_To_Draw_3dMarkers; static wchar m_BigMessage[6][128]; static int16 m_ItemToFlash; + static bool m_HideRadar; // These aren't really in CHud static float BigMessageInUse[6]; diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp index 5239dc06..687cc76b 100644 --- a/src/render/RenderBuffer.cpp +++ b/src/render/RenderBuffer.cpp @@ -5,8 +5,7 @@ int32 TempBufferVerticesStored; int32 TempBufferIndicesStored; -RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE]; -RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex * )TempVertexBuffer; +VertexBufferUnion TempVertexBuffer; RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; int RenderBuffer::VerticesToBeStored; diff --git a/src/render/RenderBuffer.h b/src/render/RenderBuffer.h index e67a28d0..a0f3e7b9 100644 --- a/src/render/RenderBuffer.h +++ b/src/render/RenderBuffer.h @@ -12,8 +12,14 @@ public: #define TEMPBUFFERVERTSIZE 512 #define TEMPBUFFERINDEXSIZE 1024 +struct VertexBufferUnion +{ + RwIm2DVertex im2d[TEMPBUFFERVERTSIZE]; + RwIm3DVertex im3d[TEMPBUFFERVERTSIZE]; +}; + extern int32 TempBufferVerticesStored; extern int32 TempBufferIndicesStored; -extern RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE]; -extern RwIm3DVertex *TempBufferRenderVertices; +extern VertexBufferUnion TempVertexBuffer; +#define TempBufferRenderVertices (TempVertexBuffer.im3d) extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
\ No newline at end of file diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index becac84d..329a8c9a 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -779,7 +779,7 @@ CRenderer::ScanWorld(void) ScanSectorPoly(poly, 3, ScanSectorList); ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel)); - ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_NONE)); + ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_GENERIC)); } } } diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h index 2be592fe..52050e20 100644 --- a/src/render/Rubbish.h +++ b/src/render/Rubbish.h @@ -49,3 +49,5 @@ public: static void Init(void); static void Shutdown(void); }; + +extern RwTexture *gpRubbishTexture[4]; diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index a6d2db7b..f26f8e63 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -29,11 +29,7 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, float recip = 1.0f/out->z; out->x *= SCREEN_WIDTH * recip; out->y *= SCREEN_HEIGHT * recip; -#ifdef ASPECT_RATIO_SCALE - float fov = CDraw::ConvertFOV(DefaultFOV); -#else const float fov = DefaultFOV; -#endif // this is used to scale correctly if you zoom in with sniper rifle float fovScale = fov / CDraw::GetFOV(); diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index bf39d15e..cba64e7a 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -432,7 +432,7 @@ void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, void CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2) { - SetVertices(&TempVertexBuffer[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2); + SetVertices(&TempVertexBuffer.im2d[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2); RwImVertexIndex *pIndexList = &TempBufferRenderIndexList[nextBufferIndex]; pIndexList[0] = nextBufferVertex; pIndexList[1] = nextBufferVertex + 1; @@ -449,7 +449,7 @@ CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float bool CSprite2d::IsVertexBufferFull() { - return (nextBufferVertex > ARRAY_SIZE(TempVertexBuffer)-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6); + return (nextBufferVertex > TEMPBUFFERVERTSIZE-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6); } void @@ -457,7 +457,7 @@ CSprite2d::RenderVertexBuffer() { if (nextBufferVertex > 0) { RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); - RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempVertexBuffer, nextBufferVertex, TempBufferRenderIndexList, nextBufferIndex); + RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempVertexBuffer.im2d, nextBufferVertex, TempBufferRenderIndexList, nextBufferIndex); nextBufferVertex = 0; nextBufferIndex = 0; } diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 76c6c753..ab368e85 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -108,7 +108,7 @@ DefinedState(void) RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RwRenderStateSet(rwRENDERSTATEALPHAPRIMITIVEBUFFER, (void*)FALSE); + //RwRenderStateSet(rwRENDERSTATEALPHAPRIMITIVEBUFFER, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEBORDERCOLOR, (void*)RWRGBALONG(0, 0, 0, 255)); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEFOGCOLOR, @@ -212,7 +212,7 @@ isSkinnedCb(RpAtomic *atomic, void *data) RpAtomic **pAtomic = (RpAtomic**)data; if(*pAtomic) return nil; // already found one - if(RpSkinGeometryGetSkin(atomic->geometry)) + if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))) *pAtomic = atomic; // we could just return nil here directly... return atomic; } @@ -358,9 +358,9 @@ AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data) hier->interpolator->currentAnim = nil; } #else - if(hier && hier->pCurrentAnim){ - RpHAnimAnimationDestroy(hier->pCurrentAnim); - hier->pCurrentAnim = nil; + if(hier && hier->currentAnim){ + RpHAnimAnimationDestroy(hier->currentAnim->pCurrentAnim); + hier->currentAnim = nil; } #endif } @@ -621,3 +621,70 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer) WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); } WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); } #endif + +#ifdef LIBRW +#include <rpmatfx.h> +#include "VehicleModelInfo.h" + +int32 +findPlatform(rw::Atomic *a) +{ + rw::Geometry *g = a->geometry; + if(g->instData) + return g->instData->platform; + return 0; +} + +// Game doesn't read atomic extensions so we never get any other than the default pipe, +// but we need it for uninstancing +void +attachPipe(rw::Atomic *atomic) +{ + if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))) + atomic->pipeline = rw::skinGlobals.pipelines[rw::platform]; + else{ + int fx = rpMATFXEFFECTNULL; + RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), CVehicleModelInfo::GetMatFXEffectMaterialCB, &fx); + if(fx != rpMATFXEFFECTNULL) + RpMatFXAtomicEnableEffects(atomic); + } +} + +// Attach pipes for the platform we have native data for so we can uninstance +void +switchPipes(rw::Atomic *a, int32 platform) +{ + if(a->pipeline && a->pipeline->platform != platform){ + uint32 plgid = a->pipeline->pluginID; + switch(plgid){ + // assume default pipe won't be attached explicitly + case rw::ID_SKIN: + a->pipeline = rw::skinGlobals.pipelines[platform]; + break; + case rw::ID_MATFX: + a->pipeline = rw::matFXGlobals.pipelines[platform]; + break; + } + } +} + +RpAtomic* +ConvertPlatformAtomic(RpAtomic *atomic, void *data) +{ + int32 driver = rw::platform; + int32 platform = findPlatform(atomic); + if(platform != 0 && platform != driver){ + attachPipe(atomic); // kludge + rw::ObjPipeline *origPipe = atomic->pipeline; + rw::platform = platform; + switchPipes(atomic, rw::platform); + if(atomic->geometry->flags & rw::Geometry::NATIVE) + atomic->uninstance(); + // no ADC in this game + //rw::ps2::unconvertADC(atomic->geometry); + rw::platform = driver; + atomic->pipeline = origPipe; + } + return atomic; +} +#endif diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h index 993acd89..94a8bd94 100644 --- a/src/rw/RwHelper.h +++ b/src/rw/RwHelper.h @@ -54,4 +54,6 @@ RwCamera *CameraCreate(RwInt32 width, void _TexturePoolsInitialise(); -void _TexturePoolsShutdown();
\ No newline at end of file +void _TexturePoolsShutdown(); + +RpAtomic *ConvertPlatformAtomic(RpAtomic *atomic, void *data); diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 0f583221..52c1aef7 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -497,7 +497,7 @@ CheckDataNotCorrupt(int32 slot, char *name) char filename[100]; int32 blocknum = 0; - eLevelName level = LEVEL_NONE; + eLevelName level = LEVEL_GENERIC; CheckSum = 0; uint32 bytes_processed = 0; sprintf(filename, "%s%i%s", DefaultPCSaveFileName, slot + 1, ".b"); diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 5a2d2667..e1860179 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -178,7 +178,11 @@ psCameraBeginUpdate(RwCamera *camera) void psCameraShowRaster(RwCamera *camera) { - if (FrontEndMenuManager.m_PrefsVsync) +#ifdef LEGACY_MENU_OPTIONS + if (FrontEndMenuManager.m_PrefsVsync || FrontEndMenuManager.m_bMenuActive) +#else + if (FrontEndMenuManager.m_PrefsFrameLimiter || FrontEndMenuManager.m_bMenuActive) +#endif RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPWAITVSYNC); else RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPDONTWAIT); @@ -1366,6 +1370,15 @@ WinMain(HINSTANCE instance, RwInt32 argc; RwChar** argv; SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); + +#if 0 + // TODO: make this an option somewhere + AllocConsole(); + freopen("CONIN$", "r", stdin); + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); +#endif + #else int main(int argc, char *argv[]) @@ -1488,7 +1501,7 @@ main(int argc, char *argv[]) { CFileMgr::SetDirMyDocuments(); - int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r"); if ( gta3set ) { diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 77475ca5..ed423f30 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -223,7 +223,11 @@ psCameraBeginUpdate(RwCamera *camera) void psCameraShowRaster(RwCamera *camera) { - if (FrontEndMenuManager.m_PrefsVsync) +#ifdef LEGACY_MENU_OPTIONS + if (FrontEndMenuManager.m_PrefsVsync || FrontEndMenuManager.m_bMenuActive) +#else + if (FrontEndMenuManager.m_PrefsFrameLimiter || FrontEndMenuManager.m_bMenuActive) +#endif RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPWAITVSYNC); else RwCameraShowRaster(camera, PSGLOBAL(window), rwRASTERFLIPDONTWAIT); @@ -2073,7 +2077,7 @@ WinMain(HINSTANCE instance, { CFileMgr::SetDirMyDocuments(); - int32 gta3set = CFileMgr::OpenFile("gta3.set", "r"); + int32 gta3set = CFileMgr::OpenFile("gta_vc.set", "r"); if ( gta3set ) { @@ -2243,6 +2247,11 @@ WinMain(HINSTANCE instance, CloseClip(); CoUninitialize(); +#ifdef FIX_BUGS + // draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on + RsCameraShowRaster(Scene.camera); +#endif + #ifdef PS2_MENU extern char version_name[64]; if ( CGame::frenchGame || CGame::germanGame ) diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 217b383f..fc856de1 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1349,7 +1349,7 @@ CAutomobile::ProcessControl(void) if(!IsAlarmOn()) ReduceHornCounter(); }else{ - if(UsesSiren(GetModelIndex())){ + if(UsesSiren()){ if(Pads[0].bHornHistory[Pads[0].iCurrHornHistory]){ if(Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+4) % 5] && Pads[0].bHornHistory[(Pads[0].iCurrHornHistory+3) % 5]) @@ -1559,7 +1559,7 @@ CAutomobile::ProcessControl(void) if(m_bSirenOrAlarm && (CTimer::GetFrameCounter()&7) == 5 && - UsesSiren(GetModelIndex()) && GetModelIndex() != MI_MRWHOOP) + UsesSiren() && GetModelIndex() != MI_MRWHOOP) CCarAI::MakeWayForCarWithSiren(this); diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 786b5f4d..ae437f56 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -851,7 +851,7 @@ CBoat::BlowUpCar(CEntity *culprit) bLightsOn = false; ChangeLawEnforcerState(false); - CExplosion::AddExplosion(this, culprit, EXPLOSION_HELI, GetPosition(), 0); + CExplosion::AddExplosion(this, culprit, EXPLOSION_BOAT, GetPosition(), 0); CDarkel::RegisterCarBlownUpByPlayer(this); if(m_aBoatNodes[BOAT_MOVING] == nil) return; diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index c8fa1c22..83c727f5 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -460,7 +460,7 @@ bool CCrane::DoesCranePickUpThisCarType(uint32 mi) return mi == MI_FIRETRUCK || mi == MI_AMBULAN || mi == MI_ENFORCER || - mi == MI_FBICAR || + mi == MI_FBIRANCH || mi == MI_RHINO || mi == MI_BARRACKS || mi == MI_POLICE; @@ -474,7 +474,7 @@ bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi) case MI_FIRETRUCK: return (CarsCollectedMilitaryCrane & 1); case MI_AMBULAN: return (CarsCollectedMilitaryCrane & 2); case MI_ENFORCER: return (CarsCollectedMilitaryCrane & 4); - case MI_FBICAR: return (CarsCollectedMilitaryCrane & 8); + case MI_FBIRANCH: return (CarsCollectedMilitaryCrane & 8); case MI_RHINO: return (CarsCollectedMilitaryCrane & 0x10); case MI_BARRACKS: return (CarsCollectedMilitaryCrane & 0x20); case MI_POLICE: return (CarsCollectedMilitaryCrane & 0x40); @@ -489,7 +489,7 @@ void CCranes::RegisterCarForMilitaryCrane(uint32 mi) case MI_FIRETRUCK: CarsCollectedMilitaryCrane |= 1; break; case MI_AMBULAN: CarsCollectedMilitaryCrane |= 2; break; case MI_ENFORCER: CarsCollectedMilitaryCrane |= 4; break; - case MI_FBICAR: CarsCollectedMilitaryCrane |= 8; break; + case MI_FBIRANCH: CarsCollectedMilitaryCrane |= 8; break; case MI_RHINO: CarsCollectedMilitaryCrane |= 0x10; break; case MI_BARRACKS: CarsCollectedMilitaryCrane |= 0x20; break; case MI_POLICE: CarsCollectedMilitaryCrane |= 0x40; break; diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index bc27ca32..a3754854 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -2,6 +2,7 @@ #include "main.h" #include "General.h" +#include "CutsceneMgr.h" #include "ModelIndices.h" #include "FileMgr.h" #include "Streaming.h" @@ -12,10 +13,13 @@ #include "Coronas.h" #include "Particle.h" #include "Explosion.h" +#include "Fluff.h" #include "World.h" #include "HandlingMgr.h" #include "Plane.h" +//--MIAMI: file done + CPlaneNode *pPathNodes; CPlaneNode *pPath2Nodes; CPlaneNode *pPath3Nodes; @@ -39,12 +43,10 @@ CPlaneInterpolationLine aPlaneLineBits[6]; float PlanePathPosition[3]; float OldPlanePathPosition[3]; float PlanePathSpeed[3]; -float PlanePath2Position[3]; -float PlanePath3Position; -float PlanePath4Position; -float PlanePath2Speed[3]; -float PlanePath3Speed; -float PlanePath4Speed; +float PlanePath2Position[5]; +float PlanePath3Position[4]; +float PlanePath2Speed[5]; +float PlanePath3Speed[4]; enum @@ -62,7 +64,6 @@ int32 DropOffCesnaMissionStatus; int32 DropOffCesnaMissionStartTime; CPlane *pDropOffCesna; - CPlane::CPlane(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) { @@ -80,14 +81,13 @@ CPlane::CPlane(int32 id, uint8 CreatedBy) m_bHasBeenHit = false; m_bIsDrugRunCesna = false; m_bIsDropOffCesna = false; + m_bTempPlane = false; SetStatus(STATUS_PLANE); bIsBIGBuilding = true; - m_level = LEVEL_NONE; + m_level = LEVEL_GENERIC; -#ifdef FIX_BUGS - m_isFarAway = true; -#endif + m_isFarAway = false; } CPlane::~CPlane() @@ -123,6 +123,15 @@ CPlane::ProcessControl(void) int i; CVector pos; + if(CReplay::IsPlayingBack()) + return; + + if(GetModelIndex() == MI_AIRTRAIN){ + if(GetPosition().z > 100.0f) + CPlaneTrails::RegisterPoint(GetPosition(), m_nPlaneId); + }else if(GetModelIndex() == MI_DEADDODO) + CPlaneBanners::RegisterPoint(GetPosition(), m_nPlaneId); + // Explosion if(m_bHasBeenHit){ // BUG: since this is all based on frames, you can skip the explosion processing when you go into the menu @@ -154,7 +163,7 @@ CPlane::ProcessControl(void) int f = ++nFrameGen & 3; CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), dir, nil, CGeneral::GetRandomNumberInRange(0.1f, 1.0f), - colors[nFrameGen], rotSpeed, 0, f, 0); + colors[nFrameGen&7], rotSpeed, 0, f, 0); } } if(frm >= 40 && frm <= 80 && frm & 1){ @@ -197,17 +206,18 @@ CPlane::ProcessControl(void) colors[6] = CRGBA(0, 0, 0, 255); colors[7] = CRGBA(252, 66, 66, 255); + CVector dir; for(i = 0; i < 40; i++){ + dir.x = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f); + dir.y = CGeneral::GetRandomNumberInRange(-2.0f, 2.0f); + dir.z = CGeneral::GetRandomNumberInRange(0.0f, 2.0f); int rotSpeed = CGeneral::GetRandomNumberInRange(30.0f, 20.0f); if(CGeneral::GetRandomNumber() & 1) rotSpeed = -rotSpeed; int f = ++nFrameGen & 3; - CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), - CVector(CGeneral::GetRandomNumberInRange(-2.0f, 2.0f), - CGeneral::GetRandomNumberInRange(-2.0f, 2.0f), - CGeneral::GetRandomNumberInRange(0.0f, 2.0f)), + CParticle::AddParticle(PARTICLE_HELI_DEBRIS, GetMatrix() * CVector(0.0f, 0.0f, 0.0f), dir, nil, CGeneral::GetRandomNumberInRange(0.1f, 1.0f), - colors[nFrameGen], rotSpeed, 0, f, 0); + colors[nFrameGen&7], rotSpeed, 0, f, 0); } } if(frm >= 40 && frm <= 60 && frm & 1){ @@ -226,7 +236,7 @@ CPlane::ProcessControl(void) } if(frm == 30) bRenderScorched = true; - if(frm == 61){ + if(frm == 62){ TheCamera.SetFadeColour(200, 200, 200); TheCamera.Fade(0.0f, FADE_OUT); TheCamera.ProcessFade(); @@ -363,7 +373,7 @@ CPlane::ProcessControl(void) CVector posFront2 = (1.0f - f)*pPathNodes[curPathNodeFront2].p + f*pPathNodes[nextPathNodeFront2].p; // Now set matrix - GetMatrix().GetPosition() = (posRear + posFront) / 2.0f; + GetMatrix().SetTranslateOnly((posRear + posFront) / 2.0f); GetMatrix().GetPosition().z += 4.3f; CVector fwd = posFront - posRear; fwd.Normalise(); @@ -382,13 +392,12 @@ CPlane::ProcessControl(void) GetMatrix().GetRight() = right; GetMatrix().GetUp() = up; GetMatrix().GetForward() = fwd; - // Set speed m_vecMoveSpeed = fwd*PlanePathSpeed[m_nPlaneId]/60.0f; m_fSpeed = PlanePathSpeed[m_nPlaneId]/60.0f; m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); - m_isFarAway = !((posFront - TheCamera.GetPosition()).Magnitude2D() < sq(300.0f)); + m_isFarAway = !((posFront - TheCamera.GetPosition()).MagnitudeSqr2D() < sq(300.0f)); }else{ float planePathPosition; float totalLengthOfFlightPath; @@ -396,26 +405,12 @@ CPlane::ProcessControl(void) float planePathSpeed; int numPathNodes; - if(m_bIsDrugRunCesna){ - planePathPosition = PlanePath3Position; + if(GetModelIndex() == MI_CHOPPER){ + planePathPosition = PlanePath3Position[m_nPlaneId]; totalLengthOfFlightPath = TotalLengthOfFlightPath3; pathNodes = pPath3Nodes; - planePathSpeed = PlanePath3Speed; + planePathSpeed = PlanePath3Speed[m_nPlaneId]; numPathNodes = NumPath3Nodes; - if(CesnaMissionStatus == CESNA_STATUS_LANDED){ - pDrugRunCesna = nil; - FlagToDestroyWhenNextProcessed(); - } - }else if(m_bIsDropOffCesna){ - planePathPosition = PlanePath4Position; - totalLengthOfFlightPath = TotalLengthOfFlightPath4; - pathNodes = pPath4Nodes; - planePathSpeed = PlanePath4Speed; - numPathNodes = NumPath4Nodes; - if(DropOffCesnaMissionStatus == CESNA_STATUS_LANDED){ - pDropOffCesna = nil; - FlagToDestroyWhenNextProcessed(); - } }else{ planePathPosition = PlanePath2Position[m_nPlaneId]; totalLengthOfFlightPath = TotalLengthOfFlightPath2; @@ -484,7 +479,7 @@ CPlane::ProcessControl(void) f = (pathPositionFront - pathNodes[curPathNodeFront].t)/dist; CVector posFront = (1.0f - f)*pathNodes[curPathNodeFront].p + f*pathNodes[nextPathNodeFront].p; - // And for another point 60 units in front of the plane, used to calculate roll + // And for another point 30 units in front of the plane, used to calculate roll float pathPositionFront2 = pathPositionFront + 30.0f; if(pathPositionFront2 > totalLengthOfFlightPath) pathPositionFront2 -= totalLengthOfFlightPath; @@ -515,7 +510,7 @@ CPlane::ProcessControl(void) CVector posFront2 = (1.0f - f)*pathNodes[curPathNodeFront2].p + f*pathNodes[nextPathNodeFront2].p; // Now set matrix - GetMatrix().GetPosition() = (posRear + posFront) / 2.0f; + GetMatrix().SetTranslateOnly((posRear + posFront) / 2.0f); GetMatrix().GetPosition().z += 1.0f; CVector fwd = posFront - posRear; fwd.Normalise(); @@ -535,7 +530,7 @@ CPlane::ProcessControl(void) m_fSpeed = planePathSpeed/60.0f; m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); - m_isFarAway = !((posFront - TheCamera.GetPosition()).Magnitude2D() < sq(300.0f)); + m_isFarAway = !((posFront - TheCamera.GetPosition()).MagnitudeSqr2D() < sq(300.0f)); } } @@ -639,7 +634,8 @@ CPlane::PreRender(void) void CPlane::Render(void) { - CEntity::Render(); + if(!CCutsceneMgr::IsRunning()) + CEntity::Render(); } #define CRUISE_SPEED (50.0f) @@ -657,11 +653,9 @@ CPlane::InitPlanes(void) pPathNodes = LoadPath("data\\paths\\flight.dat", NumPathNodes, TotalLengthOfFlightPath, true); // Figure out which nodes are on ground - CColPoint colpoint; - CEntity *entity; for(i = 0; i < NumPathNodes; i++){ - if(CWorld::ProcessVerticalLine(pPathNodes[i].p, 1000.0f, colpoint, entity, true, false, false, false, true, false, nil)){ - pPathNodes[i].p.z = colpoint.point.z; + if(pPathNodes[i].p.z < 14.0f){ + pPathNodes[i].p.z = 14.0f; pPathNodes[i].bOnGround = true; }else pPathNodes[i].bOnGround = false; @@ -688,7 +682,7 @@ CPlane::InitPlanes(void) aPlaneLineBits[0].position = position; aPlaneLineBits[0].speed = TAXI_SPEED; aPlaneLineBits[0].acceleration = 0.0f; - float dist = (TakeOffPoint-600.0f) - position; + float dist = (TakeOffPoint-500.0f) - position; time += dist/TAXI_SPEED; position += dist; @@ -697,9 +691,9 @@ CPlane::InitPlanes(void) aPlaneLineBits[1].time = time; aPlaneLineBits[1].position = position; aPlaneLineBits[1].speed = TAXI_SPEED; - aPlaneLineBits[1].acceleration = 33.0f/32.0f; - time += 600.0f/((CRUISE_SPEED+TAXI_SPEED)/2.0f); - position += 600.0f; + aPlaneLineBits[1].acceleration = 618.75f/500.0f; + time += 500.0f/((CRUISE_SPEED+TAXI_SPEED)/2.0f); + position += 500.0f; // Fly at cruise speed aPlaneLineBits[2].type = 1; @@ -716,9 +710,9 @@ CPlane::InitPlanes(void) aPlaneLineBits[3].time = time; aPlaneLineBits[3].position = position; aPlaneLineBits[3].speed = CRUISE_SPEED; - aPlaneLineBits[3].acceleration = -33.0f/32.0f; - time += 600.0f/((CRUISE_SPEED+TAXI_SPEED)/2.0f); - position += 600.0f; + aPlaneLineBits[3].acceleration = -618.75f/500.0f; + time += 500.0f/((CRUISE_SPEED+TAXI_SPEED)/2.0f); + position += 500.0f; // Taxi aPlaneLineBits[4].type = 1; @@ -739,24 +733,17 @@ CPlane::InitPlanes(void) TotalDurationOfFlightPath2 = TotalLengthOfFlightPath2/CRUISE_SPEED; } -/* - // Mission Cesna + // Heli if(pPath3Nodes == nil){ pPath3Nodes = LoadPath("data\\paths\\flight3.dat", NumPath3Nodes, TotalLengthOfFlightPath3, false); TotalDurationOfFlightPath3 = TotalLengthOfFlightPath3/CRUISE_SPEED; } - // Mission Cesna - if(pPath4Nodes == nil){ - pPath4Nodes = LoadPath("data\\paths\\flight4.dat", NumPath4Nodes, TotalLengthOfFlightPath4, false); - TotalDurationOfFlightPath4 = TotalLengthOfFlightPath4/CRUISE_SPEED; - } -*/ - CStreaming::LoadAllRequestedModels(false); CStreaming::RequestModel(MI_AIRTRAIN, 0); CStreaming::LoadAllRequestedModels(false); + // NB: 3 hardcoded also in CPlaneTrails for(i = 0; i < 3; i++){ CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE); plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); @@ -766,20 +753,6 @@ CPlane::InitPlanes(void) plane->m_nCurPathNode = 0; CWorld::Add(plane); } - - - CStreaming::RequestModel(MI_DEADDODO, 0); - CStreaming::LoadAllRequestedModels(false); - - for(i = 0; i < 3; i++){ - CPlane *plane = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); - plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - plane->SetStatus(STATUS_ABANDONED); - plane->bIsLocked = true; - plane->m_nPlaneId = i; - plane->m_nCurPathNode = 0; - CWorld::Add(plane); - } } void @@ -811,7 +784,6 @@ CPlane::LoadPath(char const *filename, int32 &numNodes, float &totalLength, bool CPlaneNode *nodes = new CPlaneNode[numNodes]; for(i = 0; i < numNodes; i++){ - *gString = '\0'; for(lp = 0; work_buff[bp] != '\n' && work_buff[bp] != '\0'; bp++, lp++) gString[lp] = work_buff[bp]; bp++; @@ -833,6 +805,10 @@ CPlane::LoadPath(char const *filename, int32 &numNodes, float &totalLength, bool return nodes; } +int32 LastTimeInPlane, LastTimeNotInPlane; +bool bCesnasActivated; +bool bHelisActivated; + void CPlane::UpdatePlanes(void) { @@ -875,25 +851,87 @@ CPlane::UpdatePlanes(void) t = TotalDurationOfFlightPath2/0x80000; PlanePath2Position[0] = CRUISE_SPEED * (time & 0x7FFFF)*t; - PlanePath2Position[1] = CRUISE_SPEED * ((time + 0x80000/3) & 0x7FFFF)*t; - PlanePath2Position[2] = CRUISE_SPEED * ((time + 0x80000/3*2) & 0x7FFFF)*t; + PlanePath2Position[1] = CRUISE_SPEED * ((time + 0x80000/5) & 0x7FFFF)*t; + PlanePath2Position[2] = CRUISE_SPEED * ((time + 0x80000/5*2) & 0x7FFFF)*t; + PlanePath2Position[3] = CRUISE_SPEED * ((time + 0x80000/5*3) & 0x7FFFF)*t; + PlanePath2Position[4] = CRUISE_SPEED * ((time + 0x80000/5*4) & 0x7FFFF)*t; PlanePath2Speed[0] = CRUISE_SPEED*t; PlanePath2Speed[1] = CRUISE_SPEED*t; PlanePath2Speed[2] = CRUISE_SPEED*t; + PlanePath2Speed[3] = CRUISE_SPEED*t; + PlanePath2Speed[4] = CRUISE_SPEED*t; + + t = TotalDurationOfFlightPath3/0x80000; + PlanePath3Position[0] = CRUISE_SPEED * (time & 0x7FFFF)*t; + PlanePath3Position[1] = CRUISE_SPEED * ((time + 0x80000/4) & 0x7FFFF)*t; + PlanePath3Position[2] = CRUISE_SPEED * ((time + 0x80000/4*2) & 0x7FFFF)*t; + PlanePath3Position[3] = CRUISE_SPEED * ((time + 0x80000/4*3) & 0x7FFFF)*t; + PlanePath3Speed[0] = CRUISE_SPEED*t; + PlanePath3Speed[1] = CRUISE_SPEED*t; + PlanePath3Speed[2] = CRUISE_SPEED*t; + PlanePath3Speed[3] = CRUISE_SPEED*t; + + if(FindPlayerVehicle() && (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI || + FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE)) + LastTimeInPlane = CTimer::GetTimeInMilliseconds(); + else + LastTimeNotInPlane = CTimer::GetTimeInMilliseconds(); + + if(CTimer::GetTimeInMilliseconds() - LastTimeNotInPlane > 10000){ + if(!bCesnasActivated){ + if(CStreaming::HasModelLoaded(MI_DEADDODO)){ + for(i = 0; i < 5; i++){ + CPlane *plane = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); + plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); + plane->SetStatus(STATUS_ABANDONED); + plane->bIsLocked = true; + plane->m_nPlaneId = i; + plane->m_nCurPathNode = 0; + plane->m_bTempPlane = true; + CWorld::Add(plane); + } + bCesnasActivated = true; + }else + CStreaming::RequestModel(MI_DEADDODO, 0); + } - if(CesnaMissionStatus == CESNA_STATUS_FLYING){ - PlanePath3Speed = CRUISE_SPEED*TotalDurationOfFlightPath3/0x20000; - PlanePath3Position = PlanePath3Speed * ((time - CesnaMissionStartTime) & 0x1FFFF); - if(time - CesnaMissionStartTime >= 128072) - CesnaMissionStatus = CESNA_STATUS_LANDED; - } + if(!bHelisActivated){ + if(CStreaming::HasModelLoaded(MI_CHOPPER)){ + for(i = 0; i < 4; i++){ + CPlane *plane = new CPlane(MI_CHOPPER, PERMANENT_VEHICLE); + plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); + plane->SetStatus(STATUS_ABANDONED); + plane->bIsLocked = true; + plane->m_nPlaneId = i; + plane->m_nCurPathNode = 0; + plane->m_bTempPlane = true; + CWorld::Add(plane); + } + bHelisActivated = true; + }else + CStreaming::RequestModel(MI_CHOPPER, 0); + } + }else if(CTimer::GetTimeInMilliseconds() - LastTimeInPlane > 10000) + RemoveTemporaryPlanes(); +} - if(DropOffCesnaMissionStatus == CESNA_STATUS_FLYING){ - PlanePath4Speed = CRUISE_SPEED*TotalDurationOfFlightPath4/0x80000; - PlanePath4Position = PlanePath4Speed * ((time - DropOffCesnaMissionStartTime) & 0x7FFFF); - if(time - DropOffCesnaMissionStartTime >= 521288) - DropOffCesnaMissionStatus = CESNA_STATUS_LANDED; +void +CPlane::RemoveTemporaryPlanes(void) +{ + int i; + if(!bHelisActivated && !bCesnasActivated) + return; + + i = CPools::GetVehiclePool()->GetSize(); + while(--i >= 0){ + CPlane *plane = (CPlane*)CPools::GetVehiclePool()->GetSlot(i); + if(plane && plane->IsPlane() && plane->m_bTempPlane){ + CWorld::Remove(plane); + delete plane; + } } + bCesnasActivated = false; + bHelisActivated = false; } bool @@ -921,6 +959,7 @@ CPlane::TestRocketCollision(CVector *rocketPos) return false; } +//--MIAMI: unused // BUG: not in CPlane in the game void CPlane::CreateIncomingCesna(void) @@ -944,6 +983,7 @@ CPlane::CreateIncomingCesna(void) printf("CPlane::CreateIncomingCesna(void)\n"); } +//--MIAMI: unused void CPlane::CreateDropOffCesna(void) { @@ -966,8 +1006,21 @@ CPlane::CreateDropOffCesna(void) printf("CPlane::CreateDropOffCesna(void)\n"); } +//--MIAMI: all unused const CVector CPlane::FindDrugPlaneCoordinates(void) { return pDrugRunCesna->GetPosition(); } const CVector CPlane::FindDropOffCesnaCoordinates(void) { return pDropOffCesna->GetPosition(); } bool CPlane::HasCesnaLanded(void) { return CesnaMissionStatus == CESNA_STATUS_LANDED; } bool CPlane::HasCesnaBeenDestroyed(void) { return CesnaMissionStatus == CESNA_STATUS_DESTROYED; } bool CPlane::HasDropOffCesnaBeenShotDown(void) { return DropOffCesnaMissionStatus == CESNA_STATUS_DESTROYED; } + +void +CPlane::Load(void) +{ + RemoveTemporaryPlanes(); +} + +void +CPlane::Save(void) +{ + RemoveTemporaryPlanes(); +} diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h index e9456bcd..5fb05468 100644 --- a/src/vehicles/Plane.h +++ b/src/vehicles/Plane.h @@ -29,7 +29,6 @@ struct CPlaneInterpolationLine class CPlane : public CVehicle { public: - // 0x288 int16 m_nPlaneId; int16 m_isFarAway; int16 m_nCurPathNode; @@ -38,6 +37,7 @@ public: bool m_bHasBeenHit; bool m_bIsDrugRunCesna; bool m_bIsDropOffCesna; + bool m_bTempPlane; CPlane(int32 id, uint8 CreatedBy); ~CPlane(void); @@ -53,6 +53,7 @@ public: static void InitPlanes(void); static void Shutdown(void); static CPlaneNode *LoadPath(char const *filename, int32 &numNodes, float &totalLength, bool loop); + static void RemoveTemporaryPlanes(void); static void UpdatePlanes(void); static bool TestRocketCollision(CVector *rocketPos); static void CreateIncomingCesna(void); @@ -62,6 +63,8 @@ public: static bool HasCesnaLanded(void); static bool HasCesnaBeenDestroyed(void); static bool HasDropOffCesnaBeenShotDown(void); + static void Load(void); + static void Save(void); }; extern float LandingPoint; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index e26fd99f..2c296ee2 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1512,7 +1512,7 @@ CVehicle::MakeNonDraggedPedsLeaveVehicle(CPed *ped1, CPed *ped2, CPlayerPed *&pl for(i = 0; i < numPeds2; i++) if(peds2[i]->IsFemale() || CGeneral::GetRandomTrueFalse()){ peds2[i]->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 10000; - peds2[i]->b156_8 = true; + peds2[i]->bHeldHostageInCar = true; peds2[i]->bFleeAfterExitingCar = true; } } @@ -1557,9 +1557,9 @@ CVehicle::IsLawEnforcementVehicle(void) } bool -CVehicle::UsesSiren(uint32 id) +CVehicle::UsesSiren(void) { - switch(id){ + switch(GetModelIndex()){ case MI_FIRETRUCK: case MI_AMBULAN: case MI_FBICAR: diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index b1e3d803..34106327 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -345,7 +345,7 @@ public: int FindTyreNearestPoint(float x, float y); bool IsLawEnforcementVehicle(void); void ChangeLawEnforcerState(uint8 enable); - bool UsesSiren(uint32 id); + bool UsesSiren(void); bool IsVehicleNormal(void); bool CarHasRoof(void); bool IsUpsideDown(void); diff --git a/src/weapons/Explosion.cpp b/src/weapons/Explosion.cpp index f4ad346d..74af1375 100644 --- a/src/weapons/Explosion.cpp +++ b/src/weapons/Explosion.cpp @@ -170,6 +170,7 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT break; case EXPLOSION_CAR: case EXPLOSION_CAR_QUICK: + case EXPLOSION_BOAT: explosion.m_fRadius = 9.0f; explosion.m_fPower = 300.0f; explosion.m_fStopTime = lifetime + CTimer::GetTimeInMilliseconds() + 4250; @@ -205,6 +206,7 @@ CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionT } break; case EXPLOSION_HELI: + case EXPLOSION_HELI2: explosion.m_fRadius = 6.0f; explosion.m_fPower = 300.0f; explosion.m_fStopTime = lifetime + CTimer::GetTimeInMilliseconds() + 750; diff --git a/src/weapons/Explosion.h b/src/weapons/Explosion.h index c8539cca..cfa75ec1 100644 --- a/src/weapons/Explosion.h +++ b/src/weapons/Explosion.h @@ -10,7 +10,9 @@ enum eExplosionType EXPLOSION_ROCKET, EXPLOSION_CAR, EXPLOSION_CAR_QUICK, + EXPLOSION_BOAT, EXPLOSION_HELI, + EXPLOSION_HELI2, EXPLOSION_MINE, EXPLOSION_BARREL, EXPLOSION_TANK_GRENADE, |