📄 hong_light.cpp
字号:
if (!light) return; // LTS DRAGON BUG
xl = *(DWORD *)light;
yl = *(DWORD *)(light + 4 );
x >>= 1;
y >>= 1;
light += 8;
x -= (xl/2);
y -= (yl/2);
if( x >= (GAME_SCREEN_XSIZE/2) ) return;
else if( x + xl < 0 ) return;
if( y >= (GAME_SCREEN_YSIZE/2) ) return;
else if( y + yl < 0 ) return;
rx = xl;
lx = 0;
ty = 0;
by = yl;
if( x + xl >= (GAME_SCREEN_XSIZE/2) )
{
rx -= x + xl - (GAME_SCREEN_XSIZE/2);
}
if( x < 0 )
{
lx = 0 - x;
x = 0;
}
if( y + yl >= (GAME_SCREEN_YSIZE/2) )
{
by -= y + yl - (GAME_SCREEN_YSIZE/2);
}
if( y < 0 )
{
ty = 0 - y;
y = 0;
}
sou = light + lx + ty * xl;
for( i = ty ; i < by ; i ++)
{
p = BrightBuf + x + y * (GAME_SCREEN_XSIZE/2);
for( j = lx ; j < rx ; j ++, p++, sou++ )
{
if( *sou )
{
*(p) += *sou;
if( *(p) > 31 ) *(p) = 31;
}
}
sou += ( xl - ( rx - lx ) );
y ++;
}
}
void OutputLight( int x, int y, int lightness, int color)
{
if( LightCount + 1 >= LIGHT_MAX_ ) return;
int mx, my;
mx = x/TILE_SIZE;
my = y/TILE_SIZE;
if( TileMap[mx ][my].roof && TileMap[mx][my].show_roof == 0 ) return;
for(int i=0;i<LightCount;i++)
{
if( BoxAndDotCrash( Light[i].x - 48, Light[i].y - 48, 96, 96, x, y ) )
{
return;
}
}
//distance_Light = sqrt(pow(Light[i].x - x,2)+pow(Light[i].y - y,2));
//}
Light[LightCount].x = x+(rand()%5-2);
Light[LightCount].y = y+(rand()%5-2);
Light[LightCount].light = lightness; //0~16
Light[LightCount].flag = color;
LightCount ++;
}
///////////////////////// 0807 lkh 眠啊(PC/NPC/MONSTER 堡盔阑 免仿窍绰 窃荐) ////////////////////////////
void PutCharacterLight(LPCHARACTER lpCharacter, int diff_Time)
{
char *tt;
if( g_Inside != TileMap[ lpCharacter->position.x][lpCharacter->position.y].attr_inside ) return;
tt = NULL;
switch( lpCharacter->animationType )
{
case ANIMATION_TYPE_MAN :
case ANIMATION_TYPE_WOMAN :
{
if( Hero->viewtype == VIEWTYPE_GHOST_ )
{
if( lpCharacter->viewtype == VIEWTYPE_GHOST_ ) //蜡飞牢 版快
{
if( !IsHidenGhost(lpCharacter) )//洒电 绊胶飘啊 酒聪扼搁 堡盔阑 嘛绰促.
{
tt = BrightSprBuf[18-diff_Time][0];
}
}
else
{
tt = BrightSprBuf[18-diff_Time][0]; // 郴啊 Ghost啊 登搁 葛电 Light绰 杭荐 乐促.
}
}
else
{
if( lpCharacter->viewtype != VIEWTYPE_TRANSPARENCY_ || lpCharacter == Hero)
{
if( lpCharacter->viewtype == VIEWTYPE_GHOST_ ) //蜡飞牢 版快
{
if( !IsHidenGhost(lpCharacter) && CanViewGhost(Hero) )//020320 lsw
{
tt = BrightSprBuf[18-diff_Time][0]; // 惑措啊 Ghost瘤父 杭荐 乐绰 扁贱阑 荤侩窍搁 杭荐 乐促.
}
}
else //混酒 乐绰 版快
{
if( lpCharacter == Hero ) tt = BrightSprBuf[18-diff_Time][0]; // 唱档 Ghsot啊 酒聪绊 惑措档 Ghost啊 酒聪搁 杭荐 乐促.
else
{
tt = BrightSprBuf[18-diff_Time][0];
/******************************************** 唱狼 颇萍盔甸父 辑肺 杭荐 乐促.
for(int i=0; i<6; i++)
{
if( SCharacterData.party[i].m_Sight == 1 )
{
if( lpCharacter == SCharacterData.party[i].ch )
{
tt = BrightSprBuf[12-diff_Time][0]; // 唱档 Ghsot啊 酒聪绊 惑措档 Ghost啊 酒聪搁 杭荐 乐促.
break;
}
}
}
***********************************************************/
}
}
}
}
break;
}
case ANIMATION_TYPE_MON1:
{
if (lpCharacter->nRace == HUMAN)
{ //< CSD-030419
tt = BrightSprBuf[15][0];
} //> CSD-030419
break;
}
}
if( tt )
{
if( Hero->lostSight )
{
if( lpCharacter == Hero )
{
PutBright( ( lpCharacter->x - Mapx ), ( lpCharacter->y - Mapy - 32 ), tt );
}
}
else
{
if (lpCharacter->nRace == HUMAN)
{ //< CSD-030419
PutBright(lpCharacter->x - Mapx, lpCharacter->y - Mapy - 32, tt);
} //> CSD-030419
}
}
}
///////////////////// 0807 lkh 荐沥 //////////////////////
int MapBright( void )
{
int i;
LPCHARACTER lpCharacter = Hero;
static int toggle = 0;
static int oldmx;
static int oldmy;
static int mx = g_Map.x;
static int my = g_Map.y;
int temp_DayLight=DayLightControl;
int diff_Time=0;
//////////////////// 0313 lkh 眠啊 (磷篮 版快) //////////////////////////
if( (Hero->condition == CON_DEATH || Hero->hp == 0) && Hero->lostSight != 0 )
{
Hero->sight = 10;
Hero->lostSight = 0;
// Hero->lightness = 0;//010530 lsw
Hero->lostSightTime = 0;
}
//////////////////// 0322 lkh 眠啊 /////////////////////
/* if(Hero->lightness && DayLightControl < 29 && !Hero->lostSight) //撤捞 酒聪绊 矫具惑角 惑怕啊 酒聪哥, Hero啊 蝴 付过阑 荤侩茄 版快
{
if(Hero->lightnessTime <= g_curr_time)
{
Hero->light = 0;
Hero->lightness = 0;
Hero->lightnessTime = 0;
}
temp_DayLight = rand()%3+28;
}
*/
///////////////////////////////////////////////////////
//////////////////// 0201 捞 痹绕 //////////////////////
if(Hero->lostSightTime) //矫具惑角 矫埃捞 悸泼登绢 乐栏搁
{
diff_Time=abs(Hero->lostSightTime - g_curr_time); //泅犁 矫埃苞狼 瞒捞矫埃 拌魂
if(diff_Time>15) diff_Time=15; //瞒捞啊 15檬 捞惑捞搁 绢涤扁甫 15 窍茄急栏肺 悸
}
if( Hero->lostSight ) //矫具 惑角 惑怕
{
if( Hero->lostSightTime <= g_curr_time) //矫具 惑角 蜡瓤矫埃 版苞矫
{
Hero->lostSight = 0;
Hero->lostSightTime = 0;
diff_Time = 0;
Hero->sight = 10;
}
if(diff_Time<15) //辆丰矫埃苞 15檬 捞郴牢 版快
{
Hero->lostSight = (diff_Time*2) ;
if(Hero->lostSight < 0) Hero->lostSight=0;
}
temp_DayLight = DayLightControl - Hero->lostSight; //DayLightControl=>0~31
if(temp_DayLight < 0) temp_DayLight=0;
}
else if( DayLightControl >= 31)
return 0;
///////////////////// 咯扁鳖瘤 //////////////////////
toggle = !toggle;
mx = Mapx;
my = Mapy;
if( toggle || ( mx != oldmx || my != oldmy ) )
{
oldmx = mx, oldmy = my;
memset( BrightBuf, temp_DayLight, (GAME_SCREEN_XSIZE/2) * (GAME_SCREEN_YSIZE/2) );
while( lpCharacter != NULL )
{
PutCharacterLight(lpCharacter, diff_Time);
lpCharacter = lpCharacter->lpNext;
}
//////////////////////////////// 捞痹绕 1029 //////////////////////////////////
for(i=0; i<MAX_OUTLIGHT_;i++)
{
if(g_OutLight[i].light>0) //家戈 堡盔 免仿阑 困秦 Light备炼眉俊 蔼阑 悸泼
{
if( LightCount + 1 >= LIGHT_MAX_ ) break;
Light[LightCount].x = g_OutLight[i].x;
Light[LightCount].y = g_OutLight[i].y;
Light[LightCount].light = g_OutLight[i].light;
Light[LightCount].flag = g_OutLight[i].flag;
Light[LightCount].frame = g_OutLight[i].frame;
Light[LightCount].terminateFrame=g_OutLight[i].terminateFrame;
if( Light[LightCount].frame >= Light[LightCount].terminateFrame)
g_OutLight[i].light-=2;
else
g_OutLight[i].frame++;
// if(g_OutLight[i].light<=0)
// {
// memset(&g_OutLight[i],0,sizeof(LIGHT));
// }
LightCount++;
}
else
{
memset(&Light[LightCount],0,sizeof(LIGHT));
}
}
// 001216 KHS 祸堡盔阑 嘛绰促. InsertLightOut()窃荐 曼炼.. effect_table.et-> light......
for(i=0; i<LightCount;i++) //老馆 捞悼 堡盔 拱府扁
{
LIGHT *l = &Light[i];
switch(l->flag)
{
case 0: //default -White
//PutBright( l->x - Mapx, l->y - Mapy, BrightSprBuf[l->light] );
//break;
case 1: //臭捞蔼阑 歹窍咯 捞固瘤客 悼老 臭捞俊 堡盔 嘛澜
if(!BrightSprBuf[l->light][0])continue;//soto-031031
PutBright( l->x - Mapx, l->y - Mapy, BrightSprBuf[l->light][0] );
break;
case 2: //Red Light Effspr[sprite_Num].EffSpr[i].img
////////////////// 0206 lkh 荐沥 ////////////////////
// PutCompressedImageFX( l->x - Mapx, l->y - Mapy, &Effspr[78].EffSpr[l->light], 2, 2 ); // 唱吝俊 哪荤剧捞 棵扼啊搁 remark甫乾促.
PutBright( l->x - Mapx, l->y - Mapy, BrightSprBuf[l->light][0] );
break;
case 3: //Blue Light
////////////////// 0206 lkh 荐沥 ////////////////////
// PutCompressedImageFX( l->x - Mapx, l->y - Mapy, &Effspr[79].EffSpr[l->light], 2, 2); // 唱吝俊 哪荤剧捞 棵扼啊搁 remark甫乾促.
PutBright( l->x - Mapx, l->y - Mapy, BrightSprBuf[l->light][0] );
break;
}
}
///////////////////////////////////////////////////////////////////////////////
}
LightCount = 0;
PutMapBright2( g_DestBackBuf, BrightBuf );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -