A forum for reporting bugs NOT related to custom plugins.
Moderator: MacroQuest Developers
-
QuestionTheAnswers
- orc pawn

- Posts: 20
- Joined: Sun Mar 13, 2005 10:56 am
Post
by QuestionTheAnswers » Wed Oct 29, 2008 9:54 pm
When mercenarys are untargetted their names would show up as black, then when you target it, they would show up as yellow. Adding the following highlighted lines is a real simple fix. Testing this out however if you target a mercenary and then use escape to clear your target, there is a fraction of a second where the caption over the mercenary disappears, and I don't know what's causing it or how to fix it.
MQ2Main\MQ2Spawns.cpp:
Code: Select all
VOID SetNameSpriteTint(PSPAWNINFO pSpawn)
{
if (!gMQCaptions) return;
// DebugSpew("SetNameSpriteTint(%s)",pSpawn->Name);
DWORD NewColor;
switch(GetSpawnType(pSpawn))
{
case PC:
/*
#define CC_PC 0
#define CC_PCConColor 1
#define CC_PCPVPTeamColor 2
#define CC_PCRaidColor 3
#define CC_PCClassColor 4
#define CC_PCGroupColor 5
#define CC_PCTrader 6
/**/
if (pSpawn->Trader && CaptionColors[CC_PCTrader].Enabled)
NewColor=CaptionColors[CC_PCTrader].Color;
else if (CaptionColors[CC_PCGroupColor].Enabled && IsGroupMember(pSpawn))
NewColor=CaptionColors[CC_PCGroupColor].Color;
else if (CaptionColors[CC_PCClassColor].Enabled)
NewColor=((PEQRAIDWINDOW)pRaidWnd)->ClassColors[ClassInfo[pSpawn->Class].RaidColorOrder];
else if (CaptionColors[CC_PCRaidColor].Enabled && IsRaidMember(pSpawn))
NewColor=CaptionColors[CC_PCRaidColor].Color;
else if (CaptionColors[CC_PCPVPTeamColor].Enabled)
{
// TODO
}
else if (CaptionColors[CC_PCConColor].Enabled)
NewColor=ConColorToARGB(ConColor(pSpawn));
else if (CaptionColors[CC_PC].Enabled)
NewColor=CaptionColors[CC_PC].Color;
else
{
((EQPlayerHook*)pSpawn)->SetNameSpriteTint_Trampoline();
return;
}
break;
case NPC:
/*
#define CC_NPC 7
#define CC_NPCConColor 8
#define CC_NPCClassColor 9
#define CC_NPCMerchant 10
#define CC_NPCBanker 11
#define CC_NPCAssist 12
#define CC_NPCMark 13
/**/
if (CaptionColors[CC_NPCMark].Enabled && IsMarkedNPC(pSpawn))
NewColor=CaptionColors[CC_NPCMark].Color;
if (CaptionColors[CC_NPCAssist].Enabled && IsAssistNPC(pSpawn))
NewColor=CaptionColors[CC_NPCAssist].Color;
else if (CaptionColors[CC_NPCBanker].Enabled && pSpawn->Class==40)
NewColor=CaptionColors[CC_NPCBanker].Color;
else if (CaptionColors[CC_NPCMerchant].Enabled && (pSpawn->Class==41 || pSpawn->Class==61))
NewColor=CaptionColors[CC_NPCMerchant].Color;
else if (CaptionColors[CC_NPCClassColor].Enabled && pSpawn->Class<0x10)
NewColor=((PEQRAIDWINDOW)pRaidWnd)->ClassColors[ClassInfo[pSpawn->Class].RaidColorOrder];
else if (CaptionColors[CC_NPCConColor].Enabled)
NewColor=ConColorToARGB(ConColor(pSpawn));
else if (CaptionColors[CC_NPC].Enabled)
NewColor=CaptionColors[CC_NPC].Color;
else
{
((EQPlayerHook*)pSpawn)->SetNameSpriteTint_Trampoline();
return;
}
break;
case CORPSE:
if (CaptionColors[CC_CorpseClassColor].Enabled)
NewColor=((PEQRAIDWINDOW)pRaidWnd)->ClassColors[ClassInfo[pSpawn->Class].RaidColorOrder];
else if (CaptionColors[CC_Corpse].Enabled)
NewColor=CaptionColors[CC_Corpse].Color;
else
{
((EQPlayerHook*)pSpawn)->SetNameSpriteTint_Trampoline();
return;
}
break;
case PET:
if (CaptionColors[CC_PetClassColor].Enabled)
NewColor=((PEQRAIDWINDOW)pRaidWnd)->ClassColors[ClassInfo[pSpawn->Class].RaidColorOrder];
else if (CaptionColors[CC_PetConColor].Enabled)
NewColor=ConColorToARGB(ConColor(pSpawn));
else if (CaptionColors[CC_PetNPC].Enabled && ((PSPAWNINFO)GetSpawnByID(pSpawn->MasterID))->Type==SPAWN_NPC)
NewColor=CaptionColors[CC_PetNPC].Color;
else if (CaptionColors[CC_PetPC].Enabled && ((PSPAWNINFO)GetSpawnByID(pSpawn->MasterID))->Type==SPAWN_PLAYER)
NewColor=CaptionColors[CC_PetPC].Color;
else
{
((EQPlayerHook*)pSpawn)->SetNameSpriteTint_Trampoline();
return;
}
break;
case OBJECT:
((EQPlayerHook*)pSpawn)->SetNameSpriteTint_Trampoline();
return;
[color=red] case MERCENARY:
((EQPlayerHook*)pSpawn)->SetNameSpriteTint_Trampoline();
return;[/color]
}
DebugTry(((CActorEx *)pSpawn->pcactorex)->SetNameColor(NewColor));
}
-
ieatacid
- Developer

- Posts: 2727
- Joined: Wed Sep 03, 2003 7:44 pm
Post
by ieatacid » Wed Oct 29, 2008 11:48 pm
In the next zip.
-
QuestionTheAnswers
- orc pawn

- Posts: 20
- Joined: Sun Mar 13, 2005 10:56 am
Post
by QuestionTheAnswers » Thu Nov 13, 2008 9:30 pm
I figured out how to fix the disappearing mercenary name for a fraction of a second when you target them and clear your target... Add the following highlighted line... You could add a new caption type for mercenarys but this works just as well for now.
MQ2Main\MQ2Spawns.cpp:
Code: Select all
BOOL SetNameSpriteState(PSPAWNINFO pSpawn, bool Show)
{
...
switch(GetSpawnType(pSpawn))
{
[color=red]case MERCENARY:[/color]
case NPC:
SetCaption(gszSpawnNPCName);
break;
...
}
...
}
-
SwiftyMUSE
- Developer

- Posts: 1205
- Joined: Tue Sep 23, 2003 10:52 pm
Post
by SwiftyMUSE » Fri Nov 14, 2008 10:40 am
The fix still causes the disappearance for a "brief time". The code is called 4 times and only once (when changing a target from the last target which includes clearing a target) does it set Show=false. Calling the trampoline function with show=false will remove the caption. The "fix" you provide does not address that issue.
With that said, I don't understand why we are clearing the caption on the last target when the target changes. I'm sure it has something to do with changing targets in combat and will have to research further.
-
QuestionTheAnswers
- orc pawn

- Posts: 20
- Joined: Sun Mar 13, 2005 10:56 am
Post
by QuestionTheAnswers » Fri Nov 14, 2008 11:08 am
Strange, it seemed to work on my end. I'll see if I can find what you're talking about.
-
QuestionTheAnswers
- orc pawn

- Posts: 20
- Joined: Sun Mar 13, 2005 10:56 am
Post
by QuestionTheAnswers » Fri Nov 14, 2008 11:33 am
I believe it has something to do with the following line.
MQ2Main\MQ2Spawns.cpp:
Code: Select all
VOID UpdateMQ2SpawnSort()
{
EnterMQ2Benchmark(bmUpdateSpawnSort);
ZeroMemory(EQP_DistArray,sizeof(EQP_DistArray));
gSpawnCount=0;
PSPAWNINFO pSpawn=(PSPAWNINFO)pSpawnList;
while(pSpawn)
{
EQP_DistArray[gSpawnCount].VarPtr.Ptr=pSpawn;
EQP_DistArray[gSpawnCount].Value.Float=GetDistance(pSpawn->X,pSpawn->Y);
gSpawnCount++;
pSpawn=pSpawn->pNext;
}
// quicksort!
qsort(&EQP_DistArray[0],gSpawnCount,sizeof(MQRANK),MQRankFloatCompare);
ExitMQ2Benchmark(bmUpdateSpawnSort);
static unsigned long nCaptions=100;
static unsigned long LastTarget=0;
++nCaptions;
if (LastTarget)
{
if (PSPAWNINFO pSpawn=(PSPAWNINFO)GetSpawnByID(LastTarget))
{
if (pSpawn!=(PSPAWNINFO)pTarget)
{
[color=red]SetNameSpriteState(pSpawn,false);[/color]
}
}
LastTarget=0;
}
if (gGameState==GAMESTATE_INGAME && nCaptions>7)
{
nCaptions=0;
Benchmark(bmUpdateSpawnCaptions,UpdateSpawnCaptions());
}
if (pTarget)
{
LastTarget=((PSPAWNINFO)pTarget)->SpawnID;
((EQPlayerHook*)pTarget)->SetNameSpriteTint_Trampoline();
SetNameSpriteState((PSPAWNINFO)pTarget,true);
}
}
-
QuestionTheAnswers
- orc pawn

- Posts: 20
- Joined: Sun Mar 13, 2005 10:56 am
Post
by QuestionTheAnswers » Fri Nov 14, 2008 1:41 pm
Removing the following lines fixes the problem, but I don't know why they were there to begin with, so I don't know if removing them will cause any problems related to what you were thinking of.
MQ2Main\MQ2Spawns.cpp:
Code: Select all
VOID UpdateMQ2SpawnSort()
{
EnterMQ2Benchmark(bmUpdateSpawnSort);
ZeroMemory(EQP_DistArray,sizeof(EQP_DistArray));
gSpawnCount=0;
PSPAWNINFO pSpawn=(PSPAWNINFO)pSpawnList;
while(pSpawn)
{
EQP_DistArray[gSpawnCount].VarPtr.Ptr=pSpawn;
EQP_DistArray[gSpawnCount].Value.Float=GetDistance(pSpawn->X,pSpawn->Y);
gSpawnCount++;
pSpawn=pSpawn->pNext;
}
// quicksort!
qsort(&EQP_DistArray[0],gSpawnCount,sizeof(MQRANK),MQRankFloatCompare);
ExitMQ2Benchmark(bmUpdateSpawnSort);
static unsigned long nCaptions=100;
[color=red] static unsigned long LastTarget=0;[/color]
++nCaptions;
[color=red] if (LastTarget)
{
if (PSPAWNINFO pSpawn=(PSPAWNINFO)GetSpawnByID(LastTarget))
{
if (pSpawn!=(PSPAWNINFO)pTarget)
{
SetNameSpriteState(pSpawn,false);
}
}
LastTarget=0;
}[/color]
if (gGameState==GAMESTATE_INGAME && nCaptions>7)
{
nCaptions=0;
Benchmark(bmUpdateSpawnCaptions,UpdateSpawnCaptions());
}
if (pTarget)
{
[color=red] LastTarget=((PSPAWNINFO)pTarget)->SpawnID;[/color]
((EQPlayerHook*)pTarget)->SetNameSpriteTint_Trampoline();
SetNameSpriteState((PSPAWNINFO)pTarget,true);
}
}
-
SwiftyMUSE
- Developer

- Posts: 1205
- Joined: Tue Sep 23, 2003 10:52 pm
Post
by SwiftyMUSE » Fri Nov 14, 2008 2:13 pm
Did you read what I posted? I had already discovered the lines of code, I am looking at why it is in there.
And no, your new fix is just as bad/wrong as the original.
Let me spend the time to look at why the code is the way it is and determine a proper fix.