mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added a new example mod gl_static_books
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
|
||||
Static Books mod for Fallout 2 by NovaRain
|
||||
------------------------------------------
|
||||
|
||||
- changes vanilla skill books to increase skills by a fixed amount
|
||||
- reading a book gives +5% to a skill (+6% if tagged), +8% with the Comprehension perk
|
||||
- books can still increase skills when over 91%
|
||||
|
||||
Requires sfall 3.5 or higher
|
||||
|
||||
*/
|
||||
|
||||
#include "..\headers\define.h"
|
||||
#include "..\headers\command.h"
|
||||
#include "..\headers\sfall\sfall.h"
|
||||
|
||||
#define BOOK_BONUS (5)
|
||||
|
||||
procedure start;
|
||||
procedure useobj_handler;
|
||||
|
||||
procedure start begin
|
||||
if game_loaded then begin
|
||||
register_hook_proc(HOOK_USEOBJ, useobj_handler);
|
||||
end
|
||||
end
|
||||
|
||||
procedure useobj_handler begin
|
||||
variable
|
||||
user := get_sfall_arg,
|
||||
obj := get_sfall_arg,
|
||||
skill := -1,
|
||||
bonus := BOOK_BONUS,
|
||||
msg, skLevel;
|
||||
|
||||
if (obj_item_subtype(obj) == item_type_misc_item) then begin
|
||||
switch obj_pid(obj) begin
|
||||
case PID_BIG_BOOK_OF_SCIENCE:
|
||||
skill := SKILL_SCIENCE;
|
||||
msg := 802;
|
||||
case PID_DEANS_ELECTRONICS:
|
||||
skill := SKILL_REPAIR;
|
||||
msg := 803;
|
||||
case PID_FIRST_AID_BOOK:
|
||||
skill := SKILL_FIRST_AID;
|
||||
msg := 804;
|
||||
case PID_SCOUT_HANDBOOK:
|
||||
skill := SKILL_OUTDOORSMAN;
|
||||
msg := 806;
|
||||
case PID_GUNS_AND_BULLETS:
|
||||
skill := SKILL_SMALL_GUNS;
|
||||
msg := 805;
|
||||
end
|
||||
|
||||
// read book
|
||||
if (skill != -1) then begin
|
||||
if combat_is_initialized then begin
|
||||
display_msg(mstr_proto(902));
|
||||
set_sfall_return(0);
|
||||
return;
|
||||
end
|
||||
|
||||
skLevel := has_skill(dude_obj, skill);
|
||||
if (dude_perk(PERK_comprehension_perk)) then begin
|
||||
bonus := (bonus * 3 + 1) / 2; // +50%, rounding up
|
||||
end
|
||||
if (bonus % 2) then begin
|
||||
bonus += is_skill_tagged(skill); // adjustment for tagged skill when the bonus is an odd number
|
||||
end
|
||||
critter_mod_skill(dude_obj, skill, bonus);
|
||||
gfade_out(1);
|
||||
game_time_advance(ONE_GAME_HOUR * (11 - dude_iq));
|
||||
exec_map_update_scripts;
|
||||
gfade_in(1);
|
||||
display_msg(mstr_proto(800));
|
||||
if (has_skill(dude_obj, skill) == skLevel) then begin
|
||||
msg := 801;
|
||||
end
|
||||
display_msg(mstr_proto(msg));
|
||||
set_sfall_return(1); // remove
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
Static Books mod for Fallout 2 by NovaRain
|
||||
------------------------------------------
|
||||
|
||||
- changes vanilla skill books to increase skills by a fixed amount
|
||||
- reading a book gives +5% to a skill (+6% if tagged), +8% with the Comprehension perk
|
||||
- books can still increase skills when over 91%
|
||||
|
||||
|
||||
Requires sfall 3.5 or higher
|
||||
|
||||
To use, copy gl_static_books.int to your scripts folder.
|
||||
@@ -303,7 +303,7 @@ void __fastcall window_trans_cscale(long i_width, long i_height, long s_width, l
|
||||
}
|
||||
}
|
||||
|
||||
// buf_to_buf_ function with pure SSE implementation
|
||||
// buf_to_buf_ function in pure SSE implementation
|
||||
void __cdecl buf_to_buf(BYTE* src, long width, long height, long src_width, BYTE* dst, long dst_width) {
|
||||
if (height <= 0 || width <= 0) return;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void __fastcall displayInWindow(long w_here, long width, long height, void* data
|
||||
// draws an image to the buffer of the active script window
|
||||
void __fastcall window_trans_cscale(long i_width, long i_height, long s_width, long s_height, long xy_shift, long w_width, void* data);
|
||||
|
||||
// buf_to_buf_ function with pure SSE implementation
|
||||
// buf_to_buf_ function in pure SSE implementation
|
||||
void __cdecl buf_to_buf(BYTE* src, long width, long height, long src_width, BYTE* dst, long dst_width);
|
||||
|
||||
// trans_buf_to_buf_ function implementation
|
||||
|
||||
Reference in New Issue
Block a user