// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/plasma.c
// Function: plasma_spread_touch
void
plasma_spread_touch
(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) 
{
int damage;

	// If hit the sky, remove from world
	if (surf && (surf->flags & SURF_SKY)) {
		G_FreeEdict(self);
		return;
	}

	// Don't collide with other plasma goops
	if (Q_stricmp(other->classname,"goop") == 0)
		return;
	
	//bat
	if(quadmeister)
		damage = PLASMA_SPREAD_DAMAGE * 4;
	else
		damage = PLASMA_SPREAD_DAMAGE;

	if( self->owner->client )
		PlayerNoise(self->owner,self->s.origin,PNOISE_IMPACT);

	// If can damage, hurt it
	if( other->takedamage )
	{
		//T_Damage (other, self, self->owner, self->velocity,
		//          self->s.origin, plane->normal, self->dmg, 1,
		//	  DAMAGE_ENERGY, MOD_PLASMA);
		T_Damage(other, self, self->owner, self->velocity, self->s.origin, plane->normal, damage, 1, DAMAGE_ENERGY, MOD_PLASMA);
	}		  
	else	// otherwise, splash damage
	{
		//-bat
		//T_RadiusDamage(self,self->owner,self->dmg,NULL, self->dmg+PLASMA_SPLASH_RADIUS,MOD_PLASMA);
		//T_RadiusDamage(self,self->owner,32,NULL,32,MOD_PLASMA);
		
		//-bat added sparks to this too.
		// Draw blue sparks
		gi.WriteByte (svc_temp_entity);
		gi.WriteByte (TE_LASER_SPARKS);
		gi.WriteByte (32);		// ammount
		gi.WritePosition (self->s.origin);
		gi.WriteDir (plane->normal);
		gi.WriteByte (176);		// stecki's choice of id's blue
		gi.multicast (self->s.origin, MULTICAST_PVS);



		T_RadiusDamage(self,self->owner,damage,NULL, damage+PLASMA_SPLASH_RADIUS,MOD_PLASMA);
	}		  
	// play hit sound
	gi.sound( self,CHAN_BODY, gi.soundindex(PLASMA_SOUND_HIT), 1,
	          ATTN_IDLE,0 );	// idle static none

	self->solid=	SOLID_NOT;
	self->touch=	NULL;
	VectorMA (self->s.origin,-1*FRAMETIME,self->velocity,self->s.origin);
	VectorClear (self->velocity);

	// Run Plasma Hit Animation
	self->s.modelindex= 	gi.modelindex (PLASMA_SPRITE_HIT);
	self->s.frame= 		0;
	self->s.sound=		0;
	self->think=		G_FreeEdict;
	self->nextthink=	level.time + 0.1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x276ec
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x276ec
movq -0x8(%rbp), %rdi
callq 0x19cd0
jmp 0x279a0
movq -0x10(%rbp), %rax
movq 0x138(%rax), %rdi
leaq 0x49579(%rip), %rsi     # 0x70c77
callq 0x186f0
cmpl $0x0, %eax
jne 0x2770d
jmp 0x279a0
movq 0x5af5c(%rip), %rax     # 0x82670
cmpl $0x0, (%rax)
je 0x27722
movl $0x70, -0x24(%rbp)
jmp 0x27729
movl $0x1c, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rax
cmpq $0x0, 0x58(%rax)
je 0x27758
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
movl $0x2, %edx
callq 0x19080
movq -0x10(%rbp), %rax
cmpl $0x0, 0x27c(%rax)
je 0x277b7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdx
movq -0x8(%rbp), %rcx
addq $0x1c0, %rcx            # imm = 0x1C0
movq -0x8(%rbp), %r8
addq $0x4, %r8
movq -0x18(%rbp), %r9
movl -0x24(%rbp), %eax
movl %eax, (%rsp)
movl $0x1, 0x8(%rsp)
movl $0x4, 0x10(%rsp)
movl $0x22, 0x18(%rsp)
callq 0x192c0
jmp 0x27874
movl $0x3, %edi
movq 0x5ae3d(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0xf, %edi
movq 0x5ae2b(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0x20, %edi
movq 0x5ae19(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x5ae0c(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
callq *%rax
movq 0x5adf4(%rip), %rax     # 0x82600
movq 0xf8(%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
movl $0xb0, %edi
movq 0x5addb(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x5adce(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movl $0x2, %esi
callq *%rax
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rsi
cvtsi2ssl -0x24(%rbp), %xmm0
movl -0x24(%rbp), %eax
addl $0x46, %eax
cvtsi2ss %eax, %xmm1
xorl %eax, %eax
movl %eax, %edx
movl $0x22, %ecx
callq 0x180c0
movq 0x5ad85(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq 0x4939e(%rip), %rdi     # 0x70c30
movq 0x5ad67(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x38(%rbp), %rdi
movl %eax, %edx
movq -0x30(%rbp), %rax
movl $0x4, %esi
movss 0x48639(%rip), %xmm0    # 0x6feec
movss 0x4862d(%rip), %xmm1    # 0x6fee8
xorps %xmm2, %xmm2
callq *%rax
movq -0x8(%rbp), %rax
movl $0x0, 0x108(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x220(%rax)
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movq -0x8(%rbp), %rsi
addq $0x1c0, %rsi            # imm = 0x1C0
movq -0x8(%rbp), %rdx
addq $0x4, %rdx
movss 0x49308(%rip), %xmm0    # 0x70c08
callq 0x199c0
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c8(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c4(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c0(%rax)
leaq 0x4930e(%rip), %rdi     # 0x70c47
movq 0x5acc0(%rip), %rax     # 0x82600
callq *0x40(%rax)
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq -0x8(%rbp), %rax
movq 0x5aac3(%rip), %rcx     # 0x82430
movq %rcx, 0x210(%rax)
movq 0x5b425(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x4928c(%rip), %xmm1    # 0x70c18
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x200(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)