# HG changeset patch # User Gloval # Date 1361222584 -14400 # Node ID 27670273a6ffaf4ddaa4a09857ae4d7c08b131e5 # Parent 5586bb4e839577240a3d9b6176c0c22d042f445d little fix npc gen diff -r 5586bb4e8395 -r 27670273a6ff Game.cpp --- a/Game.cpp Tue Feb 19 00:37:12 2013 +0400 +++ b/Game.cpp Tue Feb 19 01:23:04 2013 +0400 @@ -370,7 +370,7 @@ continue; } pAudioPlayer->StopChannels(-1, -1);//далее в случае смерти группы - memset(pParty->pHirelings, 0, 0x4Cu); + memset(&pParty->pHirelings[0], 0, 0x4Cu); memset(&pParty->pHirelings[1], 0, 0x4Cu); pNewNPCsCount = 0; if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) diff -r 5586bb4e8395 -r 27670273a6ff NPC.cpp --- a/NPC.cpp Tue Feb 19 00:37:12 2013 +0400 +++ b/NPC.cpp Tue Feb 19 01:23:04 2013 +0400 @@ -159,6 +159,8 @@ { pProfessionChance[i].uTotalprofChance+=pProfessionChance[i].professionChancePerArea[ii]; } + pProfessionChance[i].professionChancePerArea[0]=0; + pProfessionChance[i].professionChancePerArea[59]=0; } if (pNPCDistTXT_Raw) @@ -539,18 +541,17 @@ int uPortretMax; static const unsigned __int8 NPCSexGenTable[86] ={ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 }; - static const unsigned __int8 NPCRaceGenTable[86] ={ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0}; - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0 }; + static const unsigned __int8 NPCRaceGenTable[86] ={ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0}; unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1) * 0.33333334); uNPCSex = NPCSexGenTable[seed]; @@ -563,59 +564,58 @@ do { - switch ( uRace ) - { - case 0: - if ( uNPCSex == 0 ) + switch ( uRace ) + { + case 0: + if ( uNPCSex == 0 ) { uPortretMin = 2; uPortretMax = 100; } else { - uPortretMin = 201; - uPortretMax = 250; + uPortretMin = 201; + uPortretMax = 250; + } + case 1: + if ( uNPCSex == 0 ) + { + uPortretMin = 400; + uPortretMax = 430; + } + else + { + uPortretMin = 460; + uPortretMax = 490; + } + break; + case 2: + if ( uNPCSex == 0 ) + { + uPortretMin = 500; + uPortretMax = 520; + } + else + { + uPortretMin = 530; + uPortretMax = 550; + } + break; + case 3: + if ( uNPCSex == 0 ) + { + uPortretMin = 300; + uPortretMax = 330; + } + else + { + uPortretMin = 360; + uPortretMax = 387; } - case 1: - if ( uNPCSex == 0 ) - { - uPortretMin = 400; - uPortretMax = 430; - } - else - { - uPortretMin = 460; - uPortretMax = 490; - } - break; - case 2: - if ( uNPCSex == 0 ) - { - uPortretMin = 500; - uPortretMax = 520; - } - else - { - uPortretMin = 530; - uPortretMax = 550; - } - break; - case 3: - if ( uNPCSex == 0 ) - { - uPortretMin = 300; - uPortretMax = 330; - } - else - { - uPortretMin = 360; - uPortretMax = 387; - } - - break; - } - + break; + } + uGeneratedPortret = uPortretMin + rand() % (uPortretMax - uPortretMin + 1); if ( CheckPortretAgainsSex(uGeneratedPortret, uNPCSex)) break_gen = true; @@ -628,47 +628,46 @@ } while(!break_gen); - pNPCDataBuff->uPortraitID = uGeneratedPortret; - pNPCDataBuff->uFlags = 0; - pNPCDataBuff->fame = 0; - //generate reputation - rep_gen = rand() % 100 + 1; + pNPCDataBuff->uPortraitID = uGeneratedPortret; + pNPCDataBuff->uFlags = 0; + pNPCDataBuff->fame = 0; + //generate reputation + rep_gen = rand() % 100 + 1; - if ( rep_gen >= 60 ) - { - if ( rep_gen >= 90 ) + if ( rep_gen >= 60 ) { - if ( rep_gen >= 95 ) + if ( rep_gen >= 90 ) { - if ( rep_gen >= 98 ) - pNPCDataBuff->rep = -600; + if ( rep_gen >= 95 ) + { + if ( rep_gen >= 98 ) + pNPCDataBuff->rep = -600; + else + pNPCDataBuff->rep = 400; + } else - pNPCDataBuff->rep = 400; + pNPCDataBuff->rep = -300; } else - pNPCDataBuff->rep = -300; + pNPCDataBuff->rep = 200; } else - pNPCDataBuff->rep = 200; + pNPCDataBuff->rep = 0; - } - else - pNPCDataBuff->rep = 0; - - max_prof_cap = rand() % pProfessionChance[uMapId].uTotalprofChance+1; - test_prof_summ = 0; - gen_profession = 0; + max_prof_cap = rand() % pProfessionChance[uMapId].uTotalprofChance+1; + test_prof_summ = 0; + gen_profession = 0; - if ( max_prof_cap > 0 ) - { - do - test_prof_summ += pProfessionChance[uMapId].professionChancePerArea[gen_profession++]; - while ( test_prof_summ < max_prof_cap ); - } - pNPCDataBuff->uProfession = gen_profession - 1; - pNPCDataBuff->Location2D = uLocation2D; - pNPCDataBuff->field_24 = 1; - pNPCDataBuff->joins = 1; + if ( max_prof_cap > 0 ) + { + do + test_prof_summ += pProfessionChance[uMapId].professionChancePerArea[gen_profession++]; + while ( test_prof_summ < max_prof_cap ); + } + pNPCDataBuff->uProfession = gen_profession - 1; + pNPCDataBuff->Location2D = uLocation2D; + pNPCDataBuff->field_24 = 1; + pNPCDataBuff->joins = 1; } diff -r 5586bb4e8395 -r 27670273a6ff mm7_2.cpp --- a/mm7_2.cpp Tue Feb 19 00:37:12 2013 +0400 +++ b/mm7_2.cpp Tue Feb 19 01:23:04 2013 +0400 @@ -12871,7 +12871,7 @@ _wgetcwd(pCurrentDir, 1024); wchar_t pMM6IniFile[1024]; - wsprintf(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir); + wsprintfW(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir); bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile); if (bNoCD)