10th Anniversary Edition (Version A)

Revert: AATF returned to Autumn/Winter ruleset
Update: Added new AATF variables for ease of changing rulesets
Update: File loading error message now reports SEH exception code
Fix: AATF checks all PES20+ abilities and cards
Fix: Playstyles are now numbered correctly for PES20+ (Build Up is 18)
Fix: Editor now supports 20 character shirt names for PES20+
master
Noteperson 2 years ago
parent 1049386c32
commit b7da693a28
  1. 55
      aatf.cpp
  2. 2
      editor.h
  3. 45
      main.cpp
  4. 4
      pes20.cpp
  5. 3
      resource.h
  6. 13
      window.cpp

@ -20,11 +20,12 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
//Settings
int manletBonus = 5;
int giantPen = 0;
int goldRate = 99;
int silverRate = 89;
int reqNumGold = 1;
int reqNumSilver = 4;
int silverRate = 88;
int reqNumGold = 2;
int reqNumSilver = 2;
int greenGiant = 6;
int greenTall = 5;
@ -93,6 +94,13 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
rating = max(player.place_kick, rating);
rating = max(player.stamina, rating);
rating = max(player.speed, rating);
if(pesVersion>19) rating = max(player.aggres, rating);
if(player.injury+1 > 3)
{
errorTot++;
errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", cannot exceed 3; ");
}
//Check if registered pos has playable set to A
if(player.reg_pos == 12 && player.play_pos[0] != 2)
@ -172,6 +180,7 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
if(player.play_pos[jj] > 0)
countA++;
}
//If more than 1 A, 1 card less for each
if(countA > 1)
{
@ -188,6 +197,7 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
int numCom = 0;
int numSkill;
if(pesVersion==19) numSkill=39;
else if(pesVersion>19) numSkill=41;
else numSkill=28;
for(int jj=0;jj<numSkill;jj++)
{
@ -225,7 +235,7 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
numTall++;
else if(player.height == 189 && player.reg_pos == 0) //GK
numTall++;
else if(player.height == 194) // && player.height < 200)
else if(player.height > 193 && player.height < 200)
numGiant++;
else
{
@ -245,6 +255,7 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
errorMsg << _T("Weight out of range (") << max(30,player.height-129) << _T(",") << player.height-81 << _T("); ");
}
/* REGULAR */
if(rating < silverRate-2) //Regular player
{
numReg++;
@ -274,6 +285,7 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
if(player.reg_pos == 0) //GK gets 2 cards
{
cardMod += min(0, numTrick); //0 free tricks
cardLimit = 2 + cardMod;
if(cardCount > cardLimit)
{
@ -320,26 +332,23 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
targetRate2 += manletBonus;
}
}
if(player.height > 175 && player.injury+1 > 2)
{
errorTot++;
errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", should be 2; ");
}
else if(player.height < 175 && player.injury+1 > 1)
if(player.injury+1 > 1)
{
errorTot++;
errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", should be 1; ");
}
}
}
/* SILVER */
else if(rating < goldRate-4) //Silver player
{
numSilver++;
targetRate = silverRate;
targetRate2 = silverRate;
if(numSilver>4)
if(numSilver > reqNumSilver)
{
errorTot++;
errorMsg << _T("Already has 4 Silver medals; ");
errorMsg << _T("Too many Silver medals; ");
}
if(player.form+1 != 8)
{
@ -351,11 +360,11 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
errorTot++;
errorMsg << _T("Medals cannot play as GK; ");
}
/*if(player.height > 185) //HA get penalty
if(player.height > 185) //HA get penalty
{
targetRate -= 2;
targetRate2 -= 2;
}*/
}
cardMod += min(3, numTrick); //3 free tricks
cardMod += min(1, numCom); //1 free COM
cardLimit = 5 + cardMod;
@ -375,16 +384,17 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
errorMsg << _T("Injury resist is ") << player.injury+1 << _T(", should be 3; ");
}
}
/* GOLD */
else //rating == 99 //Gold player
{
numGold++;
targetRate = goldRate;
targetRate2 = goldRate;
if(numGold>1)
if(numGold > reqNumGold)
{
errorTot++;
errorMsg << _T("Already has 1 Gold medals; ");
errorMsg << _T("Too many Gold medals; ");
}
if(player.form+1 != 8)
{
@ -396,12 +406,12 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
errorTot++;
errorMsg << _T("Medals cannot play as GK; ");
}
/*if(player.height > 185) //Medal HA penalty
if(player.height > 185) //Medal HA penalty
{
targetRate -= 4;
targetRate2 -= 4;
}*/
cardMod += min(4, numTrick); //3 free tricks
}
cardMod += min(3, numTrick); //3 free tricks
cardMod += min(2, numCom); //2 free COMs
cardLimit = 6 + cardMod;
@ -544,6 +554,11 @@ void aatf_single(HWND hAatfbox, int pesVersion, int teamSel, player_entry* gplay
{
errorTot++;
errorMsg << _T("Defensive Prowess is ") << player.def << _T(", should be ") << targetRate2 << _T(" or less; ");
}
if(pesVersion>19 && player.aggres > targetRate)
{
errorTot++;
errorMsg << _T("Aggression is ") << player.aggres << _T(", should be ") << targetRate << _T("; ");
}
if(errorMsg.rdbuf()->in_avail())
{

@ -130,7 +130,7 @@ struct player_export
40 Through Passing (20+)
*/
wchar_t name[61]; //Player Name
char shirt_name[20]; //Shirt Name
char shirt_name[21]; //Shirt Name
//Appearance
bool b_edit_face; //Edited Face

@ -155,7 +155,7 @@ int APIENTRY _tWinMain(HINSTANCE I, HINSTANCE PI, LPTSTR CL, int SC)
ghw_main = CreateWindowEx(
0,
wc.lpszClassName,
_T("4ccEditor 21 Preview Edition (Version B)"),
_T("4ccEditor 10th Anniversary Edition (Version A)"),
WS_OVERLAPPEDWINDOW,
20, 20, 1120+144, 700,
NULL, NULL, ghinst, NULL);
@ -1042,7 +1042,10 @@ void DoFileOpen(HWND hwnd, TCHAR* pcs_title)
__except(EXCEPTION_EXECUTE_HANDLER) //If file loading fails (usually due to trying to open the wrong type of file for the chosen loader,
// e.g. opening a PES21 save file with the PES19 loading function), report the error and fail gracefully
{
MessageBox(ghw_main, _T("This load function cannot handle this file type."), _T("Error!"), MB_ICONEXCLAMATION | MB_OK);
TCHAR errBuffer[MAX_PATH] = _T("");
_stprintf_s(errBuffer, MAX_PATH, _T("File loading failed with code %d.\nThe EDIT file may be from a different PES version or may be malformed."),
GetExceptionCode());
MessageBox(ghw_main, errBuffer, _T("Error!"), MB_ICONEXCLAMATION | MB_OK);
//Clear all entries, as no save has been loaded
if(ghdescriptor)
{
@ -1554,10 +1557,10 @@ void data_handler(const TCHAR *pcs_file_name)
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("The Destroyer"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Orchestrator"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Anchor Man"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Build Up"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Offensive Fullback"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Fullback Finisher"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Defensive Fullback"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Build Up"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Extra Frontman"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Offensive Goalkeeper"));
SendDlgItemMessage(ghw_main, IDC_PLAY_STYL, CB_ADDSTRING, 0, (LPARAM)_T("Defensive Goalkeeper"));
@ -1898,7 +1901,8 @@ void show_player_info(int p_ind)
{
int ii,jj;
bool match=false;
wchar_t buffer[18];
wchar_t buffer[21];
memset(buffer,0,sizeof(buffer));
//ZeroMemory(buffer,12);
SendDlgItemMessage(ghw_main, IDT_PLAY_NAME, WM_SETTEXT, 0, (LPARAM)gplayers[p_ind].name);
@ -1906,7 +1910,7 @@ void show_player_info(int p_ind)
_itow_s(gplayers[p_ind].id, buffer, 12, 10);
SendDlgItemMessage(ghw_main, IDT_PLAY_ID, WM_SETTEXT, 0, (LPARAM)buffer);
mbstowcs(buffer, gplayers[p_ind].shirt_name, 18);
mbstowcs(buffer, gplayers[p_ind].shirt_name, 20);
SendDlgItemMessage(ghw_main, IDT_PLAY_SHIRT, WM_SETTEXT, 0, (LPARAM)buffer);
_itow_s(gplayers[p_ind].nation, buffer, 12, 10);
@ -1925,6 +1929,7 @@ void show_player_info(int p_ind)
else Button_SetCheck(GetDlgItem(ghw_main, IDB_PLAY_EDIT),BST_UNCHECKED);
SendDlgItemMessage(ghw_main, IDC_PLAY_FOOT, CB_SETCURSEL, (WPARAM)gplayers[p_ind].strong_foot, 0);
SendDlgItemMessage(ghw_tab2, IDC_PLAY_HAND, CB_SETCURSEL, (WPARAM)gplayers[p_ind].strong_hand, 0);
SendDlgItemMessage(ghw_main, IDC_PLAY_RPOS, CB_SETCURSEL, (WPARAM)gplayers[p_ind].reg_pos, 0);
@ -2216,8 +2221,9 @@ void show_player_info(int p_ind)
}
player_entry get_form_player_info(int index)
{
wchar_t buffer[18], wc;
wchar_t buffer[21], wc;
int ii, shirtNameLen;
memset(buffer,0,sizeof(buffer));
//player_entry output;
//if(index<0 || index > gnum_players) return output; //DEBUG, fix
@ -2230,8 +2236,9 @@ player_entry get_form_player_info(int index)
output.id = _wtoi(buffer);
if(giPesVersion==16) shirtNameLen=16;
else shirtNameLen=18;
SendDlgItemMessage(ghw_main, IDT_PLAY_SHIRT, WM_GETTEXT, shirtNameLen, (LPARAM)buffer);
else if(giPesVersion<20) shirtNameLen=18;
else shirtNameLen=20;
SendDlgItemMessage(ghw_main, IDT_PLAY_SHIRT, WM_GETTEXT, shirtNameLen+1, (LPARAM)buffer);
ii = 0;
while(buffer[ii])
{
@ -2257,6 +2264,7 @@ player_entry get_form_player_info(int index)
else output.b_edit_player=false;
output.strong_foot = SendDlgItemMessage(ghw_main, IDC_PLAY_FOOT, CB_GETCURSEL, 0, 0);
output.strong_hand = SendDlgItemMessage(ghw_tab2, IDC_PLAY_HAND, CB_GETCURSEL, 0, 0);
output.reg_pos = SendDlgItemMessage(ghw_main, IDC_PLAY_RPOS, CB_GETCURSEL, 0, 0);
@ -3714,6 +3722,8 @@ void toggle_hid()
ShowWindow(GetDlgItem(ghw_tab2, IDC_STATIC_T89), value);
ShowWindow(GetDlgItem(ghw_tab2, IDT_MOTI_DRIB), value);
ShowWindow(GetDlgItem(ghw_tab2, IDC_MOTI_DRIB), value);
ShowWindow(GetDlgItem(ghw_tab2, IDT_PLAY_HAND), value);
ShowWindow(GetDlgItem(ghw_tab2, IDC_PLAY_HAND), value);
}
void set_stats()
@ -4441,7 +4451,24 @@ void import_squad(HWND hwnd)
else if(gplayers[ii].play_style==16) gplayers[ii].play_style=20;
else if(gplayers[ii].play_style==17) gplayers[ii].play_style=21;
}
else if(giPesVersion<19 && pesVer>=19)
if(giPesVersion>=20 && pesVer<20)
{
if(gplayers[ii].play_style==15) gplayers[ii].play_style=18;
else if(gplayers[ii].play_style==16) gplayers[ii].play_style=15;
else if(gplayers[ii].play_style==17) gplayers[ii].play_style=16;
else if(gplayers[ii].play_style==18) gplayers[ii].play_style=17;
}
if(giPesVersion<20 && pesVer>=20)
{
if(gplayers[ii].play_style==18) gplayers[ii].play_style=15;
else if(gplayers[ii].play_style==15) gplayers[ii].play_style=16;
else if(gplayers[ii].play_style==16) gplayers[ii].play_style=17;
else if(gplayers[ii].play_style==17) gplayers[ii].play_style=18;
}
if(giPesVersion<19 && pesVer>=19)
{
if(gplayers[ii].play_style==4) gplayers[ii].play_style=13;
else if(gplayers[ii].play_style==5) gplayers[ii].play_style=14;

@ -138,7 +138,7 @@ void fill_player_entry20(player_entry &players, int &current_byte, void* ghdescr
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)&(pDescriptorNew->data[current_byte]), -1, players.name, 61);
current_byte+=61;
strcpy_s(players.shirt_name, 20, (const char*)&(pDescriptorNew->data[current_byte]));
strcpy_s(players.shirt_name, 21, (const char*)&(pDescriptorNew->data[current_byte]));
current_byte+=61;
current_byte+=64; //Print Name (National Team)
@ -461,7 +461,7 @@ void extract_player_entry20(player_entry player, int &current_byte, void* ghdesc
WideCharToMultiByte(CP_UTF8, 0, player.name, -1, (LPSTR)&(pDescriptorNew->data[current_byte]), 61, NULL, NULL);
current_byte+=61;
strcpy_s((char *)&(pDescriptorNew->data[current_byte]), 20, player.shirt_name);
strcpy_s((char *)&(pDescriptorNew->data[current_byte]), 21, player.shirt_name);
current_byte+=61;
current_byte+=64; //Print Name (National Team)

@ -344,6 +344,9 @@
#define IDT_MOTI_DRIB 1519
#define IDC_MOTI_DRIB 1520
#define IDT_PLAY_HAND 1521
#define IDC_PLAY_HAND 1522
#define IDC_STATIC_T48 1550
#define IDC_STATIC_T49 1551
#define IDC_STATIC_T50 1552

@ -1841,6 +1841,19 @@ void setup_tab2(HWND H)
SendDlgItemMessage(ghw_tab2, IDC_MOTI_DRIB, UDM_SETRANGE, 0, MAKELPARAM(0, 3));
SendDlgItemMessage(ghw_tab2, IDT_MOTI_DRIB, WM_SETTEXT, 0, (LPARAM)_T("0"));
hw_new = CreateWindowEx(0, _T("Static"), _T("Hand:"),
SS_SIMPLE | SS_NOPREFIX | WS_CHILD,
420, y2+10+ydiff*2+4, 35, 17, ghw_tab2, (HMENU)IDT_PLAY_HAND, GetModuleHandle(NULL), NULL);
setup_control(hw_new, ghFont, scale_cntl_proc);
hw_new = CreateWindowEx(NULL, _T("ComboBox"), _T(""),
CBS_DROPDOWNLIST | WS_CHILD | WS_VSCROLL | WS_TABSTOP,
465, y2+10+ydiff*2, 60, 100, ghw_tab2, (HMENU)IDC_PLAY_HAND, GetModuleHandle(NULL), NULL);
SendMessage(hw_new, CB_ADDSTRING, 0, (LPARAM)_T("Right"));
SendMessage(hw_new, CB_ADDSTRING, 0, (LPARAM)_T("Left"));
SendMessage(hw_new, CB_SETCURSEL, (WPARAM)0, 0);
setup_combo(hw_new, ghFont, cb2_cntl_proc);
/*chd_rect = new RECT;
GetWindowRect(ghw_tab2, chd_rect);
MapWindowPoints(HWND_DESKTOP, GetParent(ghw_tab2), (LPPOINT)chd_rect, 2);

Loading…
Cancel
Save