From 0b7b3796ec987cbb1c263722b841cfa5795aa6d3 Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 8 Nov 2013 03:09:20 +0100 Subject: Added support for monster spritename constants - Follow-up to 124ab2a1cdb344f24170a4d91f7000ebabf39b40 - Replaced numeric IDs in NPC definitions and setnpcdisplay calls with the appropriate constants - Made possible thanks to Ind Signed-off-by: Haru --- src/map/mob.c | 11 +++++++++++ src/map/mob.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/map/mob.c b/src/map/mob.c index b8a8ed6c5..c3c6fceee 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -3874,6 +3874,7 @@ void mob_readdb(void) { sv->readdb(map->db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, mob->readdb_sub); } + mob->name_constants(); } /*========================================== @@ -3923,9 +3924,18 @@ int mob_read_sqldb(void) { ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_db_name[fi]); } + mob->name_constants(); return 0; } +void mob_name_constants(void) { + int i; + for (i = 0; i < MAX_MOB_DB; i++) { + if (mob->db_data[i] && !mob->is_clone(i)) + script->set_constant2(mob->db_data[i]->sprite, i, 0); + } +} + /*========================================== * MOB display graphic change data reading *------------------------------------------*/ @@ -4759,6 +4769,7 @@ void mob_defaults(void) { mob->readdb_sub = mob_readdb_sub; mob->readdb = mob_readdb; mob->read_sqldb = mob_read_sqldb; + mob->name_constants = mob_name_constants; mob->readdb_mobavail = mob_readdb_mobavail; mob->read_randommonster = mob_read_randommonster; mob->parse_row_chatdb = mob_parse_row_chatdb; diff --git a/src/map/mob.h b/src/map/mob.h index 31a8666a2..61f718c30 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -345,6 +345,7 @@ struct mob_interface { bool (*readdb_sub) (char *fields[], int columns, int current); void (*readdb) (void); int (*read_sqldb) (void); + void (*name_constants) (void); bool (*readdb_mobavail) (char *str[], int columns, int current); int (*read_randommonster) (void); bool (*parse_row_chatdb) (char **str, const char *source, int line, int *last_msg_id); -- cgit v1.2.3-70-g09d2 From 9cbaab60234b6c633c8dff46a52aeb2bf981f078 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Fri, 8 Nov 2013 03:15:41 +0100 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking.Hooks.inc | 25 ++++++++++++++++++++++ 3 files changed, 30 insertions(+) (limited to 'src') diff --git a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc index b659a59d5..19917e338 100644 --- a/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking.HPMHooksCore.inc @@ -3125,6 +3125,8 @@ struct { struct HPMHookPoint *HP_mob_readdb_post; struct HPMHookPoint *HP_mob_read_sqldb_pre; struct HPMHookPoint *HP_mob_read_sqldb_post; + struct HPMHookPoint *HP_mob_name_constants_pre; + struct HPMHookPoint *HP_mob_name_constants_post; struct HPMHookPoint *HP_mob_readdb_mobavail_pre; struct HPMHookPoint *HP_mob_readdb_mobavail_post; struct HPMHookPoint *HP_mob_read_randommonster_pre; @@ -8066,6 +8068,8 @@ struct { int HP_mob_readdb_post; int HP_mob_read_sqldb_pre; int HP_mob_read_sqldb_post; + int HP_mob_name_constants_pre; + int HP_mob_name_constants_post; int HP_mob_readdb_mobavail_pre; int HP_mob_readdb_mobavail_post; int HP_mob_read_randommonster_pre; diff --git a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc index 097985877..01eb6684b 100644 --- a/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking.HookingPoints.inc @@ -1588,6 +1588,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->readdb_sub, HP_mob_readdb_sub) }, { HP_POP(mob->readdb, HP_mob_readdb) }, { HP_POP(mob->read_sqldb, HP_mob_read_sqldb) }, + { HP_POP(mob->name_constants, HP_mob_name_constants) }, { HP_POP(mob->readdb_mobavail, HP_mob_readdb_mobavail) }, { HP_POP(mob->read_randommonster, HP_mob_read_randommonster) }, { HP_POP(mob->parse_row_chatdb, HP_mob_parse_row_chatdb) }, diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc index 575e004f1..fdf4a6763 100644 --- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc @@ -40166,6 +40166,31 @@ int HP_mob_read_sqldb(void) { } return retVal___; } +void HP_mob_name_constants(void) { + int hIndex = 0; + if( HPMHooks.count.HP_mob_name_constants_pre ) { + void (*preHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_name_constants_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mob_name_constants_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mob.name_constants(); + } + if( HPMHooks.count.HP_mob_name_constants_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mob_name_constants_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mob_name_constants_post[hIndex].func; + postHookFunc(); + } + } + return; +} bool HP_mob_readdb_mobavail(char *str[], int columns, int current) { int hIndex = 0; bool retVal___ = false; -- cgit v1.2.3-70-g09d2