re3/src/render/2dEffect.h

104 lines
1.8 KiB
C
Raw Normal View History

2020-05-07 19:56:09 +00:00
#pragma once
2019-06-17 08:30:02 +00:00
enum {
EFFECT_LIGHT,
EFFECT_PARTICLE,
2020-05-13 08:38:05 +00:00
EFFECT_ATTRACTOR,
2020-05-19 18:56:42 +00:00
EFFECT_PED_ATTRACTOR,
EFFECT_SUNGLARE
2019-06-17 08:30:02 +00:00
};
2019-06-30 19:06:55 +00:00
enum {
LIGHT_ON,
LIGHT_ON_NIGHT,
LIGHT_FLICKER,
LIGHT_FLICKER_NIGHT,
LIGHT_FLASH1,
LIGHT_FLASH1_NIGHT,
LIGHT_FLASH2,
LIGHT_FLASH2_NIGHT,
LIGHT_FLASH3,
LIGHT_FLASH3_NIGHT,
LIGHT_RANDOM_FLICKER,
LIGHT_RANDOM_FLICKER_NIGHT,
LIGHT_SPECIAL,
LIGHT_BRIDGE_FLASH1,
LIGHT_BRIDGE_FLASH2,
};
2020-03-02 00:03:39 +00:00
enum {
2020-06-25 13:12:57 +00:00
ATTRACTORTYPE_ICECREAM,
ATTRACTORTYPE_STARE
2020-03-02 00:03:39 +00:00
};
2019-06-30 19:06:55 +00:00
enum {
LIGHTFLAG_LOSCHECK = 1,
// same order as CPointLights flags, must start at 2
LIGHTFLAG_FOG_NORMAL = 2, // can have light and fog
LIGHTFLAG_FOG_ALWAYS = 4, // fog only
2020-05-19 18:56:42 +00:00
LIGHTFLAG_HIDE_OBJECT = 8, // hide the object instead of rendering light (???)
LIGHTFLAG_LONG_DIST = 16,
2019-06-30 19:06:55 +00:00
LIGHTFLAG_FOG = (LIGHTFLAG_FOG_NORMAL|LIGHTFLAG_FOG_ALWAYS)
};
2019-05-15 14:52:37 +00:00
class C2dEffect
{
public:
struct Light {
float dist;
2019-06-30 19:06:55 +00:00
float range; // of pointlight
2019-05-15 14:52:37 +00:00
float size;
2020-06-28 10:05:31 +00:00
float shadowSize;
2019-06-30 19:06:55 +00:00
uint8 lightType; // LIGHT_
2019-06-17 08:30:02 +00:00
uint8 roadReflection;
uint8 flareType;
uint8 shadowIntensity;
2019-06-30 19:06:55 +00:00
uint8 flags; // LIGHTFLAG_
2019-05-15 14:52:37 +00:00
RwTexture *corona;
RwTexture *shadow;
};
struct Particle {
int particleType;
2019-06-17 08:30:02 +00:00
CVector dir;
2019-05-15 14:52:37 +00:00
float scale;
};
struct Attractor {
CVector dir;
2020-06-25 13:12:57 +00:00
int8 type;
2019-05-15 14:52:37 +00:00
uint8 probability;
};
2020-05-13 08:38:05 +00:00
struct PedAttractor {
CVector queueDir;
2020-05-15 22:49:30 +00:00
CVector useDir;
2020-05-13 08:38:05 +00:00
int8 type;
};
2019-05-15 14:52:37 +00:00
CVector pos;
2019-06-17 08:30:02 +00:00
CRGBA col;
2019-05-15 14:52:37 +00:00
uint8 type;
union {
Light light;
Particle particle;
Attractor attractor;
2020-05-13 08:38:05 +00:00
PedAttractor pedattr;
2019-05-15 14:52:37 +00:00
};
C2dEffect(void) {}
2019-06-17 08:30:02 +00:00
void Shutdown(void){
2020-03-02 00:03:39 +00:00
if(type == EFFECT_LIGHT){
2019-06-17 08:30:02 +00:00
if(light.corona)
RwTextureDestroy(light.corona);
2020-04-19 14:38:10 +00:00
#ifdef GTA3_1_1_PATCH
light.corona = nil;
#endif
2019-06-17 08:30:02 +00:00
if(light.shadow)
RwTextureDestroy(light.shadow);
2020-04-19 14:38:10 +00:00
#ifdef GTA3_1_1_PATCH
light.shadow = nil;
#endif
2019-06-17 08:30:02 +00:00
}
}
2019-05-15 14:52:37 +00:00
};
2020-05-10 13:54:37 +00:00
VALIDATE_SIZE(C2dEffect, 0x34);