CTR: Enable Achievement Support

This commit is contained in:
Steam Deck User 2022-12-28 13:10:44 -05:00
parent d3e4af8707
commit cdda3a943d
2 changed files with 13 additions and 18 deletions

View file

@ -425,19 +425,18 @@ void(string chaptertitle, string location, string date, string person, entity wh
#endif #endif
#ifndef NX #ifndef NX
#ifndef CTR
void (float achievement_id, optional entity who) GiveAchievement = void (float achievement_id, optional entity who) GiveAchievement =
{ {
#ifdef PSP #ifndef PC
// temp // temp
if (achievement_id > 4) if (achievement_id > 4)
return; return;
#endif // PSP #endif // PC
// this is an achievement specific to an individual // this is an achievement specific to an individual
if ((who && who != world) || player_count == 0) { if ((who && who != world) || player_count == 0) {
if (player_count == 0) who = find(world, classname, "player"); if (player_count == 0) who = find(world, classname, "player");
#ifdef PSP #ifndef PC
achievement(who, achievement_id); achievement(who, achievement_id);
#else #else
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
@ -445,9 +444,9 @@ void (float achievement_id, optional entity who) GiveAchievement =
WriteByte(MSG_MULTICAST, achievement_id); WriteByte(MSG_MULTICAST, achievement_id);
msg_entity = who; msg_entity = who;
multicast('0 0 0', MULTICAST_ONE); multicast('0 0 0', MULTICAST_ONE);
#endif // PSP #endif // PC
} else { } else {
#ifdef PSP #ifndef PC
entity players; entity players;
players = find(world, classname, "player"); players = find(world, classname, "player");
while(players != world) { while(players != world) {
@ -459,21 +458,21 @@ void (float achievement_id, optional entity who) GiveAchievement =
WriteByte(MSG_MULTICAST, EVENT_ACHIEVEMENT); WriteByte(MSG_MULTICAST, EVENT_ACHIEVEMENT);
WriteByte(MSG_MULTICAST, achievement_id); WriteByte(MSG_MULTICAST, achievement_id);
multicast('0 0 0', MULTICAST_ALL); multicast('0 0 0', MULTICAST_ALL);
#endif // PSP #endif // PC
} }
} }
void (float achievement_id, float progress_value, optional entity who) UpdateAchievementProgress = void (float achievement_id, float progress_value, optional entity who) UpdateAchievementProgress =
{ {
#ifdef PSP #ifndef PC
// temp // temp
if (achievement_id > 4) if (achievement_id > 4)
return; return;
#endif // PSP #endif // PC
// this is a progress update specific to an individual // this is a progress update specific to an individual
if ((who && who != world) || player_count == 0) { if ((who && who != world) || player_count == 0) {
if (player_count == 0) who = find(world, classname, "player"); if (player_count == 0) who = find(world, classname, "player");
#ifdef PSP #ifndef PC
//achievement_progress(who, achievement_id, progress_value); //achievement_progress(who, achievement_id, progress_value);
#else #else
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
@ -482,9 +481,9 @@ void (float achievement_id, float progress_value, optional entity who) UpdateAch
WriteFloat(MSG_MULTICAST, progress_value); WriteFloat(MSG_MULTICAST, progress_value);
msg_entity = who; msg_entity = who;
multicast('0 0 0', MULTICAST_ONE); multicast('0 0 0', MULTICAST_ONE);
#endif // PSP #endif // PC
} else { } else {
#ifdef PSP #ifndef PC
entity players; entity players;
players = find(world, classname, "player"); players = find(world, classname, "player");
while(players != world) { while(players != world) {
@ -497,10 +496,9 @@ void (float achievement_id, float progress_value, optional entity who) UpdateAch
WriteByte(MSG_MULTICAST, achievement_id); WriteByte(MSG_MULTICAST, achievement_id);
WriteFloat(MSG_MULTICAST, progress_value); WriteFloat(MSG_MULTICAST, progress_value);
multicast('0 0 0', MULTICAST_ALL); multicast('0 0 0', MULTICAST_ALL);
#endif // PSP #endif // PC
} }
} }
#endif // CTR
#endif // NX #endif // NX
// ***************************************** // *****************************************

View file

@ -33,6 +33,3 @@ void LoadWaypointData() = {};
float gotdog; float gotdog;
void(string chaptertitle, string location, string date, string person, entity who) WorldText = {}; void(string chaptertitle, string location, string date, string person, entity who) WorldText = {};
void GiveAchievement(float achievement_id, optional entity who) = {};