Permalink
Browse files

* moved custom actor tiles from data/images/actors/U6 to

  data/images/tiles/U6
* Added support for replacing all tiles. Just put a bmp file called
  custom_tiles.bmp into data/images/tiles/U6/
* More work on MD dreamworld. Use dreamstuff. use spray gun.
* Allow MD usecode to target actors.
  • Loading branch information...
yuv422 committed May 30, 2017
1 parent 6c0cfbf commit 9346dc3d3e817b744304699b2d5a161f4485628f
Showing with 278 additions and 71 deletions.
  1. +8 −0 ChangeLog
  2. +3 −3 Makefile.mingw
  3. +11 −1 actors/ActorManager.cpp
  4. +1 −0 actors/ActorManager.h
  5. BIN data/images/{actors → tiles}/U6/actor_002_0339.bmp
  6. BIN data/images/{actors → tiles}/U6/actor_002_0376.bmp
  7. BIN data/images/{actors → tiles}/U6/actor_003_0339.bmp
  8. BIN data/images/{actors → tiles}/U6/actor_003_0377.bmp
  9. BIN data/images/{actors → tiles}/U6/actor_004_0339.bmp
  10. BIN data/images/{actors → tiles}/U6/actor_004_0386.bmp
  11. BIN data/images/{actors → tiles}/U6/actor_004_0392.bmp
  12. BIN data/images/{actors → tiles}/U6/actor_009_0354.bmp
  13. BIN data/images/{actors → tiles}/U6/actor_062_0339.bmp
  14. BIN data/images/{actors → tiles}/U6/actor_062_0387.bmp
  15. BIN data/images/{actors → tiles}/U6/actor_066_0339.bmp
  16. BIN data/images/{actors → tiles}/U6/actor_066_0386.bmp
  17. BIN data/images/{actors → tiles}/U6/actor_066_0392.bmp
  18. BIN data/images/{actors → tiles}/U6/actor_067_0339.bmp
  19. BIN data/images/{actors → tiles}/U6/actor_067_0387.bmp
  20. BIN data/images/{actors → tiles}/U6/actor_097_0339.bmp
  21. BIN data/images/{actors → tiles}/U6/actor_097_0385.bmp
  22. BIN data/images/{actors → tiles}/U6/actor_113_0339.bmp
  23. BIN data/images/{actors → tiles}/U6/actor_113_0386.bmp
  24. BIN data/images/{actors → tiles}/U6/actor_113_0392.bmp
  25. BIN data/images/{actors → tiles}/U6/actor_114_0339.bmp
  26. BIN data/images/{actors → tiles}/U6/actor_114_0387.bmp
  27. BIN data/images/{actors → tiles}/U6/actor_131_0339.bmp
  28. BIN data/images/{actors → tiles}/U6/actor_131_0376.bmp
  29. BIN data/images/{actors → tiles}/U6/actor_137_0339.bmp
  30. BIN data/images/{actors → tiles}/U6/actor_137_0383.bmp
  31. BIN data/images/{actors → tiles}/U6/actor_162_0339.bmp
  32. BIN data/images/{actors → tiles}/U6/actor_162_0376.bmp
  33. BIN data/images/{actors → tiles}/U6/actor_164_0339.bmp
  34. BIN data/images/{actors → tiles}/U6/actor_164_0363.bmp
  35. BIN data/images/{actors → tiles}/U6/actor_186_0339.bmp
  36. BIN data/images/{actors → tiles}/U6/actor_186_0376.bmp
  37. BIN data/images/{actors → tiles}/U6/avatar_001_0339.bmp
  38. BIN data/images/{actors → tiles}/U6/avatar_001_0410.bmp
  39. BIN data/images/{actors → tiles}/U6/avatar_010_0339.bmp
  40. BIN data/images/{actors → tiles}/U6/avatar_010_0410.bmp
  41. +26 −1 data/scripts/common/actor.lua
  42. +35 −0 data/scripts/md/combat.lua
  43. +6 −0 data/scripts/md/lang/en/game.lua
  44. +14 −0 data/scripts/md/talk.lua
  45. +133 −8 data/scripts/md/usecode.lua
  46. +5 −0 data/scripts/md/worktype.lua
  47. +0 −22 data/scripts/u6/actor.lua
  48. +36 −36 win32/Nuvie.iss
View
@@ -1,3 +1,11 @@
2017-05-30 Eric Fry <efry at users.sourceforge.net>
* moved custom actor tiles from data/images/actors/U6 to
data/images/tiles/U6
* Added support for replacing all tiles. Just put a bmp file called
custom_tiles.bmp into data/images/tiles/U6/
* More work on MD dreamworld. Use dreamstuff. use spray gun.
* Allow MD usecode to target actors.
2017-05-07 Eric Fry <efry at users.sourceforge.net>
* Moved technical docs from subversion into the main Nuvie git repo.
View
@@ -132,8 +132,8 @@ clean:
install: all copy_scripts
strip nuvie.exe -o $(U6PATH)/nuvie.exe
mkdir -p $(U6PATH)/data/images
mkdir -p $(U6PATH)/data/images/actors
mkdir -p $(U6PATH)/data/images/actors/U6
mkdir -p $(U6PATH)/data/images/tiles
mkdir -p $(U6PATH)/data/images/tiles/U6
mkdir -p $(U6PATH)/data/images/gumps
mkdir -p $(U6PATH)/data/images/gumps/celestial
mkdir -p $(U6PATH)/data/images/gumps/fonts
@@ -146,7 +146,7 @@ install: all copy_scripts
mkdir -p $(U6PATH)/data/maps
mkdir -p $(U6PATH)/data/maps/u6
cp data/images/*.bmp $(U6PATH)/data/images
cp data/images/actors/U6/*.bmp $(U6PATH)/data/images/actors/U6
cp data/images/tiles/U6/*.bmp $(U6PATH)/data/images/tiles/U6
cp data/images/gumps/*.bmp $(U6PATH)/data/images/gumps
cp data/images/gumps/celestial/*.bmp $(U6PATH)/data/images/gumps/celestial
cp data/images/gumps/fonts/*.bmp $(U6PATH)/data/images/gumps/fonts
View
@@ -1212,19 +1212,29 @@ bool ActorManager::loadCustomTiles(nuvie_game_t game_type)
build_path(datadir, "images", path);
datadir = path;
build_path(datadir, "actors", path);
build_path(datadir, "tiles", path);
datadir = path;
build_path(datadir, get_game_tag(game_type), path);
datadir = path;
tile_manager->freeCustomTiles(); //FIXME this might need to change if we start using custom tiles outside of ActorManager. eg custom map/object tilesets
loadCustomBaseTiles(datadir);
loadAvatarTiles(datadir);
loadNPCTiles(datadir);
return true;
}
void ActorManager::loadCustomBaseTiles(std::string datadir)
{
std::string imagefile;
build_path(datadir, "custom_tiles.bmp", imagefile);
//attempt to load custom base tiles if the file exists.
tile_manager->loadCustomTiles(imagefile,true,true,0);
}
void ActorManager::loadAvatarTiles(std::string datadir)
{
NuvieFileList filelist;
View
@@ -132,6 +132,7 @@ class ActorManager
bool loadCustomTiles(nuvie_game_t game_type);
void loadNPCTiles(std::string datadir);
void loadAvatarTiles(std::string datadir);
void loadCustomBaseTiles(std::string datadir);
};
#endif /* __ActorManager_h__ */
@@ -174,4 +174,29 @@ function actor_move_towards_loc(actor, map_x, map_y)
--dgb(" now at ("..actor.x..","..actor.y..") dir="..actor.direction.."\n")
return var_6
end
end
function toss_actor(actor, from_x, from_y, from_z, arg_0)
local random = math.random
local player_loc = player_get_location()
for i=1,8 do
local new_x = random(1, 4) + random(1, 4) + from_x - 5
local new_y = random(1, 4) + random(1, 4) + from_y - 5
if arg_0 == 0
or player_loc.x - 5 > new_x or player_loc.x + 5 < new_x or player_loc.y - 5 > new_y or player_loc.y + 5 < new_y then
if Actor.move(actor, new_x, new_y, from_z) == true then return true end
end
end
return false
end
function actor_has_bad_alignment(actor)
return actor.wt == ALIGNMENT_EVIL or actor.wt == ALIGNMENT_CHAOTIC
end
View
@@ -96,6 +96,41 @@ function get_weapon_damage(weapon)
return dmg
end
function sub_1B432(attacker, target)
end
function actor_get_weapon(attacker, target)
local int_test = false
local selected_weapon = attacker
if not actor_has_bad_alignment(attacker) then
if math.random(1, 0x1e) <= actor_int_adj(attacker) then
int_test = true
end
end
local range = actor_get_combat_range(attacker, target.x, target.y)
for obj in actor_inventory(actor) do
if get_weapon_damage(obj) > 0 and get_weapon_range(obj) >= range then
if (obj.obj_n ~= 129 and obj.obj_n ~= 261) --OBJ_WEED_SPRAYER, OBJ_SPRAY_GUN
or (obj.quality ~= 0 and obj.invisible)
or (obj.quality == 0 and (is_plant_obj(target) or (target.luatype=="actor" and (is_actor_stat_bit_set(target.obj_n, 7) and not is_actor_stat_bit_set(target.obj_n, 14))))) then
local weapon_requires_int = false
if obj.obj_n == 240 --OBJ_HEAT_RAY_GUN
or obj.obj_n == 241 --OBJ_FREEZE_RAY_GUN
or obj.obj_n == 45 then
weapon_requires_int = true
end
--if int_test == true and weapon_requires_int == true or obj.obj_n == 43 and not sub_1B432(attacker, target) then --OBJ_SHOTGUN
end
end
end
end
function attack_dex_saving_throw(attacker, defender, weapon)
if defender == nil or defender.luatype == "obj" then
return true
@@ -255,4 +255,10 @@ THE_WATER_FREEZES="The water freezes.\n",
ATTACK_WITH_BARE_HANDS="Attack with bare hands-",
ATTACK_WITH_WEAPON="Attack with %s-",
FASTER="...faster!\n",
YOU_IMAGINE="You imagine ",
SPRAY_GUN_GREEN_PAINT="The spray gun now contains 20 charges of green paint.\n",
SPRAY_GUN_WEED_KILLER="The spray gun now contains 10 charges of weed killer.\n",
SPRAY_GUN_10_MORE_CHARGES="The spray gun has 10 more charges.\n",
THERE_IS_NOTHING_IN_THE_GUN="There is nothing in the gun.\n",
YOU_KILLED_THE_PLANT="You killed the plant.\n",
}
View
@@ -44,12 +44,26 @@ function talk_script_fix_panels()
end
function talk_script_spawn_monster_footprints()
g_objlist_1d22_unk = 0
local player_loc = player_get_location()
for i=0,5 do
local monster = Actor.new(145, player_loc.x, player_loc.y, player_loc.z) --OBJ_MONSTER_FOOTPRINTS
actor_init(monster)
toss_actor(monster, player_loc.x, player_loc.y, player_loc.z, 0)
monster.wt = 0x8
g_objlist_1d22_unk = g_objlist_1d22_unk + 1
end
end
local talk_script_tbl = {
[1]=talk_script_fix_panels,
[6]=open_gates_at_olympus_mons,
[7]=open_dream_machine_door,
[9]=function() talk_script_status = 9 end,
[0xA]=function() talk_script_status = 0xA end,
[0x35]=talk_script_spawn_monster_footprints,
}
function talk_script(script_number)
View
@@ -1841,6 +1841,101 @@ function use_switch_device(obj, actor)
end
end
function use_dreamstuff(obj, actor)
printl("YOU_IMAGINE")
for item in container_objs(obj) do
if item.obj_n < 342 then -- OBJ_POOR_MONK
--object
print(item.look_string.."\n")
if obj.on_map then
Obj.moveToMap(item, obj.xyz)
else
local parent = obj.parent
if parent.luatype == "actor" then
Obj.moveToInv(item, parent.actor_num)
else
Obj.moveToCont(item, parent)
end
end
else
--actor
print(item.name.."\n")
local spawned_actor = Actor.new(item.obj_n, actor.x, actor.y, actor.z)
actor_init(spawned_actor, obj.quality + 1) -- alignment
toss_actor(spawned_actor, actor.x, actor.y, actor.z)
spawned_actor.wt = item.quality
end
Obj.removeFromEngine(obj)
return
end
printl("NOTHING")
end
function use_obj_on_spray_gun(obj, target_obj, actor)
if obj.obj_n == 119 and target_obj.quality == 0 then --OBJ_BOTTLE_OF_GREEN_PAINT
target_obj.quality = 1
target_obj.qty = 20
printl("SPRAY_GUN_GREEN_PAINT")
elseif obj.obj_n == 128 and target_obj.quality ~= 0 then --OBJ_WEED_KILLER
target_obj.quality = 0
target_obj.qty = 10
printl("SPRAY_GUN_WEED_KILLER")
else
local spray_gun_qty = target_obj.qty + 10
if spray_gun_qty > 0x1e then
spray_gun_qty = 0x1e
end
target_obj.qty = spray_gun_qty
printl("SPRAY_GUN_10_MORE_CHARGES")
end
Obj.removeFromEngine(obj)
end
function use_spray_gun(obj, target_obj, actor)
if obj.qty == 0 then
printl("THERE_IS_NOTHING_IN_THE_GUN")
return
end
if obj.quality ~= 0 then
obj.qty = obj.qty - 1
if target_obj.luatype == "actor" and target_obj.obj_n == 145 then --OBJ_MONSTER_FOOTPRINTS
target_obj.obj_n = 364 --OBJ_PROTO_MARTIAN
printfl("BECOMES_VISIBLE", target_obj.name)
else
if target_obj.luatype == "actor" and not target_obj.visible then
target_obj.visible = true
printfl("BECOMES_VISIBLE", target_obj.name)
elseif target_obj.luatype == "obj" and target_obj.invisible then
target_obj.invisible = false
printfl("BECOMES_VISIBLE", target_obj.name)
else
printl("IT_HAS_NO_EFFECT")
end
end
elseif target_obj.luatype == "actor" then
attack_target_with_weapon(actor, target_obj.x, target_obj.y, obj)
elseif is_plant_obj(target_obj) then
hit_target(target_obj, RED_HIT_TILE)
printl("YOU_KILLED_THE_PLANT")
if target_obj.obj_n == 205 then --OBJ_VINE
Actor.set_talk_flag(0x30, 7)
Obj.removeFromEngine(target_obj)
elseif target_obj.obj_n == 408 then --OBJ_TREE
target_obj.obj_n = 166 --OBJ_DEAD_TREE
else
Obj.removeFromEngine(target_obj)
end
else
obj.qty = obj.qty - 1
printl("IT_HAS_NO_EFFECT")
end
end
local usecode_table = {
--OBJ_RUBY_SLIPPERS
[12]=use_ruby_slippers,
@@ -1893,6 +1988,14 @@ local usecode_table = {
[104]=use_container,
--OBJ_FOLDED_TENT
[106]=use_tent,
--OBJ_BOTTLE_OF_GREEN_PAINT
[119]={
--on
--OBJ_WEED_SPRAYER
[129]=use_obj_on_spray_gun,
--OBJ_SPRAY_GUN
[261]=use_obj_on_spray_gun,
},
--OBJ_CAN_OF_LAMP_OIL
[124]={
--on
@@ -1910,6 +2013,19 @@ local usecode_table = {
[222]=use_oil_on_door,
[0]=use_oil_on_dream_door,
},
--OBJ_WEED_KILLER
[128]={
--on
--OBJ_WEED_SPRAYER
[129]=use_obj_on_spray_gun,
--OBJ_SPRAY_GUN
[261]=use_obj_on_spray_gun,
},
--OBJ_WEED_SPRAYER
[129]={
--on
[0]=use_spray_gun
},
--OBJ_BLOB_OF_OXIUM
[131]=use_misc_text,
--OBJ_WRENCH
@@ -1969,6 +2085,11 @@ local usecode_table = {
},
--OBJ_SCROLL
[243]=use_reading_material,
--OBJ_SPRAY_GUN
[261]={
--on
[0]=use_spray_gun
},
--OBJ_MARTIAN_HOE
[263]={[255]=use_misc_text,[257]=use_misc_text}, --hole in ice, hole
--OBJ_MARTIAN_SHOVEL
@@ -2003,6 +2124,7 @@ local usecode_table = {
[323]=use_misc_text,
--OBJ_MARTIAN_PICK
[327]={[255]=use_misc_text,[257]=use_misc_text}, --hole in ice, hole
[331]=use_dreamstuff,
[399]=use_pool_table,
--OBJ_POOL_QUE
[401]=use_ready_obj,
@@ -2237,23 +2359,26 @@ function use_obj_on(obj, actor, use_on_tbl)
end
local target_x, target_y = direction_get_loc(dir, actor.x, actor.y)
local target_entity = map_get_actor(target_x, target_y, actor.z)
if target_entity == nil then
target_entity = map_get_obj(target_x, target_y, actor.z)
end
local target_obj = map_get_obj(target_x, target_y, actor.z)
if target_obj ~= nil then
print(target_obj.name.."\n\n")
local on = use_on_tbl[target_obj.obj_n]
if target_entity ~= nil then
print(target_entity.name.."\n\n")
local on = use_on_tbl[target_entity.obj_n]
if on ~= nil then
if type(on) == "function" then
local func = on
func(obj, target_obj, actor)
func(obj, target_entity, actor)
else
use_obj_on_to(obj, target_obj, actor, on)
use_obj_on_to(obj, target_entity, actor, on)
end
else
local func = use_on_tbl[0]
if func ~= nil then
func(obj, target_obj, actor)
func(obj, target_entity, actor)
else
printl("NO_EFFECT")
end
@@ -31,6 +31,11 @@ function select_target_actor(src_actor)
return target_actor
end
function worktype_8_combat_attack(actor)
g_selected_obj = select_target_actor(actor)
end
function worktype_15_your_mother(actor)
if actor_move(actor, DIR_SOUTH) == false then
local target_actor = select_target_actor(actor)
Oops, something went wrong.

0 comments on commit 9346dc3

Please sign in to comment.