UINT8 CMine::LightWeight(INT16 nBaseTex) { #if 1 return (UINT8) ((lightMap [nBaseTex] - 1) / 0x0200L); #else int i; # if 1 if (file_type == RDL_FILE) { i = FindLight (nBaseTex, d1_texture_light, NUM_LIGHTS_D1); if (i >= 0) return (UINT8) ((d1_texture_light [i].light - 1) / 0x0200L); } else { i = FindLight (nBaseTex, d2_texture_light, NUM_LIGHTS_D2); if (i >= 0) return (UINT8) ((d2_texture_light [i].light - 1) / 0x0200L); } return 0; # else UINT8 result; if (nBaseTex >= 0 && nBaseTex < MAX_TEXTURES) { if (file_type == RDL_FILE) { for (i=0;i<NUM_LIGHTS_D1;i++) if (nBaseTex <= d1_texture_light[i].nBaseTex) break; if (nBaseTex == d1_texture_light[i].nBaseTex) result = (UINT8)((d1_texture_light[i].light - 1) / 0x0200L); } else { for (i=0;i<NUM_LIGHTS_D2;i++) if (nBaseTex <= d2_texture_light[i].nBaseTex) break; if (nBaseTex == d2_texture_light[i].nBaseTex) result = (UINT8)((d2_texture_light[i].light - 1) / 0x0200L); } } return (result); # endif #endif }
//----------------------------------------------------------------------------- CPUTLight *CPUTAssetLibrary::GetLight(const cString &name) { // If we already have one by this name, then return it CPUTLight *pLight = FindLight(name, true); if(NULL!=pLight) { pLight->AddRef(); return pLight; } return NULL; }
int CMine::IsLight(int nBaseTex) { #if 1 return (lightMap [nBaseTex & 0x3fff] > 0) ? 0 : -1; #else # if 1 return (file_type == RDL_FILE) ? FindLight (nBaseTex, d1_texture_light, NUM_LIGHTS_D1) : FindLight (nBaseTex, d2_texture_light, NUM_LIGHTS_D2); # else int retval = -1; int i; TEXTURE_LIGHT *t; if (file_type == RDL_FILE) { i = NUM_LIGHTS_D1; t = d1_texture_light; } else { i = NUM_LIGHTS_D2; t = d2_texture_light; } for (; i; i--, t++) if (nBaseTex <= t->nBaseTex) break; if (nBaseTex == t->nBaseTex) return t - ((file_type == RDL_FILE) ? d1_texture_light : d2_texture_light); return -1; # if 0 for (i=0;i<NUM_LIGHTS_D1;i++) { if (nBaseTex <= d1_texture_light[i].nBaseTex) break; if (nBaseTex > 0) { if (file_type == RDL_FILE) { for (i=0;i<NUM_LIGHTS_D1;i++) { if (nBaseTex <= d1_texture_light[i].nBaseTex) break; } if (nBaseTex == d1_texture_light[i].nBaseTex) { retval = i; } } else { for (i=0;i<NUM_LIGHTS_D2;i++) { if (nBaseTex <= d2_texture_light[i].nBaseTex) break; } if (nBaseTex == d2_texture_light[i].nBaseTex) { retval = i; } } } return retval; # endif # endif #endif } //------------------------------------------------------------------------ // is_exploding_light() // //291 ceil024-l 292 ceil024b-f //293 ceil025-l 294 ceil025b-f //296 ceil028-l 297 ceil028b-f //298 ceil029-l 299 ceil029b-f //------------------------------------------------------------------------ int CMine::IsExplodingLight(int nBaseTex) { switch (nBaseTex) { case 291: case 292: case 293: case 294: case 296: case 297: case 298: case 299: return (1); } return(0); } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- bool CMine::IsBlastableLight (int nBaseTex) { nBaseTex &= 0x3fff; if (IsExplodingLight (nBaseTex)) return true; if (file_type == RDL_FILE) return false; for (INT16 *p = d2_blastable_lights; *p >= 0; p++) if (*p == nBaseTex) return true; #if 0 if (IsLight (nBaseTex)) for (p = d2_switches; *p >= 0; p++) if (*p == nBaseTex) return true; #endif return false; }